hg: valhalla/valhalla: Initial prototype of Lookup::defineClass to define a dynamic nestmate.

forax at univ-mlv.fr forax at univ-mlv.fr
Fri Oct 26 10:03:11 UTC 2018


Hi Mandy, Lois and David, 
I see a failure but the way to reproduce the issue is not simple. 

Exception java.lang.NoClassDefFoundError: org/junit/platform/launcher/core/ServiceLoaderTestEngineRegistry$$Lambda$737 
at ClassLoader.defineClass0 (Native Method) 
at System$2.defineClass (System.java:2173) 
at MethodHandles$Lookup.defineClassWithNoCheck (MethodHandles.java:1271) 
at MethodHandles$Lookup.defineClassWithNoCheck (MethodHandles.java:1224) 
at InnerClassLambdaMetafactory.spinInnerClass (InnerClassLambdaMetafactory.java:324) 
at InnerClassLambdaMetafactory.buildCallSite (InnerClassLambdaMetafactory.java:190) 
at LambdaMetafactory.metafactory (LambdaMetafactory.java:329) 
at BootstrapMethodInvoker.invoke (BootstrapMethodInvoker.java:127) 
at CallSite.makeSite (CallSite.java:307) 
at MethodHandleNatives.linkCallSiteImpl (MethodHandleNatives.java:267) 
at MethodHandleNatives.linkCallSite (MethodHandleNatives.java:257) 
at ServiceLoaderTestEngineRegistry.loadTestEngines (ServiceLoaderTestEngineRegistry.java:37) 
at LauncherFactory.create (LauncherFactory.java:87) 
at LauncherFactory.create (LauncherFactory.java:67) 
at TesterRunner.launchJUnitPlatform (TesterRunner.java:65) 
at TesterRunner.getAsInt (TesterRunner.java:29) 
at FutureTask.run (FutureTask.java:264) 
at ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128) 
at ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628) 
at Thread.run (Thread.java:835) 
Caused by: java.lang.ClassNotFoundException: org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry$$Lambda$737 
at Loader.loadClass (Loader.java:566) 
at ClassLoader.loadClass (ClassLoader.java:521) 
... 

the steps to reproduce: 
mkdir test 
cd test 
git clone [ mailto:git at github.com:forax/pro.git | git at github.com:forax/pro.git ] 
cd pro 
export JAVA_HOME= ... point to jdk built with nestmates branch 
sh build.sh 
cd .. 
./pro/target/pro/bin/pro scaffold 
enter foo 
./pro/target/pro/bin/pro 

and it crashes when trying to run the JUnit test in the laucher factory of JUnit. 

the context: pro is a build tool like maven or gradle, it uses jlink to build itself and embed the modules of the jdk so pro uses its own jdk (which allows to have reproducible build because there is no dependency to an external jdk), pro scaffold creates a module (here named foo) with a defaut Main and a default test. When you run pro, it will run the file build.pro with jshell, resolve all the dependencies by downloading them from Maven central, run the test using JUnit5. 

Rémi 

> De: "mandy chung" <mandy.chung at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Mardi 23 Octobre 2018 23:44:43
> Objet: Re: hg: valhalla/valhalla: Initial prototype of Lookup::defineClass to
> define a dynamic nestmate.

> That's great.

> There is a couple of known issues that Lois is working on
> w.r.t. hiding a strong hidden class and classdata. I pushed
> this with a few test failures as this will make it easier
> for Lois and David to continue the development.

> Mandy

> On 10/23/18 1:28 PM, Remi Forax wrote:

>> I'm currently building that branch :)

>> Rémi

>> ----- Mail original -----

>>> De: "mandy chung" [ mailto:mandy.chung at oracle.com | <mandy.chung at oracle.com> ]
>>> À: "valhalla-dev" [ mailto:valhalla-dev at openjdk.java.net |
>>> <valhalla-dev at openjdk.java.net> ] Envoyé: Mardi 23 Octobre 2018 22:06:27
>>> Objet: hg: valhalla/valhalla: Initial prototype of Lookup::defineClass to define
>>> a dynamic nestmate.

