RFR[9]:Fix java/lang/invoke/MethodHandleImpl's use of Unsafe.defineAnonymousClass()
Sundararajan Athijegannathan
sundararajan.athijegannathan at oracle.com
Thu May 12 12:24:00 UTC 2016
Hi Paul:
On default package: with the new rule a VM anonymous class has to be
either [1] in the same package as that of the host class or [2] in the
unnamed package. MethodHandleImpl's T class was earlier in
java.lang.invoke package. So we can either fix it [1] to match the
package of the host class every time [modify/regenerate class bytes for
every host class or patch constant pool entries every time] or [2]
generate in unnamed package and use it unmodified every time. The option
[2] is being used because it involves no bytecode modification or
constant pool patching.
-Sundar
On 5/12/2016 5:32 PM, shilpi.rastogi at oracle.com wrote:
> Thank You Paul for comments.
> Please review updated webrev
> http://cr.openjdk.java.net/~srastogi/8149574/webrev.08/
>
> Regards,
> Shilpi
>
> On 5/12/2016 3:41 PM, Paul Sandoz wrote:
>>> On 11 May 2016, at 18:31, shilpi.rastogi at oracle.com wrote:
>>>
>>> Hi All,
>>>
>>> Please review the updated webrev-
>>> http://cr.openjdk.java.net/~srastogi/8149574/webrev.07/
>>>
>>
>> 1219 FieldVisitor fv;
>> 1220 MethodVisitor mv;
>> 1221 AnnotationVisitor av0;
>>
>> Field “fv is not used. Since “av0” is only used once, might as well
>> declare it at line #1246.
>>
>> Can you break up the long lines at #1242 & #1252 ?
>>
>>
>> My inclination is to turn the anon static block into a method
>> returning byte[] and then do:
>>
>> /*
>> <JAVA DOC explaining the class that is generated rather than just
>> floating as is the current case>
>> */
>> private static final byte[] T_BYTES = generateT();
>> private static byte[] generateT() {
>> …
>> }
>>
>>
>> One concern, more so because of my ignorance, is why can the default
>> package be used. Does anyone know?
>>
>> Paul.
>>
>>> Changed the anonymous class package with no package name.
>>>
>>> Regards,
>>> Shilpi
>>>
>
More information about the core-libs-dev
mailing list