Skip to content

Commit 834dc9b

Browse files
authored
Merge PR #91: Update Truffle/mx and minor maintenance
2 parents c3a07a8 + 80993c5 commit 834dc9b

File tree

13 files changed

+80
-42
lines changed

13 files changed

+80
-42
lines changed

.gitlab-ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ test:
2121
- ${ANT} tests native-obj-storage-test native-tests
2222
- ./som -G -cp core-lib/Smalltalk:core-lib/TestSuite:core-lib/SomSom/src/compiler:core-lib/SomSom/src/vm:core-lib/SomSom/src/vmobjects:core-lib/SomSom/src/interpreter:core-lib/SomSom/src/primitives core-lib/SomSom/tests/SomSomTests.som
2323

24-
build-native-interp-ast:
24+
build:native-interp-ast:
2525
stage: build-and-test
2626
tags: [yuria2]
2727
script:
28+
- (cd libs/truffle; git checkout compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/TruffleCompilerPhases.java)
29+
- sed -i'' '45,56d' libs/truffle/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/TruffleCompilerPhases.java
2830
- ${ANT} compile native-ast -Dno.jit=true
2931
- ./som-native-interp-ast -cp Smalltalk TestSuite/TestHarness.som
3032

@@ -36,10 +38,12 @@ build-native-interp-ast:
3638
put som-native-interp-ast.lz4 incoming/${CI_PIPELINE_ID}/
3739
EOF
3840
39-
build-native-interp-bc:
41+
build:native-interp-bc:
4042
stage: build-and-test
4143
tags: [yuria3]
4244
script:
45+
- (cd libs/truffle; git checkout compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/TruffleCompilerPhases.java)
46+
- sed -i'' '45,56d' libs/truffle/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/TruffleCompilerPhases.java
4347
- ${ANT} compile native-bc -Dno.jit=true
4448
- ./som-native-interp-bc -cp Smalltalk TestSuite/TestHarness.som
4549

@@ -53,8 +57,11 @@ build-native-interp-bc:
5357
5458
benchmark-y1:
5559
stage: benchmark
60+
needs: ["build:native-interp-ast", "build:native-interp-bc"]
5661
tags: [yuria]
5762
script:
63+
- (cd libs/truffle; git checkout compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/TruffleCompilerPhases.java)
64+
- sed -i'' '45,56d' libs/truffle/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/TruffleCompilerPhases.java
5865
- ${ANT} compile
5966
- sftp tmp-artifacts:incoming/${CI_PIPELINE_ID}/som-native-interp-ast.lz4
6067
- sftp tmp-artifacts:incoming/${CI_PIPELINE_ID}/som-native-interp-bc.lz4
@@ -69,8 +76,11 @@ benchmark-y1:
6976

7077
benchmark-y2:
7178
stage: benchmark
79+
needs: ["build:native-interp-ast", "build:native-interp-bc"]
7280
tags: [yuria2]
7381
script:
82+
- (cd libs/truffle; git checkout compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/TruffleCompilerPhases.java)
83+
- sed -i'' '45,56d' libs/truffle/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/TruffleCompilerPhases.java
7484
- ${ANT} compile
7585
- sftp tmp-artifacts:incoming/${CI_PIPELINE_ID}/som-native-interp-ast.lz4
7686
- sftp tmp-artifacts:incoming/${CI_PIPELINE_ID}/som-native-interp-bc.lz4
@@ -85,8 +95,11 @@ benchmark-y2:
8595

8696
benchmark-y3:
8797
stage: benchmark
98+
needs: ["build:native-interp-ast", "build:native-interp-bc"]
8899
tags: [yuria3]
89100
script:
101+
- (cd libs/truffle; git checkout compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/TruffleCompilerPhases.java)
102+
- sed -i'' '45,56d' libs/truffle/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/TruffleCompilerPhases.java
90103
- ${ANT} compile
91104
- sftp tmp-artifacts:incoming/${CI_PIPELINE_ID}/som-native-interp-ast.lz4
92105
- sftp tmp-artifacts:incoming/${CI_PIPELINE_ID}/som-native-interp-bc.lz4

