Hi,

I have a small program that makes a call to a method that is effectively dead 
code. I turned on PrintCompilation to see if I could see the call site being 
eliminated from the graph. What I get is

1%   com.kodewerk.mbm.DeadCode::deadMethod @ 12 (33 bytes)
19    com.kodewerk.mbm.DeadCode::deadMethod (33 bytes)

I read this to say the method was inlined with an OSR event. After which, 
something else happened to the method. I switched to LogCompilation to see if I 
could figure out what happened in compile event 19.

The method is just some silly dead code.

public void deadMethod(int a, int b) {
    int total = Integer.MIN_VALUE;
    for ( int i = 0; i < Integer.MAX_VALUE; i++)
        total += (a + b);
}

What I was hoping to see with LogCompilation was a better explanation. I've 
snipped out the task with compile_id 19. I can see that byte code 162 is an 
if_icmpge where the branch taken seems to be computed as never.. which causes 
an exception block to be setup (exact terminology is weak in the C++ code. The 
regalloc I assume assigns a register for the loop counter i. After that, I 
don't see anything that indicates that the method is declared dead. Am I 
looking for too much from this log? If so, how could I determine which 
optimizations have been applied short of inspecting the code cache?

TIA,
Kirk

<task compile_id='19' method='com/kodewerk/mbm/DeadCode deadMethod (II)V' 
bytes='33' count='5000' iicount='2' stamp='0.264'>
<phase name='parse' nodes='3' stamp='0.264'>
<type id='576' name='void'/>
<type id='574' name='int'/>
<klass id='860' name='com/kodewerk/mbm/DeadCode' flags='1'/>
<method id='861' holder='860' name='deadMethod' return='576' arguments='574 
574' flags='1' bytes='33' iicount='2'/>
<parse method='861' uses='2' stamp='0.264'>
<bc code='162' bci='16'/>
<branch target_bci='32' taken='0' not_taken='33792' cnt='33792' prob='never'/>
<bc code='162' bci='16'/>
<branch target_bci='32' taken='0' not_taken='33792' cnt='33792' prob='never'/>
<parse_done nodes='58' memory='26200' stamp='0.264'/>
</parse>
<phase_done nodes='59' stamp='0.264'/>
</phase>
<phase name='optimizer' nodes='59' stamp='0.264'>
<phase name='idealLoop' nodes='62' stamp='0.265'>
<loop_tree>
<loop idx='136' main_loop='136' >
</loop>
</loop_tree>
<phase_done nodes='148' stamp='0.265'/>
</phase>
<phase name='idealLoop' nodes='148' stamp='0.265'>
<loop_tree>
<loop idx='104' inner_loop='1' pre_loop='76' >
</loop>
<loop idx='136' inner_loop='1' main_loop='136' >
</loop>
<loop idx='85' inner_loop='1' post_loop='76' >
</loop>
</loop_tree>
<phase_done nodes='156' stamp='0.265'/>
</phase>
<phase name='idealLoop' nodes='156' stamp='0.265'>
<phase_done nodes='156' stamp='0.265'/>
</phase>
<phase name='ccp' nodes='156' stamp='0.265'>
<phase_done nodes='156' stamp='0.265'/>
</phase>
<phase_done nodes='156' stamp='0.265'/>
</phase>
<phase name='matcher' nodes='156' stamp='0.265'>
<phase_done nodes='11' stamp='0.265'/>
</phase>
<phase name='regalloc' nodes='13' stamp='0.265'>
<regalloc attempts='0' success='1'/>
<phase_done nodes='13' stamp='0.265'/>
</phase>
<phase name='output' nodes='13' stamp='0.265'>
<phase_done nodes='21' stamp='0.265'/>
</phase>
<task_done success='1' nmsize='88' count='5000' stamp='0.265'/>
</task>

    

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to