Wyrd

boost shared_ptr move semantics test ASM: boost::make_shared

Feb 22nd, 2012
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; template< class T > boost::shared_ptr< T > make_shared()
  2. ;   103: {
  3. 010411C0  push        0FFFFFFFFh  
  4. 010411C2  push        offset __ehhandler$??$make_shared@VCDerived@@@boost@@YA?AV?$shared_ptr@VCDerived@@@0@XZ (1041E49h)  
  5. 010411C7  mov         eax,dword ptr fs:[00000000h]  
  6. 010411CD  push        eax  
  7. 010411CE  mov         dword ptr fs:[0],esp  
  8. 010411D5  sub         esp,20h  
  9. 010411D8  push        ebx  
  10. 010411D9  push        esi  
  11. 010411DA  xor         ebx,ebx  
  12. 010411DC  push        edi  
  13. 010411DD  mov         edi,dword ptr [esp+3Ch]  
  14. 010411E1  mov         dword ptr [esp+0Ch],ebx  
  15. ;   104:     boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
  16. 010411E5  mov         byte ptr [esp+1Ch],bl  
  17. 010411E9  sub         esp,8  
  18. 010411EC  mov         dword ptr [esp+3Ch],1  
  19. 010411F4  mov         eax,esp  
  20. 010411F6  mov         dword ptr [esp+1Ch],ebx  
  21. 010411FA  lea         ecx,[esp+20h]  
  22. 010411FE  mov         dword ptr [esp+18h],esp  
  23. 01041202  mov         byte ptr [eax],bl  
  24. 01041204  call        boost::detail::shared_count::shared_count<CDerived *,boost::detail::sp_ms_deleter<CDerived> > (1041340h)  
  25. 01041209  push        ebx  
  26. 0104120A  lea         eax,[esp+18h]  
  27. 0104120E  push        ebx  
  28. 0104120F  push        eax  
  29. 01041210  call        boost::detail::sp_enable_shared_from_this (1041040h)  
  30. 01041215  add         esp,0Ch  
  31. 01041218  mov         byte ptr [esp+34h],bl  
  32. 0104121C  cmp         byte ptr [esp+1Ch],bl  
  33. 01041220  je          boost::make_shared<CDerived>+73h (1041233h)  ; <--------------- JUMP OCCURS
  34. 01041222  mov         edx,dword ptr [esp+20h]  
  35. 01041226  mov         eax,dword ptr [edx]  
  36. 01041228  push        ebx  
  37. 01041229  lea         ecx,[esp+24h]  
  38. 0104122D  call        eax  
  39. 0104122F  mov         byte ptr [esp+1Ch],bl  
  40. 01041233  mov         dword ptr [esp+34h],2  
  41. ;   105:
  42. ;   106:     detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
  43. 0104123B  mov         ecx,dword ptr [esp+18h]  
  44. 0104123F  cmp         ecx,ebx  
  45. 01041241  je          boost::make_shared<CDerived>+91h (1041251h) ; <------------------ NO JUMP  
  46. 01041243  mov         edx,dword ptr [ecx]  
  47. 01041245  mov         eax,dword ptr [edx+0Ch]  
  48. 01041248  push        offset boost::detail::sp_ms_deleter<CDerived> `RTTI Type Descriptor` (10430F4h)  
  49. 0104124D  call        eax  
  50. 0104124F  jmp         boost::make_shared<CDerived>+93h (1041253h)  
  51. 01041251  xor         eax,eax  
  52. ;   107:
  53. ;   108:     void * pv = pd->address();
  54. 01041253  lea         esi,[eax+4]  
  55. ;   109:
  56. ;   110:     ::new( pv ) T();
  57. 01041256  cmp         esi,ebx  
  58. 01041258  je          boost::make_shared<CDerived>+0A0h (1041260h) ; <--------------------- NO JUMP
  59. 0104125A  mov         dword ptr [esi],offset CDerived::`vftable` (104212Ch)  
  60. ;   111:     pd->set_initialized();
  61. ;   112:
  62. ;   113:     T * pt2 = static_cast< T* >( pv );
  63. ;   114:
  64. ;   115:     boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
  65. 01041260  push        esi  
  66. 01041261  lea         ecx,[esp+18h]  
  67. 01041265  push        esi  
  68. 01041266  push        ecx  
  69. 01041267  mov         byte ptr [eax],1  
  70. 0104126A  call        boost::detail::sp_enable_shared_from_this (1041040h)  
  71. ;   116:     return boost::shared_ptr< T >( pt, pt2 );
  72. 0104126F  mov         eax,dword ptr [esp+24h]  
  73. 01041273  add         esp,0Ch  
  74. 01041276  mov         dword ptr [edi],esi  
  75. 01041278  mov         dword ptr [edi+4],eax  
  76. 0104127B  cmp         eax,ebx  
  77. 0104127D  je          boost::make_shared<CDerived>+0CFh (104128Fh) ; <--------------- NO JUMP
  78. 0104127F  add         eax,4  
  79. 01041282  mov         edx,1  
  80. 01041287  lock xadd   dword ptr [eax],edx                 ; <----------------------- CALLED
  81. 0104128B  mov         eax,dword ptr [esp+18h]  
  82. 0104128F  mov         dword ptr [esp+0Ch],1  
  83. 01041297  mov         byte ptr [esp+34h],bl  
  84. 0104129B  cmp         eax,ebx  
  85. 0104129D  je          boost::make_shared<CDerived>+10Bh (10412CBh)  ; <---------- NO JUMP
  86. 0104129F  mov         esi,eax  
  87. 010412A1  add         eax,4  
  88. 010412A4  or          ecx,0FFFFFFFFh  
  89. 010412A7  lock xadd   dword ptr [eax],ecx                ; <---------------------- CALLED
  90. 010412AB  jne         boost::make_shared<CDerived>+10Bh (10412CBh)   ; <-------------- JUMP OCCURS
  91. 010412AD  mov         edx,dword ptr [esi]  
  92. 010412AF  mov         eax,dword ptr [edx+4]  
  93. 010412B2  mov         ecx,esi  
  94. 010412B4  call        eax  
  95. 010412B6  lea         ecx,[esi+8]  
  96. 010412B9  or          edx,0FFFFFFFFh  
  97. 010412BC  lock xadd   dword ptr [ecx],edx  
  98. 010412C0  jne         boost::make_shared<CDerived>+10Bh (10412CBh)  
  99. 010412C2  mov         eax,dword ptr [esi]  
  100. 010412C4  mov         edx,dword ptr [eax+8]  
  101. 010412C7  mov         ecx,esi  
  102. 010412C9  call        edx  
  103. ;   117: }
  104. 010412CB  mov         ecx,dword ptr [esp+2Ch]  
  105. 010412CF  mov         eax,edi  
  106. 010412D1  pop         edi  
  107. 010412D2  pop         esi  
  108. 010412D3  mov         dword ptr fs:[0],ecx  
  109. 010412DA  pop         ebx  
  110. 010412DB  add         esp,2Ch  
  111. 010412DE  ret
Advertisement
Add Comment
Please, Sign In to add comment