Skip to content

Commit

Permalink
Apply Eclipse formatting
Browse files Browse the repository at this point in the history
- unclear why this is the only bit that’s not formatted
  • Loading branch information
smarr committed Jul 28, 2023
1 parent ba82efd commit 6f2a0b6
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Check Eclipse Format
run: |
export ECLIPSE_EXE=${GITHUB_WORKSPACE}/../eclipse/eclipse
mx eclipseformat --primary
mx eclipseformat --primary --patchfile format.patch
test_som:
runs-on: ubuntu-22.04
Expand Down
3 changes: 2 additions & 1 deletion src/trufflesom/src/bdt/basic/IdProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
/**
* An <code>IdProvider</code> establishes a mapping from strings to unique identifies.
*
* <p>These identifiers are used for instance to select primitives or inlinable elements based
* <p>
* These identifiers are used for instance to select primitives or inlinable elements based
* on identifiers in user-language source code.
*
* @param <Id> the identifier type used for instance to allow a mapping to primitives or
Expand Down
3 changes: 2 additions & 1 deletion src/trufflesom/src/bdt/basic/ProgramDefinitionError.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* A <code>ProgramDefinitionError</code> indicates a problem in the user-language program that
* will prevent normal execution.
*
* <p>This error is the root of the error hierarchy used by Black Diamonds.
* <p>
* This error is the root of the error hierarchy used by Black Diamonds.
* Language implementations should support it and possibly adopt it as the root of their
* hierarchy of errors, too.
*/
Expand Down
5 changes: 3 additions & 2 deletions src/trufflesom/src/bdt/inlining/InlinableNodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ private void initializeNodes(final List<Class<? extends Node>> inlinableNodes) {
assert ann != null;

Constructor<?>[] ctors = nodeClass.getConstructors();
assert ctors.length == 1 : "We expect nodes marked with Inline to have only one constructor,"
+ " or be used via node factories.";
assert ctors.length == 1
: "We expect nodes marked with Inline to have only one constructor,"
+ " or be used via node factories.";

for (Inline inAn : ann) {
assert !"".equals(inAn.selector());
Expand Down
3 changes: 2 additions & 1 deletion src/trufflesom/src/bdt/inlining/NodeState.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* required state.
* It is thus merely a marker interface.
*
* <p>Node state can typically include information about lexical bindings, for instance in form
* <p>
* Node state can typically include information about lexical bindings, for instance in form
* of unique identifiers, which might be class names or ids of mixins or similar lexical
* constructs.
*/
Expand Down
9 changes: 6 additions & 3 deletions src/trufflesom/src/bdt/inlining/Scope.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
* {@link Variable} definitions that belong together, usually based on the textual/language
* properties of the implemented language.
*
* <p>Many languages use lexical scopes, i.e., grouping of variables based on textual elements.
* <p>
* Many languages use lexical scopes, i.e., grouping of variables based on textual elements.
* Often such groups are delimited by parentheses or other indicators for textual blocks.
*
* <p>Scopes are expected to form a chain from the inner to the outer scopes.
* <p>
* Scopes are expected to form a chain from the inner to the outer scopes.
*
* @param <This> the concrete type of the scope
* @param <MethodT> the type for a run-time representation of a method, block, lambda,
Expand All @@ -24,7 +26,8 @@ public interface Scope<This extends Scope<This, MethodT>, MethodT> {
/**
* The set of variables defined by this scope.
*
* <p>The set excludes variables that are defined in other scopes, even if they might be
* <p>
* The set excludes variables that are defined in other scopes, even if they might be
* logically part of the set from language perspective, perhaps because of nesting scopes.
*
* @param <T> the type of the {@link Variable} implementation
Expand Down
9 changes: 6 additions & 3 deletions src/trufflesom/src/bdt/inlining/nodes/Inlinable.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
/**
* <code>Inlinable</code> nodes can be replaced, inlined with arbitrary other nodes.
*
* <p>Note, {@link Inlinable} is different from {@link Inline}. Nodes marked
* <p>
* Note, {@link Inlinable} is different from {@link Inline}. Nodes marked
* with @{@link Inline} are replacing more general nodes, which typically have
* <code>Inlinable</code> nodes as their children.
*
* <p>In most cases, the replacement nodes for an <code>Inlinable</code> node will be at least
* <p>
* In most cases, the replacement nodes for an <code>Inlinable</code> node will be at least
* logically sub-nodes of the inlinable node.
*
* <p>An example for an <code>Inlinable</code> node is a lambda (closure, block) that
* <p>
* An example for an <code>Inlinable</code> node is a lambda (closure, block) that
* represents for instance the body of a for-each operation. The for-each operation can be
* annotated with @{@link Inline}, so that it's children, which include the node representing
* the lambda are then inlined. Concretely, the node to replace the <code>Inlinable</code> node
Expand Down
6 changes: 4 additions & 2 deletions src/trufflesom/src/trufflesom/compiler/Variable.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public boolean equals(final Object o) {
return true;
}
assert coord == 0
|| coord != var.coord : "Why are there multiple objects for this source section? might need to fix comparison above";
|| coord != var.coord
: "Why are there multiple objects for this source section? might need to fix comparison above";
return false;
}

Expand Down Expand Up @@ -204,7 +205,8 @@ public ExpressionNode getWriteNode(final int contextLevel,
}

public final FrameDescriptor getFrameDescriptor() {
assert descriptor != null : "Locals need to be initialized with a frame descriptior. Call init(.) first!";
assert descriptor != null
: "Locals need to be initialized with a frame descriptior. Call init(.) first!";
return descriptor;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ public void patchJumpOffsetToPointToNextInstruction(final int idxOfOffset,
int instructionStart = idxOfOffset - 1;
byte bytecodeBeforeOffset = bytecode.get(instructionStart);
assert isOneOf(bytecodeBeforeOffset,
JUMP_BYTECODES) : "Expected to patch a JUMP instruction, but got bc: "
JUMP_BYTECODES)
: "Expected to patch a JUMP instruction, but got bc: "
+ bytecodeBeforeOffset;
assert (JUMP2 - JUMP) == Bytecodes.NUM_1_BYTE_JUMP_BYTECODES // ~
: "There's an unexpected number of JUMP bytecodes. Need to adapt the code below";
Expand Down
6 changes: 4 additions & 2 deletions src/trufflesom/src/trufflesom/interpreter/bc/Bytecodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ public static final boolean isOneOf(final byte bytecode, final byte[] arr) {
"Q_SEND_3 ",
};

assert PADDED_BYTECODE_NAMES.length == NUM_BYTECODES : "Inconsistency between number of bytecodes and defined padded names";
assert PADDED_BYTECODE_NAMES.length == NUM_BYTECODES
: "Inconsistency between number of bytecodes and defined padded names";

BYTECODE_NAMES = Stream.of(PADDED_BYTECODE_NAMES).map(String::trim).toArray(String[]::new);

Expand Down Expand Up @@ -331,6 +332,7 @@ public static final boolean isOneOf(final byte bytecode, final byte[] arr) {
2, // Q_SEND_3
};

assert BYTECODE_LENGTH.length == NUM_BYTECODES : "The BYTECODE_LENGTH array is not having the same size as number of bytecodes";
assert BYTECODE_LENGTH.length == NUM_BYTECODES
: "The BYTECODE_LENGTH array is not having the same size as number of bytecodes";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
import trufflesom.vmobjects.SSymbol;


public abstract class LocalVariableNode extends NoPreEvalExprNode implements Invocation<SSymbol> {
public abstract class LocalVariableNode extends NoPreEvalExprNode
implements Invocation<SSymbol> {
protected final int slotIndex;
protected final Local local;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,8 @@ private void prepareBackJumpToCurrentAddress(final PriorityQueue<BackJump> backJ
final BytecodeMethodGenContext mgenc) {
while (backJumps != null && !backJumps.isEmpty() && backJumps.peek().loopBeginIdx <= i) {
BackJump jump = backJumps.poll();
assert jump.loopBeginIdx == i : "we use the less or equal, but actually expect it to be strictly equal";
assert jump.loopBeginIdx == i
: "we use the less or equal, but actually expect it to be strictly equal";
backJumpsToPatch.add(
new BackJumpPatch(jump.backwardsJumpIdx, mgenc.offsetOfNextInstruction()));
}
Expand All @@ -1352,7 +1353,8 @@ private void patchJumpToCurrentAddress(final int i, final PriorityQueue<Jump> ju
final BytecodeMethodGenContext mgenc) throws ParseError {
while (!jumps.isEmpty() && jumps.peek().originalTarget <= i) {
Jump j = jumps.poll();
assert j.originalTarget == i : "we use the less or equal, but actually expect it to be strictly equal";
assert j.originalTarget == i
: "we use the less or equal, but actually expect it to be strictly equal";
mgenc.patchJumpOffsetToPointToNextInstruction(j.offsetIdx, null);
}
}
Expand Down Expand Up @@ -1593,7 +1595,8 @@ private void inlineInto(final BytecodeMethodGenContext mgenc,
case JUMP_BACKWARDS:
case JUMP2_BACKWARDS: {
BackJumpPatch backJumpPatch = backJumps.poll();
assert backJumpPatch.backwardsJumpIdx == i : "Jump should match with jump instruction";
assert backJumpPatch.backwardsJumpIdx == i
: "Jump should match with jump instruction";
mgenc.emitBackwardsJumpOffsetToTarget(backJumpPatch.jumpTargetAddress, null);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ protected GenericMessageSendNode makeGenericSend(final SSymbol selector) {
return send;
}

assert getParent() instanceof BytecodeLoopNode : "This node was expected to be a direct child of a `BytecodeLoopNode`.";
assert getParent() instanceof BytecodeLoopNode
: "This node was expected to be a direct child of a `BytecodeLoopNode`.";
throw new RespecializeException(send);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ protected GenericMessageSendNode makeGenericSend(final SSymbol selector) {
return send;
}

assert getParent() instanceof BytecodeLoopNode : "This node was expected to be a direct child of a `BytecodeLoopNode`.";
assert getParent() instanceof BytecodeLoopNode
: "This node was expected to be a direct child of a `BytecodeLoopNode`.";
throw new RespecializeException(send);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ protected GenericMessageSendNode makeGenericSend(final SSymbol selector) {
return send;
}

assert getParent() instanceof BytecodeLoopNode : "This node was expected to be a direct child of a `BytecodeLoopNode`.";
assert getParent() instanceof BytecodeLoopNode
: "This node was expected to be a direct child of a `BytecodeLoopNode`.";
throw new RespecializeException(send);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ protected GenericMessageSendNode makeGenericSend(final SSymbol selector) {
return send;
}

assert getParent() instanceof BytecodeLoopNode : "This node was expected to be a direct child of a `BytecodeLoopNode`.";
assert getParent() instanceof BytecodeLoopNode
: "This node was expected to be a direct child of a `BytecodeLoopNode`.";
throw new RespecializeException(send);
}
}
3 changes: 2 additions & 1 deletion src/trufflesom/src/trufflesom/primitives/Primitives.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ protected void registerPrimitive(
primsForClass.put(signature, specializer);
} else {
assert "".equals(primName) && "".equals(
className) : "If either primitive() or className() is set on @Primitive, both should be set";
className)
: "If either primitive() or className() is set on @Primitive, both should be set";
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/trufflesom/src/trufflesom/vm/Universe.java
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ private static Object execute(final String[] arguments) {
@TruffleBoundary
public static void initializeObjectSystem() {
CompilerAsserts.neverPartOfCompilation();
assert classPath != null : "The classpath hasn't been initialized. Was setupClassPath() called?";
assert classPath != null
: "The classpath hasn't been initialized. Was setupClassPath() called?";

if (alreadyInitialized) {
return;
Expand Down

0 comments on commit 6f2a0b6

Please sign in to comment.