Skip to content

Commit 5943560

Browse files
committed
[GR-18553] Use JDK versions from the common.json file from the graal repository.
PullRequest: truffleruby/1270
2 parents 5e87007 + 5236967 commit 5943560

File tree

6 files changed

+66
-56
lines changed

6 files changed

+66
-56
lines changed

ci.jsonnet

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ local restrict_builds_to = [];
2020
# and it would still work.
2121
local utils = import "utils.libsonnet";
2222

23+
local jdks = (import "common.json").jdks;
24+
2325
# All builds are composed **directly** from **independent disjunct composable**
2426
# jsonnet objects defined in here. Use `+:` to make the objects or arrays
2527
# stored in fields composable, see http://jsonnet.org/docs/tutorial.html#oo.
@@ -211,33 +213,20 @@ local part_definitions = {
211213

212214
v8: with_path {
213215
downloads+: {
214-
JAVA_HOME: {
215-
name: "oraclejdk",
216-
# Update the openjdk8 version too below when updating this one
217-
version: "8u231-jvmci-19.3-b05",
218-
platformspecific: true,
219-
},
216+
JAVA_HOME: jdks.oraclejdk8,
220217
},
221218
},
222219

223220
# For `jt install jvmci`, verify that `jt install jvmci` still works when changing the version
224221
openjdk8: with_path {
225222
downloads+: {
226-
JAVA_HOME: {
227-
name: "openjdk",
228-
version: "8u232-jvmci-19.3-b05",
229-
platformspecific: true,
230-
},
223+
JAVA_HOME: jdks.openjdk8,
231224
},
232225
},
233226

234227
v11: with_path {
235228
downloads+: {
236-
JAVA_HOME: {
237-
name: "labsjdk",
238-
version: "ce-11.0.5+10-jvmci-19.3-b05",
239-
platformspecific: true,
240-
},
229+
JAVA_HOME: jdks["labsjdk-ce-11"],
241230
},
242231
},
243232
},
@@ -447,9 +436,9 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
447436

448437
// Order: platform, jdk, mx_env. Keep aligned for an easy visual comparison.
449438
"ruby-test-specs-linux": $.platform.linux + $.jdk.v8 + $.env.jvm + gate + $.run.test_unit_tck_specs + $.run.test_basictest + { timelimit: "35:00" },
450-
"ruby-test-specs-linux-11": $.platform.linux + $.jdk.v11 + $.env.jvm + gate + $.run.test_unit_tck_specs + $.run.test_basictest + { timelimit: "35:00" },
439+
"ruby-test-specs-linux-11": $.platform.linux + $.jdk.v11 + $.env.jvm + gate + $.run.test_unit_tck_specs + $.run.test_basictest + { timelimit: "50:00" },
451440
"ruby-test-specs-darwin": $.platform.darwin + $.jdk.v8 + $.env.jvm + gate + $.run.test_unit_tck_specs + $.run.test_basictest + { timelimit: "01:20:00" },
452-
"ruby-test-specs-darwin-11": $.platform.darwin + $.jdk.v11 + $.env.jvm + gate + $.run.test_unit_tck_specs + $.run.test_basictest + { timelimit: "01:20:00" },
441+
"ruby-test-specs-darwin-11": $.platform.darwin + $.jdk.v11 + $.env.jvm + gate + $.run.test_unit_tck_specs + $.run.test_basictest + { timelimit: "01:40:00" },
453442
"ruby-test-fast-linux": $.platform.linux + $.jdk.v8 + $.env.jvm + gate + $.run.test_fast + { timelimit: "30:00" }, # To catch missing slow tags
454443
"ruby-test-mri-linux": $.platform.linux + $.jdk.v8 + $.env.jvm + gate + $.run.test_mri + { timelimit: "30:00" },
455444
"ruby-test-mri-darwin": $.platform.darwin + $.jdk.v8 + $.env.jvm + gate + $.run.test_mri + { timelimit: "01:20:00" },

common.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"jdks": {
3+
"oraclejdk8": {"name": "oraclejdk", "version": "8u231-jvmci-19.3-b06", "platformspecific": true },
4+
"openjdk8": {"name": "openjdk", "version": "8u232-jvmci-19.3-b06", "platformspecific": true },
5+
"oraclejdk8Debug": {"name": "oraclejdk", "version": "8u231-jvmci-19.3-b06-fastdebug", "platformspecific": true },
6+
"oraclejdk11": {"name": "oraclejdk", "version": "11.0.3+12", "platformspecific": true },
7+
"openjdk11": {"name": "openjdk", "version": "11.0.3+7", "platformspecific": true },
8+
"labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.5+10-jvmci-19.3-b06", "platformspecific": true },
9+
"labsjdk-ee-11": {"name": "labsjdk", "version": "ee-11.0.5+10-jvmci-19.3-b06", "platformspecific": true }
10+
}
11+
}

mx.truffleruby/mx_truffleruby.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ def ruby_testdownstream_sulong(args):
108108
jt('test', 'cexts')
109109
jt('test', 'bundle')
110110

