Skip to content

Commit a33ffee

Browse files
authored
Process linter issues and remove unused virtual frame arguments (#195)
2 parents 20f8545 + 5c92231 commit a33ffee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+185
-138
lines changed

src/trufflesom/src/trufflesom/bdt/inlining/InlinableNodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ public InlinableNodes(final IdProvider<Id> ids,
5050
initializeFactories(inlinableFactories);
5151
}
5252

53-
private void initializeNodes(final List<Class<? extends Node>> inlinableNodes) {
54-
if (inlinableNodes == null) {
53+
private void initializeNodes(final List<Class<? extends Node>> nodes) {
54+
if (nodes == null) {
5555
return;
5656
}
5757

58-
for (Class<? extends Node> nodeClass : inlinableNodes) {
58+
for (Class<? extends Node> nodeClass : nodes) {
5959
Inline[] ann = getInlineAnnotation(nodeClass);
6060
assert ann != null;
6161

src/trufflesom/src/trufflesom/bdt/primitives/Specializer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public String getName() {
6262
return fact.getClass().getSimpleName();
6363
}
6464

65-
public boolean matches(final Object[] args, final ExprT[] argNodes) {
65+
public boolean matches(final Object[] args,
66+
@SuppressWarnings("unused") final ExprT[] argNodes) {
6667
// TODO: figure out whether we really want it like this with a VmSetting, or whether
6768
// there should be something on the context
6869
// TODO: with the dynamic metrics setting gone, this assertion isn't useful anymore

src/trufflesom/src/trufflesom/compiler/ClassGenerationContext.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,23 @@ public void addClassMethod(final SInvokable meth, final Parser<?> parser) throws
147147
}
148148
}
149149

150-
public Field addInstanceField(final SSymbol name, final long coord) {
150+
public Field addInstanceField(final SSymbol fieldName, final long coord) {
151151
int length = SourceCoordinate.getLength(coord);
152-
assert name.getString().length() == length;
152+
assert fieldName.getString().length() == length;
153153

154-
Field f = new Field(instanceFields.size(), name, coord);
154+
Field f = new Field(instanceFields.size(), fieldName, coord);
155155
instanceFields.add(f);
156156
if (structuralProbe != null) {
157157
structuralProbe.recordNewSlot(f);
158158
}
159159
return f;
160160
}
161161

162-
public Field addClassField(final SSymbol name, final long coord) {
162+
public Field addClassField(final SSymbol fieldName, final long coord) {
163163
int length = SourceCoordinate.getLength(coord);
164-
assert name.getString().length() == length;
164+
assert fieldName.getString().length() == length;
165165

166-
Field f = new Field(classFields.size(), name, coord);
166+
Field f = new Field(classFields.size(), fieldName, coord);
167167
classFields.add(f);
168168
if (structuralProbe != null) {
169169
structuralProbe.recordNewSlot(f);

src/trufflesom/src/trufflesom/compiler/MethodGenerationContext.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ public final SInvokable assemble(final ExpressionNode body, final long coord) {
224224
return assembleMethod(body, coord);
225225
}
226226

227-
protected SMethod assembleMethod(ExpressionNode body, final long coord) {
227+
protected SMethod assembleMethod(final ExpressionNode methodBody, final long coord) {
228+
ExpressionNode body = methodBody;
228229
if (needsToCatchNonLocalReturn()) {
229230
body = new CatchNonLocalReturnNode(
230231
body, getFrameOnStackMarker(coord)).initialize(body.getSourceCoordinate());
@@ -538,7 +539,8 @@ public SSymbol getSignature() {
538539
return signature;
539540
}
540541

541-
private static String stripColonsAndSourceLocation(String str) {
542+
private static String stripColonsAndSourceLocation(final String s) {
543+
String str = s;
542544
int startOfSource = str.indexOf('@');
543545
if (startOfSource > -1) {
544546
str = str.substring(0, startOfSource);

src/trufflesom/src/trufflesom/compiler/Parser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ protected int getStartIndex() {
242242
}
243243

244244
protected abstract MGenC createMGenC(ClassGenerationContext cgenc,
245-
StructuralProbe<SSymbol, SClass, SInvokable, Field, Variable> structuralProbe);
245+
StructuralProbe<SSymbol, SClass, SInvokable, Field, Variable> structProbe);
246246

247247
public void classdef(final ClassGenerationContext cgenc) throws ProgramDefinitionError {
248248
int coord = getStartIndex();

src/trufflesom/src/trufflesom/compiler/ParserAst.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public ParserAst(final String content, final Source source,
6060

6161
@Override
6262
protected MethodGenerationContext createMGenC(final ClassGenerationContext cgenc,
63-
final StructuralProbe<SSymbol, SClass, SInvokable, Field, Variable> structuralProbe) {
64-
return new MethodGenerationContext(cgenc, structuralProbe);
63+
final StructuralProbe<SSymbol, SClass, SInvokable, Field, Variable> structProbe) {
64+
return new MethodGenerationContext(cgenc, structProbe);
6565
}
6666

6767
@Override

src/trufflesom/src/trufflesom/compiler/ParserBc.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public ParserBc(final String content, final Source source,
6060

6161
@Override
6262
protected BytecodeMethodGenContext createMGenC(final ClassGenerationContext cgenc,
63-
final StructuralProbe<SSymbol, SClass, SInvokable, Field, Variable> structuralProbe) {
64-
return new BytecodeMethodGenContext(cgenc, structuralProbe);
63+
final StructuralProbe<SSymbol, SClass, SInvokable, Field, Variable> structProbe) {
64+
return new BytecodeMethodGenContext(cgenc, structProbe);
6565
}
6666

6767
@Override

src/trufflesom/src/trufflesom/compiler/Variable.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public String toString() {
5454
}
5555

5656
@Override
57-
public abstract ExpressionNode getReadNode(int contextLevel, long coord);
57+
public abstract ExpressionNode getReadNode(int contextLevel, long coordinate);
5858

5959
protected abstract void emitPop(BytecodeMethodGenContext mgenc);
6060

@@ -115,25 +115,26 @@ public Local splitToMergeIntoOuterScope(final int newSlotIndex) {
115115
}
116116

117117
@Override
118-
public ExpressionNode getReadNode(final int contextLevel, final long coord) {
118+
public ExpressionNode getReadNode(final int contextLevel, final long coordinate) {
119119
transferToInterpreterAndInvalidate();
120120

121121
if (contextLevel == 0) {
122-
return new LocalArgumentReadNode(this).initialize(coord);
122+
return new LocalArgumentReadNode(this).initialize(coordinate);
123123
} else {
124-
return new NonLocalArgumentReadNode(this, contextLevel).initialize(coord);
124+
return new NonLocalArgumentReadNode(this, contextLevel).initialize(coordinate);
125125
}
126126
}
127127

128128
@Override
129129
public ExpressionNode getWriteNode(final int contextLevel,
130-
final ExpressionNode valueExpr, final long coord) {
130+
final ExpressionNode valueExpr, final long coordinate) {
131131
transferToInterpreterAndInvalidate();
132132

133133
if (contextLevel == 0) {
134-
return new LocalArgumentWriteNode(this, valueExpr).initialize(coord);
134+
return new LocalArgumentWriteNode(this, valueExpr).initialize(coordinate);
135135
} else {
136-
return new NonLocalArgumentWriteNode(this, contextLevel, valueExpr).initialize(coord);
136+
return new NonLocalArgumentWriteNode(this, contextLevel, valueExpr).initialize(
137+
coordinate);
137138
}
138139
}
139140

@@ -165,17 +166,17 @@ public static class Local extends Variable {
165166
this.descriptor = descriptor;
166167
}
167168

168-
public void init(final FrameDescriptor descriptor) {
169-
this.descriptor = descriptor;
169+
public void init(final FrameDescriptor desc) {
170+
this.descriptor = desc;
170171
}
171172

172173
@Override
173-
public ExpressionNode getReadNode(final int contextLevel, final long coord) {
174+
public ExpressionNode getReadNode(final int contextLevel, final long coordinate) {
174175
transferToInterpreterAndInvalidate();
175176
if (contextLevel > 0) {
176-
return NonLocalVariableReadNodeGen.create(contextLevel, this).initialize(coord);
177+
return NonLocalVariableReadNodeGen.create(contextLevel, this).initialize(coordinate);
177178
}
178-
return LocalVariableReadNodeGen.create(this).initialize(coord);
179+
return LocalVariableReadNodeGen.create(this).initialize(coordinate);
179180
}
180181

181182
public final int getIndex() {
@@ -194,13 +195,13 @@ public Local splitToMergeIntoOuterScope(final int newSlotIndex) {
194195

195196
@Override
196197
public ExpressionNode getWriteNode(final int contextLevel,
197-
final ExpressionNode valueExpr, final long coord) {
198+
final ExpressionNode valueExpr, final long coordinate) {
198199
transferToInterpreterAndInvalidate();
199200
if (contextLevel > 0) {
200201
return NonLocalVariableWriteNodeGen.create(contextLevel, this, valueExpr)
201-
.initialize(coord);
202+
.initialize(coordinate);
202203
}
203-
return LocalVariableWriteNodeGen.create(this, valueExpr).initialize(coord);
204+
return LocalVariableWriteNodeGen.create(this, valueExpr).initialize(coordinate);
204205
}
205206

206207
public final FrameDescriptor getFrameDescriptor() {
@@ -232,7 +233,7 @@ public Internal(final SSymbol name, final long coord,
232233
}
233234

234235
@Override
235-
public ExpressionNode getReadNode(final int contextLevel, final long coord) {
236+
public ExpressionNode getReadNode(final int contextLevel, final long coordinate) {
236237
throw new UnsupportedOperationException(
237238
"There shouldn't be any language-level read nodes for internal slots. "
238239
+ "They are used directly by other nodes.");

src/trufflesom/src/trufflesom/interpreter/Invokable.java

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

33
import com.oracle.truffle.api.frame.FrameDescriptor;
4+
import com.oracle.truffle.api.nodes.Node;
45
import com.oracle.truffle.api.nodes.RootNode;
56
import com.oracle.truffle.api.source.Source;
67
import com.oracle.truffle.api.source.SourceSection;
@@ -32,7 +33,7 @@ protected Invokable(final String name, final Source source, final long sourceCoo
3233

3334
@SuppressWarnings("unchecked")
3435
@Override
35-
public Invokable initialize(final long sourceCoord) {
36+
public <T extends Node> T initialize(final long coord) {
3637
throw new UnsupportedOperationException();
3738
}
3839

@@ -97,6 +98,7 @@ public PreevaluatedExpression copyTrivialNode() {
9798
return null;
9899
}
99100

101+
@SuppressWarnings("unused")
100102
public AbstractDispatchNode asDispatchNode(final Object rcvr,
101103
final AbstractDispatchNode next) {
102104
return null;

src/trufflesom/src/trufflesom/interpreter/LexicalScope.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,17 @@ public Variable[] getVariables() {
209209
}
210210

211211
@Override
212-
public LexicalScope getScope(final Method method) {
213-
if (method.equals(this.method)) {
212+
public LexicalScope getScope(final Method m) {
213+
if (m.equals(this.method)) {
214214
return this;
215215
}
216216

217217
if (embeddedScopes == null) {
218218
return null;
219219
}
220220

221-
for (LexicalScope m : embeddedScopes) {
222-
LexicalScope result = m.getScope(method);
221+
for (LexicalScope scope : embeddedScopes) {
222+
LexicalScope result = scope.getScope(m);
223223
if (result != null) {
224224
return result;
225225
}

0 commit comments

Comments
 (0)