Skip to content

Commit

Permalink
Merge pull request #267: Various fixes before Truffle update
Browse files Browse the repository at this point in the history
  • Loading branch information
smarr committed Sep 1, 2018
2 parents fd0057c + 37f308f commit 421bfc9
Show file tree
Hide file tree
Showing 24 changed files with 317 additions and 62 deletions.
4 changes: 2 additions & 2 deletions build.xml
Expand Up @@ -58,6 +58,7 @@
<target name="clean" description="Remove build directories and generated code">
<delete dir="${build.dir}"/>
<delete dir="${src_gen.dir}"/>
<ant dir="${corelib.dir}/TestSuite/extension" useNativeBasedir="true" target="clean" inheritAll="false" />
</target>

<target name="clean-truffle" depends="check-truffle-available" if="truffle.present">
Expand Down Expand Up @@ -245,8 +246,7 @@
</target>

<target name="compile-test-extension">
<ant dir="${corelib.dir}/TestSuite/extension" useNativeBasedir="true" target="jar" inheritAll="false">
</ant>
<ant dir="${corelib.dir}/TestSuite/extension" useNativeBasedir="true" target="jar" inheritAll="false" />
</target>

<target name="kompos" description="Build Kompos">
Expand Down
11 changes: 11 additions & 0 deletions core-lib/TestSuite/extension/.checkstyle
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>

<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
<local-check-config name="Checks" location=".checkstyle_checks.xml" type="project" description="">
<additional-data name="protect-config-file" value="false"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="Checks" local="true">
<file-match-pattern match-pattern="." include-pattern="true"/>
</fileset>
<filter name="DerivedFiles" enabled="true"/>
</fileset-config>
179 changes: 179 additions & 0 deletions core-lib/TestSuite/extension/.checkstyle_checks.xml
@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: Checks
Description: none
-->
<module name="Checker">
<property name="severity" value="error"/>
<module name="TreeWalker">
<property name="tabWidth" value="4"/>
<module name="JavadocStyle">
<property name="checkHtml" value="false"/>
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName">
<property name="format" value="^[a-z_][a-zA-Z0-9_]*$"/>
</module>
<module name="MemberName">
<property name="format" value="^(([a-z][a-zA-Z0-9_]*$)|(_[A-Z][a-zA-Z0-9]*_[a-z][a-zA-Z0-9]*$))"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z_A-Z0-9]*$"/>
</module>
<module name="PackageName"/>
<module name="ParameterName">
<property name="format" value="^[a-z][a-z_A-Z0-9]*$"/>
</module>
<module name="TypeName">
<property name="format" value="^[A-Z][_a-zA-Z0-9]*$"/>
</module>
<module name="RedundantImport"/>
<module name="LineLength">
<property name="max" value="550"/>
</module>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="ParenPad"/>
<module name="TypecastParenPad">
<property name="tokens" value="RPAREN,TYPECAST"/>
</module>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,TYPE_EXTENSION_AND"/>
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyCatches" value="true"/>
</module>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks">
<property name="allowInSwitchCase" value="true"/>
</module>
<module name="EmptyBlock">
<property name="option" value="text"/>
<property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_TRY,LITERAL_WHILE,STATIC_INIT"/>
</module>
<module name="LeftCurly">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="NeedBraces"/>
<module name="RightCurly">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="EmptyStatement"/>
<module name="HiddenField">
<property name="severity" value="ignore"/>
<property name="ignoreConstructorParameter" value="true"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
<module name="FallThrough"/>
<module name="FinalLocalVariable">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="MultipleVariableDeclarations"/>
<module name="StringLiteralEquality">
<property name="severity" value="error"/>
</module>
<module name="SuperFinalize"/>
<module name="UnnecessaryParentheses">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="Indentation">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="StaticVariableName">
<property name="format" value="^[A-Za-z][a-zA-Z0-9]*$"/>
</module>
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad"/>
<module name="ModifierOrder"/>
<module name="DefaultComesLast"/>
<module name="InnerAssignment">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="JUnitTestCase">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="ModifiedControlVariable"/>
<module name="MutableException">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="ParameterAssignment">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="RegexpSinglelineJava">
<metadata name="net.sf.eclipsecs.core.comment" value="Illegal trailing whitespace(s) at the end of the line."/>
<property name="format" value="\s$"/>
<property name="message" value="Illegal trailing whitespace(s) at the end of the line."/>
<property name="ignoreComments" value="true"/>
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Checks for trailing spaces at the end of a line"/>
</module>
<module name="RegexpSinglelineJava">
<metadata name="net.sf.eclipsecs.core.comment" value="illegal space before a comma"/>
<property name="format" value=" ,"/>
<property name="message" value="illegal space before a comma"/>
<property name="ignoreComments" value="true"/>
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Checks for whitespace before a comma."/>
<metadata name="com.atlassw.tools.eclipse.checkstyle.customMessage" value="Illegal whitespace before a comma."/>
</module>
<module name="RegexpSinglelineJava">
<metadata name="net.sf.eclipsecs.core.comment" value="needs a space after comment start"/>
<property name="format" value="[^:&quot;]//[^&quot;\s]"/>
<property name="message" value="needs a space after comment start"/>
</module>
<module name="RegexpSinglelineJava">
<property name="id" value="sysout"/>
<property name="format" value="System\.(out|err)\.print"/>
<property name="message" value="System\.(out|err)\.print should be avoided. Use a logging method instead."/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="Checkstyle: stop"/>
<property name="onCommentFormat" value="Checkstyle: resume"/>
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Disable all checks"/>
</module>
</module>
<module name="SuppressionFilter">
<property name="file" value="${basedir}/.checkstyle_suppressions.xml"/>
</module>
<module name="RegexpHeader">
<property name="severity" value="ignore"/>
<property name="header" value="(?m)/\*\*\n \* Copyright((.*\n)*) \*/\n"/>
<property name="fileExtensions" value="java"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="FileTabCharacter">
<property name="severity" value="error"/>
</module>
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf"/>
</module>
<module name="RegexpMultiline">
<metadata name="net.sf.eclipsecs.core.comment" value="illegal Windows line ending"/>
<property name="format" value="\r\n"/>
<property name="message" value="illegal Windows line ending"/>
</module>
<module name="Translation"/>
</module>
10 changes: 10 additions & 0 deletions core-lib/TestSuite/extension/.checkstyle_suppressions.xml
@@ -0,0 +1,10 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files="[\\]tests/dym[\\]" checks=".*"/>
<suppress files=".*\.csv" checks=".*"/>
<suppress files=".*\.bz2" checks=".*"/>
</suppressions>
2 changes: 2 additions & 0 deletions core-lib/TestSuite/extension/.gitignore
@@ -0,0 +1,2 @@
/src_gen/
/bin/
10 changes: 10 additions & 0 deletions core-lib/TestSuite/extension/README.md
@@ -0,0 +1,10 @@
# SOMns Extension for Testing

