JDK-8190972 : Ensure that AOT/Graal filters out class files containing CONSTANT_Dynamic ahead of full AOT support
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-11-08
  • Updated: 2019-09-13
  • Resolved: 2018-01-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b01Fixed
Related Reports
Relates :  
Description
This task is specifically to ensure that AOT/Graal can parse class files containing CONSTANT_Dynamic and decide to filter them out until full AOT/Graal support can be added for condy.
Comments
[~kvn] I'm sorry, I got confused, I thought condy should be supported in the VM in 10.
15-12-2017

[~iveresov] Igor, I do not get your statement. Condy and these changes are targeting jdk 11 not jdk 10. Why Graal in jdk 10 will have problem?
15-12-2017

But we support Graal as JIT in JDK10. Neither change does anything to prevent JITting classes with condy.
14-12-2017

Committed into the amber/condy repo see http://hg.openjdk.java.net/amber/amber/rev/db4c2914ae86 This fix will be included in JDK 11's initial commit for minimal CONSTANT_Dynamic support.
14-12-2017

Yes, it is temporary solution until JDK-8188871 implementation. And to avoid going through Graal changes process ;)
14-12-2017

Looks good, but now that I think about it, HotSpotResolvedJavaMethodImpl.canBeInlined() seems like the better place, because it's a Graal limitation and not a JVMCI limitation. But it's only temporary, so I suppose either location is fine.
14-12-2017

Thanks, I will add it. Updated same webrev.
14-12-2017

[~kvn] You may need to add something to c2v_isCompilable() at the native level, or HotSpotResolvedJavaMethodImpl.canBeInlined() at the Java level, to prevent inlining.
13-12-2017

webrev: http://cr.openjdk.java.net/~kvn/8190972/webrev.00/
13-12-2017

Here are Lois's changes in CP if AOT needs class check: --- old/src/hotspot/share/classfile/classFileParser.cpp +++ new/src/hotspot/share/classfile/classFileParser.cpp @@ -559,6 +559,9 @@ name_and_type_ref_index, CHECK); // bootstrap specifier index must be checked later, // when BootstrapMethods attr is available + + // Mark the constant pool as having a CONSTANT_Dynamic_info structure + cp->set_has_dynamic_constant(); break; } case JVM_CONSTANT_InvokeDynamic: { --- old/src/hotspot/share/interpreter/rewriter.cpp +++ new/src/hotspot/share/interpreter/rewriter.cpp @@ -50,6 +50,9 @@ add_cp_cache_entry(i); break; case JVM_CONSTANT_Dynamic: + assert(_pool->has_dynamic_constant(), "constant pool's _has_dynamic_constant flag not set"); + add_resolved_references_entry(i); + break; case JVM_CONSTANT_String : // fall through case JVM_CONSTANT_MethodHandle : // fall through case JVM_CONSTANT_MethodType : // fall through --- old/src/hotspot/share/oops/constantPool.hpp +++ new/src/hotspot/share/oops/constantPool.hpp @@ -112,9 +112,10 @@ Array<Klass*>* _resolved_klasses; enum { - _has_preresolution = 1, // Flags - _on_stack = 2, - _is_shared = 4 + _has_preresolution = 1, // Flags + _on_stack = 2, + _is_shared = 4, + _has_dynamic_constant = 8 }; int _flags; // old fashioned bit twiddling @@ -206,6 +207,9 @@ // Faster than MetaspaceObj::is_shared() - used by set_on_stack() bool is_shared() const { return (_flags & _is_shared) != 0; } + bool has_dynamic_constant() const { return (_flags & _has_dynamic_constant) != 0; } + void set_has_dynamic_constant() { _flags |= _has_dynamic_constant; } + // Klass holding pool InstanceKlass* pool_holder() const { return _pool_holder; } void set_pool_holder(InstanceKlass* k) { _pool_holder = k; }
21-11-2017

We can close it when JDK-8188871 is implemented - we have more time for it. But keep it open for now.
21-11-2017

ILW = assigning same priority as the parent RFE = P3
09-11-2017