Skip to content
Snippets Groups Projects
Unverified Commit 8640c779 authored by Stefan Marr's avatar Stefan Marr Committed by GitHub
Browse files

Merge PR #331: Fix STM Bugs

parents 30c4e21f b7d557f7
No related branches found
No related tags found
No related merge requests found
Pipeline #6569 passed
......@@ -15,7 +15,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/com.oracle.truffle.api.object"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.oracle.truffle.dsl.processor"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.oracle.truffle.object"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.oracle.truffle.object.basic"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.oracle.truffle.api.profiles"/>
<classpathentry kind="lib" path="libs/somns-deps-dev.jar" sourcepath="libs/somns-deps-source.jar"/>
<classpathentry kind="lib" path="libs/somns-deps.jar" sourcepath="libs/somns-deps-source.jar"/>
......
......@@ -53,12 +53,18 @@ benchmark_suites:
- PageRank:
extra_args: "1 0 100"
codespeed_name: "1st.PageRank"
- LeeTM:
- Lee:
extra_args: "1 0 4"
codespeed_name: "1st.Lee"
- LeeSTM:
extra_args: "1 0 4"
codespeed_name: "1st.LeeSTM"
- Vacation:
extra_args: "1 0 8"
codespeed_name: "1st.Vacation"
- VacationSTM:
extra_args: "1 0 8"
codespeed_name: "1st.VacationSTM"
- Splay:
extra_args: "1 0 1"
codespeed_name: "1st.Splay"
......@@ -108,12 +114,18 @@ benchmark_suites:
extra_args: "120 0 500"
codespeed_name: "peak.PageRank"
warmup: 20
- LeeTM:
- Lee:
extra_args: "150 0 2"
codespeed_name: "peak.Lee"
- LeeSTM:
extra_args: "150 0 4"
codespeed_name: "peak.LeeSTM"
- Vacation:
extra_args: "150 0 7"
codespeed_name: "peak.Vacation"
- VacationSTM:
extra_args: "150 0 7"
codespeed_name: "peak.VacationSTM"
- Splay:
extra_args: "150 0 1"
codespeed_name: "peak.Splay"
......
(* *)
class LeeTM usingPlatform: platform andHarness: harness = (
class Lee usingPlatform: platform andHarness: harness = (
| private Benchmark = harness Benchmark.
private Array = platform kernel Array.
private Vector = platform kernel Vector.
......@@ -46,7 +46,7 @@ class LeeTM usingPlatform: platform andHarness: harness = (
private loadData: fileId = (
| dataModule str |
dataModule:: system loadModule: 'LeeTMData.ns' nextTo: outer LeeTM.
dataModule:: system loadModule: 'LeeTMData.ns' nextTo: outer Lee.
fileId = 1 ifTrue: [
str:: dataModule mainboard.
gridSize:: 100 ].
......
This diff is collapsed.
This diff is collapsed.
......@@ -329,4 +329,32 @@ class TransactionTests usingPlatform: platform testFramework: minitest = (
assert: (set contains: each) ]
)
) : ( TEST_CONTEXT = () )
public class PrimitiveValuesTests = TestContext ()(
class Fields = (
| public a
public b
public c
public d
public e
public f |
)()
(* This is a regression test for an issue committing primitive fields.
Primitive fields would be read as object fields and the freshly boxed
values compared by identity, which necessarily failed.
Before the bug was fixed, this test would loop infinetly. *)
public testCommitOfObjectWithPrimitiveSlots = (
| obj = Fields new. |
obj a: 1.
obj b: 2.
obj c: 3.
obj d: 1.1.
obj e: 2.2.
obj f: 3.3.
assert: (Transaction atomic: [
obj c: 6. true ]).
)
) : ( TEST_CONTEXT = () )
)
......@@ -703,8 +703,13 @@ public final class MethodBuilder extends ScopeBuilder<MethodScope>
MixinBuilder current = enclosing;
while (!outerName.equals(current.getName())) {
current = current.getOuter().getMixin();
if (current == null) {
boolean error = false;
if (current.getOuter() == null) {
error = true;
} else {
current = current.getOuter().getMixin();
}
if (error || current == null) {
throw new MixinDefinitionError(
"Outer send `outer " + outerName + "` could not be resolved", source);
}
......
package som.interpreter.nodes.dispatch;
import com.oracle.truffle.api.CallTarget;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.DirectCallNode;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.RootNode;
import som.interpreter.Invokable;
import som.vmobjects.SBlock;
import som.vmobjects.SInvokable;
public abstract class BlockDispatchNode extends Node {
@CompilationFinal private boolean initialized;
@CompilationFinal private boolean isAtomic;
public abstract Object executeDispatch(Object[] arguments);
protected static final boolean isSameMethod(final Object[] arguments,
......@@ -29,9 +37,18 @@ public abstract class BlockDispatchNode extends Node {
return method;
}
protected static final DirectCallNode createCallNode(final Object[] arguments) {
return Truffle.getRuntime().createDirectCallNode(
getMethod(arguments).getCallTarget());
protected CallTarget getCallTarget(final Object[] arguments) {
SInvokable blockMethod = getMethod(arguments);
if (forAtomic()) {
return blockMethod.getAtomicCallTarget();
} else {
return blockMethod.getCallTarget();
}
}
protected final DirectCallNode createCallNode(final Object[] arguments) {
CallTarget ct = getCallTarget(arguments);
return Truffle.getRuntime().createDirectCallNode(ct);
}
protected static final IndirectCallNode createIndirectCall() {
......@@ -48,6 +65,27 @@ public abstract class BlockDispatchNode extends Node {
@Specialization(replaces = "activateCachedBlock")
public Object activateBlock(final Object[] arguments,
@Cached("createIndirectCall()") final IndirectCallNode indirect) {
return indirect.call(getMethod(arguments).getCallTarget(), arguments);
return indirect.call(getCallTarget(arguments), arguments);
}
protected boolean forAtomic() {
if (initialized) {
return isAtomic;
}
CompilerDirectives.transferToInterpreterAndInvalidate();
// TODO: seems a bit expensive,
// might want to optimize for interpreter first iteration speed
RootNode root = getRootNode();
if (root instanceof Invokable) {
isAtomic = ((Invokable) root).isAtomic();
} else {
// TODO: need to think about integration with actors, but, that's a
// later research project
return false;
}
initialized = true;
return isAtomic;
}
}
......@@ -159,9 +159,10 @@ public final class Transactions {
if (hasConflicts()) {
return false;
}
applyChanges();
}
applyChanges();
return true;
}
......
......@@ -224,7 +224,8 @@ public abstract class SObject extends SObjectWithClass {
MapCursor<SlotDefinition, StorageLocation> e = locs.getEntries();
while (e.advance()) {
// need to ignore mutators and class slots
if (e.getKey().getClass() == SlotDefinition.class &&
// ignore primitives, have been checked separately before
if (e.getKey().getClass() == SlotDefinition.class && e.getValue().isObjectLocation() &&
e.getValue().read(this) != oLocs.get(e.getKey()).read(o)) {
return false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment