由jvm hotspot编译器生成的movabs同步条目

时间:2017-04-11 12:11:02

标签: optimization java-8 x86-64 jvm-hotspot

在下面的代码中 - 类A,B,C,D是POJO,没有类层次结构,并且具有相应类成员的简单getter。

 35     private static D dFromA(A t) {
 36         return callIfNotNull(
 37                 callIfNotNull(
 38                         callIfNotNull(
 39                                 t, a->a.b() ),
 40                         b->b.c()),
 41                 c->c.d());
 42     }
 43 
 44     public static <T, U> U callIfNotNull(T t, Function<T, U> func) {
 45         if (t!=null) {
 46             return func.apply(t);
 47         } else {
 48             return null;
 49         }
 50     }
 51 }

从下面生成的程序集中,这些指令的目的是什么?

98834   0x000000011daf144c: movabs $0x76ae2c8c0,%r10  ;*synchronization entry

然后我假设这些是检查生成的匿名类的类实现是否在此特定调用站点之前所见。由于dFromA总是用A类调用,为什么还需要这些?

98844   0x000000011daf145a: mov    0x8(%r10),%r11d    
98845   0x000000011daf145e: cmp    $0xf800e405,%r11d  ;   {metadata(&apos;com/inline/Main$$Lambda$1&apos;)}

以下是整个输出

 98828   # {method} {0x0000000119f04960} &apos;dFromA&apos; &apos;(Lcom/inline/A;)Lcom/inline/D;&apos; in &apos;com/inline/Main&apos; 
 98829   # parm0:    rsi:rsi   = &apos;com/inline/A&apos;                                                                             
 98830   #           [sp+0x30]  (sp of caller)
 98831   0x000000011daf1440: mov    %eax,-0x14000(%rsp)
 98832   0x000000011daf1447: push   %rbp
 98833   0x000000011daf1448: sub    $0x20,%rsp
 98834   0x000000011daf144c: movabs $0x76ae2c8c0,%r10  ;*synchronization entry                                                        
 98835                                                 ; - com.inline.Main::dFromA@-1 (line 36)                                       
 98836                                                 ;   {oop(a &apos;com/inline/Main$$Lambda$1&apos;)}                             
 98837   0x000000011daf1456: mov    0xc(%rsi),%r8d     ;*getfield b
 98838                                                 ; - com.inline.A::b@1 (line 9)
 98839                                                 ; - com.inline.Main::lambda$dFromA$0@1 (line 39)                               
 98840                                                 ; - com.inline.Main$$Lambda$1/303563356::apply@4                               
 98841                                                 ; - com.inline.Main::callIfNotNull@6 (line 46)
 98842                                                 ; - com.inline.Main::dFromA@6 (line 38)
 98843                                                 ; implicit exception: dispatches to 0x000000011daf14f5                         
 98844   0x000000011daf145a: mov    0x8(%r10),%r11d    
 98845   0x000000011daf145e: cmp    $0xf800e405,%r11d  ;   {metadata(&apos;com/inline/Main$$Lambda$1&apos;)}
 98846   0x000000011daf1465: jne    0x000000011daf14b2  ;*invokeinterface apply                                                       
 98847                                                 ; - com.inline.Main::callIfNotNull@6 (line 46)
 98848                                                 ; - com.inline.Main::dFromA@6 (line 38)                                        
 98849                                                 
 98850   0x000000011daf1467: movabs $0x76ae333a0,%r11  ;*synchronization entry
 98851                                                 ; - com.inline.Main::dFromA@-1 (line 36)                                       
 98852                                                 ;   {oop(a &apos;com/inline/Main$$Lambda$2&apos;)}                             
 98853   0x000000011daf1471: mov    0xc(%r12,%r8,8),%r9d  ;*getfield c
 98854                                                 ; - com.inline.B::c@1 (line 9)
 98855                                                 ; - com.inline.Main::lambda$dFromA$1@1 (line 40)                               
 98856                                                 ; - com.inline.Main$$Lambda$2/1826771953::apply@4                              
 98857                                                 ; - com.inline.Main::callIfNotNull@6 (line 46)
 98858                                                 ; - com.inline.Main::dFromA@14 (line 37)
 98859                                                 ; implicit exception: dispatches to 0x000000011daf150d                         
 98860   0x000000011daf1476: mov    0x8(%r11),%r10d    
 98861   0x000000011daf147a: cmp    $0xf800e585,%r10d  ;   {metadata(&apos;com/inline/Main$$Lambda$2&apos;)}
 98862   0x000000011daf1481: jne    0x000000011daf14c9  ;*invokeinterface apply                                                       
 98863                                                 ; - com.inline.Main::callIfNotNull@6 (line 46)
 98864                                                 ; - com.inline.Main::dFromA@14 (line 37)                                       
 98865                                                 
 98866   0x000000011daf1483: movabs $0x76ae35cb8,%rbp  ;*synchronization entry
 98867                                                 ; - com.inline.Main::dFromA@-1 (line 36)                                       
 98868                                                 ;   {oop(a &apos;com/inline/Main$$Lambda$3&apos;)}                             
 98869   0x000000011daf148d: mov    0xc(%r12,%r9,8),%r10d  ; implicit exception: dispatches to 0x000000011daf1525                     
 98870   0x000000011daf1492: mov    0x8(%rbp),%r8d     
 98871   0x000000011daf1496: cmp    $0xf800e605,%r8d   ;   {metadata(&apos;com/inline/Main$$Lambda$3&apos;)}
 98872   0x000000011daf149d: jne    0x000000011daf14e1  ;*invokeinterface apply                                                       
 98873                                                 ; - com.inline.Main::callIfNotNull@6 (line 46)
 98874                                                 ; - com.inline.Main::dFromA@22 (line 36)                                       
 98875                                                 
 98876   0x000000011daf149f: mov    %r10,%rax          
 98877   0x000000011daf14a2: shl    $0x3,%rax          ;*getfield d                                                                   
 98878                                                 ; - com.inline.C::d@1 (line 9)                                                 
 98879                                                 ; - com.inline.Main::lambda$dFromA$2@1 (line 41)                               
 98880                                                 ; - com.inline.Main$$Lambda$3/245257410::apply@4                               
 98881                                                 ; - com.inline.Main::callIfNotNull@6 (line 46)
 98882                                                 ; - com.inline.Main::dFromA@22 (line 36)
 98883                                                 
 98884   0x000000011daf14a6: add    $0x20,%rsp         
 98885   0x000000011daf14aa: pop    %rbp                                                                                              
 98886   0x000000011daf14ab: test   %eax,-0xf1334b1(%rip)        # 0x000000010e9be000                                                 
 98887                                                 ;   {poll_return}                                           

0 个答案:

没有答案