Skip to content

Commit 4ef9c2f

Browse files
committed
[GR-45890] Use G1 by default on Native EE on Linux
* [GR-39431] G1 + AuxiliaryEngineCache is not supported yet.
1 parent 341e210 commit 4ef9c2f

File tree

12 files changed

+39
-16
lines changed

12 files changed

+39
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
New features:
44

5+
* TruffleRuby Native on Oracle GraalVM on Linux now uses the G1 garbage collector which is much faster.
56

67
Bug fixes:
78

ci.jsonnet

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ local part_definitions = {
204204
HOST_VM_CONFIG: "graal-enterprise",
205205
},
206206
},
207+
native_ee_aux: {
208+
mx_env:: "native-ee-aux",
209+
},
207210
host_inlining_log: {
208211
# Same as in mx.truffleruby/native-host-inlining
209212
mx_options+:: [
@@ -551,6 +554,7 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
551554
"ruby-test-svm-ce-darwin-aarch64-new": $.platform.darwin_aarch64 + $.jdk.new + $.env.native + gate + native_tests,
552555
"ruby-test-svm-ee-linux-amd64": $.platform.linux + $.jdk.lts + $.env.native_ee + $.env.gdb_svm + gate + native_tests + $.env.host_inlining_log + { timelimit: "01:30:00" },
553556
"ruby-test-svm-ee-darwin-aarch64": $.platform.darwin_aarch64 + $.jdk.lts + $.env.native_ee + gate + native_tests,
557+
"ruby-test-svm-ee-aux-linux-amd64": $.platform.linux + $.jdk.lts + $.env.native_ee_aux + $.env.gdb_svm + gate + native_tests + { timelimit: "01:30:00" },
554558
},
555559

556560
local other_rubies = {

mx.truffleruby/env_files.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Here is how the various env files relate to each other:
88
* `jvm-ee`: + Oracle GraalVM Compiler + `Truffle enterprise`
99
* `jvm-ee-ntl`: + native toolchain launchers
1010
* `jvm-ee-libgraal`: + libgraal
11-
* `native-ee`: + librubyvm + `Truffle Macro Enterprise`
12-
* `native-ee-g1`: + Native Image G1
11+
* `native-ee`: + librubyvm + `Truffle Macro Enterprise` + Native Image G1
12+
* `native-ee-aux`: + `AuxiliaryEngineCache`, - Native Image G1 (currently incompatible)
1313
* `jvm-gu`: + Graal Updater
1414
* `jvm-js`: + Graal.js
1515
* `jvm-py`: + GraalPython

mx.truffleruby/mx_truffleruby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def verify_ci(args):
306306
],
307307
build_args_enterprise=[
308308
'-J-Xmx7g', # Set Xmx to use a reliable amount of memory
309-
],
309+
] + (['--gc=G1', '-H:-ProtectionKeys'] if (mx.get_os() == 'linux' and 'NATIVE_IMAGE_AUXILIARY_ENGINE_CACHE' not in os.environ) else []), # G1 is only supported on linux currently
310310
language='ruby',
311311
option_vars=[
312312
'RUBYOPT',

mx.truffleruby/native-ee

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GRAALVM_SKIP_ARCHIVE=true
2-
DYNAMIC_IMPORTS=/tools,/graal-enterprise,/substratevm-enterprise
3-
COMPONENTS=TruffleRuby,suite:tools,GraalVM enterprise compiler,Truffle enterprise,SubstrateVM Enterprise,Truffle Macro Enterprise
2+
DYNAMIC_IMPORTS=/tools,/graal-enterprise,/substratevm-enterprise,substratevm-enterprise-gcs
3+
COMPONENTS=TruffleRuby,suite:tools,GraalVM enterprise compiler,Truffle enterprise,SubstrateVM Enterprise,Truffle Macro Enterprise,suite:substratevm-enterprise-gcs
44
NATIVE_IMAGES=suite:sulong,lib:rubyvm
5-
EXTRA_IMAGE_BUILDER_ARGUMENTS=rubyvm:-H:BuildOutputJSONFile=native-image-build-rubyvm.json rubyvm:-H:+AuxiliaryEngineCache rubyvm:-H:ReservedAuxiliaryImageBytes=1073741824
5+
EXTRA_IMAGE_BUILDER_ARGUMENTS=rubyvm:-H:BuildOutputJSONFile=native-image-build-rubyvm.json
66
# To also create the standalone
7-
INSTALLABLES=TruffleRuby
7+
INSTALLABLES=TruffleRuby
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
GRAALVM_SKIP_ARCHIVE=true
2-
DYNAMIC_IMPORTS=/tools,/graal-enterprise,/substratevm-enterprise,substratevm-enterprise-gcs
3-
COMPONENTS=TruffleRuby,suite:tools,GraalVM enterprise compiler,Truffle enterprise,SubstrateVM Enterprise,Truffle Macro Enterprise,SubstrateVM Enterprise GC
2+
DYNAMIC_IMPORTS=/tools,/graal-enterprise,/substratevm-enterprise
3+
COMPONENTS=TruffleRuby,suite:tools,GraalVM enterprise compiler,Truffle enterprise,SubstrateVM Enterprise,Truffle Macro Enterprise
44
NATIVE_IMAGES=suite:sulong,lib:rubyvm
5-
EXTRA_IMAGE_BUILDER_ARGUMENTS=rubyvm:-H:BuildOutputJSONFile=native-image-build-rubyvm.json rubyvm:-H:+UseG1GC
5+
EXTRA_IMAGE_BUILDER_ARGUMENTS=rubyvm:-H:BuildOutputJSONFile=native-image-build-rubyvm.json rubyvm:-H:+AuxiliaryEngineCache rubyvm:-H:ReservedAuxiliaryImageBytes=1073741824
6+
NATIVE_IMAGE_AUXILIARY_ENGINE_CACHE=true
67
# To also create the standalone
78
INSTALLABLES=TruffleRuby

spec/tags/core/gc/count_tags.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
slow:GC.count increases as collections are run
2+
native-g1:GC.count increases as collections are run

spec/tags/core/gc/stat_tags.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
slow:GC.stat increases count after GC is run
22
slow:GC.stat increases major_gc_count after GC is run
33
fails:GC.stat raises an error if an unknown key is given
4+
native-g1:GC.stat increases count after GC is run
5+
native-g1:GC.stat increases major_gc_count after GC is run

spec/tags/optional/capi/gc_tags.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ slow:CApiGCSpecs rb_gc increases gc count
22
fails:CApiGCSpecs rb_gc_adjust_memory_usage adjusts the amount of registered external memory
33
slow:CApiGCSpecs rb_gc_register_address keeps the value alive even if the value is assigned after rb_gc_register_address() is called
44
slow:CApiGCSpecs rb_global_variable keeps the value alive even if the value is assigned after rb_global_variable() is called
5+
native-g1:CApiGCSpecs rb_gc increases gc count

spec/truffleruby.mspec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ class MSpecScript
118118

119119
if defined?(::TruffleRuby)
120120
if TruffleRuby.native?
121-
excludes << 'aot'
121+
excludes << 'native'
122+
if GC.heap_stats.values.none?(Hash)
123+
excludes << 'native-g1'
124+
end
122125
else
123126
excludes << 'jvm'
124127
end

test/truffle/compiler/engine-caching.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,19 @@ source test/truffle/common.sh.inc
55
ruby_version=$(jt ruby -v)
66

77
if [[ ! $ruby_version =~ "Oracle GraalVM Native" ]]; then
8-
echo Oracle GraalVM Native not detected, no tests to run.
8+
echo Oracle GraalVM Native not detected, skipping test
99
exit 0
1010
fi
1111

12+
set +x
13+
output=$(jt ruby --experimental-options --engine.CacheLoad=does-not-exist.image -e0 2>&1 || true)
14+
15+
if [[ $output =~ "AuxiliaryEngineCache at image build time" ]]; then
16+
echo Oracle GraalVM Native without AuxiliaryEngineCache, skipping test
17+
exit 0
18+
fi
19+
set -x
20+
1221
# Store the image
1322
jt ruby --experimental-options --engine.TraceCache --engine.CacheCompile=executed --engine.CacheStore=core.image test/truffle/compiler/engine_caching/engine_caching.rb
1423

tool/jt.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,20 +1630,21 @@ def mspec(*args)
16301630
private def test_specs(command, *args)
16311631
env_vars = {}
16321632
options = []
1633+
tag = ENV['TAG'] || 'fails'
16331634

16341635
case command
16351636
when 'run'
16361637
options += %w[--excl-tag fails]
16371638
when 'tag'
1638-
options += %w[--add fails --fail --excl-tag fails]
1639+
options += %W[--add #{tag} --fail --excl-tag fails]
16391640
when 'untag'
1640-
options += %w[--del fails --pass]
1641+
options += %W[--del #{tag} --pass]
16411642
command = 'tag'
16421643
when 'purge'
16431644
options += %w[--purge]
16441645
command = 'tag'
16451646
when 'tag_all'
1646-
options += %w[--unguarded --all --dry-run --add fails]
1647+
options += %W[--unguarded --all --dry-run --add #{tag}]
16471648
command = 'tag'
16481649
else
16491650
raise command
@@ -2234,7 +2235,7 @@ def graph(*args)
22342235
# See org.graalvm.compiler.debug.StandardPathUtilitiesProvider#sanitizeFileName
22352236
method_glob_pattern = method.gsub(/[ \/\p{Cntrl}]/, '_')
22362237
if truffleruby_native?
2237-
method_glob_pattern = "Isolated:_#{method_glob_pattern}"
2238+
method_glob_pattern = "{Isolated:_,}#{method_glob_pattern}"
22382239
end
22392240

22402241
dumps = Dir.glob('graal_dumps/*').select { |path| File.directory?(path) }.sort.last

0 commit comments

Comments
 (0)