RFR (XS): 8066497: Update c.o.j.t.ByteCodeLoader to be able really reload given class

Pavel Chistyakov pavel.chistyakov at oracle.com
Wed Dec 10 12:03:13 UTC 2014


Hi David,

Thanks for review.

The intent was:

  * be able to get */new/* instance of Class w/ given name and given
    bytecode for every /*new*/ instance of ByteCodeLoader even if this
    class was already loaded by parent loader. For this reason, I
    overrided loadClass to break delegation to parent loader for given
    className;
  * make single class definition for ByteCodeLoader instance. Here
    holder field appears and DCL for it's thread safe initialization.


-------------
Pavel

On 09.12.2014 23:49, David Chase wrote:
> I agree with your changes to loadClass, but I am not sure that this will allow you to redefine an existing class.  My understanding of how this would work is that it will allow you re-obtain the class that was already loaded (but not to fail at this).  Actually redefining a class requires use of JVMTI (or so I think).
>
> Was that your intent?
>
> David
>
>
> On 2014-12-09, at 11:50 AM, Pavel Chistyakov <pavel.chistyakov at oracle.com> wrote:
>
>> Hi all,
>>
>> please review changes for: https://bugs.openjdk.java.net/browse/JDK-8066497
>> webrev: http://cr.openjdk.java.net/~iignatyev/pchistyakov/8066497/webrev.00/ <http://cr.openjdk.java.net/%7Eiignatyev/pchistyakov/8066497/webrev.00/>
>>
>> Problem:
>> ByteCodeLoader allows one to load class with given name from existing bytecode. But if this class is already loaded by e.g. system classloader it cannot be redefined using another bytecode array because of delegation of loadClass call to parent classloader.
>>
>> Solution:
>> override loadClass to break delegation for given className.
>>
>> Testing: manual
>>
>> -------------------
>> Thanks,
>> Pavel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20141210/2d1db68d/attachment-0001.html>


More information about the hotspot-compiler-dev mailing list