This is a SOMns extension module, which is used to test the SOMns functionality.

Similar to SOMns, the extension uses `ant` as build systems.

The `build.xml` file defines the various build tasks. It contains examples of
how to create the `somns.properties` file (see the `compile` task) as well as
an example for adding a JAR dependency to the module's own `Class-Path`
property in its manifest file (see the `jar` task).
2 changes: 1 addition & 1 deletion core-lib/TestSuite/extension/src/ext/ExtensionPrims.java
Expand Up @@ -8,7 +8,7 @@
import som.interpreter.nodes.nary.UnaryExpressionNode;


public class ExtensionPrims {
public abstract class ExtensionPrims {

private static long cnt = 0;

Expand Down
3 changes: 3 additions & 0 deletions src/som/UncaughtExceptions.java
Expand Up @@ -30,6 +30,9 @@ public void uncaughtException(final Thread t, final Throwable e) {
Output.errorPrintln("Processing failed for: "
+ thread.getActivity().toString());
}

Output.errorPrintln(
"Stack Trace: (printing may fail in some situation with a null pointer exception");
e.printStackTrace();

vm.requestExit(2);
Expand Down
11 changes: 8 additions & 3 deletions src/som/interpreter/LexicalScope.java
Expand Up @@ -245,7 +245,12 @@ public void removeMerged(final MethodScope scope) {

@Override
public MethodScope getOuterScopeOrNull() {
return outerScope.getMethodScope();
if (outerScope == null) {
// this can only happen for superclass resolution methods
return null;
} else {
return outerScope.getMethodScope();
}
}

@Override
Expand Down Expand Up @@ -395,13 +400,13 @@ public MethodScope getOuterMethod() {
@Override
public boolean lookupSlotOrClass(final SSymbol selector,
final List<MixinDefinitionId> results) {
assert outerScope != null : "Should not be possible, because we do not support top-level methods";
assert outerScope != null : "Should not be possible, because we do not support top-level methods, except for superclass resolution";
// this traversal concerns only the enclosing objects, not the activations
return outerScope.lookupSlotOrClass(selector, results);
}

public MethodScope getEmbeddedScope(final SourceSection source) {
assert embeddedScopes != null : "Something is wrong, trying to get embedded scope for leaf method";
assert embeddedScopes != null : "Something is wrong, trying to get embedded scope for leaf method, except for superclass resolution";
for (MethodScope s : embeddedScopes) {
if (s.method.getSourceSection().equals(source)) {
return s;
Expand Down
5 changes: 2 additions & 3 deletions src/som/interpreter/actors/Actor.java
Expand Up @@ -265,9 +265,8 @@ void doRun() {
ObjectTransitionSafepoint.INSTANCE.unregister();
}

if (VmSettings.ACTOR_TRACING && t.swapTracingBuffer) {
t.getBuffer().swapStorage();
t.swapTracingBuffer = false;
if (VmSettings.ACTOR_TRACING || VmSettings.KOMPOS_TRACING) {
t.swapTracingBufferIfRequestedUnsync();
}
t.currentlyExecutingActor = null;
}
Expand Down
4 changes: 0 additions & 4 deletions src/som/interpreter/nodes/ExpressionNode.java
Expand Up @@ -49,10 +49,6 @@ protected ExpressionNode() {}

protected ExpressionNode(final ExpressionNode wrapped) {}

public boolean assertIsStatement() {
return isTaggedWith(StatementTag.class);
}

public void markAsRootExpression() {
throw new UnsupportedOperationException();
}
Expand Down
4 changes: 2 additions & 2 deletions src/som/interpreter/nodes/dispatch/ClassSlotAccessNode.java
Expand Up @@ -64,7 +64,7 @@ public SClass read(final SObject rcvr) {
try {
// recheck guard under synchronized, don't want to access object if
// layout might have changed, we are going to slow path in that case
read.guard.entryMatches(rcvr);
guard.entryMatches(rcvr);
cachedValue = read.read(rcvr);
} catch (InvalidAssumptionException e) {
CompilerDirectives.transferToInterpreterAndInvalidate();
Expand Down Expand Up @@ -93,7 +93,7 @@ private SClass instantiateAndWriteUnsynced(final SObject rcvr) {
//
// at this point the guard will fail, if it failed for the read guard,
// but we simply recheck here to avoid impact on fast path
write.guard.entryMatches(rcvr);
guard.entryMatches(rcvr);
write.doWrite(rcvr, classObject);
} catch (InvalidAssumptionException e) {
CompilerDirectives.transferToInterpreterAndInvalidate();
Expand Down
3 changes: 2 additions & 1 deletion src/som/primitives/ActivityJoin.java
Expand Up @@ -13,6 +13,7 @@
import som.primitives.threading.TaskThreads.SomTaskOrThread;
import som.vm.VmSettings;
import tools.concurrency.KomposTrace;
import tools.concurrency.Tags;
import tools.concurrency.Tags.ExpressionBreakpoint;
import tools.debugger.entities.ReceiveOp;

Expand Down Expand Up @@ -58,7 +59,7 @@ public final Object doTask(final VirtualFrame frame, final SomTaskOrThread task)

@Override
protected boolean isTaggedWithIgnoringEagerness(final Class<?> tag) {
if (tag == ActivityJoin.class || tag == ExpressionBreakpoint.class) {
if (tag == Tags.ActivityJoin.class || tag == ExpressionBreakpoint.class) {
return true;
}
return super.isTaggedWith(tag);
Expand Down
2 changes: 1 addition & 1 deletion src/som/primitives/arrays/AtPutPrim.java
Expand Up @@ -62,7 +62,7 @@ public ExpressionNode create(final Object[] arguments,

if (forAtomic) {
return TxTernaryArrayOpNodeGen.create((TernaryExpressionNode) node, null, null, null)
.initialize(section);
.initialize(section, eagerWrapper);
} else {
return node;
}
Expand Down
4 changes: 4 additions & 0 deletions src/tools/Tagging.java
Expand Up @@ -28,6 +28,10 @@ public static void collectSourceSectionsAndTags(
@SuppressWarnings("unchecked")
Set<Class<? extends Tags>> tags = t;

if (node.getSourceSection() == null) {
return true;
}

if (tags.size() > 0) {
if (sourceSectionsAndTags.containsKey(node.getSourceSection())) {
sourceSectionsAndTags.get(node.getSourceSection()).addAll(tags);
Expand Down

0 comments on commit 421bfc9

Please sign in to comment.