diff --git a/compiler/mx.compiler/suite.py b/compiler/mx.compiler/suite.py index 44e3d98e945d..75f511eb4425 100644 --- a/compiler/mx.compiler/suite.py +++ b/compiler/mx.compiler/suite.py @@ -563,7 +563,6 @@ org.graalvm.nativeimage.foreign, org.graalvm.nativeimage.llvm, com.oracle.svm.svm_enterprise, - com.oracle.svm.jdwp.resident, com.oracle.svm_enterprise.ml_dataset, org.graalvm.nativeimage.base, org.graalvm.extraimage.builder, diff --git a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/VerifyWordFactoryUsage.java b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/VerifyWordFactoryUsage.java index e43350e662d8..5807b5ef0bec 100644 --- a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/VerifyWordFactoryUsage.java +++ b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/VerifyWordFactoryUsage.java @@ -24,13 +24,14 @@ */ package jdk.graal.compiler.core.test; +import org.graalvm.word.WordFactory; + import jdk.graal.compiler.nodes.StructuredGraph; import jdk.graal.compiler.nodes.java.MethodCallTargetNode; import jdk.graal.compiler.nodes.spi.CoreProviders; import jdk.graal.compiler.phases.VerifyPhase; import jdk.graal.compiler.word.Word; import jdk.vm.ci.meta.ResolvedJavaType; -import org.graalvm.word.WordFactory; /** * Ensures that Graal compiler code uses factory methods in {@link Word} instead of @@ -53,7 +54,7 @@ protected void verify(StructuredGraph graph, CoreProviders context) { wordFactory.toJavaName(), graph.method().format("%H.%n(%p)"), Word.class.getName(), - graph.method().format("%n(%p)")); + t.targetMethod().format("%n(%p)")); } } diff --git a/docs/reference-manual/native-image/JDWP.md b/docs/reference-manual/native-image/JDWP.md index 2b1ebd12c3a2..391246143a02 100644 --- a/docs/reference-manual/native-image/JDWP.md +++ b/docs/reference-manual/native-image/JDWP.md @@ -13,20 +13,25 @@ This document describes the Java Debug Wire Protocol (JDWP) debugging support fo ## Installation -The JDWP feature is not included by default as part of Native Image. To use it, you need to [build GraalVM from source](https://github.com/oracle/graal/blob/master/vm/README.md) using the following [mx](https://github.com/graalvm/mx/) commands: +The JDWP feature relies on a shared library, which is loaded only when the debugger is actively used. +This library must be built once before building native images with JDWP enabled. ```shell -mx --dynamicimports /substratevm build -export JAVA_HOME=$(mx --dynamicimports /substratevm graalvm-home) +native-image --macro:svmjdwp-library ``` +> Note: This is a one-time setup step. The same library will be used for all native images built with JDWP enabled. + +> Note: This library is stored in the GraalVM installation by default. +> If that directory is not writable, provide an alternative destination path with `-o /libsvmjdwp`, or on Windows, use `-o \\svmjdwp`. + ## Usage > Note: JDWP debugging for Native Image is currently under development. -To include JDWP support in a native image, add the `--macro:svmjdwp` option to your `native-image` command: +To include JDWP support in a native image, add the `-H:+JDWP` option to your `native-image` command: ```shell -native-image --macro:svmjdwp ... -cp YourApplication ... +native-image -H:+UnlockExperimentalVMOptions -H:+JDWP ... -cp YourApplication ... ``` This command produces: @@ -42,7 +47,7 @@ To launch the native image in debug mode, use the `-XX:JDWPOptions=` option, sim ./your-application -XX:JDWPOptions=transport=dt_socket,server=y,address=8000 ``` -> Note: Debugging requires the _image-name.metadata_ file generated at build time and the `svmjdwp` shared library in the same directory as the native executable. +> Note: Debugging requires the _image-name.metadata_ file generated at build time and the `svmjdwp` shared library in the same directory as the native executable. For a complete list of supported JDWP options on Native Image, run: @@ -72,24 +77,6 @@ Examples: Note: If `lib:svmjdwp` cannot be found, the application will terminate with error code 1. -### Build `lib:svmjdwp` - -Run `mx --native-images=lib:svmjdwp build` to build the library. - -### Build a Native Executable with JDWP Support - -Add the `--macro:svmjdwp` option to the `native-image` command: -```shell -mx native-image --macro:svmjdwp -cp MainClass ... -``` - -To build and include `lib:svmjdwp` as a build artifact, run: -```shell -mx --native-images=lib:svmjdwp native-image --macro:svmjdwp -cp MainClass ... -``` - -Both commands produce a binary, an `.metadata` file. - ## Goals and Constraints The JDWP debugging support for Native Image aims to: diff --git a/substratevm/CHANGELOG.md b/substratevm/CHANGELOG.md index a33a50ea6bef..bd900af80a42 100644 --- a/substratevm/CHANGELOG.md +++ b/substratevm/CHANGELOG.md @@ -8,6 +8,7 @@ This changelog summarizes major changes to GraalVM Native Image. * (GR-52400) The build process now uses 85% of system memory in containers and CI environments. Otherwise, it tries to only use available memory. If less than 8GB of memory are available, it falls back to 85% of system memory. The reason for the selected memory limit is now also shown in the build resources section of the build output. * (GR-59864) Added JVM version check to the Native Image agent. The agent will abort execution if the JVM major version does not match the version it was built with, and warn if the full JVM version is different. * (GR-59135) Verify if hosted options passed to `native-image` exist prior to starting the builder. Provide suggestions how to fix unknown options early on. +* (GR-61492) The experimental JDWP option is now present in standard GraalVM builds. ## GraalVM for JDK 24 (Internal Version 24.2.0) * (GR-59717) Added `DuringSetupAccess.registerObjectReachabilityHandler` to allow registering a callback that is executed when an object of a specified type is marked as reachable during heap scanning. diff --git a/substratevm/mx.substratevm/macro-svmjdwp.properties b/substratevm/mx.substratevm/macro-svmjdwp.properties deleted file mode 100644 index 089d18bcb43d..000000000000 --- a/substratevm/mx.substratevm/macro-svmjdwp.properties +++ /dev/null @@ -1,9 +0,0 @@ -# This file contains support for building images with JDWP debugging support - -ProvidedHostedOptions = JDWP CopyNativeJDWPLibrary - -ImageBuilderModulePath = ${.}/builder/svm-jdwp-common.jar:${.}/builder/svm-jdwp-resident.jar - -Args = -H:+UnlockExperimentalVMOptions \ - -H:+JDWP \ - -H:-UnlockExperimentalVMOptions diff --git a/substratevm/mx.substratevm/mx_substratevm.py b/substratevm/mx.substratevm/mx_substratevm.py index 01a50deeeaa6..65d06bad20db 100644 --- a/substratevm/mx.substratevm/mx_substratevm.py +++ b/substratevm/mx.substratevm/mx_substratevm.py @@ -1627,20 +1627,6 @@ def prevent_build_path_in_libgraal(): "-H:+PreserveFramePointer", ] -mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVMSvmMacro( - suite=suite, - name='SubstrateVM JDWP Debugger Resident', - short_name='svmjdwp', - dir_name="svmjdwp", - license_files=[], - third_party_license_files=[], - dependencies=['SubstrateVM'], - builder_jar_distributions=['substratevm:SVM_JDWP_COMMON', 'substratevm:SVM_JDWP_RESIDENT'], - support_distributions=['substratevm:SVM_JDWP_RESIDENT_SUPPORT'], - stability="experimental", - jlink=False, -)) - libsvmjdwp_lib_config = mx_sdk_vm.LibraryConfig( destination="", jvm_library=True, @@ -1655,7 +1641,7 @@ def prevent_build_path_in_libgraal(): libsvmjdwp = mx_sdk_vm.GraalVmJreComponent( suite=suite, name='SubstrateVM JDWP Debugger', - short_name='svmjdwpserver', + short_name='svmjdwp', dir_name="svm", license_files=[], third_party_license_files=[], diff --git a/substratevm/mx.substratevm/suite.py b/substratevm/mx.substratevm/suite.py index 348697aae502..d6c3368db65e 100644 --- a/substratevm/mx.substratevm/suite.py +++ b/substratevm/mx.substratevm/suite.py @@ -686,6 +686,7 @@ "requires" : [ "jdk.jfr", "jdk.management", + "java.instrument", ], "requiresConcealed" : { "java.base" : [ @@ -710,9 +711,6 @@ "sun.util.locale", "sun.invoke.util", ], - "java.instrument":[ - "java.lang.instrument" - ], "java.management": [ "com.sun.jmx.mbeanserver", # Needed for javadoc links (MXBeanIntrospector,DefaultMXBeanMappingFactory, MXBeanProxy) "sun.management", # Needed for javadoc links (MappedMXBeanType) @@ -1575,7 +1573,8 @@ "subDir": "src", "sourceDirs": ["src"], "dependencies": [ - "substratevm:SVM" + "com.oracle.svm.core", + "com.oracle.graal.pointsto", ], "requiresConcealed" : { "jdk.internal.vm.ci" : [ @@ -1593,6 +1592,8 @@ "sourceDirs": ["src"], "dependencies": [ "com.oracle.svm.interpreter.metadata", + "com.oracle.svm.core.graal.aarch64", + "com.oracle.svm.graal", ], "requires" : [ "java.base" @@ -1621,7 +1622,7 @@ "subDir": "src", "sourceDirs": ["src"], "dependencies": [ - "substratevm:SVM", + "com.oracle.svm.core", ], "requiresConcealed" : { "jdk.internal.vm.ci" : [ @@ -1718,6 +1719,7 @@ "com.oracle.svm.core.posix", "com.oracle.svm.core.windows", "com.oracle.svm.core.genscavenge", + "com.oracle.svm.jdwp.resident", ], "distDependencies": [ "sdk:NATIVEIMAGE", @@ -1747,12 +1749,15 @@ org.graalvm.extraimage.librarysupport, com.oracle.svm.extraimage_enterprise, org.graalvm.nativeimage.foreign, - com.oracle.svm.jdwp.common, com.oracle.svm.jdwp.server, - com.oracle.svm.jdwp.resident, org.graalvm.truffle.runtime.svm, com.oracle.truffle.enterprise.svm""", "com.oracle.svm.hosted.c.libc to com.oracle.graal.sandbox", + "com.oracle.svm.jdwp.bridge to com.oracle.svm.jdwp.server", + "com.oracle.svm.jdwp.bridge.nativebridge to com.oracle.svm.jdwp.server", + "com.oracle.svm.jdwp.bridge.jniutils to com.oracle.svm.jdwp.server", + "com.oracle.svm.interpreter.metadata to com.oracle.svm.jdwp.server", + "com.oracle.svm.interpreter.metadata.serialization to com.oracle.svm.jdwp.server", ], "opens" : [ "com.oracle.svm.core to jdk.graal.compiler", @@ -1762,7 +1767,6 @@ "com.oracle.svm.hosted.fieldfolding to jdk.graal.compiler", "com.oracle.svm.hosted.phases to jdk.graal.compiler", "com.oracle.svm.hosted.reflect to jdk.graal.compiler", - "com.oracle.svm.core.thread to com.oracle.svm.jdwp.resident", ], "requires": [ "java.management", @@ -2229,7 +2233,7 @@ "org.graalvm.collections", ], "exports" : [ - "com.oracle.svm.util to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.llvm,org.graalvm.nativeimage.agent.jvmtibase,org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.agent.diagnostics,org.graalvm.nativeimage.junitsupport,com.oracle.svm.svm_enterprise,com.oracle.svm_enterprise.ml_dataset,com.oracle.svm.jdwp.resident,org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise,org.graalvm.extraimage.librarysupport,org.graalvm.nativeimage.foreign,org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm", + "com.oracle.svm.util to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.llvm,org.graalvm.nativeimage.agent.jvmtibase,org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.agent.diagnostics,org.graalvm.nativeimage.junitsupport,com.oracle.svm.svm_enterprise,com.oracle.svm_enterprise.ml_dataset,org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise,org.graalvm.extraimage.librarysupport,org.graalvm.nativeimage.foreign,org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm", "com.oracle.svm.common.meta to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.llvm,org.graalvm.extraimage.builder,org.graalvm.nativeimage.foreign,org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm", "com.oracle.svm.common.option to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.foreign,org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm", ], @@ -2549,56 +2553,6 @@ }, }, - "SVM_JDWP_COMMON": { - "subDir": "src", - "dependencies": [ - "com.oracle.svm.interpreter.metadata", - "com.oracle.svm.jdwp.bridge", - ], - "distDependencies": [ - "SVM", - ], - "moduleInfo" : { - "name" : "com.oracle.svm.jdwp.common", - "exports" : [ - "com.oracle.svm.jdwp.bridge to com.oracle.svm.jdwp.server,com.oracle.svm.jdwp.resident", - "com.oracle.svm.jdwp.bridge.nativebridge to com.oracle.svm.jdwp.server,com.oracle.svm.jdwp.resident", - "com.oracle.svm.jdwp.bridge.jniutils to com.oracle.svm.jdwp.server,com.oracle.svm.jdwp.resident", - "com.oracle.svm.interpreter.metadata to com.oracle.svm.jdwp.server,com.oracle.svm.jdwp.resident", - "com.oracle.svm.interpreter.metadata.serialization to com.oracle.svm.jdwp.server,com.oracle.svm.jdwp.resident", - ], - "requires" : [ - "org.graalvm.collections", - ], - } - }, - - "SVM_JDWP_RESIDENT": { - "subDir": "src", - "dependencies": [ - "com.oracle.svm.jdwp.resident", - ], - "distDependencies": [ - "SVM_JDWP_COMMON", - "sdk:COLLECTIONS", - "compiler:GRAAL", - ], - "moduleInfo" : { - "name" : "com.oracle.svm.jdwp.resident", - "exports": [ - "com.oracle.svm.interpreter,com.oracle.svm.jdwp.resident to org.graalvm.nativeimage.builder", - ], - } - }, - - "SVM_JDWP_RESIDENT_SUPPORT" : { - "native" : True, - "description" : "JDWP debugging support", - "layout" : { - "native-image.properties" : "file:mx.substratevm/macro-svmjdwp.properties", - }, - }, - "SVM_JDWP_SERVER": { "subDir": "src", "dependencies": [ @@ -2606,11 +2560,11 @@ ], "distDependencies": [ "substratevm:SVM", - "SVM_JDWP_COMMON", ], "moduleInfo" : { "name" : "com.oracle.svm.jdwp.server", - } + }, + "maven" : False, }, }, diff --git a/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/InterpreterResolvedJavaMethod.java b/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/InterpreterResolvedJavaMethod.java index 8c85a557ca74..d1e5f94718d8 100644 --- a/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/InterpreterResolvedJavaMethod.java +++ b/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/InterpreterResolvedJavaMethod.java @@ -33,13 +33,13 @@ import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; -import org.graalvm.word.WordFactory; import com.oracle.svm.core.FunctionPointerHolder; import com.oracle.svm.core.meta.MethodPointer; import com.oracle.svm.core.util.VMError; import com.oracle.svm.interpreter.metadata.serialization.VisibleForSerialization; +import jdk.graal.compiler.word.Word; import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.ExceptionHandler; import jdk.vm.ci.meta.LineNumberTable; @@ -387,7 +387,7 @@ public boolean hasNativeEntryPoint() { public MethodPointer getNativeEntryPoint() { if (nativeEntryPoint == null) { - return WordFactory.nullPointer(); + return Word.nullPointer(); } return (MethodPointer) nativeEntryPoint.getReferent().functionPointer; } diff --git a/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/serialization/Serializers.java b/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/serialization/Serializers.java index 2a2114214c61..8af19bf757c3 100644 --- a/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/serialization/Serializers.java +++ b/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/serialization/Serializers.java @@ -31,11 +31,9 @@ import java.util.function.IntFunction; import java.util.function.ToLongFunction; -import com.oracle.svm.interpreter.metadata.ReferenceConstant; import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; import org.graalvm.word.Pointer; -import org.graalvm.word.WordFactory; import com.oracle.svm.core.FunctionPointerHolder; import com.oracle.svm.core.snippets.KnownIntrinsics; @@ -47,7 +45,9 @@ import com.oracle.svm.interpreter.metadata.InterpreterResolvedObjectType; import com.oracle.svm.interpreter.metadata.InterpreterResolvedPrimitiveType; import com.oracle.svm.interpreter.metadata.InterpreterUnresolvedSignature; +import com.oracle.svm.interpreter.metadata.ReferenceConstant; +import jdk.graal.compiler.word.Word; import jdk.vm.ci.meta.ExceptionHandler; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; @@ -282,7 +282,7 @@ static ValueSerializer asReferenceConstant() { return ReferenceConstant.nullReference(); } Pointer heapBase = KnownIntrinsics.heapBase(); - Object ref = heapBase.add(WordFactory.unsigned(nativeHeapAddress)).toObject(); + Object ref = heapBase.add(Word.unsigned(nativeHeapAddress)).toObject(); return ReferenceConstant.createFromNonNullReference(ref); } else { // The reference could have been serialized despite not being on the native image heap. diff --git a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/DebuggerFeature.java b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/DebuggerFeature.java index 9e2431b24719..b8033340f4bf 100644 --- a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/DebuggerFeature.java +++ b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/DebuggerFeature.java @@ -95,13 +95,11 @@ import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaMethod; import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaType; import com.oracle.svm.interpreter.metadata.InterpreterResolvedObjectType; -import com.oracle.svm.interpreter.metadata.InterpreterUniverse; import com.oracle.svm.interpreter.metadata.InterpreterUniverseImpl; import com.oracle.svm.interpreter.metadata.MetadataUtil; import com.oracle.svm.interpreter.metadata.ReferenceConstant; import com.oracle.svm.interpreter.metadata.serialization.SerializationContext; import com.oracle.svm.interpreter.metadata.serialization.Serializers; -import com.oracle.svm.util.ModuleSupport; import jdk.graal.compiler.api.replacements.SnippetReflectionProvider; import jdk.graal.compiler.core.common.SuppressFBWarnings; @@ -140,26 +138,6 @@ public class DebuggerFeature implements InternalFeature { private InvocationPlugins invocationPlugins; private static final String SYNTHETIC_ASSERTIONS_DISABLED_FIELD_NAME = "$assertionsDisabled"; - public DebuggerFeature() { - if (ModuleSupport.modulePathBuild) { - /* SVM_JDWP_RESIDENT */ - ModuleSupport.accessPackagesToClass(ModuleSupport.Access.EXPORT, InterpreterFeature.class, false, - "jdk.internal.vm.ci", "jdk.vm.ci.code", "jdk.vm.ci.meta"); - ModuleSupport.accessPackagesToClass(ModuleSupport.Access.EXPORT, InterpreterFeature.class, false, - "java.base", "jdk.internal.misc"); - - ModuleSupport.accessPackagesToClass(ModuleSupport.Access.EXPORT, InterpreterFeature.class, false, - "org.graalvm.nativeimage", "org.graalvm.nativeimage.impl"); - - ModuleSupport.accessPackagesToClass(ModuleSupport.Access.EXPORT, InterpreterFeature.class, false, - "org.graalvm.nativeimage.base"); - - /* SVM_JDWP_COMMON */ - ModuleSupport.accessPackagesToClass(ModuleSupport.Access.EXPORT, InterpreterUniverse.class, false, - "jdk.internal.vm.ci", "jdk.vm.ci.meta"); - } - } - @Override public boolean isInConfiguration(IsInConfigurationAccess access) { return InterpreterOptions.DebuggerWithInterpreter.getValue(); diff --git a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/Interpreter.java b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/Interpreter.java index 64b9bd0a3ed4..c864c43220fd 100644 --- a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/Interpreter.java +++ b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/Interpreter.java @@ -58,8 +58,8 @@ import static com.oracle.svm.interpreter.EspressoFrame.setLocalObjectOrReturnAddress; import static com.oracle.svm.interpreter.EspressoFrame.startingStackOffset; import static com.oracle.svm.interpreter.EspressoFrame.swapSingle; -import static com.oracle.svm.interpreter.InterpreterUtil.traceInterpreter; import static com.oracle.svm.interpreter.InterpreterToVM.nullCheck; +import static com.oracle.svm.interpreter.InterpreterUtil.traceInterpreter; import static com.oracle.svm.interpreter.metadata.Bytecodes.AALOAD; import static com.oracle.svm.interpreter.metadata.Bytecodes.AASTORE; import static com.oracle.svm.interpreter.metadata.Bytecodes.ACONST_NULL; @@ -264,28 +264,26 @@ import static com.oracle.svm.interpreter.metadata.Bytecodes.TABLESWITCH; import static com.oracle.svm.interpreter.metadata.Bytecodes.WIDE; +import com.oracle.svm.core.StaticFieldsSupport; +import com.oracle.svm.core.jdk.InternalVMMethod; +import com.oracle.svm.core.util.VMError; import com.oracle.svm.interpreter.debug.DebuggerEvents; import com.oracle.svm.interpreter.debug.EventKind; import com.oracle.svm.interpreter.debug.SteppingControl; import com.oracle.svm.interpreter.metadata.BytecodeStream; -import com.oracle.svm.interpreter.metadata.LookupSwitch; -import com.oracle.svm.interpreter.metadata.ReferenceConstant; -import com.oracle.svm.interpreter.metadata.TableSwitch; -import jdk.graal.compiler.api.directives.GraalDirectives; import com.oracle.svm.interpreter.metadata.Bytecodes; -import org.graalvm.nativeimage.ImageSingletons; - -import com.oracle.svm.core.StaticFieldsSupport; -import com.oracle.svm.core.jdk.InternalVMMethod; -import com.oracle.svm.core.util.VMError; import com.oracle.svm.interpreter.metadata.InterpreterConstantPool; import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaField; import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaMethod; import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaType; import com.oracle.svm.interpreter.metadata.InterpreterResolvedObjectType; import com.oracle.svm.interpreter.metadata.InterpreterUnresolvedSignature; +import com.oracle.svm.interpreter.metadata.LookupSwitch; import com.oracle.svm.interpreter.metadata.MetadataUtil; +import com.oracle.svm.interpreter.metadata.ReferenceConstant; +import com.oracle.svm.interpreter.metadata.TableSwitch; +import jdk.graal.compiler.api.directives.GraalDirectives; import jdk.vm.ci.meta.ConstantPool; import jdk.vm.ci.meta.ExceptionHandler; import jdk.vm.ci.meta.JavaConstant; @@ -302,9 +300,7 @@ */ @InternalVMMethod public final class Interpreter { - protected static final String FAILURE_CONSTANT_NOT_PART_OF_IMAGE_HEAP = "Trying to load constant that is not part of the Native Image heap"; - - public static final DebuggerEvents DEBUGGER = MetadataUtil.requireNonNull(ImageSingletons.lookup(DebuggerEvents.class)); + static final String FAILURE_CONSTANT_NOT_PART_OF_IMAGE_HEAP = "Trying to load constant that is not part of the Native Image heap"; private Interpreter() { throw VMError.shouldNotReachHere("private constructor"); @@ -483,7 +479,7 @@ private static Object executeBodyFromBCI(InterpreterFrame frame, InterpreterReso traceInterpreterEnter(method, indent, curBCI, top); int debuggerEventFlags = 0; - if (DEBUGGER.isEventEnabled(Thread.currentThread(), EventKind.METHOD_ENTRY)) { + if (DebuggerEvents.singleton().isEventEnabled(Thread.currentThread(), EventKind.METHOD_ENTRY)) { if (((InterpreterResolvedJavaType) method.getDeclaringClass()).isMethodEnterEvent()) { debuggerEventFlags |= EventKind.METHOD_ENTRY.getFlag(); } @@ -496,10 +492,10 @@ private static Object executeBodyFromBCI(InterpreterFrame frame, InterpreterReso */ int curOpcode = BytecodeStream.opaqueOpcode(code, curBCI); - if (DEBUGGER.isEventEnabled(Thread.currentThread(), EventKind.SINGLE_STEP)) { + if (DebuggerEvents.singleton().isEventEnabled(Thread.currentThread(), EventKind.SINGLE_STEP)) { // Check that stepping "depth" and "size" are respected. Thread currentThread = Thread.currentThread(); - SteppingControl steppingControl = DEBUGGER.getSteppingControl(currentThread); + SteppingControl steppingControl = DebuggerEvents.singleton().getSteppingControl(currentThread); if (steppingControl != null && steppingControl.isActiveAtCurrentFrameDepth()) { int stepSize = steppingControl.getSize(); if (stepSize == SteppingControl.STEP_MIN || @@ -510,14 +506,14 @@ private static Object executeBodyFromBCI(InterpreterFrame frame, InterpreterReso } if (curOpcode == BREAKPOINT) { - if (DEBUGGER.isEventEnabled(Thread.currentThread(), EventKind.BREAKPOINT)) { + if (DebuggerEvents.singleton().isEventEnabled(Thread.currentThread(), EventKind.BREAKPOINT)) { debuggerEventFlags |= EventKind.BREAKPOINT.getFlag(); } curOpcode = method.getOriginalOpcodeAt(curBCI); } if (debuggerEventFlags != 0) { // We have possibly: method enter, step before statement/expression, breakpoint - DEBUGGER.getEventHandler().onEventAt(Thread.currentThread(), method, curBCI, null, debuggerEventFlags); + DebuggerEvents.singleton().getEventHandler().onEventAt(Thread.currentThread(), method, curBCI, null, debuggerEventFlags); debuggerEventFlags = 0; } @@ -855,10 +851,10 @@ private static Object executeBodyFromBCI(InterpreterFrame frame, InterpreterReso case RETURN: { Object returnValue = getReturnValueAsObject(frame, method, top); traceInterpreterReturn(method, indent, curBCI, top); - if (DEBUGGER.isEventEnabled(Thread.currentThread(), EventKind.METHOD_EXIT)) { + if (DebuggerEvents.singleton().isEventEnabled(Thread.currentThread(), EventKind.METHOD_EXIT)) { if (((InterpreterResolvedJavaType) method.getDeclaringClass()).isMethodExitEvent()) { int flags = EventKind.METHOD_EXIT.getFlag() | EventKind.METHOD_EXIT_WITH_RETURN_VALUE.getFlag(); - DEBUGGER.getEventHandler().onEventAt(Thread.currentThread(), method, curBCI, returnValue, flags); + DebuggerEvents.singleton().getEventHandler().onEventAt(Thread.currentThread(), method, curBCI, returnValue, flags); } } return returnValue; @@ -879,14 +875,14 @@ private static Object executeBodyFromBCI(InterpreterFrame frame, InterpreterReso SteppingControl steppingControl = null; boolean stepEventDisabled = false; Thread currentThread = Thread.currentThread(); - if (DEBUGGER.isEventEnabled(currentThread, EventKind.SINGLE_STEP)) { + if (DebuggerEvents.singleton().isEventEnabled(currentThread, EventKind.SINGLE_STEP)) { // Disable stepping for inner frames, except for step into, where we must force interpreter execution. - steppingControl = DEBUGGER.getSteppingControl(currentThread); + steppingControl = DebuggerEvents.singleton().getSteppingControl(currentThread); if (steppingControl != null) { // If step events can be ignored at frame n => can be also ignored at inner frame n + 1. steppingControl.pushFrame(); if (!steppingControl.isActiveAtCurrentFrameDepth()) { - DEBUGGER.setEventEnabled(currentThread, EventKind.SINGLE_STEP, false); + DebuggerEvents.singleton().setEventEnabled(currentThread, EventKind.SINGLE_STEP, false); stepEventDisabled = true; } if (steppingControl.getDepth() == SteppingControl.STEP_INTO) { @@ -901,13 +897,13 @@ private static Object executeBodyFromBCI(InterpreterFrame frame, InterpreterReso try { top += invoke(frame, method, code, top, curBCI, curOpcode, forceStayInInterpreter, preferStayInInterpreter); } finally { - SteppingControl newSteppingControl = DEBUGGER.getSteppingControl(currentThread); + SteppingControl newSteppingControl = DebuggerEvents.singleton().getSteppingControl(currentThread); if (newSteppingControl != null) { - if (DEBUGGER.isEventEnabled(currentThread, EventKind.SINGLE_STEP)) { + if (DebuggerEvents.singleton().isEventEnabled(currentThread, EventKind.SINGLE_STEP)) { newSteppingControl.popFrame(); } else if (steppingControl == newSteppingControl && stepEventDisabled) { // Re-enable stepping events that could have been disabled by step outer/out into inner frames. - DEBUGGER.setEventEnabled(currentThread, EventKind.SINGLE_STEP, true); + DebuggerEvents.singleton().setEventEnabled(currentThread, EventKind.SINGLE_STEP, true); newSteppingControl.popFrame(); } } diff --git a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterDirectivesSupportImpl.java b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterDirectivesSupportImpl.java index 17f130f67e27..f4c5f8ca806f 100644 --- a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterDirectivesSupportImpl.java +++ b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterDirectivesSupportImpl.java @@ -24,9 +24,9 @@ */ package com.oracle.svm.interpreter; +import static com.oracle.svm.hosted.pltgot.GOTEntryAllocator.GOT_NO_ENTRY; import static com.oracle.svm.interpreter.InterpreterUtil.traceInterpreter; import static com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaMethod.EST_NO_ENTRY; -import static com.oracle.svm.hosted.pltgot.GOTEntryAllocator.GOT_NO_ENTRY; import java.util.ArrayList; import java.util.Collection; @@ -37,7 +37,6 @@ import org.graalvm.word.Pointer; import org.graalvm.word.UnsignedWord; import org.graalvm.word.WordBase; -import org.graalvm.word.WordFactory; import com.oracle.svm.core.config.ConfigurationValues; import com.oracle.svm.core.jdk.InternalVMMethod; @@ -50,6 +49,7 @@ import com.oracle.svm.interpreter.metadata.InterpreterUniverse; import jdk.graal.compiler.debug.GraalError; +import jdk.graal.compiler.word.Word; import jdk.vm.ci.meta.ResolvedJavaMethod; @InternalVMMethod @@ -106,7 +106,7 @@ public void resetInterpreterExecution(Object method) { return; } long previousEntry = rememberCompiledEntry.get(interpreterMethod); - writeGOTHelper(interpreterMethod, WordFactory.pointer(previousEntry)); + writeGOTHelper(interpreterMethod, Word.pointer(previousEntry)); } private class InterpreterOpToken { diff --git a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterFeature.java b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterFeature.java index 85251cef3364..f57c0e6d4aba 100644 --- a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterFeature.java +++ b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterFeature.java @@ -47,17 +47,17 @@ import com.oracle.svm.core.ParsingReason; import com.oracle.svm.core.Uninterruptible; import com.oracle.svm.core.feature.InternalFeature; +import com.oracle.svm.core.graal.aarch64.AArch64InterpreterStubs; +import com.oracle.svm.core.graal.amd64.AMD64InterpreterStubs; +import com.oracle.svm.core.graal.code.InterpreterAccessStubData; import com.oracle.svm.core.interpreter.InterpreterSupport; import com.oracle.svm.core.meta.MethodPointer; import com.oracle.svm.core.util.VMError; -import com.oracle.svm.core.graal.code.InterpreterAccessStubData; -import com.oracle.svm.core.graal.aarch64.AArch64InterpreterStubs; -import com.oracle.svm.core.graal.amd64.AMD64InterpreterStubs; -import com.oracle.svm.interpreter.debug.DebuggerEventsFeature; import com.oracle.svm.graal.hosted.DeoptimizationFeature; import com.oracle.svm.hosted.FeatureImpl; import com.oracle.svm.hosted.code.SubstrateCompilationDirectives; import com.oracle.svm.hosted.meta.HostedMethod; +import com.oracle.svm.interpreter.debug.DebuggerEventsFeature; import com.oracle.svm.util.ReflectionUtil; import jdk.graal.compiler.api.replacements.Fold; @@ -174,7 +174,7 @@ public void lower(LoweringTool tool) { } @Override - public void afterRegistration(AfterRegistrationAccess access) { + public void duringSetup(DuringSetupAccess access) { if (Platform.includedIn(Platform.AARCH64.class)) { ImageSingletons.add(InterpreterStubSection.class, new AArch64InterpreterStubSection()); ImageSingletons.add(InterpreterAccessStubData.class, new AArch64InterpreterStubs.AArch64InterpreterAccessStubData()); @@ -182,7 +182,7 @@ public void afterRegistration(AfterRegistrationAccess access) { ImageSingletons.add(InterpreterStubSection.class, new AMD64InterpreterStubSection()); ImageSingletons.add(InterpreterAccessStubData.class, new AMD64InterpreterStubs.AMD64InterpreterAccessStubData()); } else { - VMError.unsupportedFeature("Platform not supported yet"); + throw VMError.unsupportedFeature("Platform not supported yet: " + ImageSingletons.lookup(Platform.class)); } } diff --git a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterStubSection.java b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterStubSection.java index b64e99e037e3..796962776774 100644 --- a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterStubSection.java +++ b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterStubSection.java @@ -25,6 +25,22 @@ package com.oracle.svm.interpreter; +import static com.oracle.svm.interpreter.EspressoFrame.setLocalDouble; +import static com.oracle.svm.interpreter.EspressoFrame.setLocalFloat; +import static com.oracle.svm.interpreter.EspressoFrame.setLocalInt; +import static com.oracle.svm.interpreter.EspressoFrame.setLocalLong; +import static com.oracle.svm.interpreter.EspressoFrame.setLocalObject; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.graalvm.nativeimage.ImageSingletons; +import org.graalvm.nativeimage.StackValue; +import org.graalvm.nativeimage.c.function.CFunctionPointer; +import org.graalvm.nativeimage.impl.UnmanagedMemorySupport; +import org.graalvm.word.Pointer; + import com.oracle.objectfile.BasicProgbitsSectionImpl; import com.oracle.objectfile.ObjectFile; import com.oracle.objectfile.SectionName; @@ -33,10 +49,10 @@ import com.oracle.svm.core.SubstrateTargetDescription; import com.oracle.svm.core.config.ConfigurationValues; import com.oracle.svm.core.deopt.Deoptimizer; -import com.oracle.svm.core.graal.meta.KnownOffsets; import com.oracle.svm.core.graal.code.InterpreterAccessStubData; import com.oracle.svm.core.graal.code.SubstrateCallingConventionKind; import com.oracle.svm.core.graal.code.SubstrateCallingConventionType; +import com.oracle.svm.core.graal.meta.KnownOffsets; import com.oracle.svm.core.jdk.InternalVMMethod; import com.oracle.svm.core.util.VMError; import com.oracle.svm.hosted.image.AbstractImage; @@ -45,6 +61,7 @@ import com.oracle.svm.hosted.meta.HostedMethod; import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaMethod; import com.oracle.svm.interpreter.metadata.InterpreterUnresolvedSignature; + import jdk.graal.compiler.core.common.LIRKind; import jdk.graal.compiler.core.common.NumUtil; import jdk.graal.compiler.word.Word; @@ -56,22 +73,6 @@ import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; -import org.graalvm.nativeimage.ImageSingletons; -import org.graalvm.nativeimage.StackValue; -import org.graalvm.nativeimage.c.function.CFunctionPointer; -import org.graalvm.nativeimage.impl.UnmanagedMemorySupport; -import org.graalvm.word.Pointer; -import org.graalvm.word.WordFactory; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import static com.oracle.svm.interpreter.EspressoFrame.setLocalDouble; -import static com.oracle.svm.interpreter.EspressoFrame.setLocalFloat; -import static com.oracle.svm.interpreter.EspressoFrame.setLocalInt; -import static com.oracle.svm.interpreter.EspressoFrame.setLocalLong; -import static com.oracle.svm.interpreter.EspressoFrame.setLocalObject; @InternalVMMethod public abstract class InterpreterStubSection { @@ -180,7 +181,7 @@ public static Pointer enterInterpreterStub(int interpreterMethodESTOffset, Point int gpIdx = 0; int fpIdx = 0; if (interpreterMethod.hasReceiver()) { - Object receiver = ((Pointer) WordFactory.pointer(accessHelper.getGpArgumentAt(callingConvention.getArgument(gpIdx), enterData, gpIdx))).toObject(); + Object receiver = ((Pointer) Word.pointer(accessHelper.getGpArgumentAt(callingConvention.getArgument(gpIdx), enterData, gpIdx))).toObject(); setLocalObject(frame, 0, receiver); gpIdx++; interpSlot++; @@ -212,7 +213,7 @@ public static Pointer enterInterpreterStub(int interpreterMethodESTOffset, Point case Long: setLocalLong(frame, interpSlot, arg); interpSlot++; break; case Float: setLocalFloat(frame, interpSlot, Float.intBitsToFloat((int) arg)); break; case Double: setLocalDouble(frame, interpSlot, Double.longBitsToDouble(arg)); interpSlot++; break; - case Object: setLocalObject(frame, interpSlot, ((Pointer) WordFactory.pointer(arg)).toObject()); break; + case Object: setLocalObject(frame, interpSlot, ((Pointer) Word.pointer(arg)).toObject()); break; // @formatter:on default: throw VMError.shouldNotReachHereAtRuntime(); @@ -301,9 +302,9 @@ public static Object leaveInterpreter(CFunctionPointer compiledEntryPoint, Inter int stackSize = NumUtil.roundUp(callingConvention.getStackSize(), stubSection.target.stackAlignment); - Pointer stackBuffer = WordFactory.nullPointer(); + Pointer stackBuffer = Word.nullPointer(); if (stackSize > 0) { - stackBuffer = ImageSingletons.lookup(UnmanagedMemorySupport.class).malloc(WordFactory.unsigned(stackSize)); + stackBuffer = ImageSingletons.lookup(UnmanagedMemorySupport.class).malloc(Word.unsigned(stackSize)); accessHelper.setSp(leaveData, stackSize, stackBuffer); } @@ -382,7 +383,7 @@ public static Object leaveInterpreter(CFunctionPointer compiledEntryPoint, Inter case Long -> accessHelper.getGpReturn(leaveData); case Float -> Float.intBitsToFloat((int) accessHelper.getFpReturn(leaveData)); case Double -> Double.longBitsToDouble(accessHelper.getFpReturn(leaveData)); - case Object -> ((Pointer) WordFactory.pointer(accessHelper.getGpReturn(leaveData))).toObject(); + case Object -> ((Pointer) Word.pointer(accessHelper.getGpReturn(leaveData))).toObject(); case Void -> null; default -> throw VMError.shouldNotReachHereAtRuntime(); }; diff --git a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterSupportImpl.java b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterSupportImpl.java index 6eeee427e546..96875d5792c3 100644 --- a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterSupportImpl.java +++ b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterSupportImpl.java @@ -25,17 +25,16 @@ package com.oracle.svm.interpreter; -import com.oracle.svm.core.interpreter.InterpreterFrameSourceInfo; import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; import org.graalvm.word.Pointer; import org.graalvm.word.SignedWord; -import org.graalvm.word.WordFactory; import com.oracle.svm.core.code.FrameInfoQueryResult; import com.oracle.svm.core.code.FrameSourceInfo; import com.oracle.svm.core.heap.ReferenceAccess; +import com.oracle.svm.core.interpreter.InterpreterFrameSourceInfo; import com.oracle.svm.core.interpreter.InterpreterSupport; import com.oracle.svm.core.util.VMError; import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaMethod; @@ -74,17 +73,17 @@ private static T readObject(Pointer addr, SignedWord offset, boolean compres private InterpreterResolvedJavaMethod readInterpretedMethod(FrameInfoQueryResult frameInfo, Pointer sp) { FrameInfoQueryResult.ValueInfo valueInfo = frameInfo.getValueInfos()[interpretedMethodSlot]; - return readObject(sp, WordFactory.signed(valueInfo.getData()), valueInfo.isCompressedReference()); + return readObject(sp, Word.signed(valueInfo.getData()), valueInfo.isCompressedReference()); } private int readBCI(FrameInfoQueryResult frameInfo, Pointer sp) { FrameInfoQueryResult.ValueInfo valueInfo = frameInfo.getValueInfos()[bciSlot]; - return readInt(sp, WordFactory.signed(valueInfo.getData())); + return readInt(sp, Word.signed(valueInfo.getData())); } private InterpreterFrame readInterpreterFrame(FrameInfoQueryResult frameInfo, Pointer sp) { FrameInfoQueryResult.ValueInfo valueInfo = frameInfo.getValueInfos()[interpretedFrameSlot]; - return readObject(sp, WordFactory.signed(valueInfo.getData()), valueInfo.isCompressedReference()); + return readObject(sp, Word.signed(valueInfo.getData()), valueInfo.isCompressedReference()); } @Override diff --git a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterToVM.java b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterToVM.java index 65ae4e36c7d7..7f24eb467646 100644 --- a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterToVM.java +++ b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterToVM.java @@ -25,8 +25,8 @@ package com.oracle.svm.interpreter; -import static com.oracle.svm.interpreter.InterpreterOptions.InterpreterTraceSupport; import static com.oracle.svm.interpreter.InterpreterOptions.DebuggerWithInterpreter; +import static com.oracle.svm.interpreter.InterpreterOptions.InterpreterTraceSupport; import static com.oracle.svm.interpreter.InterpreterUtil.traceInterpreter; import static com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaMethod.VTBL_NO_ENTRY; import static com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaMethod.VTBL_ONE_IMPL; @@ -34,21 +34,18 @@ import java.lang.reflect.Array; import java.lang.reflect.Field; -import com.oracle.svm.core.SubstrateOptions; -import com.oracle.svm.core.graal.snippets.OpenTypeWorldDispatchTableSnippets; -import com.oracle.svm.core.hub.RuntimeClassLoading; -import com.oracle.svm.interpreter.metadata.ReferenceConstant; -import jdk.vm.ci.meta.PrimitiveConstant; import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.MissingReflectionRegistrationError; import org.graalvm.nativeimage.c.function.CFunctionPointer; import org.graalvm.word.WordBase; -import org.graalvm.word.WordFactory; +import com.oracle.svm.core.SubstrateOptions; import com.oracle.svm.core.classinitialization.EnsureClassInitializedNode; import com.oracle.svm.core.config.ConfigurationValues; import com.oracle.svm.core.graal.meta.KnownOffsets; +import com.oracle.svm.core.graal.snippets.OpenTypeWorldDispatchTableSnippets; import com.oracle.svm.core.hub.DynamicHub; +import com.oracle.svm.core.hub.RuntimeClassLoading; import com.oracle.svm.core.jdk.InternalVMMethod; import com.oracle.svm.core.monitor.MonitorInflationCause; import com.oracle.svm.core.monitor.MonitorSupport; @@ -57,6 +54,7 @@ import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaMethod; import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaType; import com.oracle.svm.interpreter.metadata.InterpreterResolvedObjectType; +import com.oracle.svm.interpreter.metadata.ReferenceConstant; import jdk.graal.compiler.api.directives.GraalDirectives; import jdk.graal.compiler.core.common.SuppressFBWarnings; @@ -65,6 +63,7 @@ import jdk.internal.misc.Unsafe; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.PrimitiveConstant; import jdk.vm.ci.meta.ResolvedJavaType; @InternalVMMethod @@ -323,8 +322,8 @@ public static WordBase getFieldWord(Object obj, InterpreterResolvedJavaField wor assert obj != null; assert wordField.getType().isWordType(); return switch (wordJavaKind()) { - case Long -> WordFactory.signed(getFieldLong(obj, wordField)); - case Int -> WordFactory.signed(getFieldInt(obj, wordField)); + case Long -> Word.signed(getFieldLong(obj, wordField)); + case Int -> Word.signed(getFieldInt(obj, wordField)); default -> throw VMError.shouldNotReachHere("Unexpected word kind " + wordJavaKind()); }; } @@ -763,7 +762,7 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod ensureClassInitialized(seedDeclaringClass); } - CFunctionPointer calleeFtnPtr = WordFactory.nullPointer(); + CFunctionPointer calleeFtnPtr = Word.nullPointer(); if (goThroughPLT) { if (seedMethod.hasNativeEntryPoint()) { diff --git a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/debug/DebuggerEvents.java b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/debug/DebuggerEvents.java index be9a43973901..128f0d6e915a 100644 --- a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/debug/DebuggerEvents.java +++ b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/debug/DebuggerEvents.java @@ -24,8 +24,10 @@ */ package com.oracle.svm.interpreter.debug; +import com.oracle.svm.interpreter.metadata.MetadataUtil; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; +import org.graalvm.nativeimage.ImageSingletons; public interface DebuggerEvents { @@ -90,4 +92,8 @@ default void setStepping(Thread thread, int depth, int size) { * Returns the {@link SteppingControl stepping information} associated with a thread. */ SteppingControl getSteppingControl(Thread thread); + + static DebuggerEvents singleton() { + return MetadataUtil.requireNonNull(ImageSingletons.lookup(DebuggerEvents.class)); + } } diff --git a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/HSToNativeJDWPBridgeGen.java b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/HSToNativeJDWPBridgeGen.java index ccc2262c8271..7507d35f7487 100644 --- a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/HSToNativeJDWPBridgeGen.java +++ b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/HSToNativeJDWPBridgeGen.java @@ -26,6 +26,12 @@ // @formatter:off package com.oracle.svm.jdwp.bridge; +import org.graalvm.nativeimage.StackValue; +import org.graalvm.nativeimage.UnmanagedMemory; +import org.graalvm.nativeimage.c.function.CEntryPoint; +import org.graalvm.nativeimage.c.function.CEntryPoint.IsolateThreadContext; +import org.graalvm.nativeimage.c.type.CCharPointer; + import com.oracle.svm.jdwp.bridge.jniutils.JNI.JByteArray; import com.oracle.svm.jdwp.bridge.jniutils.JNI.JClass; import com.oracle.svm.jdwp.bridge.jniutils.JNI.JIntArray; @@ -43,12 +49,8 @@ import com.oracle.svm.jdwp.bridge.nativebridge.NativeIsolate; import com.oracle.svm.jdwp.bridge.nativebridge.NativeIsolateThread; import com.oracle.svm.jdwp.bridge.nativebridge.NativeObjectHandles; -import org.graalvm.nativeimage.StackValue; -import org.graalvm.nativeimage.UnmanagedMemory; -import org.graalvm.nativeimage.c.function.CEntryPoint; -import org.graalvm.nativeimage.c.function.CEntryPoint.IsolateThreadContext; -import org.graalvm.nativeimage.c.type.CCharPointer; -import org.graalvm.word.WordFactory; + +import jdk.graal.compiler.word.Word; /* Checkout README.md before modifying */ final class HSToNativeJDWPBridgeGen { @@ -506,7 +508,7 @@ static JString currentWorkingDirectory(JNIEnv jniEnv, JClass jniClazz, @IsolateT scope.setObjectResult(JNIUtil.createHSString(jniEnv, endPointResult)); } catch (Throwable e) { ForeignException.forThrowable(e, throwableMarshaller).throwUsingJNI(jniEnv); - scope.setObjectResult(WordFactory.nullPointer()); + scope.setObjectResult(Word.nullPointer()); } return scope.getObjectResult(); } @@ -541,7 +543,7 @@ static JByteArray dispatch(JNIEnv jniEnv, JClass jniClazz, @IsolateThreadContext } } catch (Throwable e) { ForeignException.forThrowable(e, throwableMarshaller).throwUsingJNI(jniEnv); - scope.setObjectResult(WordFactory.nullPointer()); + scope.setObjectResult(Word.nullPointer()); } return scope.getObjectResult(); } @@ -595,7 +597,7 @@ static JString getSystemProperty(JNIEnv jniEnv, JClass jniClazz, @IsolateThreadC scope.setObjectResult(JNIUtil.createHSString(jniEnv, endPointResult)); } catch (Throwable e) { ForeignException.forThrowable(e, throwableMarshaller).throwUsingJNI(jniEnv); - scope.setObjectResult(WordFactory.nullPointer()); + scope.setObjectResult(Word.nullPointer()); } return scope.getObjectResult(); } @@ -625,7 +627,7 @@ static JByteArray getThreadFrames(JNIEnv jniEnv, JClass jniClazz, @IsolateThread } } catch (Throwable e) { ForeignException.forThrowable(e, throwableMarshaller).throwUsingJNI(jniEnv); - scope.setObjectResult(WordFactory.nullPointer()); + scope.setObjectResult(Word.nullPointer()); } return scope.getObjectResult(); } @@ -834,7 +836,7 @@ static JIntArray typeStatus(JNIEnv jniEnv, JClass jniClazz, @IsolateThreadContex scope.setObjectResult(JNIUtil.createHSArray(jniEnv, endPointResult)); } catch (Throwable e) { ForeignException.forThrowable(e, throwableMarshaller).throwUsingJNI(jniEnv); - scope.setObjectResult(WordFactory.nullPointer()); + scope.setObjectResult(Word.nullPointer()); } return scope.getObjectResult(); } @@ -860,7 +862,7 @@ static JLongArray vmSuspend(JNIEnv jniEnv, JClass jniClazz, @IsolateThreadContex scope.setObjectResult(JNIUtil.createHSArray(jniEnv, endPointResult)); } catch (Throwable e) { ForeignException.forThrowable(e, throwableMarshaller).throwUsingJNI(jniEnv); - scope.setObjectResult(WordFactory.nullPointer()); + scope.setObjectResult(Word.nullPointer()); } return scope.getObjectResult(); } diff --git a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/jniutils/HSObject.java b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/jniutils/HSObject.java index 31a665fadd34..35e0e7257b2e 100644 --- a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/jniutils/HSObject.java +++ b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/jniutils/HSObject.java @@ -39,7 +39,7 @@ import com.oracle.svm.jdwp.bridge.jniutils.JNI.JNIEnv; import com.oracle.svm.jdwp.bridge.jniutils.JNI.JObject; import com.oracle.svm.jdwp.bridge.jniutils.JNI.JWeak; -import org.graalvm.word.WordFactory; +import jdk.graal.compiler.word.Word; /** * Encapsulates a JNI handle to an object in the HotSpot heap. Depending on which constructor is @@ -204,7 +204,7 @@ void clean(JNIEnv env) { if (checkingGlobalDuplicates(allowGlobalDuplicates)) { synchronized (this) { delete(env); - handle = WordFactory.nullPointer(); + handle = Word.nullPointer(); } } else { delete(env); diff --git a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/jniutils/JNIUtil.java b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/jniutils/JNIUtil.java index 88ac118371c1..67dd8ef7328e 100644 --- a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/jniutils/JNIUtil.java +++ b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/jniutils/JNIUtil.java @@ -27,11 +27,22 @@ import static com.oracle.svm.jdwp.bridge.jniutils.JNI.JNI_OK; import static com.oracle.svm.jdwp.bridge.jniutils.JNI.JNI_VERSION_10; import static org.graalvm.nativeimage.c.type.CTypeConversion.toCString; -import static org.graalvm.word.WordFactory.nullPointer; import java.io.PrintWriter; import java.io.StringWriter; +import org.graalvm.nativeimage.StackValue; +import org.graalvm.nativeimage.UnmanagedMemory; +import org.graalvm.nativeimage.c.type.CCharPointer; +import org.graalvm.nativeimage.c.type.CDoublePointer; +import org.graalvm.nativeimage.c.type.CFloatPointer; +import org.graalvm.nativeimage.c.type.CIntPointer; +import org.graalvm.nativeimage.c.type.CLongPointer; +import org.graalvm.nativeimage.c.type.CShortPointer; +import org.graalvm.nativeimage.c.type.CTypeConversion; +import org.graalvm.nativeimage.c.type.CTypeConversion.CCharPointerHolder; +import org.graalvm.nativeimage.c.type.VoidPointer; + import com.oracle.svm.jdwp.bridge.jniutils.JNI.JArray; import com.oracle.svm.jdwp.bridge.jniutils.JNI.JBooleanArray; import com.oracle.svm.jdwp.bridge.jniutils.JNI.JByteArray; @@ -55,18 +66,8 @@ import com.oracle.svm.jdwp.bridge.jniutils.JNI.JavaVM; import com.oracle.svm.jdwp.bridge.jniutils.JNI.JavaVMAttachArgs; import com.oracle.svm.jdwp.bridge.jniutils.JNI.JavaVMPointer; -import org.graalvm.nativeimage.StackValue; -import org.graalvm.nativeimage.UnmanagedMemory; -import org.graalvm.nativeimage.c.type.CCharPointer; -import org.graalvm.nativeimage.c.type.CDoublePointer; -import org.graalvm.nativeimage.c.type.CFloatPointer; -import org.graalvm.nativeimage.c.type.CIntPointer; -import org.graalvm.nativeimage.c.type.CLongPointer; -import org.graalvm.nativeimage.c.type.CShortPointer; -import org.graalvm.nativeimage.c.type.CTypeConversion; -import org.graalvm.nativeimage.c.type.CTypeConversion.CCharPointerHolder; -import org.graalvm.nativeimage.c.type.VoidPointer; -import org.graalvm.word.WordFactory; + +import jdk.graal.compiler.word.Word; /** * Helpers for calling JNI functions. @@ -380,7 +381,7 @@ public static JavaVM GetJavaVM(JNIEnv env) { if (env.getFunctions().getGetJavaVM().call(env, javaVMPointer) == JNI_OK) { return javaVMPointer.readJavaVM(); } else { - return WordFactory.nullPointer(); + return Word.nullPointer(); } } @@ -390,7 +391,7 @@ public static JNIEnv GetEnv(JavaVM vm) { if (vm.getFunctions().getGetEnv().call(vm, envPointer, JNI_VERSION_10) == JNI_OK) { return envPointer.readJNIEnv(); } else { - return WordFactory.nullPointer(); + return Word.nullPointer(); } } @@ -400,7 +401,7 @@ public static JNIEnv AttachCurrentThread(JavaVM vm, JavaVMAttachArgs args) { if (vm.getFunctions().getAttachCurrentThread().call(vm, envPointer, args) == JNI_OK) { return envPointer.readJNIEnv(); } else { - return WordFactory.nullPointer(); + return Word.nullPointer(); } } @@ -410,7 +411,7 @@ public static JNIEnv AttachCurrentThreadAsDaemon(JavaVM vm, JavaVMAttachArgs arg if (vm.getFunctions().getAttachCurrentThreadAsDaemon().call(vm, envPointer, args) == JNI_OK) { return envPointer.readJNIEnv(); } else { - return WordFactory.nullPointer(); + return Word.nullPointer(); } } @@ -527,7 +528,7 @@ public static String createString(JNIEnv env, JString hsString) { return null; } int len = env.getFunctions().getGetStringLength().call(env, hsString); - CShortPointer unicode = env.getFunctions().getGetStringChars().call(env, hsString, WordFactory.nullPointer()); + CShortPointer unicode = env.getFunctions().getGetStringChars().call(env, hsString, Word.nullPointer()); try { char[] data = new char[len]; for (int i = 0; i < len; i++) { @@ -544,7 +545,7 @@ public static String createString(JNIEnv env, JString hsString) { */ public static JString createHSString(JNIEnv env, String string) { if (string == null) { - return WordFactory.nullPointer(); + return Word.nullPointer(); } int len = string.length(); CShortPointer buffer = UnmanagedMemory.malloc(len << 1); @@ -570,7 +571,7 @@ public static boolean[] createArray(JNIEnv env, JBooleanArray booleanArray) { public static JBooleanArray createHSArray(JNIEnv jniEnv, boolean[] a) { if (a == null) { - return WordFactory.nullPointer(); + return Word.nullPointer(); } JBooleanArray array = NewBooleanArray(jniEnv, a.length); arrayCopy(jniEnv, a, 0, array, 0, a.length); @@ -589,7 +590,7 @@ public static byte[] createArray(JNIEnv env, JByteArray byteArray) { public static JByteArray createHSArray(JNIEnv jniEnv, byte[] a) { if (a == null) { - return WordFactory.nullPointer(); + return Word.nullPointer(); } JByteArray array = NewByteArray(jniEnv, a.length); arrayCopy(jniEnv, a, 0, array, 0, a.length); @@ -608,7 +609,7 @@ public static char[] createArray(JNIEnv env, JCharArray charArray) { public static JCharArray createHSArray(JNIEnv jniEnv, char[] a) { if (a == null) { - return WordFactory.nullPointer(); + return Word.nullPointer(); } JCharArray array = NewCharArray(jniEnv, a.length); arrayCopy(jniEnv, a, 0, array, 0, a.length); @@ -627,7 +628,7 @@ public static short[] createArray(JNIEnv env, JShortArray shortArray) { public static JShortArray createHSArray(JNIEnv jniEnv, short[] a) { if (a == null) { - return WordFactory.nullPointer(); + return Word.nullPointer(); } JShortArray array = NewShortArray(jniEnv, a.length); arrayCopy(jniEnv, a, 0, array, 0, a.length); @@ -646,7 +647,7 @@ public static int[] createArray(JNIEnv env, JIntArray intArray) { public static JIntArray createHSArray(JNIEnv jniEnv, int[] a) { if (a == null) { - return WordFactory.nullPointer(); + return Word.nullPointer(); } JIntArray array = NewIntArray(jniEnv, a.length); arrayCopy(jniEnv, a, 0, array, 0, a.length); @@ -665,7 +666,7 @@ public static long[] createArray(JNIEnv env, JLongArray longArray) { public static JLongArray createHSArray(JNIEnv jniEnv, long[] a) { if (a == null) { - return WordFactory.nullPointer(); + return Word.nullPointer(); } JLongArray array = NewLongArray(jniEnv, a.length); arrayCopy(jniEnv, a, 0, array, 0, a.length); @@ -684,7 +685,7 @@ public static float[] createArray(JNIEnv env, JFloatArray floatArray) { public static JFloatArray createHSArray(JNIEnv jniEnv, float[] a) { if (a == null) { - return WordFactory.nullPointer(); + return Word.nullPointer(); } JFloatArray array = NewFloatArray(jniEnv, a.length); arrayCopy(jniEnv, a, 0, array, 0, a.length); @@ -703,7 +704,7 @@ public static double[] createArray(JNIEnv env, JDoubleArray doubleArray) { public static JDoubleArray createHSArray(JNIEnv jniEnv, double[] a) { if (a == null) { - return WordFactory.nullPointer(); + return Word.nullPointer(); } JDoubleArray array = NewDoubleArray(jniEnv, a.length); arrayCopy(jniEnv, a, 0, array, 0, a.length); @@ -713,14 +714,14 @@ public static JDoubleArray createHSArray(JNIEnv jniEnv, double[] a) { public static JObjectArray createHSArray(JNIEnv jniEnv, Object[] array, int sourcePosition, int length, String componentTypeBinaryName) { JObjectArray hsArray; if (array != null) { - hsArray = JNIUtil.NewObjectArray(jniEnv, length, JNIUtil.findClass(jniEnv, WordFactory.nullPointer(), componentTypeBinaryName, true), WordFactory.nullPointer()); + hsArray = JNIUtil.NewObjectArray(jniEnv, length, JNIUtil.findClass(jniEnv, Word.nullPointer(), componentTypeBinaryName, true), Word.nullPointer()); for (int i = 0; i < length; i++) { HSObject element = (HSObject) array[sourcePosition + i]; - JObject hsElement = element != null ? element.getHandle() : WordFactory.nullPointer(); + JObject hsElement = element != null ? element.getHandle() : Word.nullPointer(); JNIUtil.SetObjectArrayElement(jniEnv, hsArray, i, hsElement); } } else { - hsArray = WordFactory.nullPointer(); + hsArray = Word.nullPointer(); } return hsArray; } @@ -1048,7 +1049,7 @@ public static JClass findClass(JNIEnv env, JObject classLoader, String binaryNam * Finds a class in HotSpot heap using JNI. * * @param env the {@code JNIEnv} - * @param classLoader the class loader to find class in or {@link WordFactory#nullPointer() NULL + * @param classLoader the class loader to find class in or {@link Word#nullPointer() NULL * pointer}. * @param binaryName the class binary name * @param required if {@code true} the {@link JNIExceptionWrapper} is thrown when the class is @@ -1086,7 +1087,7 @@ public static JObject getJVMCIClassLoader(JNIEnv env) { if (getClassLoaderId.isNull()) { throw new InternalError(String.format("Cannot find method %s in class %s.", METHOD_GET_PLATFORM_CLASS_LOADER[0], ClassLoader.class.getName())); } - return env.getFunctions().getCallStaticObjectMethodA().call(env, clazz, getClassLoaderId, nullPointer()); + return env.getFunctions().getCallStaticObjectMethodA().call(env, clazz, getClassLoaderId, Word.nullPointer()); } public static JObject getClassLoader(JNIEnv env, JClass clazz) { @@ -1099,7 +1100,7 @@ public static JObject getClassLoader(JNIEnv env, JClass clazz) { if (getClassLoader.isNull()) { throw new NullPointerException("Not found: getClassLoader()"); } - return env.getFunctions().getCallObjectMethodA().call(env, clazz, getClassLoader, nullPointer()); + return env.getFunctions().getCallObjectMethodA().call(env, clazz, getClassLoader, Word.nullPointer()); } /** @@ -1117,7 +1118,7 @@ public static JObject getSystemClassLoader(JNIEnv env) { if (getClassLoaderId.isNull()) { throw new InternalError(String.format("Cannot find method %s in class %s.", METHOD_GET_SYSTEM_CLASS_LOADER[0], ClassLoader.class.getName())); } - return env.getFunctions().getCallStaticObjectMethodA().call(env, clazz, getClassLoaderId, nullPointer()); + return env.getFunctions().getCallStaticObjectMethodA().call(env, clazz, getClassLoaderId, Word.nullPointer()); } public static JMethodID findMethod(JNIEnv env, JClass clazz, boolean staticMethod, String methodName, String methodSignature) { diff --git a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/BinaryOutput.java b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/BinaryOutput.java index 3544f3fe5947..a9cde38490f9 100644 --- a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/BinaryOutput.java +++ b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/BinaryOutput.java @@ -32,7 +32,8 @@ import org.graalvm.nativeimage.UnmanagedMemory; import org.graalvm.nativeimage.c.type.CCharPointer; import org.graalvm.nativeimage.c.type.CTypeConversion; -import org.graalvm.word.WordFactory; + +import jdk.graal.compiler.word.Word; /** * A buffer used by the {@link BinaryMarshaller} to marshall parameters and results passed by value. @@ -618,7 +619,7 @@ public void close() { if (unmanaged) { UnmanagedMemory.free(address); byteBufferView = null; - address = WordFactory.nullPointer(); + address = Word.nullPointer(); length = 0; unmanaged = false; pos = Integer.MIN_VALUE; @@ -642,7 +643,7 @@ private void ensureCapacity(int neededCapacity) { throw new OutOfMemoryError(); } if (unmanaged) { - address = UnmanagedMemory.realloc(address, WordFactory.unsigned(newCapacity)); + address = UnmanagedMemory.realloc(address, Word.unsigned(newCapacity)); } else { CCharPointer newAddress = UnmanagedMemory.malloc(newCapacity); memcpy(newAddress, address, pos); diff --git a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/JNIClassCache.java b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/JNIClassCache.java index 5bbbdf0734d7..eeef5580e113 100644 --- a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/JNIClassCache.java +++ b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/JNIClassCache.java @@ -33,7 +33,8 @@ import com.oracle.svm.jdwp.bridge.jniutils.JNI.JNIEnv; import com.oracle.svm.jdwp.bridge.jniutils.JNIExceptionWrapper; import com.oracle.svm.jdwp.bridge.jniutils.JNIUtil; -import org.graalvm.word.WordFactory; + +import jdk.graal.compiler.word.Word; /** * Support class for {@link JClass} lookup. JClass instances are cached as JNI globals. The cached @@ -72,7 +73,7 @@ private static JClass lookupClassImpl(JNIEnv env, String className, boolean requ Function createClassData = new Function<>() { @Override public JNIClassData apply(String cn) { - JClass jClass = JNIUtil.findClass(env, WordFactory.nullPointer(), JNIUtil.getBinaryName(className), required); + JClass jClass = JNIUtil.findClass(env, Word.nullPointer(), JNIUtil.getBinaryName(className), required); if (jClass.isNull()) { return JNIClassData.INVALID; } diff --git a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/NativeObjectHandles.java b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/NativeObjectHandles.java index e1c623aeea73..22968a6086e2 100644 --- a/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/NativeObjectHandles.java +++ b/substratevm/src/com.oracle.svm.jdwp.bridge/src/com/oracle/svm/jdwp/bridge/nativebridge/NativeObjectHandles.java @@ -25,7 +25,8 @@ package com.oracle.svm.jdwp.bridge.nativebridge; import org.graalvm.nativeimage.ObjectHandles; -import org.graalvm.word.WordFactory; + +import jdk.graal.compiler.word.Word; /** * A support class for mapping objects in the native image isolate to long handles. @@ -50,7 +51,7 @@ public static long create(Object object) { */ public static T resolve(long handle, Class type) { try { - return type.cast(ObjectHandles.getGlobal().get(WordFactory.pointer(handle))); + return type.cast(ObjectHandles.getGlobal().get(Word.pointer(handle))); } catch (IllegalArgumentException iae) { throw new InvalidHandleException(iae); } @@ -61,7 +62,7 @@ public static T resolve(long handle, Class type) { */ public static void remove(long handle) { try { - ObjectHandles.getGlobal().destroy(WordFactory.pointer(handle)); + ObjectHandles.getGlobal().destroy(Word.pointer(handle)); } catch (IllegalArgumentException iae) { throw new InvalidHandleException(iae); } diff --git a/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/DebuggingOnDemandHandler.java b/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/DebuggingOnDemandHandler.java index ad5619a34ac1..82c580e8dcb1 100644 --- a/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/DebuggingOnDemandHandler.java +++ b/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/DebuggingOnDemandHandler.java @@ -29,12 +29,6 @@ import java.util.ArrayList; import java.util.List; -import com.oracle.svm.core.threadlocal.FastThreadLocalWord; -import com.oracle.svm.interpreter.DebuggerSupport; -import com.oracle.svm.jdwp.bridge.Logger; -import com.oracle.svm.jdwp.bridge.nativebridge.NativeObjectHandles; -import com.oracle.svm.jdwp.resident.impl.ResidentJDWP; -import jdk.graal.compiler.core.common.SuppressFBWarnings; import org.graalvm.nativeimage.CurrentIsolate; import org.graalvm.nativeimage.Isolate; import org.graalvm.nativeimage.IsolateThread; @@ -46,7 +40,6 @@ import org.graalvm.nativeimage.c.type.CCharPointer; import org.graalvm.nativeimage.c.type.CTypeConversion; import org.graalvm.word.PointerBase; -import org.graalvm.word.WordFactory; import com.oracle.svm.core.OS; import com.oracle.svm.core.Uninterruptible; @@ -64,20 +57,27 @@ import com.oracle.svm.core.jni.headers.JNIVersion; import com.oracle.svm.core.log.Log; import com.oracle.svm.core.threadlocal.FastThreadLocalFactory; +import com.oracle.svm.core.threadlocal.FastThreadLocalWord; import com.oracle.svm.core.util.VMError; -import com.oracle.svm.interpreter.Interpreter; +import com.oracle.svm.interpreter.DebuggerSupport; import com.oracle.svm.interpreter.InterpreterOptions; -import com.oracle.svm.jdwp.bridge.jniutils.JNI; -import com.oracle.svm.jdwp.bridge.jniutils.JNIMethodScope; +import com.oracle.svm.interpreter.debug.DebuggerEvents; import com.oracle.svm.jdwp.bridge.ArgFilesOption; import com.oracle.svm.jdwp.bridge.DebugOptions.Options; import com.oracle.svm.jdwp.bridge.JDWPEventHandlerBridge; +import com.oracle.svm.jdwp.bridge.Logger; import com.oracle.svm.jdwp.bridge.NativeToHSJDWPEventHandlerBridge; import com.oracle.svm.jdwp.bridge.ResidentJDWPFeatureEnabled; +import com.oracle.svm.jdwp.bridge.jniutils.JNI; +import com.oracle.svm.jdwp.bridge.jniutils.JNIMethodScope; +import com.oracle.svm.jdwp.bridge.nativebridge.NativeObjectHandles; +import com.oracle.svm.jdwp.resident.impl.ResidentJDWP; +import jdk.graal.compiler.core.common.SuppressFBWarnings; +import jdk.graal.compiler.word.Word; +import jdk.internal.misc.Signal; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; -import jdk.internal.misc.Signal; public class DebuggingOnDemandHandler implements Signal.Handler { @@ -101,7 +101,7 @@ public static JNI.JNIEnv currentThreadJniEnv() { if (currentJniEnv.isNull()) { JNI.JNIEnvPointer attachedJniEnvPointer = StackValue.get(JNI.JNIEnvPointer.class); // Enter the debugger server (HotSpot or isolate) as a daemon thread. - debuggerServerJavaVM.getFunctions().getAttachCurrentThreadAsDaemon().call(debuggerServerJavaVM, attachedJniEnvPointer, WordFactory.nullPointer()); + debuggerServerJavaVM.getFunctions().getAttachCurrentThreadAsDaemon().call(debuggerServerJavaVM, attachedJniEnvPointer, Word.nullPointer()); currentJniEnv = attachedJniEnvPointer.readJNIEnv(); jniEnvPerThread.set(currentJniEnv); } @@ -262,7 +262,7 @@ public static void spawnJDWPServer(Path libraryPath, long initialThreadId, Optio long isolate = CurrentIsolate.getIsolate().rawValue(); // Ensures that the callbacks To HotSpot have a JNIEnv available via JNIMethodScope. - Interpreter.DEBUGGER.setEventHandler(new EnterHSEventHandler(jdwpEventHandler)); + DebuggerEvents.singleton().setEventHandler(new EnterHSEventHandler(jdwpEventHandler)); ThreadStartDeathSupport.get().setListener(new ThreadStartDeathSupport.Listener() { @Override @@ -309,7 +309,7 @@ public void vmDied() { }); - assert Interpreter.DEBUGGER.getEventHandler() != null; + assert DebuggerEvents.singleton().getEventHandler() != null; Path metadataPath = DebuggerSupport.getMetadataFilePath(); String metadataHashString = DebuggerSupport.getMetadataHashString(); try (JNIMethodScope ignored = new JNIMethodScope("JDWPServer::spawnServer", currentThreadJniEnv())) { diff --git a/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/JDWPBridgeImpl.java b/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/JDWPBridgeImpl.java index fc836e993406..9284ec3f1ce1 100644 --- a/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/JDWPBridgeImpl.java +++ b/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/JDWPBridgeImpl.java @@ -24,6 +24,13 @@ */ package com.oracle.svm.jdwp.resident; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.List; +import java.util.OptionalInt; + +import org.graalvm.nativeimage.IsolateThread; + import com.oracle.svm.core.code.FrameInfoQueryResult; import com.oracle.svm.core.code.FrameSourceInfo; import com.oracle.svm.core.heap.VMOperationInfos; @@ -40,7 +47,6 @@ import com.oracle.svm.interpreter.debug.Location; import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaMethod; import com.oracle.svm.interpreter.metadata.InterpreterUniverse; -import com.oracle.svm.interpreter.metadata.MetadataUtil; import com.oracle.svm.jdwp.bridge.ErrorCode; import com.oracle.svm.jdwp.bridge.JDWP; import com.oracle.svm.jdwp.bridge.JDWPBridge; @@ -51,16 +57,10 @@ import com.oracle.svm.jdwp.resident.impl.AllJavaFramesVisitor; import com.oracle.svm.jdwp.resident.impl.ResidentJDWP; import com.oracle.svm.jdwp.resident.impl.SafeStackWalker; + import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; -import org.graalvm.nativeimage.ImageSingletons; -import org.graalvm.nativeimage.IsolateThread; - -import java.nio.file.Path; -import java.util.Arrays; -import java.util.List; -import java.util.OptionalInt; public final class JDWPBridgeImpl implements JDWPBridge { @@ -72,41 +72,40 @@ public static ObjectIdMap getIds() { return IDS; } - private static final DebuggerEvents DEBUGGER = MetadataUtil.requireNonNull(ImageSingletons.lookup(DebuggerEvents.class)); - @Override public void setEventEnabled(long threadId, int eventKind, boolean enable) { - DEBUGGER.setEventEnabled(getIds().toObject(threadId, Thread.class), EventKind.fromOrdinal(eventKind), enable); + DebuggerEvents.singleton().setEventEnabled(getIds().toObject(threadId, Thread.class), EventKind.fromOrdinal(eventKind), enable); } @Override public boolean isEventEnabled(long threadId, int eventKind) { - return DEBUGGER.isEventEnabled(getIds().toObject(threadId, Thread.class), EventKind.fromOrdinal(eventKind)); + return DebuggerEvents.singleton().isEventEnabled(getIds().toObject(threadId, Thread.class), EventKind.fromOrdinal(eventKind)); } @Override public void toggleBreakpoint(long methodId, int bci, boolean enable) { - DEBUGGER.toggleBreakpoint(getIds().toObject(methodId, ResolvedJavaMethod.class), bci, enable); + DebuggerEvents.singleton().toggleBreakpoint(getIds().toObject(methodId, ResolvedJavaMethod.class), bci, enable); } @Override public void toggleMethodEnterEvent(long clazzId, boolean enable) { - DEBUGGER.toggleMethodEnterEvent(getIds().toObject(clazzId, ResolvedJavaType.class), enable); + DebuggerEvents.singleton().toggleMethodEnterEvent(getIds().toObject(clazzId, ResolvedJavaType.class), enable); } @Override public void toggleMethodExitEvent(long clazzId, boolean enable) { - DEBUGGER.toggleMethodExitEvent(getIds().toObject(clazzId, ResolvedJavaType.class), enable); + DebuggerEvents.singleton().toggleMethodExitEvent(getIds().toObject(clazzId, ResolvedJavaType.class), enable); } @Override public void setSteppingFromLocation(long threadId, int depth, int size, long methodId, int bci, int lineNumber) { - DEBUGGER.setSteppingFromLocation(getIds().toObject(threadId, Thread.class), depth, size, Location.create(getIds().toObject(methodId, ResolvedJavaMethod.class), bci, lineNumber)); + DebuggerEvents.singleton().setSteppingFromLocation(getIds().toObject(threadId, Thread.class), depth, size, + Location.create(getIds().toObject(methodId, ResolvedJavaMethod.class), bci, lineNumber)); } @Override public void clearStepping(long threadId) { - DEBUGGER.clearStepping(getIds().toObject(threadId, Thread.class)); + DebuggerEvents.singleton().clearStepping(getIds().toObject(threadId, Thread.class)); } @Override diff --git a/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/ResidentJDWPFeature.java b/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/ResidentJDWPFeature.java index 4be25fab7807..41cec88327c1 100644 --- a/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/ResidentJDWPFeature.java +++ b/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/ResidentJDWPFeature.java @@ -26,19 +26,19 @@ import java.util.List; -import com.oracle.svm.core.feature.InternalFeature; -import com.oracle.svm.jdwp.bridge.jniutils.NativeBridgeSupport; import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; import org.graalvm.nativeimage.hosted.Feature; import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; +import com.oracle.svm.core.feature.InternalFeature; import com.oracle.svm.core.jdk.RuntimeSupport; import com.oracle.svm.interpreter.InterpreterFeature; import com.oracle.svm.interpreter.debug.DebuggerEventsFeature; import com.oracle.svm.jdwp.bridge.JDWPNativeBridgeSupport; import com.oracle.svm.jdwp.bridge.ResidentJDWPFeatureEnabled; +import com.oracle.svm.jdwp.bridge.jniutils.NativeBridgeSupport; @Platforms(Platform.HOSTED_ONLY.class) @AutomaticallyRegisteredFeature @@ -51,13 +51,14 @@ public String getDescription() { @Override public void afterRegistration(AfterRegistrationAccess access) { - registerStartupHook(); ImageSingletons.add(NativeBridgeSupport.class, new JDWPNativeBridgeSupport()); ImageSingletons.add(ResidentJDWPFeatureEnabled.class, new ResidentJDWPFeatureEnabled()); } - private static void registerStartupHook() { + @Override + public void duringSetup(DuringSetupAccess access) { RuntimeSupport.getRuntimeSupport().addStartupHook(new DebuggingOnDemandHook()); + ImageSingletons.add(ThreadStartDeathSupport.class, new ThreadStartDeathSupport()); } @Override diff --git a/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/ThreadStartDeathSupport.java b/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/ThreadStartDeathSupport.java index 16e226e1b3e5..2dd7f1810358 100644 --- a/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/ThreadStartDeathSupport.java +++ b/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/ThreadStartDeathSupport.java @@ -24,13 +24,12 @@ */ package com.oracle.svm.jdwp.resident; -import com.oracle.svm.core.Uninterruptible; import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.IsolateThread; import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; -import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton; +import com.oracle.svm.core.Uninterruptible; import com.oracle.svm.core.jdk.RuntimeSupport; import com.oracle.svm.core.thread.PlatformThreads; import com.oracle.svm.core.thread.ThreadListener; @@ -42,7 +41,6 @@ /** * Support for Thread start/death events. */ -@AutomaticallyRegisteredImageSingleton public final class ThreadStartDeathSupport implements ThreadListener { /** diff --git a/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/impl/ResidentJDWP.java b/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/impl/ResidentJDWP.java index a6318ff66cb0..5772de6a00e7 100644 --- a/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/impl/ResidentJDWP.java +++ b/substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/impl/ResidentJDWP.java @@ -24,6 +24,19 @@ */ package com.oracle.svm.jdwp.resident.impl; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.OptionalInt; +import java.util.Set; + +import jdk.graal.compiler.word.Word; +import org.graalvm.nativeimage.IsolateThread; +import org.graalvm.word.Pointer; +import org.graalvm.word.WordBase; + import com.oracle.svm.core.StaticFieldsSupport; import com.oracle.svm.core.code.FrameInfoQueryResult; import com.oracle.svm.core.code.FrameSourceInfo; @@ -31,13 +44,12 @@ import com.oracle.svm.core.hub.ClassForNameSupport; import com.oracle.svm.core.hub.DynamicHub; import com.oracle.svm.core.interpreter.InterpreterFrameSourceInfo; -import com.oracle.svm.interpreter.DebuggerSupport; -import com.oracle.svm.interpreter.metadata.InterpreterUniverse; import com.oracle.svm.core.locks.VMMutex; import com.oracle.svm.core.log.Log; import com.oracle.svm.core.meta.SubstrateObjectConstant; import com.oracle.svm.core.thread.VMThreads; import com.oracle.svm.core.util.VMError; +import com.oracle.svm.interpreter.DebuggerSupport; import com.oracle.svm.interpreter.EspressoFrame; import com.oracle.svm.interpreter.InterpreterFrame; import com.oracle.svm.interpreter.InterpreterToVM; @@ -46,6 +58,7 @@ import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaMethod; import com.oracle.svm.interpreter.metadata.InterpreterResolvedJavaType; import com.oracle.svm.interpreter.metadata.InterpreterResolvedObjectType; +import com.oracle.svm.interpreter.metadata.InterpreterUniverse; import com.oracle.svm.interpreter.metadata.MetadataUtil; import com.oracle.svm.jdwp.bridge.ErrorCode; import com.oracle.svm.jdwp.bridge.FrameId; @@ -58,10 +71,11 @@ import com.oracle.svm.jdwp.bridge.TagConstants; import com.oracle.svm.jdwp.bridge.TypeTag; import com.oracle.svm.jdwp.bridge.WritablePacket; +import com.oracle.svm.jdwp.resident.ClassUtils; import com.oracle.svm.jdwp.resident.JDWPBridgeImpl; import com.oracle.svm.jdwp.resident.ThreadStartDeathSupport; -import com.oracle.svm.jdwp.resident.ClassUtils; import com.oracle.svm.jdwp.resident.api.StackframeDescriptor; + import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.Local; @@ -69,18 +83,6 @@ import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; -import org.graalvm.nativeimage.IsolateThread; -import org.graalvm.word.Pointer; -import org.graalvm.word.WordBase; -import org.graalvm.word.WordFactory; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.OptionalInt; -import java.util.Set; public final class ResidentJDWP implements JDWP { @@ -1095,11 +1097,11 @@ public Packet ArrayReference_SetValues(Packet packet) throws JDWPException { for (int i = firstIndex; i - firstIndex < length; ++i) { switch (InterpreterToVM.wordJavaKind()) { case Int -> { - WordBase value = WordFactory.signed(reader.readInt()); + WordBase value = Word.signed(reader.readInt()); InterpreterToVM.setArrayWord(value, i, (WordBase[]) array); } case Long -> { - WordBase value = WordFactory.signed(reader.readLong()); + WordBase value = Word.signed(reader.readLong()); InterpreterToVM.setArrayWord(value, i, (WordBase[]) array); } default -> @@ -1239,7 +1241,7 @@ public static Object getThis(Thread thread, int frameDepth) { if (method.isStatic()) { thisObject = null; } else { - DeoptState deoptState = new DeoptState(stackframeDescriptor.getStackPointer(), WordFactory.zero()); + DeoptState deoptState = new DeoptState(stackframeDescriptor.getStackPointer(), Word.zero()); JavaConstant javaConstant = deoptState.readLocalVariable(0, frameInfoQueryResult); thisObject = SubstrateObjectConstant.asObject(javaConstant); } @@ -1551,7 +1553,7 @@ private static void readLocalFromCompiledFrame(byte tag, FrameInfoQueryResult fr throw JDWPException.raise(ErrorCode.ABSENT_INFORMATION); } - IsolateThread targetThread = WordFactory.zero(); + IsolateThread targetThread = Word.zero(); DeoptState deoptState = new DeoptState(stackPointer, targetThread); JavaConstant javaConstant = deoptState.readLocalVariable(slot, frame); @@ -1778,9 +1780,9 @@ private static void sharedWriteField(Packet.Reader reader, Object typeOrReceiver if (field.getType().isWordType()) { switch (InterpreterToVM.wordJavaKind()) { case Int -> - InterpreterToVM.setFieldWord(WordFactory.signed(reader.readInt()), receiver, field); + InterpreterToVM.setFieldWord(Word.signed(reader.readInt()), receiver, field); case Long -> - InterpreterToVM.setFieldWord(WordFactory.signed(reader.readLong()), receiver, field); + InterpreterToVM.setFieldWord(Word.signed(reader.readLong()), receiver, field); default -> throw VMError.shouldNotReachHere("Unexpected word kind " + InterpreterToVM.wordJavaKind()); } diff --git a/substratevm/src/com.oracle.svm.jdwp.server/README.md b/substratevm/src/com.oracle.svm.jdwp.server/README.md index a63930834fa6..8e1883d8c8e4 100644 --- a/substratevm/src/com.oracle.svm.jdwp.server/README.md +++ b/substratevm/src/com.oracle.svm.jdwp.server/README.md @@ -13,3 +13,20 @@ An additional non-standard mode is available to enable that: - `-XX:JDWPOptions=...,mode=jvm: - `-XX:JDWPOptions=...,mode=jvm: +## Build `lib:svmjdwp` + +Run `mx --native-images=lib:svmjdwp build` to build the library. + +## Build a Native Executable with JDWP Support + +Add the `-H:+JDWP` option to the `native-image` command: +```shell +mx native-image -H:+UnlockExperimentalVMOptions -H:+JDWP -cp MainClass ... +``` + +To build and include `lib:svmjdwp` as a build artifact, run: +```shell +mx --native-images=lib:svmjdwp native-image -H:+UnlockExperimentalVMOptions -H:+JDWP -cp MainClass ... +``` + +Both commands produce a binary, an `.metadata` file. diff --git a/vm/mx.vm/ce b/vm/mx.vm/ce index bcf0695479ad..891ce8ed3185 100644 --- a/vm/mx.vm/ce +++ b/vm/mx.vm/ce @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/sdk,/truffle,/compiler,/substratevm -COMPONENTS=cmp,gvm,lg,ni,nic,nil,sdkni,svm,svmt,svmsl,tflc,tflsm +COMPONENTS=cmp,gvm,lg,ni,nic,nil,sdkni,svm,svmjdwp,svmt,svmsl,tflc,tflsm NATIVE_IMAGES=lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-aarch64 b/vm/mx.vm/ce-aarch64 index bcf0695479ad..891ce8ed3185 100644 --- a/vm/mx.vm/ce-aarch64 +++ b/vm/mx.vm/ce-aarch64 @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/sdk,/truffle,/compiler,/substratevm -COMPONENTS=cmp,gvm,lg,ni,nic,nil,sdkni,svm,svmt,svmsl,tflc,tflsm +COMPONENTS=cmp,gvm,lg,ni,nic,nil,sdkni,svm,svmjdwp,svmt,svmsl,tflc,tflsm NATIVE_IMAGES=lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-aarch64-complete b/vm/mx.vm/ce-aarch64-complete index 054fa0ea91f3..cf2eed2b8f58 100644 --- a/vm/mx.vm/ce-aarch64-complete +++ b/vm/mx.vm/ce-aarch64-complete @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,graalpython,truffleruby -COMPONENTS=antlr4,cmp,cov,dap,gvm,gwa,icu4j,ins,insight,insightheap,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,nil,njs,njsl,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm +COMPONENTS=antlr4,cmp,cov,dap,gvm,gwa,icu4j,ins,insight,insightheap,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,nil,njs,njsl,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmjdwp,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-complete b/vm/mx.vm/ce-complete index ddf4620c1b75..352bbc9f358b 100644 --- a/vm/mx.vm/ce-complete +++ b/vm/mx.vm/ce-complete @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,fastr,graalpython,truffleruby -COMPONENTS=antlr4,cmp,cov,dap,gvm,gwa,icu4j,xz,ins,insight,insightheap,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,pro,pyn,pynl,R,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm +COMPONENTS=antlr4,cmp,cov,dap,gvm,gwa,icu4j,xz,ins,insight,insightheap,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,pro,pyn,pynl,R,rby,rbyl,rgx,sdk,sdkl,svm,svmjdwp,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm DISABLE_INSTALLABLES=false diff --git a/vm/mx.vm/ce-darwin b/vm/mx.vm/ce-darwin index bcf0695479ad..891ce8ed3185 100644 --- a/vm/mx.vm/ce-darwin +++ b/vm/mx.vm/ce-darwin @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/sdk,/truffle,/compiler,/substratevm -COMPONENTS=cmp,gvm,lg,ni,nic,nil,sdkni,svm,svmt,svmsl,tflc,tflsm +COMPONENTS=cmp,gvm,lg,ni,nic,nil,sdkni,svm,svmjdwp,svmt,svmsl,tflc,tflsm NATIVE_IMAGES=lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-darwin-aarch64 b/vm/mx.vm/ce-darwin-aarch64 index bcf0695479ad..891ce8ed3185 100644 --- a/vm/mx.vm/ce-darwin-aarch64 +++ b/vm/mx.vm/ce-darwin-aarch64 @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/sdk,/truffle,/compiler,/substratevm -COMPONENTS=cmp,gvm,lg,ni,nic,nil,sdkni,svm,svmt,svmsl,tflc,tflsm +COMPONENTS=cmp,gvm,lg,ni,nic,nil,sdkni,svm,svmjdwp,svmt,svmsl,tflc,tflsm NATIVE_IMAGES=lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-darwin-aarch64-complete b/vm/mx.vm/ce-darwin-aarch64-complete index 792ba235ff26..1a4d3758dce4 100644 --- a/vm/mx.vm/ce-darwin-aarch64-complete +++ b/vm/mx.vm/ce-darwin-aarch64-complete @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,graalpython,truffleruby -COMPONENTS=antlr4,cmp,cov,dap,gvm,gwa,icu4j,ins,insight,insightheap,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm +COMPONENTS=antlr4,cmp,cov,dap,gvm,gwa,icu4j,ins,insight,insightheap,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmjdwp,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm DISABLE_INSTALLABLES=false diff --git a/vm/mx.vm/ce-darwin-complete b/vm/mx.vm/ce-darwin-complete index dbb92f7ba2d3..da161e92d641 100644 --- a/vm/mx.vm/ce-darwin-complete +++ b/vm/mx.vm/ce-darwin-complete @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,graalpython,truffleruby -COMPONENTS=antlr4,cmp,cov,dap,gvm,gwa,icu4j,xz,ins,insight,insightheap,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm +COMPONENTS=antlr4,cmp,cov,dap,gvm,gwa,icu4j,xz,ins,insight,insightheap,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmjdwp,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm DISABLE_INSTALLABLES=false diff --git a/vm/mx.vm/ce-win b/vm/mx.vm/ce-win index bcf0695479ad..891ce8ed3185 100644 --- a/vm/mx.vm/ce-win +++ b/vm/mx.vm/ce-win @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/sdk,/truffle,/compiler,/substratevm -COMPONENTS=cmp,gvm,lg,ni,nic,nil,sdkni,svm,svmt,svmsl,tflc,tflsm +COMPONENTS=cmp,gvm,lg,ni,nic,nil,sdkni,svm,svmjdwp,svmt,svmsl,tflc,tflsm NATIVE_IMAGES=lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-win-complete b/vm/mx.vm/ce-win-complete index d022160f7f9f..9a65de376465 100644 --- a/vm/mx.vm/ce-win-complete +++ b/vm/mx.vm/ce-win-complete @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,graalpython -COMPONENTS=antlr4,cmp,cov,dap,gvm,gwa,icu4j,ins,insight,insightheap,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,pro,pyn,pynl,rgx,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm +COMPONENTS=antlr4,cmp,cov,dap,gvm,gwa,icu4j,ins,insight,insightheap,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,pro,pyn,pynl,rgx,sdk,sdkl,svm,svmjdwp,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:wasmvm DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/mx_vm.py b/vm/mx.vm/mx_vm.py index a22e1ec6db33..633a5dcae0fe 100644 --- a/vm/mx.vm/mx_vm.py +++ b/vm/mx.vm/mx_vm.py @@ -138,7 +138,7 @@ def local_path_to_url(args): llvm_components = ['bgraalvm-native-binutil', 'bgraalvm-native-clang', 'bgraalvm-native-clang-cl', 'bgraalvm-native-clang++', 'bgraalvm-native-flang', 'bgraalvm-native-ld'] # pylint: disable=line-too-long -ce_unchained_components = ['bnative-image-configure', 'cmp', 'gvm', 'lg', 'ni', 'nic', 'nil', 'nr_lib_jvmcicompiler', 'sdkc', 'sdkni', 'svm', 'svmsl', 'svmt', 'tflc', 'tflsm'] +ce_unchained_components = ['bnative-image-configure', 'cmp', 'gvm', 'lg', 'ni', 'nic', 'nil', 'nr_lib_jvmcicompiler', 'sdkc', 'sdkni', 'ssvmjdwp', 'svm', 'svmjdwp', 'svmsl', 'svmt', 'tflc', 'tflsm'] ce_components_minimal = ['cmp', 'cov', 'dap', 'gvm', 'ins', 'insight', 'insightheap', 'lg', 'lsp', 'nfi-libffi', 'nfi', 'pro', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json'] ce_components = ce_components_minimal + ['nr_lib_jvmcicompiler', 'bnative-image-configure', 'ni', 'nic', 'nil', 'svm', 'svmt', 'svmnfi', 'svmsl'] ce_python_components = ['antlr4', 'sllvmvm', 'bpolybench', 'cmp', 'cov', 'dap', 'dis', 'gvm', 'icu4j', 'xz', 'ins', 'insight', 'insightheap', 'lg', 'llp', 'llrc', 'llrl', 'llrlf', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'pbm', 'pmh', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json']