>>> Changeset: 55aafa38f559
>>> Author:    mchung
>>> Date:      2018-10-23 13:05 -0700
>>> URL: [ http://hg.openjdk.java.net/valhalla/valhalla/rev/55aafa38f559 |
>>> http://hg.openjdk.java.net/valhalla/valhalla/rev/55aafa38f559 ] Initial
>>> prototype of Lookup::defineClass to define a dynamic nestmate.
>>> javac is updated not to generate the bridge method for lambda.
>>> Also experiment to replace the use of Unsafe VM anonmyous class
>>> and constant pool patching.  Unsafe::defineAnonymousClass supports
>>> the following properties:

>>> 1. Hidden / non-findable / unregister class
>>>   The class is not registered in the system dictionary
>>>   Should a non-findable class forbid any reference to this_class?

>>> 2. Weak class
>>>   The class has a different life cycle as its defining class loader.
>>>   i.e. it may be reclaimed when the class loader is alive

>>> 3. Access to VM annotations
>>>   VM annotations are internal.

>>> 4. Live constants
>>>   Explore the class data idea to replace the constant pool patching
>>>   mechanism.

>>> ! make/hotspot/symbols/symbols-unix
>>> ! src/hotspot/share/aot/aotCodeHeap.cpp
>>> ! src/hotspot/share/aot/aotLoader.cpp
>>> ! src/hotspot/share/ci/ciField.cpp
>>> ! src/hotspot/share/ci/ciInstanceKlass.cpp
>>> ! src/hotspot/share/ci/ciInstanceKlass.hpp
>>> ! src/hotspot/share/classfile/classFileParser.cpp
>>> ! src/hotspot/share/classfile/classFileParser.hpp
>>> ! src/hotspot/share/classfile/classLoader.cpp
>>> ! src/hotspot/share/classfile/classLoaderData.cpp
>>> ! src/hotspot/share/classfile/classLoaderData.hpp
>>> ! src/hotspot/share/classfile/classLoaderDataGraph.cpp
>>> ! src/hotspot/share/classfile/classLoaderDataGraph.hpp
>>> ! src/hotspot/share/classfile/classLoaderExt.cpp
>>> ! src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp
>>> ! src/hotspot/share/classfile/classLoaderStats.cpp
>>> ! src/hotspot/share/classfile/defaultMethods.cpp
>>> ! src/hotspot/share/classfile/javaClasses.hpp
>>> ! src/hotspot/share/classfile/klassFactory.cpp
>>> ! src/hotspot/share/classfile/klassFactory.hpp
>>> ! src/hotspot/share/classfile/moduleEntry.hpp
>>> ! src/hotspot/share/classfile/systemDictionary.cpp
>>> ! src/hotspot/share/classfile/systemDictionary.hpp
>>> ! src/hotspot/share/classfile/systemDictionaryShared.cpp
>>> ! src/hotspot/share/include/jvm.h
>>> ! src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp
>>> ! src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp
>>> ! src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp
>>> ! src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp
>>> ! src/hotspot/share/jvmci/vmStructs_jvmci.cpp
>>> ! src/hotspot/share/memory/metaspace.cpp
>>> ! src/hotspot/share/memory/metaspace.hpp
>>> ! src/hotspot/share/memory/metaspace/printCLDMetaspaceInfoClosure.cpp
>>> ! src/hotspot/share/memory/metaspace/spaceManager.cpp
>>> ! src/hotspot/share/memory/metaspaceShared.cpp
>>> ! src/hotspot/share/memory/metaspaceTracer.cpp
>>> ! src/hotspot/share/oops/instanceKlass.cpp
>>> ! src/hotspot/share/oops/instanceKlass.hpp
>>> ! src/hotspot/share/oops/instanceMirrorKlass.inline.hpp
>>> ! src/hotspot/share/prims/jvm.cpp
>>> ! src/hotspot/share/prims/jvmtiRedefineClasses.cpp
>>> ! src/hotspot/share/prims/methodHandles.cpp
>>> ! src/hotspot/share/prims/unsafe.cpp
>>> ! src/hotspot/share/runtime/reflection.cpp
>>> ! src/hotspot/share/runtime/vmStructs.cpp
>>> ! src/java.base/share/classes/java/lang/Class.java
>>> ! src/java.base/share/classes/java/lang/ClassLoader.java
>>> ! src/java.base/share/classes/java/lang/System.java
>>> ! src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java
>>> ! src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
>>> ! src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
>>> ! src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
>>> ! src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
>>> ! src/java.base/share/classes/java/lang/invoke/MethodHandles.java
>>> ! src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java
>>> ! src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java
>>> ! src/java.base/share/native/libjava/ClassLoader.c
>>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
>>> ! test/hotspot/gtest/memory/test_metaspace_allocation.cpp
>>> + test/jdk/java/lang/invoke/defineClass/DefineClassTest.java
>>> + test/jdk/java/lang/invoke/defineClass/DefineClassWithClassData.java


More information about the valhalla-dev mailing list