RFR: 8165434: [JVMCI] remove uses of setAccessible
doug.simon at oracle.com
Thu Sep 8 13:12:34 UTC 2016
> On 07 Sep 2016, at 19:52, Christian Thalinger <cthalinger at twitter.com> wrote:
>> On Sep 7, 2016, at 2:29 AM, Doug Simon <doug.simon at oracle.com> wrote:
>>> On 06 Sep 2016, at 20:12, Christian Thalinger <cthalinger at twitter.com> wrote:
>>>> On Sep 5, 2016, at 6:45 AM, Doug Simon <doug.simon at oracle.com> wrote:
>>>> JVMCI currently uses java.lang.reflect.AccessibleObject.setAccessible to get at private internals of certain JDK objects (e.g. java.lang.reflect.Method::slot). In light of changes around java.lang.reflect.AccessibleObject::setAccessible at http://openjdk.java.net/jeps/261, this may require extra command line options at some point. To avoid that, I’ve removed all uses of setAccessible in JVMCI.
>>> + int BRIDGE = 0x0040;
>>> + int VARARGS = 0x0080;
>>> + int SYNTHETIC = 0x1000;
>>> + int ANNOTATION = 0x2000;
>>> + int ENUM = 0x4000;
>>> I wish we could avoid that. We can’t use this stuff because it’s HotSpot-dependent, right?
>>> + assert ModifiersProvider.SYNTHETIC == getConstant("JVM_ACC_SYNTHETIC", Integer.class);
>>> + assert ModifiersProvider.ANNOTATION == getConstant("JVM_ACC_ANNOTATION", Integer.class);
>>> + assert ModifiersProvider.BRIDGE == getConstant("JVM_ACC_BRIDGE", Integer.class);
>>> + assert ModifiersProvider.VARARGS == getConstant("JVM_ACC_VARARGS", Integer.class);
>>> + assert ModifiersProvider.ENUM == getConstant("JVM_ACC_ENUM", Integer.class);
>>> What if we convert these constants to interface methods and the VM-dependent part has to implement them? Or maybe even keep the fields and assign them via interface methods.
>> Following your suggestion, I’ve factored out these VM dependent flags to a new HotSpotModifiers class:
> Excellent. One question… I noticed HotSpotModifiers is an interface but no other class implements it. Is there a reason for it being an interface?
Nope. It’s now a class.
> Only nit, remove 2011:
> 2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
More information about the hotspot-compiler-dev