Skip to content

Commit

Permalink
fix some minor issues to make all the tests pass again after v2.2 is …
Browse files Browse the repository at this point in the history
…complete!
  • Loading branch information
Santiago Ontañón authored and Santiago Ontañón committed Nov 20, 2021
1 parent be6be2d commit 124ec94
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/code/Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ public Object evaluateInternal(CodeStatement s, CodeBase code, boolean silent, C
case EXPRESSION_SYMBOL: {
if (symbolName.equals(CodeBase.CURRENT_ADDRESS)) {
if (s != null) {
return (s.getAddressInternal(code, true, previous, variableStack) & 0xffff);
// return (s.getAddressInternal(code, true, previous, variableStack) & 0xffff);
return s.getAddressInternal(code, true, previous, variableStack);
} else {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/parser/LineParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ && isKeyword(tokens.get(1),KEYWORD_COLON)) {
config.error("Problem defining symbol " + labelPrefix + token + " in " + sl);
return false;
}
if (!scope) {
if (!scope && c.relativeTo == null) {
c.name = c.originalName;
}
s.type = CodeStatement.STATEMENT_NONE;
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/workers/searchopt/SearchBasedOptimizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,13 @@ private boolean preventOptimization(CodeStatement s, CodeBase code)
}
}

// If a value is being assigned to "R", we do not try to optimize that, since
// the optimizer will try to remove that assignment, which is usually wrong:
if (s.op.isLd() && s.op.args.get(0).registerOrFlagName != null &&
s.op.args.get(0).registerOrFlagName.equalsIgnoreCase("r")) {
return true;
}

for(int i = 0;i<s.op.spec.args.size();i++) {
if (s.op.spec.args.get(i).wordConstantIndirectionAllowed ||
s.op.spec.args.get(i).regIndirection != null ||
Expand Down Expand Up @@ -1195,7 +1202,7 @@ List<RegisterNames> findRegistersUsedAfter(List<CodeStatement> l, SourceFile f,
if (used) registers.add(reg);
}
}

return registers;
}

Expand Down

0 comments on commit 124ec94

Please sign in to comment.