111+
def verify_ci(args):
112+
"""Verify CI configuration"""
113+
mx.verify_ci(args, mx.suite('truffle'), _suite, 'common.json')
114+
111115
mx_sdk.register_graalvm_component(mx_sdk.GraalVmLanguage(
112116
suite=_suite,
113117
name='TruffleRuby license files',
@@ -185,4 +189,5 @@ def ruby_testdownstream_sulong(args):
185189
'ruby_testdownstream_aot': [ruby_testdownstream_aot, 'aot_bin'],
186190
'ruby_testdownstream_hello': [ruby_testdownstream_hello, ''],
187191
'ruby_testdownstream_sulong': [ruby_testdownstream_sulong, ''],
192+
'verify-ci' : [verify_ci, '[options]'],
188193
})

mx.truffleruby/suite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"name": "tools",
1010
"subdir": True,
1111
# version must always be equal to the version of the "sulong" import below
12-
"version": "70c5f95afa7f3e5f66952310bcfe8bea50b78eb9",
12+
"version": "e5cf1f7daf6381e3ea516c55962ec2f1c0dd430e",
1313
"urls": [
1414
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
1515
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},
@@ -19,7 +19,7 @@
1919
"name": "sulong",
2020
"subdir": True,
2121
# version must always be equal to the version of the "tools" import above
22-
"version": "70c5f95afa7f3e5f66952310bcfe8bea50b78eb9",
22+
"version": "e5cf1f7daf6381e3ea516c55962ec2f1c0dd430e",
2323
"urls": [
2424
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
2525
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},

src/main/java/org/truffleruby/language/locals/ReadFrameSlotNode.java

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
*/
1010
package org.truffleruby.language.locals;
1111

12+
import com.oracle.truffle.api.frame.FrameUtil;
1213
import org.truffleruby.language.RubyBaseWithoutContextNode;
1314

1415
import com.oracle.truffle.api.dsl.Specialization;
1516
import com.oracle.truffle.api.frame.Frame;
1617
import com.oracle.truffle.api.frame.FrameSlot;
17-
import com.oracle.truffle.api.frame.FrameSlotTypeException;
1818

