Skip to content

Commit c6fab36

Browse files
committed
[GR-63253] [GR-62947] Unchained Ruby Standalone
PullRequest: truffleruby/4495
2 parents 241afc9 + c9776eb commit c6fab36

21 files changed

+342
-125
lines changed

ci.jsonnet

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ local part_definitions = {
216216
"--extra-image-builder-argument=rubyvm:-H:+TruffleHostInliningPrintExplored",
217217
"--extra-image-builder-argument=rubyvm:-H:MethodFilter=org.truffleruby.*.*",
218218
"--extra-image-builder-argument=rubyvm:-H:-UnlockExperimentalVMOptions",
219-
"--extra-image-builder-argument=rubyvm:-Djdk.graal.LogFile=host-inlining.txt",
219+
"--extra-image-builder-argument=rubyvm:-Dgraal.LogFile=host-inlining.txt",
220220
],
221221
environment+: {
222222
TRUFFLERUBY_HOST_INLINING_TEST: "1",
@@ -227,8 +227,20 @@ local part_definitions = {
227227
jdk: {
228228
local with_path = { environment+: { path+:: ["$JAVA_HOME/bin"] } },
229229

230-
stable: with_path + common.jdks["labsjdk-ce-21"] + { environment+: { JT_JDK: "21" }, jdk_label:: 'stable' },
231-
latest: with_path + common.jdks["labsjdk-ce-latest"] + { environment+: { JT_JDK: "latest" }, jdk_label:: 'latest' },
230+
latest: with_path + common.jdks["labsjdk-ce-latest"] + {
231+
environment+: {
232+
JT_JDK: "latest",
233+
},
234+
},
235+
236+
stable: with_path + common.jdks["labsjdk-ce-latest"] + {
237+
downloads+: {
238+
BOOTSTRAP_GRAALVM: common.jdks_data["graalvm-ee-21"],
239+
},
240+
environment+: {
241+
JT_JDK: "latest",
242+
},
243+
},
232244
},
233245

234246
platform: {
@@ -320,7 +332,7 @@ local part_definitions = {
320332
run+: jt(["test", "fast"]),
321333
},
322334

323-
lint: {
335+
lint: common.deps.spotbugs + {
324336
is_after:: ["$.use.build"],
325337
downloads+: {
326338
ECLIPSE: {
@@ -718,26 +730,18 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
718730

719731
builds:
720732
local all_builds = $.test_builds + $.bench_builds + $.manual_builds;
721-
local filtered_builds = if $.jdk.stable.jdk_version == $.jdk.latest.jdk_version then
722-
{
723-
[k]: all_builds[k]
724-
for k in std.objectFields(all_builds)
725-
if !std.objectHasAll(all_builds[k], "jdk_label") || all_builds[k].jdk_label == $.jdk.stable.jdk_label
726-
}
727-
else
728-
all_builds;
729733
utils.check_builds(
730734
restrict_builds_to,
731735
# Move name inside into `name` field
732736
# and ensure timelimit is present
733737
[
734-
filtered_builds[k] {
738+
all_builds[k] {
735739
name: k,
736-
timelimit: if std.objectHas(filtered_builds[k], "timelimit")
737-
then filtered_builds[k].timelimit
740+
timelimit: if std.objectHas(all_builds[k], "timelimit")
741+
then all_builds[k].timelimit
738742
else error "Missing timelimit in " + k + " build.",
739743
}
740-
for k in std.objectFields(filtered_builds)
744+
for k in std.objectFields(all_builds)
741745
]
742746
),
743747
};

mx.truffleruby/env_files.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
Here is how the various env files relate to each other:
2-
* `jvm`
2+
* `jvm`: standalone with all tools
33
* `jvm-ce`: + GraalVM Community Compiler
44
* `jvm-ce-libgraal`: + libgraal
5-
* `native`: + librubyvm + `Truffle Macro`
5+
* `native`: + librubyvm + `Truffle SVM Macro`
66
* `native-host-inlining`: + `TruffleHostInliningPrintExplored`
77
* `native-profiling`: + `-H:-DeleteLocalSymbols`
88
* `jvm-ee`: + Oracle GraalVM Compiler + `Truffle enterprise` + license + `LLVM Runtime Native Enterprise`
99
* `jvm-ee-libgraal`: + libgraal
10-
* `native-ee`: + librubyvm + `Truffle Macro Enterprise` + Native Image G1
10+
* `native-ee`: + librubyvm + `Truffle SVM Macro Enterprise` + Native Image G1
1111
* `native-ee-host-inlining`: + `TruffleHostInliningPrintExplored`
1212
* `native-ee-aux`: + `AuxiliaryEngineCache`, - Native Image G1 (currently incompatible)
13-
* `native-ee-polybench`: + `PolyBench Launcher Enterprise` + `PolyBench Instruments`, only builds `polybench` launcher
14-
* `jvm-js`: + Graal.js
15-
* `jvm-py`: + GraalPython

mx.truffleruby/jvm

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
GRAALVM_SKIP_ARCHIVE=true
21
DYNAMIC_IMPORTS=/tools
3-
COMPONENTS=TruffleRuby,suite:tools
4-
# To also create the standalone
5-
INSTALLABLES=TruffleRuby
6-
BUILD_TARGETS=GRAALVM_STANDALONES
2+
BUILD_TARGETS=TRUFFLERUBY_JVM_STANDALONE

mx.truffleruby/jvm-ce

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
GRAALVM_SKIP_ARCHIVE=true
21
DYNAMIC_IMPORTS=/tools,/compiler
3-
COMPONENTS=TruffleRuby,suite:tools,GraalVM compiler
4-
# To also create the standalone
5-
INSTALLABLES=TruffleRuby
6-
BUILD_TARGETS=GRAALVM_STANDALONES
2+
BUILD_TARGETS=TRUFFLERUBY_JVM_STANDALONE

mx.truffleruby/jvm-ce-libgraal

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
GRAALVM_SKIP_ARCHIVE=true
21
DYNAMIC_IMPORTS=/tools,/compiler,/substratevm
3-
COMPONENTS=TruffleRuby,suite:tools,GraalVM compiler,SubstrateVM,LibGraal
2+
BUILD_TARGETS=TRUFFLERUBY_JVM_STANDALONE
3+
COMPONENTS=LibGraal
44
NATIVE_IMAGES=lib:jvmcicompiler
5-
# To also create the standalone
6-
INSTALLABLES=TruffleRuby
7-
BUILD_TARGETS=GRAALVM_STANDALONES
5+
GRAALVM_SKIP_ARCHIVE=true

mx.truffleruby/jvm-ee

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
1-
GRAALVM_SKIP_ARCHIVE=true
2-
DYNAMIC_IMPORTS=/tools,/truffleruby-enterprise,/graal-enterprise,/vm-enterprise,/sulong-managed,/substratevm-enterprise
3-
COMPONENTS=TruffleRuby,suite:tools,GraalVM enterprise compiler,Truffle enterprise,GraalVM enterprise license files,LLVM Runtime Native Enterprise,SubstrateVM Enterprise
4-
NATIVE_IMAGES=false
5-
# To also create the standalone
6-
INSTALLABLES=TruffleRuby
7-
BUILD_TARGETS=GRAALVM_STANDALONES
8-
# NOTE: SVM EE is added as a workaround to tell the JVM standalone to be EE
1+
DYNAMIC_IMPORTS=/tools,/graal-enterprise,/truffle-enterprise,/sulong-managed
2+
BUILD_TARGETS=TRUFFLERUBY_JVM_STANDALONE

mx.truffleruby/jvm-ee-libgraal

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
GRAALVM_SKIP_ARCHIVE=true
2-
DYNAMIC_IMPORTS=/tools,/truffleruby-enterprise,/graal-enterprise,/vm-enterprise,/sulong-managed,/substratevm-enterprise
3-
COMPONENTS=TruffleRuby,suite:tools,GraalVM enterprise compiler,Truffle enterprise,GraalVM enterprise license files,LLVM Runtime Native Enterprise,SubstrateVM Enterprise,LibGraal Enterprise
1+
DYNAMIC_IMPORTS=/tools,/graal-enterprise,/truffle-enterprise,/sulong-managed,/substratevm-enterprise
2+
BUILD_TARGETS=TRUFFLERUBY_JVM_STANDALONE
3+
COMPONENTS=LibGraal Enterprise
44
NATIVE_IMAGES=lib:jvmcicompiler
5-
# To also create the standalone
6-
INSTALLABLES=TruffleRuby
7-
BUILD_TARGETS=GRAALVM_STANDALONES
5+
GRAALVM_SKIP_ARCHIVE=true

mx.truffleruby/jvm-js

Lines changed: 0 additions & 3 deletions
This file was deleted.

mx.truffleruby/jvm-py

Lines changed: 0 additions & 3 deletions
This file was deleted.

mx.truffleruby/mx_truffleruby.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
import mx_gate
2121
import mx_sdk
2222
import mx_sdk_vm
23-
import mx_sdk_vm_impl
2423
import mx_subst
2524
import mx_spotbugs
2625
import mx_truffle
2726
import mx_unittest
2827

2928
# re-export custom mx project classes, so they can be used from suite.py
3029
from mx_sdk_shaded import ShadedLibraryProject # pylint: disable=unused-import
30+
from mx_sdk_vm_ng import StandaloneLicenses, ThinLauncherProject, LanguageLibraryProject, DynamicPOMDistribution, DeliverableStandaloneArchive # pylint: disable=unused-import
3131

3232
# Fail early and clearly when trying to build with a too old JDK
3333
jdk = mx.get_jdk(mx.JavaCompliance('11+'), 'building TruffleRuby which requires JDK 11 or newer')
@@ -187,6 +187,27 @@ def __init__(self, suite, name, deps, workingSets, output=None, **kwArgs):
187187
results=kwArgs.pop('results'),
188188
output=path, d=path, vpath=False, **kwArgs)
189189

190+
# Functions called from suite.py
191+
192+
def has_suite(name):
193+
return mx.suite(name, fatalIfMissing=False)
194+
195+
def is_ee():
196+
return has_suite('truffle-enterprise')
197+
198+
def truffleruby_standalone_deps():
199+
deps = mx_truffle.resolve_truffle_dist_names(use_optimized_runtime=has_suite('compiler'))
200+
if is_ee():
201+
deps += ['sulong-managed:SULONG_ENTERPRISE_NATIVE']
202+
return deps
203+
204+
def librubyvm_build_args():
205+
if is_ee() and mx.get_os() == 'linux' and 'NATIVE_IMAGE_AUXILIARY_ENGINE_CACHE' not in os.environ:
206+
mx.suite('substratevm-enterprise-gcs', fatalIfMissing=True) # fail early if missing
207+
return ['--gc=G1', '-H:-ProtectionKeys']
208+
else:
209+
return []
210+
190211
# Commands
191212

192213
def jt(*args):
@@ -219,7 +240,7 @@ def ruby_check_heap_dump(input_args, out=None):
219240
ruby_check_heap_dump(["--keep-dump"] + input_args, out=out)
220241
path = out.data.strip().partition("Dump file:")[2].strip()
221242
if path:
222-
save_path = os.path.join(root, "dumps", "leak_test")
243+
save_path = join(root, "dumps", "leak_test")
223244
try:
224245
os.makedirs(save_path)
225246
except OSError:
@@ -233,8 +254,8 @@ def ruby_check_heap_dump(input_args, out=None):
233254
raise Exception("heap dump check failed")
234255

235256
def ruby_run_ruby(args):
236-
"""run TruffleRuby in $(mx standalone-home --type=jvm ruby), needs an env including a ruby standalone. Use bin/jt for more control and shortcuts"""
237-
standalone_home = mx_sdk_vm_impl.standalone_home('ruby', is_jvm=True)
257+
"""run TruffleRuby in mxbuild/$OS-$ARCH/TRUFFLERUBY_JVM_STANDALONE, needs an env including a ruby standalone. Use bin/jt for more control and shortcuts"""
258+
standalone_home = mx.distribution('TRUFFLERUBY_JVM_STANDALONE').output
238259
ruby = join(standalone_home, 'bin/ruby')
239260
os.execlp(ruby, ruby, *args)
240261

@@ -329,8 +350,8 @@ def ruby_maven_deploy_public_repo_dir(args):
329350
'TruffleRuby license files': ('', []),
330351
}},
331352
standalone_dependencies_enterprise={**standalone_dependencies_common, **{
332-
'LLVM Runtime Enterprise': ('lib/sulong', []),
333-
'LLVM Runtime Native Enterprise': ('lib/sulong', []),
353+
'LLVM Runtime Enterprise': ('lib/sulong', []), # sulong-managed:SULONG_ENTERPRISE
354+
'LLVM Runtime Native Enterprise': ('lib/sulong', []), # sulong-managed:SULONG_ENTERPRISE_NATIVE
334355
'TruffleRuby license files EE': ('', []),
335356
'GraalVM enterprise license files': ('', ['LICENSE.txt', 'GRAALVM-README.md']),
336357
}},

0 commit comments

Comments
 (0)