-
Enhancement
-
Resolution: Fixed
-
P4
-
14
-
b13
-
generic
-
generic
People may get confused with the 'MetaData' dumped by PrintOptoAssembly.
The following is an example which confused me a lot due to the mismatch between 'MetaData' and 'OptoAssembly'.
Let's see line 235.
It seems that the following OptoAssembly belongs to the compilation of compileID=37 (@line 204).
But line 204 was compiled by C1 which should not dump OptoAssembly.
Also please see line 223, it seems that the nmethod should be compiled by C1.
But line 210 told me it was a C2-compiled nmethod.
Actually, the 'MetaData' belongs to the last normal compilation of the method.
It might be better to make it more clear.
```
203 85 36 % 3 SmallByteAdd::doit2 @ 8 (46 bytes)
204 86 37 3 SmallByteAdd::doit2 (46 bytes)
205 87 32 1 java.util.ImmutableCollections$Set12::isEmpty (2 bytes)
206 87 38 % 4 SmallByteAdd::doit2 @ 8 (46 bytes)
207 87 31 1 java.lang.module.ResolvedModule::configuration (5 bytes)
208 87 30 1 java.lang.module.ModuleDescriptor$Exports::targets (5 bytes)
209
210 ============================= C2-compiled nmethod ==============================
211 ----------------------------------- MetaData -----------------------------------
212 {method}
213 - this oop: 0x00007f21cb3f67b0
214 - method holder: 'SmallByteAdd'
215 - constants: 0x00007f21cb3f60c8 constant pool [124]/operands[5] {0x00007f21cb3f60c8} for 'SmallByteAdd' cache=0x00007f21cb3f6ae0
216 - access: 0xc1000009 public static
217 - name: 'doit2'
218 - signature: '(J)V'
219 - max stack: 6
220 - max locals: 3
221 - size of params: 2
222 - method size: 13
223 - highest level: 3
224 - vtable index: -2
225 - i2i entry: 0x00007f21e4563460
226 - adapters: AHE@0x00007f21fc32ce00: 0xbe000000 i2c: 0x00007f21e4728060 c2i: 0x00007f21e47281aa c2iUV: 0x00007f21e472816d c2iNCI: 0x00007f21e47281e7
227 - compiled entry 0x00007f21e4af05c0
228 - code size: 46
229 - code start: 0x00007f21cb3f6770
230 - code end (excl): 0x00007f21cb3f679e
231 - method data: 0x00007f21cb3f7040
232 - checked ex length: 0
233 - linenumber start: 0x00007f21cb3f679e
234 - localvar length: 0
235 - compiled code: nmethod 112 37 3 SmallByteAdd::doit2 (46 bytes)
236
237 --------------------------------- OptoAssembly ---------------------------------
238 #
239 # void ( rawptr:BotPTR )
240 #
241 #r018 rsi:rsi : parm 0: rawptr:BotPTR
242 # -- Old rsp -- Framesize: 64 --
243 #r583 rsp+60: in_preserve
244 #r582 rsp+56: return address
245 #r581 rsp+52: in_preserve
246 #r580 rsp+48: saved fp register
247 #r579 rsp+44: pad2, stack alignment
248 #r578 rsp+40: pad2, stack alignment
249 #r577 rsp+36: Fixed slot 1
250 #r576 rsp+32: Fixed slot 0
251 #r591 rsp+28: spill
252 #r590 rsp+24: spill
253 #r589 rsp+20: spill
254 #r588 rsp+16: spill
255 #r587 rsp+12: spill
256 #r586 rsp+ 8: spill
257 #r585 rsp+ 4: spill
258 #r584 rsp+ 0: spill
259 #
260 000 N518: # out( B1 ) <- BLOCK HEAD IS JUNK Freq: 1
261 000 # breakpoint
262 nop # 11 bytes pad for loops and calls
263
264 010 B1: # out( B13 ) <- BLOCK HEAD IS JUNK Freq: 1
265 010 # stack bang (160 bytes)
266 pushq rbp # Save rbp
267 subq rsp, #48 # Create frame
```
The following is an example which confused me a lot due to the mismatch between 'MetaData' and 'OptoAssembly'.
Let's see line 235.
It seems that the following OptoAssembly belongs to the compilation of compileID=37 (@line 204).
But line 204 was compiled by C1 which should not dump OptoAssembly.
Also please see line 223, it seems that the nmethod should be compiled by C1.
But line 210 told me it was a C2-compiled nmethod.
Actually, the 'MetaData' belongs to the last normal compilation of the method.
It might be better to make it more clear.
```
203 85 36 % 3 SmallByteAdd::doit2 @ 8 (46 bytes)
204 86 37 3 SmallByteAdd::doit2 (46 bytes)
205 87 32 1 java.util.ImmutableCollections$Set12::isEmpty (2 bytes)
206 87 38 % 4 SmallByteAdd::doit2 @ 8 (46 bytes)
207 87 31 1 java.lang.module.ResolvedModule::configuration (5 bytes)
208 87 30 1 java.lang.module.ModuleDescriptor$Exports::targets (5 bytes)
209
210 ============================= C2-compiled nmethod ==============================
211 ----------------------------------- MetaData -----------------------------------
212 {method}
213 - this oop: 0x00007f21cb3f67b0
214 - method holder: 'SmallByteAdd'
215 - constants: 0x00007f21cb3f60c8 constant pool [124]/operands[5] {0x00007f21cb3f60c8} for 'SmallByteAdd' cache=0x00007f21cb3f6ae0
216 - access: 0xc1000009 public static
217 - name: 'doit2'
218 - signature: '(J)V'
219 - max stack: 6
220 - max locals: 3
221 - size of params: 2
222 - method size: 13
223 - highest level: 3
224 - vtable index: -2
225 - i2i entry: 0x00007f21e4563460
226 - adapters: AHE@0x00007f21fc32ce00: 0xbe000000 i2c: 0x00007f21e4728060 c2i: 0x00007f21e47281aa c2iUV: 0x00007f21e472816d c2iNCI: 0x00007f21e47281e7
227 - compiled entry 0x00007f21e4af05c0
228 - code size: 46
229 - code start: 0x00007f21cb3f6770
230 - code end (excl): 0x00007f21cb3f679e
231 - method data: 0x00007f21cb3f7040
232 - checked ex length: 0
233 - linenumber start: 0x00007f21cb3f679e
234 - localvar length: 0
235 - compiled code: nmethod 112 37 3 SmallByteAdd::doit2 (46 bytes)
236
237 --------------------------------- OptoAssembly ---------------------------------
238 #
239 # void ( rawptr:BotPTR )
240 #
241 #r018 rsi:rsi : parm 0: rawptr:BotPTR
242 # -- Old rsp -- Framesize: 64 --
243 #r583 rsp+60: in_preserve
244 #r582 rsp+56: return address
245 #r581 rsp+52: in_preserve
246 #r580 rsp+48: saved fp register
247 #r579 rsp+44: pad2, stack alignment
248 #r578 rsp+40: pad2, stack alignment
249 #r577 rsp+36: Fixed slot 1
250 #r576 rsp+32: Fixed slot 0
251 #r591 rsp+28: spill
252 #r590 rsp+24: spill
253 #r589 rsp+20: spill
254 #r588 rsp+16: spill
255 #r587 rsp+12: spill
256 #r586 rsp+ 8: spill
257 #r585 rsp+ 4: spill
258 #r584 rsp+ 0: spill
259 #
260 000 N518: # out( B1 ) <- BLOCK HEAD IS JUNK Freq: 1
261 000 # breakpoint
262 nop # 11 bytes pad for loops and calls
263
264 010 B1: # out( B13 ) <- BLOCK HEAD IS JUNK Freq: 1
265 010 # stack bang (160 bytes)
266 pushq rbp # Save rbp
267 subq rsp, #48 # Create frame
```