more-detailed source mapping information
This commit is contained in:
parent
8005b665b9
commit
6b2db3e190
|
@ -500,11 +500,15 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
|
|
||||||
private Position[] instructionPositions;
|
private Position[] instructionPositions;
|
||||||
|
|
||||||
AstDebuggingInformation(Position codeBodyPosition, Position[] instructionPositions, String[] names) {
|
private Position[][] operandPositions;
|
||||||
|
|
||||||
|
AstDebuggingInformation(Position codeBodyPosition, Position[] instructionPositions, Position[][] operandPositions, String[] names) {
|
||||||
this.codeBodyPosition = codeBodyPosition;
|
this.codeBodyPosition = codeBodyPosition;
|
||||||
|
|
||||||
this.instructionPositions = instructionPositions;
|
this.instructionPositions = instructionPositions;
|
||||||
|
|
||||||
|
this.operandPositions = operandPositions;
|
||||||
|
|
||||||
valueNumberNames = new String[names.length][];
|
valueNumberNames = new String[names.length][];
|
||||||
for (int i = 0; i < names.length; i++) {
|
for (int i = 0; i < names.length; i++) {
|
||||||
if (names[i] != null) {
|
if (names[i] != null) {
|
||||||
|
@ -525,6 +529,15 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
return instructionPositions[instructionOffset];
|
return instructionPositions[instructionOffset];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Position getOperandPosition(int instructionOffset, int operand) {
|
||||||
|
if (operandPositions[instructionOffset] != null && operandPositions[instructionOffset].length > operand) {
|
||||||
|
return operandPositions[instructionOffset][operand];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[][] getSourceNamesForValues() {
|
public String[][] getSourceNamesForValues() {
|
||||||
return valueNumberNames;
|
return valueNumberNames;
|
||||||
|
@ -837,6 +850,8 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
|
|
||||||
private Position[] linePositions = new Position[10];
|
private Position[] linePositions = new Position[10];
|
||||||
|
|
||||||
|
private Position[][] operandPositions = new Position[10][];
|
||||||
|
|
||||||
private boolean hasCatchBlock = false;
|
private boolean hasCatchBlock = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1067,13 +1082,24 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
* mark the current position as the position for the instruction
|
* mark the current position as the position for the instruction
|
||||||
*/
|
*/
|
||||||
private void noteLinePosition(int instruction) {
|
private void noteLinePosition(int instruction) {
|
||||||
if (linePositions.length < (instruction + 1)) {
|
ensurePositionSpace(instruction);
|
||||||
Position[] newData = new Position[instruction * 2 + 1];
|
linePositions[instruction] = getCurrentPosition();
|
||||||
System.arraycopy(linePositions, 0, newData, 0, linePositions.length);
|
|
||||||
linePositions = newData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
linePositions[instruction] = getCurrentPosition();
|
private void ensurePositionSpace(int instruction) {
|
||||||
|
if (linePositions.length < (instruction + 1)) {
|
||||||
|
Position[] newData = new Position[instruction * 2 + 1];
|
||||||
|
Position[][] newOperands = new Position[instruction * 2 + 1][];
|
||||||
|
System.arraycopy(linePositions, 0, newData, 0, linePositions.length);
|
||||||
|
linePositions = newData;
|
||||||
|
System.arraycopy(operandPositions, 0, newOperands, 0, operandPositions.length);
|
||||||
|
operandPositions = newOperands;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void noteOperands(int instruction, Position... operands) {
|
||||||
|
ensurePositionSpace(instruction);
|
||||||
|
operandPositions[instruction] = operands;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInstruction(SSAInstruction n) {
|
public void addInstruction(SSAInstruction n) {
|
||||||
|
@ -1118,6 +1144,10 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Position[][] getOperandPositionMap() {
|
||||||
|
return operandPositions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3310,6 +3340,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
Map<IBasicBlock<SSAInstruction>,TypeReference[]> catchTypes = functionContext.getCatchTypes();
|
Map<IBasicBlock<SSAInstruction>,TypeReference[]> catchTypes = functionContext.getCatchTypes();
|
||||||
AstCFG cfg = new AstCFG(n, functionContext.cfg(), symtab, insts);
|
AstCFG cfg = new AstCFG(n, functionContext.cfg(), symtab, insts);
|
||||||
Position[] line = functionContext.cfg().getLinePositionMap();
|
Position[] line = functionContext.cfg().getLinePositionMap();
|
||||||
|
Position[][] operand = functionContext.cfg().getOperandPositionMap();
|
||||||
boolean katch = functionContext.cfg().hasCatchBlock();
|
boolean katch = functionContext.cfg().hasCatchBlock();
|
||||||
boolean monitor = functionContext.cfg().hasMonitorOp();
|
boolean monitor = functionContext.cfg().hasMonitorOp();
|
||||||
String[] nms = makeNameMap(n, functionContext.entityScopes(), cfg.getInstructions());
|
String[] nms = makeNameMap(n, functionContext.entityScopes(), cfg.getInstructions());
|
||||||
|
@ -3328,7 +3359,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
functionContext.exposeNameSet(n, true),
|
functionContext.exposeNameSet(n, true),
|
||||||
functionContext.getAccesses(n));
|
functionContext.getAccesses(n));
|
||||||
|
|
||||||
DebuggingInformation DBG = new AstDebuggingInformation(n.getPosition(), line, nms);
|
DebuggingInformation DBG = new AstDebuggingInformation(n.getPosition(), line, operand, nms);
|
||||||
|
|
||||||
// actually make code body
|
// actually make code body
|
||||||
defineFunction(n, parentContext, cfg, symtab, katch, catchTypes, monitor, LI, DBG);
|
defineFunction(n, parentContext, cfg, symtab, katch, catchTypes, monitor, LI, DBG);
|
||||||
|
@ -3669,9 +3700,11 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
|
|
||||||
boolean mayBeInteger = handleBinaryOpThrow(n, n.getChild(0), context);
|
boolean mayBeInteger = handleBinaryOpThrow(n, n.getChild(0), context);
|
||||||
|
|
||||||
|
int currentInstruction = context.cfg().currentInstruction;
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
insts.BinaryOpInstruction(context.cfg().currentInstruction, translateBinaryOpcode(n.getChild(0)), false, false, result, c.getValue(l), c.getValue(r),
|
insts.BinaryOpInstruction(currentInstruction, translateBinaryOpcode(n.getChild(0)), false, false, result, c.getValue(l), c.getValue(r),
|
||||||
mayBeInteger));
|
mayBeInteger));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(l), context.getSourceMap().getPosition(r));
|
||||||
|
|
||||||
if (mayBeInteger) {
|
if (mayBeInteger) {
|
||||||
context.cfg().newBlock(true);
|
context.cfg().newBlock(true);
|
||||||
|
@ -3691,7 +3724,9 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
WalkContext context = c;
|
WalkContext context = c;
|
||||||
int result = c.getValue(n);
|
int result = c.getValue(n);
|
||||||
CAstNode v = n.getChild(1);
|
CAstNode v = n.getChild(1);
|
||||||
context.cfg().addInstruction(insts.UnaryOpInstruction(context.cfg().currentInstruction, translateUnaryOpcode(n.getChild(0)), result, c.getValue(v)));
|
int currentInstruction = context.cfg().currentInstruction;
|
||||||
|
context.cfg().addInstruction(insts.UnaryOpInstruction(currentInstruction, translateUnaryOpcode(n.getChild(0)), result, c.getValue(v)));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3706,8 +3741,11 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
protected void leaveArrayLength(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
protected void leaveArrayLength(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
||||||
WalkContext context = c;
|
WalkContext context = c;
|
||||||
int result = c.getValue(n);
|
int result = c.getValue(n);
|
||||||
int arrayValue = c.getValue(n.getChild(0));
|
CAstNode arrayExpr = n.getChild(0);
|
||||||
context.cfg().addInstruction(insts.ArrayLengthInstruction(context.cfg().currentInstruction, result, arrayValue));
|
int arrayValue = c.getValue(arrayExpr);
|
||||||
|
int currentInstruction = context.cfg().currentInstruction;
|
||||||
|
context.cfg().addInstruction(insts.ArrayLengthInstruction(currentInstruction, result, arrayValue));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(arrayExpr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3760,10 +3798,13 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
@Override
|
@Override
|
||||||
protected void leaveReturn(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
protected void leaveReturn(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
||||||
WalkContext context = c;
|
WalkContext context = c;
|
||||||
|
int currentInstruction = context.cfg().currentInstruction;
|
||||||
if (n.getChildCount() > 0) {
|
if (n.getChildCount() > 0) {
|
||||||
context.cfg().addInstruction(insts.ReturnInstruction(context.cfg().currentInstruction, c.getValue(n.getChild(0)), false));
|
CAstNode returnExpr = n.getChild(0);
|
||||||
|
context.cfg().addInstruction(insts.ReturnInstruction(currentInstruction, c.getValue(returnExpr), false));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(returnExpr));
|
||||||
} else {
|
} else {
|
||||||
context.cfg().addInstruction(insts.ReturnInstruction(context.cfg().currentInstruction));
|
context.cfg().addInstruction(insts.ReturnInstruction(currentInstruction));
|
||||||
}
|
}
|
||||||
|
|
||||||
context.cfg().addPreNode(n, context.getUnwindState());
|
context.cfg().addPreNode(n, context.getUnwindState());
|
||||||
|
@ -3779,14 +3820,21 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
@Override
|
@Override
|
||||||
protected void leaveIfgoto(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
protected void leaveIfgoto(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
||||||
WalkContext context = c;
|
WalkContext context = c;
|
||||||
|
int currentInstruction = context.cfg().currentInstruction;
|
||||||
if (n.getChildCount() == 1) {
|
if (n.getChildCount() == 1) {
|
||||||
|
CAstNode arg = n.getChild(0);
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
insts.ConditionalBranchInstruction(context.cfg().currentInstruction, translateConditionOpcode(CAstOperator.OP_NE), null, c.getValue(n.getChild(0)), context
|
insts.ConditionalBranchInstruction(currentInstruction, translateConditionOpcode(CAstOperator.OP_NE), null, c.getValue(arg), context
|
||||||
.currentScope().getConstantValue(new Integer(0)), -1));
|
.currentScope().getConstantValue(new Integer(0)), -1));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(arg));
|
||||||
} else if (n.getChildCount() == 3) {
|
} else if (n.getChildCount() == 3) {
|
||||||
|
CAstNode op = n.getChild(0);
|
||||||
|
CAstNode leftExpr = n.getChild(1);
|
||||||
|
CAstNode rightExpr = n.getChild(2);
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
insts.ConditionalBranchInstruction(context.cfg().currentInstruction, translateConditionOpcode(n.getChild(0)), null, c.getValue(n.getChild(1)),
|
insts.ConditionalBranchInstruction(currentInstruction, translateConditionOpcode(op), null, c.getValue(leftExpr),
|
||||||
c.getValue(n.getChild(2)), -1));
|
c.getValue(rightExpr), -1));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(leftExpr), context.getSourceMap().getPosition(rightExpr));
|
||||||
} else {
|
} else {
|
||||||
Assertions.UNREACHABLE();
|
Assertions.UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
@ -3838,16 +3886,21 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
// conditional
|
// conditional
|
||||||
CAstNode l = n.getChild(0);
|
CAstNode l = n.getChild(0);
|
||||||
visitor.visit(l, context, visitor);
|
visitor.visit(l, context, visitor);
|
||||||
|
int currentInstruction = context.cfg().getCurrentInstruction();
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
insts.ConditionalBranchInstruction(context.cfg().currentInstruction, translateConditionOpcode(CAstOperator.OP_EQ), null, c.getValue(l), context.currentScope()
|
insts.ConditionalBranchInstruction(currentInstruction, translateConditionOpcode(CAstOperator.OP_EQ), null, c.getValue(l), context.currentScope()
|
||||||
.getConstantValue(new Integer(0)), -1));
|
.getConstantValue(new Integer(0)), -1));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(l));
|
||||||
PreBasicBlock srcB = context.cfg().getCurrentBlock();
|
PreBasicBlock srcB = context.cfg().getCurrentBlock();
|
||||||
// true clause
|
// true clause
|
||||||
context.cfg().newBlock(true);
|
context.cfg().newBlock(true);
|
||||||
CAstNode r = n.getChild(1);
|
CAstNode r = n.getChild(1);
|
||||||
visitor.visit(r, context, visitor);
|
visitor.visit(r, context, visitor);
|
||||||
if (isExpr)
|
if (isExpr) {
|
||||||
context.cfg().addInstruction(new AssignInstruction(context.cfg().currentInstruction, c.getValue(n), c.getValue(r)));
|
currentInstruction = context.cfg().getCurrentInstruction();
|
||||||
|
context.cfg().addInstruction(new AssignInstruction(currentInstruction, c.getValue(n), c.getValue(r)));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(r));
|
||||||
|
}
|
||||||
if (n.getChildCount() == 3) {
|
if (n.getChildCount() == 3) {
|
||||||
if (!context.cfg().isDeadBlock(context.cfg().getCurrentBlock())) {
|
if (!context.cfg().isDeadBlock(context.cfg().getCurrentBlock())) {
|
||||||
context.cfg().addInstruction(insts.GotoInstruction(context.cfg().currentInstruction, -1));
|
context.cfg().addInstruction(insts.GotoInstruction(context.cfg().currentInstruction, -1));
|
||||||
|
@ -3861,8 +3914,11 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
CAstNode f = n.getChild(2);
|
CAstNode f = n.getChild(2);
|
||||||
context.cfg().deadBlocks.remove(falseB);
|
context.cfg().deadBlocks.remove(falseB);
|
||||||
visitor.visit(f, context, visitor);
|
visitor.visit(f, context, visitor);
|
||||||
if (isExpr)
|
if (isExpr) {
|
||||||
context.cfg().addInstruction(new AssignInstruction(context.cfg().currentInstruction, c.getValue(n), c.getValue(f)));
|
currentInstruction = context.cfg().currentInstruction;
|
||||||
|
context.cfg().addInstruction(new AssignInstruction(currentInstruction, c.getValue(n), c.getValue(f)));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// end
|
// end
|
||||||
|
@ -4027,8 +4083,10 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
|
|
||||||
boolean mayBeInteger = handleBinaryOpThrow(a, op, context);
|
boolean mayBeInteger = handleBinaryOpThrow(a, op, context);
|
||||||
|
|
||||||
|
int currentInstruction = context.cfg().getCurrentInstruction();
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
insts.BinaryOpInstruction(context.cfg().currentInstruction, translateBinaryOpcode(op), false, false, temp2, temp, rval, mayBeInteger));
|
insts.BinaryOpInstruction(currentInstruction, translateBinaryOpcode(op), false, false, temp2, temp, rval, mayBeInteger));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(a.getChild(0)), context.getSourceMap().getPosition(v));
|
||||||
|
|
||||||
if (mayBeInteger) {
|
if (mayBeInteger) {
|
||||||
context.cfg().newBlock(true);
|
context.cfg().newBlock(true);
|
||||||
|
@ -4166,7 +4224,9 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
|
|
||||||
if (!pre) {
|
if (!pre) {
|
||||||
int ret = context.currentScope().allocateTempValue();
|
int ret = context.currentScope().allocateTempValue();
|
||||||
context.cfg().addInstruction(new AssignInstruction(context.cfg().currentInstruction, ret, temp));
|
int currentInstruction = context.cfg().getCurrentInstruction();
|
||||||
|
context.cfg().addInstruction(new AssignInstruction(currentInstruction, ret, temp));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(n.getChild(0)));
|
||||||
c.setValue(n, ret);
|
c.setValue(n, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4232,7 +4292,9 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
|
|
||||||
int defaultBlock = context.cfg().getCurrentBlock().getGraphNodeId() + 1;
|
int defaultBlock = context.cfg().getCurrentBlock().getGraphNodeId() + 1;
|
||||||
|
|
||||||
context.cfg().addInstruction(insts.SwitchInstruction(context.cfg().currentInstruction, v, defaultBlock, casesAndLabels));
|
int currentInstruction = context.cfg().getCurrentInstruction();
|
||||||
|
context.cfg().addInstruction(insts.SwitchInstruction(currentInstruction, v, defaultBlock, casesAndLabels));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(switchValue));
|
||||||
context.cfg().addPreNode(n, context.getUnwindState());
|
context.cfg().addPreNode(n, context.getUnwindState());
|
||||||
// PreBasicBlock switchB = context.cfg().getCurrentBlock();
|
// PreBasicBlock switchB = context.cfg().getCurrentBlock();
|
||||||
context.cfg().newBlock(true);
|
context.cfg().newBlock(true);
|
||||||
|
@ -4278,8 +4340,10 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
for (Object x : caseLabels) {
|
for (Object x : caseLabels) {
|
||||||
if (x != CAstControlFlowMap.SWITCH_DEFAULT) {
|
if (x != CAstControlFlowMap.SWITCH_DEFAULT) {
|
||||||
visitor.visit((CAstNode) x, context, visitor);
|
visitor.visit((CAstNode) x, context, visitor);
|
||||||
|
int currentInstruction = context.cfg().getCurrentInstruction();
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
insts.ConditionalBranchInstruction(context.cfg().currentInstruction, translateConditionOpcode(CAstOperator.OP_EQ), null, v, context.getValue((CAstNode) x), -1));
|
insts.ConditionalBranchInstruction(currentInstruction, translateConditionOpcode(CAstOperator.OP_EQ), null, v, context.getValue((CAstNode) x), -1));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(switchValue), context.getSourceMap().getPosition((CAstNode)x));
|
||||||
labelToBlock.put(x, context.cfg().getCurrentBlock());
|
labelToBlock.put(x, context.cfg().getCurrentBlock());
|
||||||
context.cfg().newBlock(true);
|
context.cfg().newBlock(true);
|
||||||
}
|
}
|
||||||
|
@ -4501,13 +4565,16 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
protected void leaveAssert(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
protected void leaveAssert(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
||||||
WalkContext context = c;
|
WalkContext context = c;
|
||||||
boolean fromSpec = true;
|
boolean fromSpec = true;
|
||||||
int result = c.getValue(n.getChild(0));
|
CAstNode assertion = n.getChild(0);
|
||||||
|
int result = c.getValue(assertion);
|
||||||
if (n.getChildCount() == 2) {
|
if (n.getChildCount() == 2) {
|
||||||
assert n.getChild(1).getKind() == CAstNode.CONSTANT;
|
assert n.getChild(1).getKind() == CAstNode.CONSTANT;
|
||||||
assert n.getChild(1).getValue() instanceof Boolean;
|
assert n.getChild(1).getValue() instanceof Boolean;
|
||||||
fromSpec = n.getChild(1).getValue().equals(Boolean.TRUE);
|
fromSpec = n.getChild(1).getValue().equals(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
context.cfg().addInstruction(new AstAssertInstruction(context.cfg().currentInstruction, result, fromSpec));
|
int currentInstruction = context.cfg().currentInstruction;
|
||||||
|
context.cfg().addInstruction(new AstAssertInstruction(currentInstruction, result, fromSpec));
|
||||||
|
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(assertion));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4519,7 +4586,9 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
protected void leaveEachElementGet(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
protected void leaveEachElementGet(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
||||||
int result = c.currentScope().allocateTempValue();
|
int result = c.currentScope().allocateTempValue();
|
||||||
c.setValue(n, result);
|
c.setValue(n, result);
|
||||||
c.cfg().addInstruction(new EachElementGetInstruction(c.cfg().currentInstruction, result, c.getValue(n.getChild(0)), c.getValue(n.getChild(1))));
|
int currentInstruction = c.cfg().getCurrentInstruction();
|
||||||
|
c.cfg().addInstruction(new EachElementGetInstruction(currentInstruction, result, c.getValue(n.getChild(0)), c.getValue(n.getChild(1))));
|
||||||
|
c.cfg().noteOperands(currentInstruction, c.getSourceMap().getPosition(n.getChild(0)), c.getSourceMap().getPosition(n.getChild(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4531,7 +4600,9 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
protected void leaveEachElementHasNext(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
protected void leaveEachElementHasNext(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
||||||
int result = c.currentScope().allocateTempValue();
|
int result = c.currentScope().allocateTempValue();
|
||||||
c.setValue(n, result);
|
c.setValue(n, result);
|
||||||
c.cfg().addInstruction(new EachElementHasNextInstruction(c.cfg().currentInstruction, result, c.getValue(n.getChild(0)), c.getValue(n.getChild(1))));
|
int currentInstruction = c.cfg().getCurrentInstruction();
|
||||||
|
c.cfg().addInstruction(new EachElementHasNextInstruction(currentInstruction, result, c.getValue(n.getChild(0)), c.getValue(n.getChild(1))));
|
||||||
|
c.cfg().noteOperands(currentInstruction, c.getSourceMap().getPosition(n.getChild(0)), c.getSourceMap().getPosition(n.getChild(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4561,11 +4632,14 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
@Override
|
@Override
|
||||||
protected void leaveIsDefinedExpr(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
protected void leaveIsDefinedExpr(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
||||||
WalkContext wc = c;
|
WalkContext wc = c;
|
||||||
int ref = c.getValue(n.getChild(0));
|
CAstNode refExpr = n.getChild(0);
|
||||||
|
int ref = c.getValue(refExpr);
|
||||||
int result = wc.currentScope().allocateTempValue();
|
int result = wc.currentScope().allocateTempValue();
|
||||||
c.setValue(n, result);
|
c.setValue(n, result);
|
||||||
if (n.getChildCount() == 1) {
|
if (n.getChildCount() == 1) {
|
||||||
wc.cfg().addInstruction(new AstIsDefinedInstruction(wc.cfg().currentInstruction, result, ref));
|
int currentInstruction = wc.cfg().getCurrentInstruction();
|
||||||
|
wc.cfg().addInstruction(new AstIsDefinedInstruction(currentInstruction, result, ref));
|
||||||
|
wc.cfg().noteOperands(currentInstruction, wc.getSourceMap().getPosition(refExpr));
|
||||||
} else {
|
} else {
|
||||||
doIsFieldDefined(wc, result, ref, n.getChild(1));
|
doIsFieldDefined(wc, result, ref, n.getChild(1));
|
||||||
}
|
}
|
||||||
|
@ -4581,11 +4655,15 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
||||||
WalkContext wc = c;
|
WalkContext wc = c;
|
||||||
|
|
||||||
int rvals[] = new int[n.getChildCount()];
|
int rvals[] = new int[n.getChildCount()];
|
||||||
|
Position rposs[] = new Position[n.getChildCount()];
|
||||||
for (int i = 0; i < n.getChildCount(); i++) {
|
for (int i = 0; i < n.getChildCount(); i++) {
|
||||||
rvals[i] = c.getValue(n.getChild(i));
|
rvals[i] = c.getValue(n.getChild(i));
|
||||||
|
rposs[i] = c.getSourceMap().getPosition(n.getChild(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
wc.cfg().addInstruction(new AstEchoInstruction(wc.cfg().currentInstruction, rvals));
|
int currentInstruction = wc.cfg().getCurrentInstruction();
|
||||||
|
wc.cfg().addInstruction(new AstEchoInstruction(currentInstruction, rvals));
|
||||||
|
wc.cfg().noteOperands(currentInstruction, rposs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CAstEntity getIncludedEntity(CAstNode n) {
|
public CAstEntity getIncludedEntity(CAstNode n) {
|
||||||
|
|
|
@ -50,6 +50,8 @@ public abstract class AstMethod implements IMethod {
|
||||||
|
|
||||||
String[][] getSourceNamesForValues();
|
String[][] getSourceNamesForValues();
|
||||||
|
|
||||||
|
Position getOperandPosition(int instructionOffset, int operand);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue