Skip to content

Commit 6649285

Browse files
committed
[GR-29152] Default to JDK11 in development
PullRequest: truffleruby/2398
2 parents f4c114c + 1dffe02 commit 6649285

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Performance:
6161

6262
Changes:
6363

64+
* Standalone builds of TruffleRuby are now based on JDK11 (they used JDK8 previously). There should be no user-visible changes. Similarly, JDK11 is now used by default in development instead of JDK8.
6465

6566
# 21.0.0
6667

src/main/java/org/truffleruby/language/objects/ObjectIDOperations.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,13 @@ public static boolean isSmallFixnum(long fixnum) {
5858
return MIN_FIXNUM_VALUE <= fixnum && fixnum <= MAX_FIXNUM_VALUE;
5959
}
6060

61+
/** This constant (typed as long) is needed in order to have compatible bytecode between JDK8 and JDK11. In JDK9+,
62+
* there is a new Math.multiplyExact(long, int) method, which does not exist on JDK8. We avoid using it purposefully
63+
* to avoid this incompatibility. */
64+
private static final long TWO_AS_LONG = 2;
65+
6166
public static long smallFixnumToIDOverflow(long fixnum) throws ArithmeticException {
62-
return Math.addExact(Math.multiplyExact(fixnum, 2), 1);
67+
return Math.addExact(Math.multiplyExact(fixnum, TWO_AS_LONG), 1);
6368
}
6469

6570
public static long smallFixnumToID(long fixnum) {

tool/jt.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ def help
640640
Default value is --use jvm, therefore all commands run on truffleruby-jvm by default.
641641
The default can be changed with `export RUBY_BIN=RUBY_SELECTOR`
642642
--silent Does not print the command and which Ruby is used
643-
--jdk Specifies which version of the JDK should be used: 8 (default) or 11
643+
--jdk Specifies which version of the JDK should be used: 8 or 11 (default)
644644
645645
jt build [graalvm|parser|options] ... by default it builds graalvm
646646
jt build [parser|options] [options]
@@ -751,6 +751,7 @@ def truffle_version
751751
def mx(*args)
752752
super(*args)
753753
end
754+
ruby2_keywords :mx if respond_to?(:ruby2_keywords, true)
754755

755756
def launcher
756757
puts ruby_launcher
@@ -1962,8 +1963,8 @@ def install(name, *options)
19621963
end
19631964
end
19641965

1965-
private def install_jvmci(download_message, ee)
1966-
if @jdk_version == 8
1966+
private def install_jvmci(download_message, ee, jdk_version: @jdk_version)
1967+
if jdk_version == 8
19671968
jdk_name = ee ? 'oraclejdk8' : 'openjdk8'
19681969
else
19691970
jdk_name = ee ? 'labsjdk-ee-11' : 'labsjdk-ce-11'
@@ -1974,7 +1975,7 @@ def install(name, *options)
19741975
STDERR.puts "#{download_message} (#{jdk_name})"
19751976
if ee
19761977
mx_env = 'jvm-ee'
1977-
options = { java_home: install_jvmci('Downloading OpenJDK8 JVMCI to bootstrap', false) }
1978+
options = { java_home: install_jvmci('Downloading OpenJDK11 JVMCI to bootstrap', false, jdk_version: 11) }
19781979
else
19791980
mx_env = 'jvm'
19801981
options = { chdir: CACHE_EXTRA_DIR, java_home: :none } # chdir to not try to load a suite (which would need a JAVA_HOME)
@@ -2705,7 +2706,7 @@ def process_pre_args(args)
27052706
needs_build = false
27062707
needs_rebuild = false
27072708
@silent = false
2708-
@jdk_version = 8
2709+
@jdk_version = 11
27092710

27102711
until args.empty?
27112712
arg = args.shift

0 commit comments

Comments
 (0)