Skip to content

Commit 3563489

Browse files
lewurmmukelentlicher
committed
[GR-58574] Add SVM interpreter and JDWP support for Native Image
New option to enable JDWP support for an image: -H:+JDWP. The JDWP implementation is split into two parts in order to reduce application image size. - svm.interpreter: Adds a Java bytecode interpreter to SVM, origins from Espresso. - jdwp.resident: Part of the JDWP implementation that lives in an application image. - jdwp.server: Part of JDWP that handles the communication to a debugger. Can run either as native-image (libsvmjdwp) or on HotSpot (development only). - jdwp.common: Shared bits. Co-authored-by: Alfonso² Peterssen <[email protected]> Co-authored-by: Martin Entlicher <[email protected]> Mentored-by: Gilles Duboscq <[email protected]>
1 parent f70bec8 commit 3563489

File tree

196 files changed

+40150
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+40150
-9
lines changed

compiler/mx.compiler/suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@
557557
org.graalvm.nativeimage.foreign,
558558
org.graalvm.nativeimage.llvm,
559559
com.oracle.svm.svm_enterprise,
560+
com.oracle.svm.jdwp.resident,
560561
com.oracle.svm_enterprise.ml_dataset,
561-
com.oracle.svm.enterprise.jdwp.resident,
562562
org.graalvm.nativeimage.base,
563563
org.graalvm.extraimage.builder,
564564
org.graalvm.extraimage.librarysupport,

substratevm/mx.substratevm/mx_substratevm.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,42 @@ def prevent_build_path_in_libgraal():
16261626
)
16271627
mx_sdk_vm.register_graalvm_component(libgraal)
16281628

1629+
libsvmjdwp_build_args = [
1630+
"-H:+UnlockExperimentalVMOptions",
1631+
"-H:+IncludeDebugHelperMethods",
1632+
"-H:-DeleteLocalSymbols",
1633+
"-H:+PreserveFramePointer",
1634+
]
1635+
1636+
libsvmjdwp_lib_config = mx_sdk_vm.LibraryConfig(
1637+
destination="<lib:svmjdwp>",
1638+
jvm_library=True,
1639+
use_modules='image',
1640+
jar_distributions=['substratevm:SVM_JDWP_SERVER'],
1641+
build_args=libsvmjdwp_build_args + [
1642+
'--features=com.oracle.svm.jdwp.server.ServerJDWPFeature',
1643+
],
1644+
headers=False,
1645+
)
1646+
1647+
libsvmjdwp = mx_sdk_vm.GraalVmJreComponent(
1648+
suite=suite,
1649+
name='SubstrateVM JDWP Debugger',
1650+
short_name='svmjdwp',
1651+
dir_name="svm",
1652+
license_files=[],
1653+
third_party_license_files=[],
1654+
dependencies=[],
1655+
jar_distributions=[],
1656+
builder_jar_distributions=['substratevm:SVM_JDWP_COMMON', 'substratevm:SVM_JDWP_RESIDENT'],
1657+
support_distributions=[],
1658+
priority=1,
1659+
library_configs=[libsvmjdwp_lib_config],
1660+
stability="experimental",
1661+
jlink=False,
1662+
)
1663+
mx_sdk_vm.register_graalvm_component(libsvmjdwp)
1664+
16291665
def _native_image_configure_extra_jvm_args():
16301666
packages = ['jdk.graal.compiler/jdk.graal.compiler.phases.common', 'jdk.internal.vm.ci/jdk.vm.ci.meta', 'jdk.internal.vm.ci/jdk.vm.ci.services', 'jdk.graal.compiler/jdk.graal.compiler.core.common.util']
16311667
args = ['--add-exports=' + packageName + '=ALL-UNNAMED' for packageName in packages]

substratevm/mx.substratevm/suite.py

