hg: valhalla/valhalla: Use requested class name for non-findable class

Lois Foltan lois.foltan at oracle.com
Fri Nov 9 15:24:52 UTC 2018


On 11/9/2018 2:18 AM, Remi Forax wrote:

> Hi Mandy,
>
> The code here
> http://hg.openjdk.java.net/valhalla/valhalla/rev/248cd28491c1#l1.7
> is dubious to me.
>
> You're patching only the class name not all other occurences of that same class in the constant pool (as a class or in a NameAndType).
> How can it works if the class reference itself, like by example, a call to a private method of itself ?

Hi Remi,

It works because later on within ClassFileParser::fill_instance_klass() 
the _this_class_index within the constant pool for unsafe anonymous and 
future nonfindable classes are eagerly resolved

if (_is_nonfindable || is_unsafe_anonymous()) {
     // _this_class_index is a CONSTANT_Class entry that refers to this
     // anonymous class itself. If this class needs to refer to its own 
methods or
     // fields, it would use a CONSTANT_MethodRef, etc, which would 
reference
     // _this_class_index. However, because this class is nonfindlabe or 
anonymous (it's
     // not stored in SystemDictionary), _this_class_index cannot be 
resolved
     // with ConstantPool::klass_at_impl, which does a SystemDictionary 
lookup.
     // Therefore, we must eagerly resolve _this_class_index now.
     ik->constants()->klass_at_put(_this_class_index, ik);
   }

Thanks,
Lois

>
> regards,
> Rémi
>
> ----- Mail original -----
>> De: "mandy chung" <mandy.chung at oracle.com>
>> À: "valhalla-dev" <valhalla-dev at openjdk.java.net>
>> Envoyé: Jeudi 8 Novembre 2018 00:10:03
>> Objet: hg: valhalla/valhalla: Use requested class name for non-findable class
>> Changeset: 248cd28491c1
>> Author:    mchung
>> Date:      2018-11-07 15:09 -0800
>> URL:       http://hg.openjdk.java.net/valhalla/valhalla/rev/248cd28491c1
>>
>> Use requested class name for non-findable class
>>
>> ! src/hotspot/share/classfile/classFileParser.cpp
>> ! src/java.base/share/classes/java/lang/Class.java
>> ! src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
>> ! src/java.base/share/classes/java/lang/invoke/MethodHandles.java
>> !
>> src/java.base/share/classes/jdk/internal/reflect/NativeConstructorAccessorImpl.java
>> ! src/java.base/share/classes/jdk/internal/reflect/NativeMethodAccessorImpl.java
>> ! src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java
>> ! src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java
>> ! test/jdk/ProblemList.txt
>> ! test/jdk/java/lang/StackWalker/VerifyStackTrace.java
>> ! test/jdk/java/lang/invoke/defineClass/DefineClassTest.java
>> ! test/jdk/java/lang/invoke/defineClass/DefineClassWithClassData.java




More information about the valhalla-dev mailing list