build.xml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xmlns:if="ant:if"
44
xmlns:jacoco="antlib:org.jacoco.ant">
55

6-
<property name="jvmci.version" value="jvmci-20.3-b09" />
7-
<property name="jdk8.version" value="282+07" />
6+
<property name="jvmci.version" value="jvmci-21.3-b05" />
7+
<property name="jdk8.version" value="302+06" />
88

99
<macrodef name="travis">
1010
<attribute name="target" />
@@ -44,13 +44,13 @@
4444
<property name="bd.dir" location="${lib.dir}/black-diamonds/" />
4545
<property name="unit.dir" location="tests"/>
4646
<property name="sdk.dir" location="${lib.dir}/truffle/sdk" />
47-
<property name="sdk.build" location="${sdk.dir}/mxbuild/dists/jdk1.8" />
47+
<property name="sdk.build" location="${sdk.dir}/mxbuild/dists" />
4848
<property name="truffle.dir" location="${lib.dir}/truffle/truffle" />
4949
<property name="svm.dir" location="${lib.dir}/truffle/substratevm" />
5050
<property name="vm.dir" location="${lib.dir}/truffle/vm" />
5151
<property name="compiler.dir" location="${lib.dir}/truffle/compiler" />
52-
<property name="compiler.build" location="${truffle.dir}/mxbuild/dists/jdk1.8" />
53-
<property name="truffle.build" location="${truffle.dir}/mxbuild/dists/jdk1.8" />
52+
<property name="compiler.build" location="${truffle.dir}/mxbuild/dists" />
53+
<property name="truffle.build" location="${truffle.dir}/mxbuild/dists" />
5454
<property name="junit.version" value="4.12" />
5555

5656
<property name="checkstyle.version" value="8.36" />
@@ -336,6 +336,7 @@
336336
<jvmarg value="-ea" />
337337
<jvmarg value="-esa" />
338338
<jvmarg value="-Dsom.interp=AST" />
339+
<jvmarg value="-Dpolyglot.engine.WarnInterpreterOnly=false" />
339340
<classpath refid="som.cp" />
340341
<batchtest fork="yes" filtertrace="false">
341342
<fileset dir="tests">
@@ -350,6 +351,7 @@
350351
<jvmarg value="-ea" />
351352
<jvmarg value="-esa" />
352353
<jvmarg value="-Dsom.interp=BC" />
354+
<jvmarg value="-Dpolyglot.engine.WarnInterpreterOnly=false" />
353355
<classpath refid="som.cp" />
354356
<batchtest fork="yes" filtertrace="false">
355357
<fileset dir="tests">
@@ -363,6 +365,7 @@
363365
<classpath refid="som.cp" />
364366
<jvmarg value="-ea" />
365367
<jvmarg value="-esa" />
368+
<jvmarg value="-Dpolyglot.engine.WarnInterpreterOnly=false" />
366369
<arg line="-cp Smalltalk TestSuite/TestHarness.som --ignore-inefficacies" />
367370
</java>
368371
<fail message="Basic tests failed for AST interpreter." if="test.failed.ast" />
@@ -409,7 +412,14 @@
409412

410413
<target name="tests" depends="test,som-test" />
411414

412-
<target name="native-ast" depends="truffle-libs,libs,jvmci-libs,compile-som,compile-native-ast"></target>
415+
<target name="native-ast" depends="truffle-libs,libs,jvmci-libs,compile-svm,compile-som,compile-native-ast"></target>
416+
417+
<target name="compile-svm">
418+
<exec executable="${mx.cmd}" dir="${svm.dir}" failonerror="true">
419+
<env key="JAVA_HOME" value="${jvmci.home}" />
420+
<arg line="build" />
421+
</exec>
422+
</target>
413423

414424
<target name="compile-native-ast">
415425
<travis target="native" start="Build Native Image" />
@@ -440,7 +450,7 @@
440450
<travis target="native" />
441451
</target>
442452