Lines changed: 175 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,119 @@
15371537
"jacoco" : "exclude",
15381538
"graalCompilerSourceEdition": "ignore",
15391539
},
1540+
1541+
"com.oracle.svm.interpreter.metadata": {
1542+
"subDir": "src",
1543+
"sourceDirs": ["src"],
1544+
"dependencies": [
1545+
"substratevm:SVM"
1546+
],
1547+
"requiresConcealed" : {
1548+
"jdk.internal.vm.ci" : [
1549+
"jdk.vm.ci.meta",
1550+
],
1551+
},
1552+
"checkstyle": "com.oracle.svm.hosted",
1553+
"javaCompliance": "21+",
1554+
"workingSets": "SVM",
1555+
},
1556+
1557+
"com.oracle.svm.interpreter": {
1558+
"subDir": "src",
1559+
"sourceDirs": ["src"],
1560+
"dependencies": [
1561+
"com.oracle.svm.interpreter.metadata",
1562+
],
1563+
"requires" : [
1564+
"java.base"
1565+
],
1566+
"requiresConcealed" : {
1567+
"jdk.internal.vm.ci" : [
1568+
"jdk.vm.ci.meta",
1569+
"jdk.vm.ci.code",
1570+
],
1571+
"java.base" : [
1572+
"jdk.internal.misc", # Unsafe
1573+
],
1574+
},
1575+
"checkstyle": "com.oracle.svm.hosted",
1576+
"javaCompliance": "21+",
1577+
"annotationProcessors": [
1578+
"compiler:GRAAL_PROCESSOR",
1579+
"substratevm:SVM_PROCESSOR",
1580+
],
1581+
"workingSets": "SVM",
1582+
},
1583+
1584+
# Common project both jdwp.server and jdwp.resident.
1585+
"com.oracle.svm.jdwp.bridge": {
1586+
"subDir": "src",
1587+
"sourceDirs": ["src"],
1588+
"dependencies": [
1589+
"substratevm:SVM",
1590+
],
1591+
"requiresConcealed" : {
1592+
"jdk.internal.vm.ci" : [
1593+
"jdk.vm.ci.meta",
1594+
],
1595+
},
1596+
"checkstyle": "com.oracle.svm.hosted",
1597+
"javaCompliance": "21+",
1598+
"annotationProcessors": [
1599+
"compiler:GRAAL_PROCESSOR",
1600+
"substratevm:SVM_PROCESSOR",
1601+
],
1602+
"workingSets": "SVM",
1603+
},
1604+
1605+
# JDWP server, should run on HotSpot and as a shared library e.g. libsvmjdwp.so
1606+
"com.oracle.svm.jdwp.server": {
1607+
"subDir": "src",
1608+
"sourceDirs": ["src"],
1609+
"dependencies": [
1610+
"com.oracle.svm.interpreter.metadata",
1611+
"com.oracle.svm.jdwp.bridge",
1612+
],
1613+
"requiresConcealed" : {
1614+
"jdk.internal.vm.ci" : [
1615+
"jdk.vm.ci.meta",
1616+
],
1617+
"java.base" : [
1618+
"jdk.internal.misc", # Signal
1619+
],
1620+
},
1621+
"checkstyle": "com.oracle.svm.hosted",
1622+
"javaCompliance": "21+",
1623+
"annotationProcessors": [
1624+
"substratevm:SVM_PROCESSOR",
1625+
],
1626+
"workingSets": "SVM",
1627+
},
1628+
1629+
# JDWP implementation bits that are included in the application.
1630+
"com.oracle.svm.jdwp.resident": {
1631+
"subDir": "src",
1632+
"sourceDirs": ["src"],
1633+
"dependencies": [
1634+
"com.oracle.svm.interpreter",
1635+
"com.oracle.svm.jdwp.bridge",
1636+
],
1637+
"requiresConcealed" : {
1638+
"jdk.internal.vm.ci" : [
1639+
"jdk.vm.ci.meta",
1640+
"jdk.vm.ci.code",
1641+
],
1642+
"java.base" : [
1643+
"jdk.internal.misc", # Signal
1644+
],
1645+
},
1646+
"checkstyle": "com.oracle.svm.hosted",
1647+
"javaCompliance": "21+",
1648+
"annotationProcessors": [
1649+
"substratevm:SVM_PROCESSOR",
1650+
],
1651+
"workingSets": "SVM",
1652+
},
15401653
},
15411654

15421655
"distributions": {
@@ -1596,9 +1709,9 @@
15961709
org.graalvm.extraimage.librarysupport,
15971710
com.oracle.svm.extraimage_enterprise,
15981711
org.graalvm.nativeimage.foreign,
1599-
com.oracle.svm.enterprise.jdwp.common,
1600-
com.oracle.svm.enterprise.jdwp.server,
1601-
com.oracle.svm.enterprise.jdwp.resident,
1712+
com.oracle.svm.jdwp.common,
1713+
com.oracle.svm.jdwp.server,
1714+
com.oracle.svm.jdwp.resident,
16021715
org.graalvm.truffle.runtime.svm,
16031716
com.oracle.truffle.enterprise.svm""",
16041717
"com.oracle.svm.hosted.c.libc to com.oracle.graal.sandbox",
@@ -1611,7 +1724,7 @@
16111724
"com.oracle.svm.hosted.fieldfolding to jdk.graal.compiler",
16121725
"com.oracle.svm.hosted.phases to jdk.graal.compiler",
16131726
"com.oracle.svm.hosted.reflect to jdk.graal.compiler",
1614-
"com.oracle.svm.core.thread to com.oracle.svm.enterprise.jdwp.resident",
1727+
"com.oracle.svm.core.thread to com.oracle.svm.jdwp.resident",
16151728
],
16161729
"requires": [
16171730
"java.management",
@@ -2079,7 +2192,7 @@
20792192
"org.graalvm.collections",
20802193
],
20812194
"exports" : [
2082-
"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.enterprise.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",
2195+
"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",
20832196
"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",
20842197
"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",
20852198
],
@@ -2407,5 +2520,62 @@
24072520
"tag": ["default", "public"],
24082521
},
24092522
},
2523+
2524+
"SVM_JDWP_COMMON": {
2525+
"subDir": "src",
2526+
"dependencies": [
2527+
"com.oracle.svm.interpreter.metadata",
2528+
"com.oracle.svm.jdwp.bridge",
2529+
],
2530+
"distDependencies": [
2531+
"SVM",
2532+
],
2533+
"moduleInfo" : {
2534+
"name" : "com.oracle.svm.jdwp.common",
2535+
"exports" : [
2536+
"com.oracle.svm.jdwp.bridge to com.oracle.svm.jdwp.server,com.oracle.svm.jdwp.resident",
2537+
"com.oracle.svm.jdwp.bridge.nativebridge to com.oracle.svm.jdwp.server,com.oracle.svm.jdwp.resident",
2538+
"com.oracle.svm.jdwp.bridge.jniutils to com.oracle.svm.jdwp.server,com.oracle.svm.jdwp.resident",
2539+
"com.oracle.svm.interpreter.metadata to com.oracle.svm.jdwp.server,com.oracle.svm.jdwp.resident",
2540+
"com.oracle.svm.interpreter.metadata.serialization to com.oracle.svm.jdwp.server,com.oracle.svm.jdwp.resident",
2541+
],
2542+
"requires" : [
2543+
"org.graalvm.collections",
2544+
],
2545+
}
2546+
},
2547+
2548+
"SVM_JDWP_RESIDENT": {
2549+
"subDir": "src",
2550+
"dependencies": [
2551+
"com.oracle.svm.jdwp.resident",
2552+
],
2553+
"distDependencies": [
2554+
"SVM_JDWP_COMMON",
2555+
"sdk:COLLECTIONS",
2556+
"compiler:GRAAL",
2557+
],
2558+
"moduleInfo" : {
2559+
"name" : "com.oracle.svm.jdwp.resident",
2560+
"exports": [
2561+
"com.oracle.svm.interpreter,com.oracle.svm.jdwp.resident to org.graalvm.nativeimage.builder",
2562+
],
2563+
}
2564+
},
2565+
2566+
"SVM_JDWP_SERVER": {
2567+
"subDir": "src",
2568+
"dependencies": [
2569+
"com.oracle.svm.jdwp.server",
2570+
],
2571+
"distDependencies": [
2572+
"substratevm:SVM",
2573+
"SVM_JDWP_COMMON",
2574+
],
2575+
"moduleInfo" : {
2576+
"name" : "com.oracle.svm.jdwp.server",
2577+
}
2578+
},
2579+
24102580
},
24112581
}

0 commit comments

Comments
 (0)