1919
public abstract class ReadFrameSlotNode extends RubyBaseWithoutContextNode {
2020

@@ -26,38 +26,29 @@ public ReadFrameSlotNode(FrameSlot slot) {
2626

2727
public abstract Object executeRead(Frame frame);
2828

29-
@Specialization(rewriteOn = FrameSlotTypeException.class)
30-
protected boolean readBoolean(Frame frame) throws FrameSlotTypeException {
31-
return frame.getBoolean(frameSlot);
29+
@Specialization(guards = "frame.isBoolean(frameSlot)")
30+
protected boolean readBoolean(Frame frame) {
31+
return FrameUtil.getBooleanSafe(frame, frameSlot);
3232
}
3333

34-
@Specialization(rewriteOn = FrameSlotTypeException.class)
35-
protected int readInt(Frame frame) throws FrameSlotTypeException {
36-
return frame.getInt(frameSlot);
34+
@Specialization(guards = "frame.isInt(frameSlot)")
35+
protected int readInt(Frame frame) {
36+
return FrameUtil.getIntSafe(frame, frameSlot);
3737
}
3838

39-
@Specialization(rewriteOn = FrameSlotTypeException.class)
40-
protected long readLong(Frame frame) throws FrameSlotTypeException {
41-
return frame.getLong(frameSlot);
39+
@Specialization(guards = "frame.isLong(frameSlot)")
40+
protected long readLong(Frame frame) {
41+
return FrameUtil.getLongSafe(frame, frameSlot);
4242
}
4343

44-
@Specialization(rewriteOn = FrameSlotTypeException.class)
45-
protected double readDouble(Frame frame) throws FrameSlotTypeException {
46-
return frame.getDouble(frameSlot);
44+
@Specialization(guards = "frame.isDouble(frameSlot)")
45+
protected double readDouble(Frame frame) {
46+
return FrameUtil.getDoubleSafe(frame, frameSlot);
4747
}
4848

49-
@Specialization(rewriteOn = FrameSlotTypeException.class)
50-
protected Object readObject(Frame frame) throws FrameSlotTypeException {
51-
return frame.getObject(frameSlot);
52-
}
53-
54-
@Specialization(replaces = { "readBoolean", "readInt", "readLong", "readDouble", "readObject" })
55-
protected Object readAny(Frame frame) {
56-
return frame.getValue(frameSlot);
57-
}
58-
59-
public final FrameSlot getFrameSlot() {
60-
return frameSlot;
49+
@Specialization(guards = "frame.isObject(frameSlot)")
50+
protected Object readObject(Frame frame) {
51+
return FrameUtil.getObjectSafe(frame, frameSlot);
6152
}
6253

6354
}

tool/jt.rb

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ def jvmci_update_and_version
144144
raise 'Could not parse JDK update and JVMCI version from $JVMCI_VERSION'
145145
end
146146
else
147-
ci = File.read("#{TRUFFLERUBY_DIR}/ci.jsonnet")
148-
unless /JAVA_HOME: \{\n\s*name: "openjdk",\n\s*version: "8u(\d+)-(jvmci-.+)",/ =~ ci
149-
raise 'JVMCI version not found in ci.jsonnet'
147+
ci = File.read("#{TRUFFLERUBY_DIR}/common.json")
148+
unless /{\s*"name"\s*:\s*"openjdk"\s*,\s*"version"\s*:\s*"8u(\d+)-(jvmci-[^"]+)"\s*,/ =~ ci
149+
raise 'JVMCI version not found in jdks.json'
150150
end
151151
end
152152
update, jvmci = $1, $2
@@ -190,7 +190,8 @@ def ruby_launcher
190190
elsif File.executable?(@ruby_name)
191191
@ruby_name
192192
else
193-
"#{TRUFFLERUBY_DIR}/mxbuild/truffleruby-#{@ruby_name}/#{language_dir}/ruby/bin/ruby"
193+
graalvm = "#{TRUFFLERUBY_DIR}/mxbuild/truffleruby-#{@ruby_name}"
194+
"#{graalvm}/#{language_dir(graalvm)}/ruby/bin/ruby"
194195
end
195196

196197
raise "The Ruby executable #{ruby_launcher} does not exist" unless File.exist?(ruby_launcher)
@@ -200,7 +201,8 @@ def ruby_launcher
200201
@ruby_launcher = ruby_launcher
201202

202203
unless @silent
203-
shortened_path = @ruby_launcher.sub(%r[^#{Regexp.escape TRUFFLERUBY_DIR}/], '').sub(%r[/bin/ruby$], '').sub(%r[/#{language_dir}/ruby$], '')
204+
shortened_path = @ruby_launcher.sub(%r[^#{Regexp.escape TRUFFLERUBY_DIR}/], '').sub(%r[/bin/(ruby|truffleruby)$], '')
205+
shortened_path = shortened_path.sub(%r[/#{language_dir(graalvm_home)}/ruby$], '') if graalvm_home
204206
tags = [*('Native' if truffleruby_native?),
205207
*('Interpreted' if truffleruby? && !truffleruby_compiler?),
206208
truffleruby? ? 'TruffleRuby' : 'a Ruby',
@@ -219,6 +221,18 @@ def ruby_home
219221
File.expand_path('../..', ruby_launcher)
220222
end
221223

224+
def graalvm_home
225+
up = if ruby_home.end_with?('jre/languages/ruby')
226+
3
227+
elsif ruby_home.end_with?('languages/ruby')
228+
2
229+
else
230+
nil # standalone
231+
end
232+
return nil unless up
233+
File.expand_path((['..'] * up).join('/'), ruby_home)
234+
end
235+
222236
def truffleruby_native!
223237
unless truffleruby_native?
224238
raise "The ruby executable #{ruby_launcher} is not native."
@@ -245,7 +259,6 @@ def truffleruby_compiler?
245259
return @truffleruby_compiler = true if truffleruby_native?
246260

247261
# Detect if the compiler is present by reading the $graalvm_home/release file
248-
graalvm_home = File.expand_path("..#{'/..' * (language_dir.count('/') + 1)}", ruby_home)
249262
@truffleruby_compiler = File.readlines("#{graalvm_home}/release").grep(/^COMMIT_INFO=/).any? do |line|
250263
line.include?('"compiler":') || line.include?("'compiler':")
251264
end
@@ -470,10 +483,9 @@ def find_java_home
470483
@java_home ||= ci? ? nil : ENV['JVMCI_HOME'] || install_jvmci
471484
end
472485

473-
def language_dir
474-
java_home = find_java_home || ENV.fetch('JAVA_HOME')
475-
raise "Java home #{java_home} does not exist" unless Dir.exist?(java_home)
476-
if Dir.exist?("#{java_home}/jmods")
486+
def language_dir(graalvm_home)
487+
raise "GraalVM #{graalvm_home} does not exist" unless Dir.exist?(graalvm_home)
488+
if Dir.exist?("#{graalvm_home}/jmods")
477489
'languages'
478490
else
479491
'jre/languages'
@@ -1920,7 +1932,7 @@ def bootstrap_toolchain
19201932
build_dir = mx(*mx_args, 'graalvm-home', capture: true).lines.last.chomp
19211933

19221934
dest = "#{TRUFFLERUBY_DIR}/mxbuild/#{name}"
1923-
dest_ruby = "#{dest}/#{language_dir}/ruby"
1935+
dest_ruby = "#{dest}/#{language_dir(build_dir)}/ruby"
19241936
dest_bin = "#{dest_ruby}/bin"
19251937
FileUtils.rm_rf dest
19261938
FileUtils.cp_r build_dir, dest
@@ -2147,6 +2159,8 @@ def lint
21472159
# - building with jdt in the ci definition could be dropped since fullbuild builds with JDT
21482160
mx 'spotbugs'
21492161

2162+
mx 'verify-ci'
2163+
21502164
check_parser
21512165
check_documentation_urls
21522166
check_license

0 commit comments

Comments
 (0)