443-
<target name="native-bc" depends="truffle-libs,libs,jvmci-libs,compile-som,compile-native-bc"></target>
453+
<target name="native-bc" depends="truffle-libs,libs,jvmci-libs,compile-svm,compile-som,compile-native-bc"></target>
444454

445455
<target name="compile-native-bc">
446456
<travis target="native" start="Build Native Image" />
@@ -472,7 +482,7 @@
472482
</target>
473483

474484

475-
<target name="native-obj-storage-test" depends="truffle-libs,libs,jvmci-libs,compile-som,compile-native-obj-storage-test"></target>
485+
<target name="native-obj-storage-test" depends="truffle-libs,libs,jvmci-libs,compile-svm,compile-som,compile-native-obj-storage-test"></target>
476486

477487
<target name="compile-native-obj-storage-test">
478488
<travis target="native" start="Build Native Image" />

libs/mx

Submodule mx updated 55 files

libs/truffle

Submodule truffle updated 6998 files

rebench.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ reporting:
1414

1515
runs:
1616
max_invocation_time: 6000
17+
min_iteration_time: 1
1718

1819
benchmark_suites:
1920
macro-startup:
@@ -200,7 +201,6 @@ experiments:
200201
profiling:
201202
description: Profile Native Image Interpreters
202203
action: profile
203-
suites:
204204
executions:
205205
- TruffleSOM-native-interp-ast:
206206
iterations: 10!

som

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ explore.add_argument('-ts', '--trace-splitting', help='trace splitting decisions
4242
dest='trace_splitting', action='store_true', default=False)
4343
explore.add_argument('-w', '--perf-warnings', help='enable performance warnings',
4444
dest='perf_warnings', action='store_true', default=False)
45-
explore.add_argument('-v', '--visual-vm', help='connect to VisualVM for profiling',
46-
dest='visual_vm', action='store_true', default=False)
4745

4846
profile = parser.add_argument_group('Profile', 'Profile Execution')
4947
profile.add_argument('-gp', '--graal-profile', help='enable Graal-level profiling after warmup',
@@ -56,6 +54,10 @@ profile.add_argument('-gb', '--graal-branch-profile', help='enable Graal-level b
5654
dest='graal_branch_profile', action='store_true', default=False)
5755
profile.add_argument('-tp', '--truffle-profile', help='enable Graal-level profiling after warmup',
5856
dest='truffle_profile', action='store_true', default=False)
57+
explore.add_argument('-v', '--visual-vm', help='connect to VisualVM for profiling',
58+
dest='visual_vm', action='store_true', default=False)
59+
explore.add_argument('-fr', '--flight-recorder', help='profile with Java Flight Recorder',
60+
dest='flight_recorder', action='store_true', default=False)
5961

6062

6163
parser.add_argument('-o', '--only', help='only compile give methods, comma separated list',
@@ -103,6 +105,9 @@ args, unknown_args = parser.parse_known_args()
103105
if args.java_interpreter:
104106
args.interpreter = True
105107

108+
if args.flight_recorder:
109+
args.interpreter = True
110+
106111
if args.interpreter:
107112
args.use_libgraal = False
108113

@@ -183,16 +188,16 @@ CLASSPATH = (BASE_DIR + '/build/classes:'
183188
+ BASE_DIR + '/libs/black-diamonds/build/classes')
184189

185190
BOOT_CLASSPATH = ('-Xbootclasspath/a:'
186-
+ TRUFFLE_DIR + '/sdk/mxbuild/dists/jdk1.8/graal-sdk.jar:'
187-
+ TRUFFLE_DIR + '/truffle/mxbuild/dists/jdk1.8/truffle-api.jar')
191+
+ TRUFFLE_DIR + '/sdk/mxbuild/dists/graal-sdk.jar:'
192+
+ TRUFFLE_DIR + '/truffle/mxbuild/dists/truffle-api.jar')
188193

189194
if args.use_libgraal:
190195
GRAAL_JAVA_8_FLAGS = ['-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary',
191196
'-XX:-UseJVMCIClassLoader', '-Dgraalvm.locatorDisabled=true']
192197
GRAAL_JVMCI_FLAGS = []
193198
else:
194199
GRAAL_JAVA_8_FLAGS = ['-Djvmci.Compiler=graal',
195-
'-Djvmci.class.path.append=' + TRUFFLE_DIR + '/compiler/mxbuild/dists/jdk1.8/graal.jar']
200+
'-Djvmci.class.path.append=' + TRUFFLE_DIR + '/compiler/mxbuild/dists/graal.jar']
196201
GRAAL_JVMCI_FLAGS = ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI', '-XX:-UseJVMCICompiler']
197202

198203

@@ -230,7 +235,8 @@ if args.dump_ir:
230235
SOM_ARGS += ['-di']
231236

232237
if args.interpreter:
233-
flags += ['-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime']
238+
flags += ['-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime',
239+
'-Dpolyglot.engine.WarnInterpreterOnly=false']
234240
else:
235241
flags += GRAAL_JVMCI_FLAGS
236242
if args.embedded_graal:
@@ -284,6 +290,11 @@ if not args.interpreter and args.only_compile:
284290
flags.append("-Dpolyglot.engine.CompileOnly=%s" % args.only_compile)
285291
if args.visual_vm:
286292
flags += ['-agentpath:/Users/smarr/Downloads/visualvm_138/profiler/lib/deployed/jdk16/mac/libprofilerinterface.jnilib=/Users/smarr/Downloads/visualvm_138/profiler/lib,5140']
293+
if args.flight_recorder:
294+
flags += ['-XX:+UnlockCommercialFeatures', '-XX:+FlightRecorder',
295+
'-XX:StartFlightRecording=delay=10s,duration=10d,name=fr-recording2,filename=fr-recording2.jfr,settings=profile']
296+
297+
287298
if args.assert_:
288299
flags += ['-esa', '-ea']
289300
else:
@@ -303,15 +314,17 @@ if args.java_interpreter:
303314
if args.print_graal_options:
304315
flags += ['-XX:+JVMCIPrintProperties']
305316

306-
if not args.interpreter:
307-
flags += ['-Dpolyglot.engine.LanguageAgnosticInlining=false']
308-
309317
if args.java_properties:
310318
flags += ['-D' + property for property in args.java_properties]
311319

312320
if args.java_args:
313321
JAVA_ARGS += ['-' + property for property in args.java_args]
314322

323+
if not args.interpreter:
324+
flags += ['-Dpolyglot.engine.MultiTier=false',
325+
'-Dpolyglot.engine.DynamicCompilationThresholds=false',
326+
'-Dpolyglot.engine.SingleTierCompilationThreshold=253']
327+
315328
# HACK: Havlak needs a lot of stack to run reliably...
316329
if 'Havlak' in args.args:
317330
# double the standard stack size

src/trufflesom/interpreter/Invokable.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package trufflesom.interpreter;
22

3-
import com.oracle.truffle.api.RootCallTarget;
4-
import com.oracle.truffle.api.Truffle;
53
import com.oracle.truffle.api.frame.FrameDescriptor;
64
import com.oracle.truffle.api.frame.VirtualFrame;
75
import com.oracle.truffle.api.nodes.RootNode;
@@ -59,10 +57,6 @@ public final boolean isCloningAllowed() {
5957
return true;
6058
}
6159

62-
public final RootCallTarget createCallTarget() {
63-
return Truffle.getRuntime().createCallTarget(this);
64-
}
65-
6660
public abstract void propagateLoopCountThroughoutLexicalScope(long count);
6761

