Skip to content

Commit

Permalink
Merge PR #374: Truffle update to latest 20.x version
Browse files Browse the repository at this point in the history
  • Loading branch information
smarr committed Feb 18, 2021
2 parents 6e13e97 + f0133a6 commit 1f2e479
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 58 deletions.
4 changes: 2 additions & 2 deletions build.xml
Expand Up @@ -3,8 +3,8 @@
xmlns:if="ant:if"
xmlns:jacoco="antlib:org.jacoco.ant">

<property name="jvmci.version" value="jvmci-20.2-b03" />
<property name="jdk8.version" value="262+10" />
<property name="jvmci.version" value="jvmci-20.3-b09" />
<property name="jdk8.version" value="282+07" />

<macrodef name="travis">
<attribute name="target" />
Expand Down
2 changes: 1 addition & 1 deletion libs/truffle
Submodule truffle updated 2531 files
3 changes: 2 additions & 1 deletion som
Expand Up @@ -448,7 +448,8 @@ flags += ['-Dsom.tools=' + BASE_DIR + '/tools']
flags += ['-Dsom.baseDir=' + BASE_DIR]

if not args.interpreter:
flags += ['-Dpolyglot.engine.LanguageAgnosticInlining=false']
flags += ['-Dpolyglot.engine.LanguageAgnosticInlining=false',
'-Dpolyglot.engine.CompilerThreads=0']

if args.use_pinning:
## check whether there are any known restrictions to core usage
Expand Down
5 changes: 4 additions & 1 deletion src/som/interpreter/objectstorage/SafepointPhaser.java
Expand Up @@ -9,6 +9,8 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.LockSupport;

import sun.misc.Unsafe;
import tools.UnsafeUtil;
import tools.concurrency.TraceBuffer;


Expand Down Expand Up @@ -526,10 +528,11 @@ boolean block() {

// Unsafe mechanics

private static final sun.misc.Unsafe U = TraceBuffer.UNSAFE;
private static final sun.misc.Unsafe U;
private static final long STATE;
static {
try {
U = UnsafeUtil.load();
STATE = U.objectFieldOffset(SafepointPhaser.class.getDeclaredField("state"));
} catch (ReflectiveOperationException e) {
throw new Error(e);
Expand Down
19 changes: 2 additions & 17 deletions src/som/interpreter/objectstorage/StorageAccessor.java
Expand Up @@ -12,6 +12,7 @@
import som.vmobjects.SObject.SImmutableObject;
import som.vmobjects.SObject.SMutableObject;
import sun.misc.Unsafe;
import tools.UnsafeUtil;


/**
Expand All @@ -25,7 +26,7 @@
* {@link SMutableObject}.
*/
public abstract class StorageAccessor {
private static final Unsafe unsafe = loadUnsafe();
private static final Unsafe unsafe = UnsafeUtil.load();

private static final int MAX_OBJECT_FIELDS = 50;
private static final int MAX_PRIM_FIELDS = 30;
Expand Down Expand Up @@ -240,20 +241,4 @@ public void write(final SObject obj, final double value) {
obj.getExtendedPrimFields()[extensionIndex] = Double.doubleToRawLongBits(value);
}
}

private static Unsafe loadUnsafe() {
try {
return Unsafe.getUnsafe();
} catch (SecurityException e) {
// can fail, is ok, just to the fallback below
}
try {
Field theUnsafeInstance = Unsafe.class.getDeclaredField("theUnsafe");
theUnsafeInstance.setAccessible(true);
return (Unsafe) theUnsafeInstance.get(Unsafe.class);
} catch (Exception e) {
throw new RuntimeException(
"exception while trying to get Unsafe.theUnsafe via reflection:", e);
}
}
}
2 changes: 1 addition & 1 deletion src/som/primitives/ActivityJoin.java
Expand Up @@ -67,7 +67,7 @@ protected boolean hasTagIgnoringEagerness(final Class<? extends Tag> tag) {
if (tag == Tags.ActivityJoin.class || tag == ExpressionBreakpoint.class) {
return true;
}
return super.hasTag(tag);
return super.hasTagIgnoringEagerness(tag);
}
}
}
4 changes: 2 additions & 2 deletions src/som/primitives/ActivitySpawn.java
Expand Up @@ -200,7 +200,7 @@ protected boolean hasTagIgnoringEagerness(final Class<? extends Tag> tag) {
tag == StatementTag.class) {
return true;
}
return super.hasTag(tag);
return super.hasTagIgnoringEagerness(tag);
}
}

Expand Down Expand Up @@ -293,7 +293,7 @@ protected boolean hasTagIgnoringEagerness(final Class<? extends Tag> tag) {
tag == StatementTag.class) {
return true;
}
return super.hasTag(tag);
return super.hasTagIgnoringEagerness(tag);
}
}
}
2 changes: 1 addition & 1 deletion src/som/primitives/actors/CreateActorPrim.java
Expand Up @@ -74,6 +74,6 @@ protected boolean hasTagIgnoringEagerness(final Class<? extends Tag> tag) {
return true;
}

return super.hasTag(tag);
return super.hasTagIgnoringEagerness(tag);
}
}
2 changes: 1 addition & 1 deletion src/som/primitives/transactions/AtomicPrim.java
Expand Up @@ -116,6 +116,6 @@ protected boolean hasTagIgnoringEagerness(final Class<? extends Tag> tag) {
tag == StatementTag.class) {
return true;
}
return super.hasTag(tag);
return super.hasTagIgnoringEagerness(tag);
}
}
9 changes: 6 additions & 3 deletions src/som/vm/VmSettings.java
@@ -1,5 +1,7 @@
package som.vm;

import com.oracle.truffle.api.TruffleOptions;

import bd.settings.Settings;


Expand Down Expand Up @@ -66,12 +68,13 @@ public class VmSettings implements Settings {
System.getProperty("som.traceFile", System.getProperty("user.dir") + "/traces/trace");
MEMORY_TRACING = getBool("som.memoryTracing", false);
REPLAY = getBool("som.replay", false);
KOMPOS_TRACING = getBool("som.komposTracing", false) || TRUFFLE_DEBUGGER_ENABLED; // REPLAY;
KOMPOS_TRACING = (getBool("som.komposTracing", false) || TRUFFLE_DEBUGGER_ENABLED)
&& !TruffleOptions.AOT; // REPLAY;
ASSISTED_DEBUGGING = getBool("som.assistedDebugging", false) && KOMPOS_TRACING;
DISABLE_TRACE_FILE = getBool("som.disableTraceFile", false) || (REPLAY && !KOMPOS_TRACING);
TRACE_SMALL_IDS = getBool("som.smallIds", false);

UNIFORM_TRACING = getBool("som.actorTracing", false);
UNIFORM_TRACING = getBool("som.actorTracing", false) && !TruffleOptions.AOT;
boolean receiverSide = getBool("som.actorReceiverTracing", false);
SENDER_SIDE_TRACING = UNIFORM_TRACING && !receiverSide;
RECEIVER_SIDE_TRACING = UNIFORM_TRACING && receiverSide;
Expand Down Expand Up @@ -102,7 +105,7 @@ public class VmSettings implements Settings {

String osName = System.getProperty("os.name", "generic").toLowerCase();
boolean isLinux = osName.contains("linux");
USE_PINNING = getBool("som.usePinning", true) && isLinux;
USE_PINNING = getBool("som.usePinning", true) && isLinux && !TruffleOptions.AOT;
}

private static boolean getBool(final String prop, final boolean defaultVal) {
Expand Down
25 changes: 25 additions & 0 deletions src/tools/UnsafeUtil.java
@@ -0,0 +1,25 @@
package tools;

import java.lang.reflect.Field;

import sun.misc.Unsafe;


public class UnsafeUtil {
public static Unsafe load() {
try {
return Unsafe.getUnsafe();
} catch (SecurityException e) {
// can fail, is ok, just to the fallback below
}
try {
Field theUnsafeInstance = Unsafe.class.getDeclaredField("theUnsafe");
theUnsafeInstance.setAccessible(true);
return (Unsafe) theUnsafeInstance.get(Unsafe.class);
} catch (Exception e) {
throw new RuntimeException(
"exception while trying to get Unsafe.theUnsafe via reflection:", e);
}
}

}
32 changes: 10 additions & 22 deletions src/tools/concurrency/TraceBuffer.java
@@ -1,12 +1,12 @@
package tools.concurrency;

import java.lang.reflect.Field;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.TruffleOptions;

import som.interpreter.actors.Actor.ActorProcessingThread;
import som.vm.VmSettings;
import sun.misc.Unsafe;
import tools.UnsafeUtil;
import tools.replay.actors.UniformExecutionTrace.UniformTraceBuffer;
import tools.replay.nodes.TraceContextNode;

Expand All @@ -25,27 +25,15 @@ public static TraceBuffer create(final long threadId) {
public static final Unsafe UNSAFE;
public static final long BYTE_ARR_BASE_OFFSET;

private static Unsafe loadUnsafe() {
try {
return Unsafe.getUnsafe();
} catch (SecurityException e) {
// can fail, is ok, just to the fallback below
}
try {
Field theUnsafeInstance = Unsafe.class.getDeclaredField("theUnsafe");
theUnsafeInstance.setAccessible(true);
return (Unsafe) theUnsafeInstance.get(Unsafe.class);
} catch (Exception e) {
throw new RuntimeException(
"exception while trying to get Unsafe.theUnsafe via reflection:", e);
}
}

static {
UNSAFE = loadUnsafe();
BYTE_ARR_BASE_OFFSET = UNSAFE.arrayBaseOffset(byte[].class);
assert UNSAFE.arrayIndexScale(
byte[].class) == 1 : "Expect byte elements to be exactly one byte in size.";
UNSAFE = UnsafeUtil.load();
if (!TruffleOptions.AOT) {
BYTE_ARR_BASE_OFFSET = UNSAFE.arrayBaseOffset(byte[].class);
assert UNSAFE.arrayIndexScale(
byte[].class) == 1 : "Expect byte elements to be exactly one byte in size.";
} else {
BYTE_ARR_BASE_OFFSET = 1;
}
}

protected byte[] buffer;
Expand Down
6 changes: 2 additions & 4 deletions src/tools/concurrency/TracingActivityThread.java
Expand Up @@ -5,8 +5,6 @@
import java.util.concurrent.ForkJoinWorkerThread;
import java.util.concurrent.atomic.AtomicInteger;

import com.oracle.truffle.api.TruffleOptions;

import net.openhft.affinity.AffinityLock;
import som.VM;
import som.interpreter.actors.Actor.ActorProcessingThread;
Expand Down Expand Up @@ -187,7 +185,7 @@ protected void onStart() {
TracingBackend.registerThread(this);
}

if (!TruffleOptions.AOT && VmSettings.USE_PINNING) {
if (VmSettings.USE_PINNING) {
affinity = AffinityLock.acquireLock();
}

Expand All @@ -205,7 +203,7 @@ protected void onTermination(final Throwable exception) {
SnapshotBackend.registerSnapshotBuffer(snapshotBuffer);
}

if (!TruffleOptions.AOT && VmSettings.USE_PINNING) {
if (VmSettings.USE_PINNING) {
((AffinityLock) affinity).release();
}

Expand Down
2 changes: 2 additions & 0 deletions src/tools/dym/MetricsCsvWriter.java
Expand Up @@ -309,6 +309,8 @@ private String operationType(final OperationProfile p, final Arguments a) {
return typeCategory(a.getArgType(0));
} else if (p.getOperation().equals("createPromise")) {
return "ref";
} else if (p.getOperation().equals("createActorFromValue:")) {
return "farRef";
} else if (p.getOperation().equals("implicitPromiseResolve")
|| p.getOperation().equals("implicitPromiseError")
|| p.getOperation().equals("explicitPromiseResolve")
Expand Down
Binary file modified tests/dym/expected-results.tar.bz2
Binary file not shown.

1 comment on commit 1f2e479

@rebenchdb
Copy link

@rebenchdb rebenchdb bot commented on 1f2e479 Feb 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance changes for 6e13e97...1f2e479

Summary Over All Benchmarks
Summary Over All Benchmarks

Full Report

Please sign in to comment.