Some libraries do use it but also have a fallback code. 

For the performance aspect: this is just used to register the class byte[] in 
an existing ClassLoader. The ClassLoader base classe uses sun.misc.Unsafe 
_internally_ anyway. So I really don't think there will be much difference. 


LieGrue,
strub



----- Original Message -----
> From: Romain Manni-Bucau <rmannibu...@gmail.com>
> To: dev@openejb.apache.org; Mark Struberg <strub...@yahoo.de>
> Cc: 
> Sent: Monday, December 31, 2012 1:21 PM
> Subject: Re: ASM proxy improvement
> 
> so no library is portable, that's my point...
> 
> grepcode Unsafe and you'll understand
> 
> but well if you manage to not use it keeping the same perf that's perfect
> 
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
> 
> 
> 
> 2012/12/31 Mark Struberg <strub...@yahoo.de>:
>>  Nope, Unsafe is gory bull****t :)
>> 
>> 
>>  There is only one situation where you still need it: if you manually pack 
> constant definitions in an existing class. But this is highly non-portable.
>> 
>>  LieGrue,
>>  strub
>> 
>> 
>> 
>>  ----- Original Message -----
>>>  From: Romain Manni-Bucau <rmannibu...@gmail.com>
>>>  To: dev@openejb.apache.org; Mark Struberg <strub...@yahoo.de>
>>>  Cc:
>>>  Sent: Monday, December 31, 2012 12:20 PM
>>>  Subject: Re: ASM proxy improvement
>>> 
>>>  Hi Mark,
>>> 
>>>  unsafe is used in all frameworks so i'd consider it as safe ;)
>>> 
>>>  Romain Manni-Bucau
>>>  Twitter: @rmannibucau
>>>  Blog: http://rmannibucau.wordpress.com/
>>>  LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>>  Github: https://github.com/rmannibucau
>>> 
>>> 
>>> 
>>>  2012/12/31 Mark Struberg <strub...@yahoo.de>:
>>>>   hi folks!
>>>> 
>>>>   While looking at the ASM proxy David imported to OWB I saw that 
> it's
>>>  based on the sun.misc.Unsafe class.
>>>>   This makes this approach non-portable to other JVMs.
>>>> 
>>>>   I now played around with an alternative way to do the same: I just 
> invoke
>>>  the protected ClassLoader#defineClass method via reflection instead. In 
> my tests
>>>  this works pretty well already. See defineAndLoadClass in  [1]. Maybe I 
> can even
>>>  remove the 2nd explicit loadClass. It also works without in java6 but 
> the docs
>>>  says that the class is only available after doing a loadClass. Would 
> need some
>>>  more tests to make sure it also works portable without this redundant 
> call.
>>>> 
>>>>   Happy about any feedback.
>>>> 
>>>> 
>>>>   LieGrue,
>>>>   strub
>>>> 
>>>> 
>>>>   [1]
>>> 
> http://svn.apache.org/repos/asf/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/asm/InterceptorDecoratorProxyFactory.java
>>>> 
>>> 
>

Reply via email to