6862
public SClass getHolder() {

src/trufflesom/interpreter/SomLanguage.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import com.oracle.truffle.api.CallTarget;
1212
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
1313
import com.oracle.truffle.api.Option;
14-
import com.oracle.truffle.api.Truffle;
1514
import com.oracle.truffle.api.TruffleLanguage;
1615
import com.oracle.truffle.api.frame.VirtualFrame;
1716
import com.oracle.truffle.api.nodes.Node;
@@ -25,7 +24,8 @@
2524

2625

2726
@TruffleLanguage.Registration(id = "som", name = "som", version = "0.1.0",
28-
mimeType = SomLanguage.MIME_TYPE)
27+
defaultMimeType = SomLanguage.MIME_TYPE,
28+
characterMimeTypes = SomLanguage.MIME_TYPE)
2929
public class SomLanguage extends TruffleLanguage<Universe> {
3030

3131
public static final String MIME_TYPE = "application/x-som-smalltalk";
@@ -145,11 +145,20 @@ public Object execute(final VirtualFrame frame) {
145145
}
146146

147147
private CallTarget createStartCallTarget() {
148-
return Truffle.getRuntime().createCallTarget(new StartInterpretation());
148+
StartInterpretation start = new StartInterpretation();
149+
CallTarget ct = start.getCallTarget();
150+
151+
assert ct != null : "Expect the StartInterpretation callTarget to be available";
152+
return ct;
149153
}
150154

151155
private CallTarget createInitCallTarget() {
152-
return Truffle.getRuntime().createCallTarget(new InitializeContext(this));
156+
InitializeContext init = new InitializeContext(this);
157+
158+
CallTarget ct = init.getCallTarget();
159+
160+
assert ct != null : "Expect the InitializeContext callTarget to be available";
161+
return ct;
153162
}
154163

155164
private static boolean isStartSource(final Source source) {

src/trufflesom/primitives/arithmetic/GreaterThanPrim.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public final boolean doDouble(final double left, final long right) {
5353
}
5454

5555
@Specialization
56+
@TruffleBoundary
5657
public final boolean doDouble(final double left, final BigInteger right) {
5758
return left > right.doubleValue();
5859
}

src/trufflesom/primitives/basics/EqualsPrim.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public final boolean doDouble(final double left, final long right) {
7676
}
7777

7878
@Specialization
79+
@TruffleBoundary
7980
public final boolean doDouble(final double left, final BigInteger right) {
8081
return left == right.doubleValue();
8182
}

src/trufflesom/vmobjects/SInvokable.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public SInvokable(final SSymbol signature, final Invokable invokable,
4848
this.sourceSection = source;
4949

5050
this.invokable = invokable;
51-
this.callTarget = invokable.createCallTarget();
5251
}
5352

5453
public static final class SMethod extends SInvokable {
@@ -123,7 +122,7 @@ public final SourceSection getSourceSection() {
123122
}
124123

125124
public final RootCallTarget getCallTarget() {
126-
return callTarget;
125+
return invokable.getCallTarget();
127126
}
128127

129128
public final Invokable getInvokable() {
@@ -149,11 +148,11 @@ public final int getNumberOfArguments() {
149148
}
150149

151150
public final Object invoke(final Object[] arguments) {
152-
return callTarget.call(arguments);
151+
return invokable.getCallTarget().call(arguments);
153152
}
154153

155154
public final Object invoke(final IndirectCallNode node, final Object[] arguments) {
156-
return node.call(callTarget, arguments);
155+
return node.call(invokable.getCallTarget(), arguments);
157156
}
158157

159158
@Override
@@ -169,10 +168,9 @@ public final String toString() {
169168

170169
public abstract String getIdentifier();
171170

172-
private final SourceSection sourceSection;
173-
protected final Invokable invokable;
174-
private final RootCallTarget callTarget;
175-
protected final SSymbol signature;
171+
private final SourceSection sourceSection;
172+
protected final Invokable invokable;
173+
protected final SSymbol signature;
176174

177175
@CompilationFinal protected SClass holder;
178176

tests/trufflesom/tests/BytecodeMethodTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,6 @@ private void inliningOfOr(final String sel) {
845845
byte[] bytecodes = methodToBytecodes(
846846
"test = ( true " + sel + " [ #val ] )");
847847

848-
dump();
849848
assertEquals(10, bytecodes.length);
850849
check(bytecodes,
851850
Bytecodes.PUSH_CONSTANT_0,

0 commit comments

Comments
 (0)