}
FlatFlagActionNode ffan=new FlatFlagActionNode(FlatFlagActionNode.PRE);
+ ffan.setNumLine(bn.getNumLine());
ffan.addNext(fn);
FlatMethod fm=new FlatMethod(td, fe);
BlockNode bn=state.getMethodBody(currmd);
if (state.DSM&&currmd.getModifiers().isAtomic()) {
- curran=new FlatAtomicEnterNode();
+ FlatAtomicEnterNode faen=new FlatAtomicEnterNode();
+ faen.setNumLine(bn.getNumLine());
+ curran = faen;
} else
curran=null;
if ((state.THREAD||state.MGC)&&currmd.getModifiers().isSynchronized()) {
for(int j = 0; j < this.lockStack.size(); j++) {
TempDescriptor thistd = this.lockStack.elementAt(j);
FlatCall fc = new FlatCall(memd, null, thistd, new TempDescriptor[0]);
+ fc.setNumLine(bn.getNumLine());
if(first == null) {
first = end = fc;
} else {
while(!this.lockStack.isEmpty()) {
TempDescriptor thistd = this.lockStack.pop();
FlatCall fcunlock = new FlatCall(memdex, null, thistd, new TempDescriptor[0]);
+ fcunlock.setNumLine(bn.getNumLine());
end.addNext(fcunlock);
end = fcunlock;
}
}
FlatMethod fm=new FlatMethod(currmd, fe);
+ fm.setNumLine(bn.getNumLine());
fm.addNext(fn);
if (!currmd.isStatic())
fm.addParameterTemp(getTempforParam(currmd.getThis()));
TempDescriptor tmp=TempDescriptor.tempFactory("tocast",cn.getExpression().getType());
NodePair np=flattenExpressionNode(cn.getExpression(), tmp);
FlatCastNode fcn=new FlatCastNode(cn.getType(), tmp, out_temp);
+ fcn.setNumLine(cn.getNumLine());
np.getEnd().addNext(fcn);
return new NodePair(np.getBegin(),fcn);
}
private NodePair flattenLiteralNode(LiteralNode ln,TempDescriptor out_temp) {
FlatLiteralNode fln=new FlatLiteralNode(ln.getType(), ln.getValue(), out_temp);
+ fln.setNumLine(ln.getNumLine());
return new NodePair(fln,fln);
}
private NodePair flattenOffsetNode(OffsetNode ofn, TempDescriptor out_temp) {
FlatOffsetNode fln = new FlatOffsetNode(ofn.getClassType(), ofn.getField(), out_temp);
+ fln.setNumLine(ofn.getNumLine());
return new NodePair(fln, fln);
}
if (fd.getType().iswrapper()) {
TempDescriptor wrap_tmp=TempDescriptor.tempFactory("wrapper_obj",fd.getType());
FlatNode fnwrapper=new FlatNew(fd.getType(), wrap_tmp, con.isGlobal());
+ fnwrapper.setNumLine(con.getNumLine());
FlatSetFieldNode fsfn=new FlatSetFieldNode(out_temp, fd, wrap_tmp);
+ fsfn.setNumLine(con.getNumLine());
last.addNext(fnwrapper);
fnwrapper.addNext(fsfn);
last=fsfn;
MethodDescriptor md=con.getConstructor();
//Call to constructor
FlatCall fc=new FlatCall(md, null, out_temp, temps);
+ fc.setNumLine(con.getNumLine());
last.addNext(fc);
last=fc;
if (td.getClassDesc().hasFlags()) {
// if (con.getFlagEffects()!=null) {
FlatFlagActionNode ffan=new FlatFlagActionNode(FlatFlagActionNode.NEWOBJECT);
+ ffan.setNumLine(con.getNumLine());
FlagEffects fes=con.getFlagEffects();
TempDescriptor flagtemp=out_temp;
if (fes!=null) {
FlatCall fc;
if(md.getReturnType()==null||md.getReturnType().isVoid())
- fc=new FlatCall(md, null, thisarg, temps);
+ fc=new FlatCall(md, null, thisarg, temps);
else
fc=new FlatCall(md, out_temp, thisarg, temps);
+
+ fc.setNumLine(min.getNumLine());
+
if (first==null) {
first=fc;
} else
// static field dereference with class name
tmp = new TempDescriptor(fan.getExpression().getType().getClassDesc().getSymbol(), fan.getExpression().getType());
FlatFieldNode fn=new FlatFieldNode(fan.getField(),tmp,out_temp);
+ fn.setNumLine(fan.getNumLine());
return new NodePair(fn,fn);
} else {
tmp=TempDescriptor.tempFactory("temp",fan.getExpression().getType());
NodePair npe=flattenExpressionNode(fan.getExpression(),tmp);
FlatFieldNode fn=new FlatFieldNode(fan.getField(),tmp,out_temp);
+ fn.setNumLine(fan.getNumLine());
npe.getEnd().addNext(fn);
return new NodePair(npe.getBegin(),fn);
}
arraytmp=TempDescriptor.tempFactory("temp", aan.getExpression().getType().dereference());
}
FlatNode fn=new FlatElementNode(tmp,tmpindex,arraytmp);
+ fn.setNumLine(aan.getNumLine());
npe.getEnd().addNext(npi.getBegin());
npi.getEnd().addNext(fn);
if (aan.iswrapper()) {
FlatFieldNode ffn=new FlatFieldNode((FieldDescriptor)aan.getExpression().getType().dereference().getClassDesc().getFieldTable().get("value") ,arraytmp,out_temp);
+ ffn.setNumLine(aan.getNumLine());
fn.addNext(ffn);
fn=ffn;
}
//Get src value
if (an.getSrc()!=null) {
if(an.getSrc().getEval() != null) {
- first = last = new FlatLiteralNode(an.getSrc().getType(), an.getSrc().getEval().longValue(), src_tmp);
+ FlatLiteralNode fln=new FlatLiteralNode(an.getSrc().getType(), an.getSrc().getEval().longValue(), src_tmp);
+ fln.setNumLine(an.getSrc().getNumLine());
+ first = last =fln;
} else {
NodePair np_src=flattenExpressionNode(an.getSrc(),src_tmp);
first=np_src.getBegin();
}
} else if (!pre) {
FlatLiteralNode fln=new FlatLiteralNode(new TypeDescriptor(TypeDescriptor.INT),new Integer(1),src_tmp);
+ fln.setNumLine(an.getNumLine());
first=fln;
last=fln;
}
TempDescriptor src_tmp2=pre ? TempDescriptor.tempFactory("src",an.getDest().getType()) : out_temp;
TempDescriptor tmp=TempDescriptor.tempFactory("srctmp3_",an.getDest().getType());
FlatFieldNode ffn=new FlatFieldNode(fan.getField(), dst_tmp, src_tmp2);
+ ffn.setNumLine(an.getNumLine());
last.addNext(ffn);
last=ffn;
ClassDescriptor stringcd=typeutil.getClass(TypeUtil.StringClass);
MethodDescriptor concatmd=typeutil.getMethod(stringcd, "concat2", new TypeDescriptor[] {new TypeDescriptor(stringcd), new TypeDescriptor(stringcd)});
FlatCall fc=new FlatCall(concatmd, tmp, null, new TempDescriptor[] {src_tmp2, src_tmp});
+ fc.setNumLine(an.getNumLine());
src_tmp=tmp;
last.addNext(fc);
last=fc;
} else {
FlatOpNode fon=new FlatOpNode(tmp, src_tmp2, src_tmp, base);
+ fon.setNumLine(an.getNumLine());
src_tmp=tmp;
last.addNext(fon);
last=fon;
}
FlatSetFieldNode fsfn=new FlatSetFieldNode(dst_tmp, fan.getField(), src_tmp);
+ fsfn.setNumLine(en.getNumLine());
last.addNext(fsfn);
last=fsfn;
if (pre) {
FlatOpNode fon2=new FlatOpNode(out_temp, src_tmp, null, new Operation(Operation.ASSIGN));
+ fon2.setNumLine(an.getNumLine());
fsfn.addNext(fon2);
last=fon2;
}
TypeDescriptor arrayeltype=aan.getExpression().getType().dereference();
TempDescriptor src_tmp3=TempDescriptor.tempFactory("src3",arrayeltype);
FlatElementNode fen=new FlatElementNode(dst_tmp, index_tmp, src_tmp3);
+ fen.setNumLine(aan.getNumLine());
FlatFieldNode ffn=new FlatFieldNode((FieldDescriptor)arrayeltype.getClassDesc().getFieldTable().get("value"),src_tmp3,src_tmp2);
+ ffn.setNumLine(aan.getNumLine());
last.addNext(fen);
fen.addNext(ffn);
last=ffn;
} else {
FlatElementNode fen=new FlatElementNode(dst_tmp, index_tmp, src_tmp2);
+ fen.setNumLine(aan.getNumLine());
last.addNext(fen);
last=fen;
}
ClassDescriptor stringcd=typeutil.getClass(TypeUtil.StringClass);
MethodDescriptor concatmd=typeutil.getMethod(stringcd, "concat2", new TypeDescriptor[] {new TypeDescriptor(stringcd), new TypeDescriptor(stringcd)});
FlatCall fc=new FlatCall(concatmd, tmp, null, new TempDescriptor[] {src_tmp2, src_tmp});
+ fc.setNumLine(an.getNumLine());
src_tmp=tmp;
last.addNext(fc);
last=fc;
} else {
FlatOpNode fon=new FlatOpNode(tmp, src_tmp2, src_tmp, base);
+ fon.setNumLine(an.getNumLine());
src_tmp=tmp;
last.addNext(fon);
last=fon;
TypeDescriptor arrayeltype=aan.getExpression().getType().dereference();
TempDescriptor src_tmp3=TempDescriptor.tempFactory("src3",arrayeltype);
FlatElementNode fen=new FlatElementNode(dst_tmp, index_tmp, src_tmp3);
+ fen.setNumLine(aan.getNumLine());
FlatSetFieldNode fsfn=new FlatSetFieldNode(src_tmp3,(FieldDescriptor)arrayeltype.getClassDesc().getFieldTable().get("value"),src_tmp);
+ fsfn.setNumLine(aan.getExpression().getNumLine());
last.addNext(fen);
fen.addNext(fsfn);
last=fsfn;
} else {
FlatSetElementNode fsen=new FlatSetElementNode(dst_tmp, index_tmp, src_tmp);
+ fsen.setNumLine(aan.getNumLine());
last.addNext(fsen);
last=fsen;
}
if (pre) {
FlatOpNode fon2=new FlatOpNode(out_temp, src_tmp, null, new Operation(Operation.ASSIGN));
+ fon2.setNumLine(an.getNumLine());
last.addNext(fon2);
last=fon2;
}
TempDescriptor tmp=TempDescriptor.tempFactory("srctmp3_",an.getDest().getType());
FlatFieldNode ffn=new FlatFieldNode(fan.getField(), dst_tmp, src_tmp2);
+ ffn.setNumLine(an.getNumLine());
last.addNext(ffn);
last=ffn;
ClassDescriptor stringcd=typeutil.getClass(TypeUtil.StringClass);
MethodDescriptor concatmd=typeutil.getMethod(stringcd, "concat2", new TypeDescriptor[] {new TypeDescriptor(stringcd), new TypeDescriptor(stringcd)});
FlatCall fc=new FlatCall(concatmd, tmp, null, new TempDescriptor[] {src_tmp2, src_tmp});
+ fc.setNumLine(an.getNumLine());
src_tmp=tmp;
last.addNext(fc);
last=fc;
} else {
FlatOpNode fon=new FlatOpNode(tmp, src_tmp2, src_tmp, base);
+ fon.setNumLine(an.getNumLine());
src_tmp=tmp;
last.addNext(fon);
last=fon;
FlatSetFieldNode fsfn=new FlatSetFieldNode(dst_tmp, fan.getField(), src_tmp);
+ fsfn.setNumLine(en.getNumLine());
last.addNext(fsfn);
last=fsfn;
if (pre) {
FlatOpNode fon2=new FlatOpNode(out_temp, src_tmp, null, new Operation(Operation.ASSIGN));
+ fon2.setNumLine(an.getNumLine());
fsfn.addNext(fon2);
last=fon2;
}
ftmp=getTempforVar(nn.getVar());
}
FlatFieldNode ffn=new FlatFieldNode(nn.getField(), ftmp, src_tmp2);
+ ffn.setNumLine(an.getNumLine());
if (first==null)
first=ffn;
ClassDescriptor stringcd=typeutil.getClass(TypeUtil.StringClass);
MethodDescriptor concatmd=typeutil.getMethod(stringcd, "concat2", new TypeDescriptor[] {new TypeDescriptor(stringcd), new TypeDescriptor(stringcd)});
FlatCall fc=new FlatCall(concatmd, tmp, null, new TempDescriptor[] {src_tmp2, src_tmp});
+ fc.setNumLine(an.getNumLine());
src_tmp=tmp;
last.addNext(fc);
last=fc;
} else {
FlatOpNode fon=new FlatOpNode(tmp, src_tmp2, src_tmp, base);
+ fon.setNumLine(an.getNumLine());
src_tmp=tmp;
last.addNext(fon);
last=fon;
if(nn.getClassDesc()!=null) {
// this is a static field access inside of a static block
fsfn=new FlatSetFieldNode(new TempDescriptor("sfsb", nn.getClassType()), nn.getField(), src_tmp);
+ fsfn.setNumLine(nn.getNumLine());
} else {
fsfn=new FlatSetFieldNode(getTempforVar(nn.getVar()), nn.getField(), src_tmp);
+ fsfn.setNumLine(nn.getNumLine());
}
if (first==null) {
first=fsfn;
last=fsfn;
if (pre) {
FlatOpNode fon2=new FlatOpNode(out_temp, src_tmp, null, new Operation(Operation.ASSIGN));
+ fon2.setNumLine(an.getNumLine());
fsfn.addNext(fon2);
last=fon2;
}
TempDescriptor tmp=TempDescriptor.tempFactory("srctmp3_",an.getDest().getType());
if (!pre) {
FlatOpNode fon=new FlatOpNode(out_temp, src_tmp2, null, new Operation(Operation.ASSIGN));
+ fon.setNumLine(an.getNumLine());
if (first==null)
first=fon;
else
ClassDescriptor stringcd=typeutil.getClass(TypeUtil.StringClass);
MethodDescriptor concatmd=typeutil.getMethod(stringcd, "concat2", new TypeDescriptor[] {new TypeDescriptor(stringcd), new TypeDescriptor(stringcd)});
FlatCall fc=new FlatCall(concatmd, tmp, null, new TempDescriptor[] {src_tmp2, src_tmp});
+ fc.setNumLine(an.getNumLine());
if (first==null)
first=fc;
else
last=fc;
} else {
FlatOpNode fon=new FlatOpNode(tmp, src_tmp2, src_tmp, base);
+ fon.setNumLine(an.getNumLine());
if (first==null)
first=fon;
else
}
FlatOpNode fon=new FlatOpNode(getTempforVar(nn.getVar()), src_tmp, null, new Operation(Operation.ASSIGN));
+ fon.setNumLine(an.getNumLine());
last.addNext(fon);
last=fon;
if (pre) {
FlatOpNode fon2=new FlatOpNode(out_temp, src_tmp, null, new Operation(Operation.ASSIGN));
+ fon2.setNumLine(an.getNumLine());
fon.addNext(fon2);
last=fon2;
}
tmp=getTempforVar(nn.getVar());
}
FlatFieldNode ffn=new FlatFieldNode(nn.getField(), tmp, out_temp);
+ ffn.setNumLine(nn.getNumLine());
return new NodePair(ffn,ffn);
} else {
TempDescriptor tmp=getTempforVar(nn.isTag() ? nn.getTagVar() : nn.getVar());
out_temp.setTag(tmp.getTag());
}
FlatOpNode fon=new FlatOpNode(out_temp, tmp, null, new Operation(Operation.ASSIGN));
+ fon.setNumLine(nn.getNumLine());
return new NodePair(fon,fon);
}
}
if (op.getOp()==Operation.LOGIC_OR) {
/* Need to do shortcircuiting */
FlatCondBranch fcb=new FlatCondBranch(temp_left);
+ fcb.setNumLine(on.getNumLine());
FlatOpNode fon1=new FlatOpNode(out_temp,temp_left,null,new Operation(Operation.ASSIGN));
+ fon1.setNumLine(on.getNumLine());
FlatOpNode fon2=new FlatOpNode(out_temp,temp_right,null,new Operation(Operation.ASSIGN));
+ fon2.setNumLine(on.getNumLine());
FlatNop fnop=new FlatNop();
left.getEnd().addNext(fcb);
fcb.addFalseNext(right.getBegin());
} else if (op.getOp()==Operation.LOGIC_AND) {
/* Need to do shortcircuiting */
FlatCondBranch fcb=new FlatCondBranch(temp_left);
+ fcb.setNumLine(on.getNumLine());
FlatOpNode fon1=new FlatOpNode(out_temp,temp_left,null,new Operation(Operation.ASSIGN));
+ fon1.setNumLine(on.getNumLine());
FlatOpNode fon2=new FlatOpNode(out_temp,temp_right,null,new Operation(Operation.ASSIGN));
+ fon2.setNumLine(on.getNumLine());
FlatNop fnop=new FlatNop();
left.getEnd().addNext(fcb);
fcb.addTrueNext(right.getBegin());
ClassDescriptor stringcd=typeutil.getClass(TypeUtil.StringClass);
MethodDescriptor concatmd=typeutil.getMethod(stringcd, "concat", new TypeDescriptor[] {new TypeDescriptor(stringcd)});
FlatCall fc=new FlatCall(concatmd, out_temp, temp_left, new TempDescriptor[] {temp_right});
+ fc.setNumLine(on.getNumLine());
left.getEnd().addNext(right.getBegin());
right.getEnd().addNext(fc);
return new NodePair(left.getBegin(), fc);
}
FlatOpNode fon=new FlatOpNode(out_temp,temp_left,temp_right,op);
+ fon.setNumLine(on.getNumLine());
left.getEnd().addNext(right.getBegin());
right.getEnd().addNext(fon);
return new NodePair(left.getBegin(),fon);
TagDescriptor tag=tvd.getTag();
TempDescriptor tmp=getTempforVar(tvd);
FlatTagDeclaration ftd=new FlatTagDeclaration(tag, tmp);
+ ftd.setNumLine(dn.getNumLine());
return new NodePair(ftd,ftd);
}
TempDescriptor cond_temp=TempDescriptor.tempFactory("condition",new TypeDescriptor(TypeDescriptor.BOOLEAN));
NodePair cond=flattenExpressionNode(isn.getCondition(),cond_temp);
FlatCondBranch fcb=new FlatCondBranch(cond_temp);
+ fcb.setNumLine(isn.getNumLine());
NodePair true_np=flattenBlockNode(isn.getTrueBlock());
NodePair false_np;
FlatNop nopend=new FlatNop();
Operation op=new Operation(Operation.EQUAL);
left=flattenExpressionNode(sln.getCondition(), temp_left);
FlatOpNode fon=new FlatOpNode(cond_tmp, temp_left, cond_temp, op);
+ fon.setNumLine(sln.getNumLine());
left.getEnd().addNext(fon);
FlatCondBranch fcb=new FlatCondBranch(cond_tmp);
+ fcb.setNumLine(bn.getNumLine());
fcb.setTrueProb(State.TRUEPROB);
FlatNop nop=new FlatNop();
NodePair body=flattenBlockNode(ln.getBody());
FlatNode begin=initializer.getBegin();
FlatCondBranch fcb=new FlatCondBranch(cond_temp);
+ fcb.setNumLine(ln.getNumLine());
fcb.setTrueProb(State.TRUEPROB);
fcb.setLoop();
FlatNop nopend=new FlatNop();
NodePair body=flattenBlockNode(ln.getBody());
FlatNode begin=condition.getBegin();
FlatCondBranch fcb=new FlatCondBranch(cond_temp);
+ fcb.setNumLine(ln.getNumLine());
fcb.setTrueProb(State.TRUEPROB);
fcb.setLoop();
FlatNop nopend=new FlatNop();
NodePair body=flattenBlockNode(ln.getBody());
FlatNode begin=body.getBegin();
FlatCondBranch fcb=new FlatCondBranch(cond_temp);
+ fcb.setNumLine(ln.getNumLine());
fcb.setTrueProb(State.TRUEPROB);
fcb.setLoop();
FlatNop nopend=new FlatNop();
}
FlatReturnNode rnflat=new FlatReturnNode(retval);
+ rnflat.setNumLine(rntree.getNumLine());
rnflat.addNext(fe);
FlatNode ln=rnflat;
if ((state.THREAD||state.MGC)&&!this.lockStack.isEmpty()) {
for(int j = this.lockStack.size(); j > 0; j--) {
TempDescriptor thistd = this.lockStack.elementAt(j-1);
FlatCall fcunlock = new FlatCall(memdex, null, thistd, new TempDescriptor[0]);
+ fcunlock.setNumLine(rntree.getNumLine());
if(end != null) {
end.addNext(fcunlock);
}
NodePair fcn=flattenConstraintCheck(ten.getChecks());
ffan.addNext(fcn.getBegin());
FlatReturnNode rnflat=new FlatReturnNode(null);
+ rnflat.setNumLine(ten.getNumLine());
rnflat.addNext(fe);
fcn.getEnd().addNext(rnflat);
return new NodePair(ffan, null);
MethodDescriptor menmd=(MethodDescriptor)typeutil.getClass("Object").getMethodTable().get("MonitorEnter");
FlatCall fcen=new FlatCall(menmd, null, montmp, new TempDescriptor[0]);
+ fcen.setNumLine(sbn.getNumLine());
MethodDescriptor mexmd=(MethodDescriptor)typeutil.getClass("Object").getMethodTable().get("MonitorExit");
FlatCall fcex=new FlatCall(mexmd, null, montmp, new TempDescriptor[0]);
+ fcex.setNumLine(sbn.getNumLine());
+
this.lockStack.pop();
if(first != null) {
private NodePair flattenAtomicNode(AtomicNode sbn) {
NodePair np=flattenBlockNode(sbn.getBlockNode());
FlatAtomicEnterNode faen=new FlatAtomicEnterNode();
+ faen.setNumLine(sbn.getNumLine());
FlatAtomicExitNode faexn=new FlatAtomicExitNode(faen);
faen.addNext(np.getBegin());
np.getEnd().addNext(faexn);
private NodePair flattenSESENode(SESENode sn) {
if( sn.isStart() ) {
FlatSESEEnterNode fsen=new FlatSESEEnterNode(sn);
+ fsen.setNumLine(sn.getNumLine());
sn.setFlatEnter(fsen);
return new NodePair(fsen, fsen);
}
TempDescriptor expr_temp=TempDescriptor.tempFactory("expr",tn.getExpr().getType());
NodePair cond=flattenExpressionNode(tn.getExpr(), expr_temp);
FlatInstanceOfNode fion=new FlatInstanceOfNode(tn.getExprType(), expr_temp, out_temp);
+ fion.setNumLine(tn.getNumLine());
cond.getEnd().addNext(fion);
return new NodePair(cond.getBegin(),fion);
}
FlatNode last=null;
TempDescriptor tmp=TempDescriptor.tempFactory("arg", new TypeDescriptor(TypeDescriptor.INT));
FlatLiteralNode fln_tmp=new FlatLiteralNode(tmp.getType(), new Integer(ain.numVarInitializers()), tmp);
+ fln_tmp.setNumLine(ain.getNumLine());
first = last=fln_tmp;
// create the new array
// index=i
TempDescriptor index=TempDescriptor.tempFactory("index", new TypeDescriptor(TypeDescriptor.INT));
FlatLiteralNode fln=new FlatLiteralNode(index.getType(), new Integer(i), index);
+ fln.setNumLine(ain.getNumLine());
// calculate the initial value
NodePair np_init = flattenExpressionNode(var_init_node, tmp_init);
// TODO wrapper class process is missing now
/*if(td.isArray() && td.dereference().iswrapper()) {
}*/
FlatSetElementNode fsen=new FlatSetElementNode(tmp_toinit, index, tmp_init);
+ fsen.setNumLine(ain.getNumLine());
last.addNext(fln);
fln.addNext(np_init.getBegin());
np_init.getEnd().addNext(fsen);
NodePair cond=flattenExpressionNode(tn.getCond(),cond_temp);
FlatCondBranch fcb=new FlatCondBranch(cond_temp);
+ fcb.setNumLine(tn.getNumLine());
NodePair trueExpr=flattenExpressionNode(tn.getTrueExpr(),true_temp);
FlatOpNode fonT=new FlatOpNode(out_temp, true_temp, null, new Operation(Operation.ASSIGN));
+ fonT.setNumLine(tn.getNumLine());
NodePair falseExpr=flattenExpressionNode(tn.getFalseExpr(),fals_temp);
FlatOpNode fonF=new FlatOpNode(out_temp, fals_temp, null, new Operation(Operation.ASSIGN));
+ fonF.setNumLine(tn.getNumLine());
FlatNop nopend=new FlatNop();
BlockNode bn=new BlockNode();
NameNode nn=new NameNode(new NameDescriptor(identifier));
AssignmentNode an=new AssignmentNode(nn,en,new AssignOperation(1));
+ an.setNumLine(pn.getLine());
bn.addBlockStatement(new BlockExpressionNode(an));
if(isfirst) {
state.addTreeCode(md,bn);
isNode(pn,"postdec")) {
ParseNode left=pn.getFirstChild();
AssignOperation op=new AssignOperation(pn.getLabel());
- return new AssignmentNode(parseExpression(left),null,op);
+ AssignmentNode an=new AssignmentNode(parseExpression(left),null,op);
+ an.setNumLine(pn.getLine());
+ return an;
} else if (isNode(pn,"preinc")||
isNode(pn,"predec")) {
ParseNode left=pn.getFirstChild();
AssignOperation op=isNode(pn,"preinc") ? new AssignOperation(AssignOperation.PLUSEQ) : new AssignOperation(AssignOperation.MINUSEQ);
- return new AssignmentNode(parseExpression(left),
- new LiteralNode("integer",new Integer(1)),op);
+ AssignmentNode an=new AssignmentNode(parseExpression(left),
+ new LiteralNode("integer",new Integer(1)),op);
+ an.setNumLine(pn.getLine());
+ return an;
} else if (isNode(pn,"literal")) {
String literaltype=pn.getTerminal();
ParseNode literalnode=pn.getChild(literaltype);
disjointId = pn.getChild("disjoint").getTerminal();
}
CreateObjectNode con=new CreateObjectNode(td, isglobal, disjointId);
+ con.setNumLine(pn.getLine());
for(int i=0; i<args.size(); i++) {
con.addArgument((ExpressionNode)args.get(i));
}
for(int i=0; i<(args.size()+num); i++)
td=td.makeArray(state);
CreateObjectNode con=new CreateObjectNode(td, isglobal, disjointId);
+ con.setNumLine(pn.getLine());
for(int i=0; i<args.size(); i++) {
con.addArgument((ExpressionNode)args.get(i));
}
for(int i=0; i<num; i++)
td=td.makeArray(state);
CreateObjectNode con=new CreateObjectNode(td, false, null);
+ con.setNumLine(pn.getLine());
ParseNode ipn = pn.getChild("initializer");
Vector initializers=parseVariableInitializerList(ipn);
ArrayInitializerNode ain = new ArrayInitializerNode(initializers);
+ ain.setNumLine(pn.getLine());
con.addArrayInitializer(ain);
return con;
} else if (isNode(pn,"name")) {
NameDescriptor nd=parseName(pn);
- return new NameNode(nd);
+ NameNode nn=new NameNode(nd);
+ nn.setNumLine(pn.getLine());
+ return nn;
} else if (isNode(pn,"this")) {
NameDescriptor nd=new NameDescriptor("this");
- return new NameNode(nd);
+ NameNode nn=new NameNode(nd);
+ nn.setNumLine(pn.getLine());
+ return nn;
} else if (isNode(pn,"isavailable")) {
NameDescriptor nd=new NameDescriptor(pn.getTerminal());
return new OpNode(new NameNode(nd),null,new Operation(Operation.ISAVAILABLE));
NameDescriptor nd=parseName(pn.getChild("name"));
Vector args=parseArgumentList(pn);
MethodInvokeNode min=new MethodInvokeNode(nd);
+ min.setNumLine(pn.getLine());
for(int i=0; i<args.size(); i++) {
min.addArgument((ExpressionNode)args.get(i));
}
ExpressionNode exp=parseExpression(pn.getChild("base").getFirstChild());
Vector args=parseArgumentList(pn);
MethodInvokeNode min=new MethodInvokeNode(methodid,exp);
+ min.setNumLine(pn.getLine());
for(int i=0; i<args.size(); i++) {
min.addArgument((ExpressionNode)args.get(i));
}
} else if (isNode(pn,"fieldaccess")) {
ExpressionNode en=parseExpression(pn.getChild("base").getFirstChild());
String fieldname=pn.getChild("field").getTerminal();
- return new FieldAccessNode(en,fieldname);
+
+ FieldAccessNode fan=new FieldAccessNode(en,fieldname);
+ fan.setNumLine(pn.getLine());
+ return fan;
} else if (isNode(pn,"arrayaccess")) {
ExpressionNode en=parseExpression(pn.getChild("base").getFirstChild());
ExpressionNode index=parseExpression(pn.getChild("index").getFirstChild());
- return new ArrayAccessNode(en,index);
+ ArrayAccessNode aan=new ArrayAccessNode(en,index);
+ aan.setNumLine(pn.getLine());
+ return aan;
} else if (isNode(pn,"cast1")) {
try {
- return new CastNode(parseTypeDescriptor(pn.getChild("type")),parseExpression(pn.getChild("exp").getFirstChild()));
+ CastNode cn=new CastNode(parseTypeDescriptor(pn.getChild("type")),parseExpression(pn.getChild("exp").getFirstChild()));
+ cn.setNumLine(pn.getLine());
+ return cn;
} catch (Exception e) {
System.out.println(pn.PPrint(1,true));
e.printStackTrace();
throw new Error();
}
} else if (isNode(pn,"cast2")) {
- return new CastNode(parseExpression(pn.getChild("type").getFirstChild()),parseExpression(pn.getChild("exp").getFirstChild()));
+ CastNode cn=new CastNode(parseExpression(pn.getChild("type").getFirstChild()),parseExpression(pn.getChild("exp").getFirstChild()));
+ cn.setNumLine(pn.getLine());
+ return cn;
} else if (isNode(pn, "getoffset")) {
TypeDescriptor td=parseTypeDescriptor(pn);
String fieldname = pn.getChild("field").getTerminal();
//System.out.println("Checking the values of: "+ " td.toString()= " + td.toString()+ " fieldname= " + fieldname);
return new OffsetNode(td, fieldname);
} else if (isNode(pn, "tert")) {
- return new TertiaryNode(parseExpression(pn.getChild("cond").getFirstChild()),
- parseExpression(pn.getChild("trueexpr").getFirstChild()),
- parseExpression(pn.getChild("falseexpr").getFirstChild()) );
+
+ TertiaryNode tn=new TertiaryNode(parseExpression(pn.getChild("cond").getFirstChild()),
+ parseExpression(pn.getChild("trueexpr").getFirstChild()),
+ parseExpression(pn.getChild("falseexpr").getFirstChild()) );
+ tn.setNumLine(pn.getLine());
+
+ return tn;
} else if (isNode(pn, "instanceof")) {
ExpressionNode exp=parseExpression(pn.getChild("exp").getFirstChild());
TypeDescriptor t=parseTypeDescriptor(pn);
- return new InstanceOfNode(exp,t);
+ InstanceOfNode ion=new InstanceOfNode(exp,t);
+ ion.setNumLine(pn.getLine());
+ return ion;
} else if (isNode(pn, "array_initializer")) {
Vector initializers=parseVariableInitializerList(pn);
return new ArrayInitializerNode(initializers);
} else if (isNode(pn, "class_type")) {
TypeDescriptor td=parseTypeDescriptor(pn);
- return new ClassTypeNode(td);
+ ClassTypeNode ctn=new ClassTypeNode(td);
+ ctn.setNumLine(pn.getLine());
+ return ctn;
} else if (isNode(pn, "empty")) {
return null;
} else {
ParseNodeVector pnv=pn.getChild("args").getChildren();
AssignmentNode an=new AssignmentNode(parseExpression(pnv.elementAt(0)),parseExpression(pnv.elementAt(1)),ao);
+ an.setNumLine(pn.getLine());
return an;
}
MethodDescriptor md=parseMethodHeader(headern);
try {
BlockNode bn=parseBlock(bodyn);
+ bn.setNumLine(pn.getLine()); // assume that method header is located at the beginning of method body
cn.addMethod(md);
state.addTreeCode(md,bn);
NameDescriptor nd=new NameDescriptor("super");
Vector args=parseArgumentList(sin);
MethodInvokeNode min=new MethodInvokeNode(nd);
+ min.setNumLine(sin.getLine());
for(int i=0; i<args.size(); i++) {
min.addArgument((ExpressionNode)args.get(i));
}
NameDescriptor nd=new NameDescriptor(cn.getSymbol());
Vector args=parseArgumentList(eci);
MethodInvokeNode min=new MethodInvokeNode(nd);
+ min.setNumLine(eci.getLine());
for(int i=0; i<args.size(); i++) {
min.addArgument((ExpressionNode)args.get(i));
}
BlockExpressionNode ben=new BlockExpressionNode(min);
+ ben.setNumLine(eci.getLine());
bn.addFirstBlockStatement(ben);
}
state.addTreeCode(md,bn);
String name=pn.getChild("single").getTerminal();
String type=pn.getChild("type").getTerminal();
- blockstatements.add(new TagDeclarationNode(name, type));
+ TagDeclarationNode tdn=new TagDeclarationNode(name, type);
+ tdn.setNumLine(pn.getLine());
+
+ blockstatements.add(tdn);
} else if (isNode(pn,"local_variable_declaration")) {
ParseNode mn=pn.getChild("modifiers");
ExpressionNode en=null;
if (epn!=null)
en=parseExpression(epn.getFirstChild());
+
+ DeclarationNode dn=new DeclarationNode(new VarDescriptor(arrayt, identifier),en);
+ dn.setNumLine(tmp.getLine());
- blockstatements.add(new DeclarationNode(new VarDescriptor(arrayt, identifier),en));
+ blockstatements.add(dn);
}
} else if (isNode(pn,"nop")) {
/* Do Nothing */
} else if (isNode(pn,"expression")) {
- blockstatements.add(new BlockExpressionNode(parseExpression(pn.getFirstChild())));
+ BlockExpressionNode ben=new BlockExpressionNode(parseExpression(pn.getFirstChild()));
+ ben.setNumLine(pn.getLine());
+ blockstatements.add(ben);
} else if (isNode(pn,"ifstatement")) {
- blockstatements.add(new IfStatementNode(parseExpression(pn.getChild("condition").getFirstChild()),
- parseSingleBlock(pn.getChild("statement").getFirstChild()),
- pn.getChild("else_statement")!=null ? parseSingleBlock(pn.getChild("else_statement").getFirstChild()) : null));
+ IfStatementNode isn=new IfStatementNode(parseExpression(pn.getChild("condition").getFirstChild()),
+ parseSingleBlock(pn.getChild("statement").getFirstChild()),
+ pn.getChild("else_statement")!=null ? parseSingleBlock(pn.getChild("else_statement").getFirstChild()) : null);
+ isn.setNumLine(pn.getLine());
+
+ blockstatements.add(isn);
} else if (isNode(pn,"switch_statement")) {
// TODO add version for normal Java later
- blockstatements.add(new SwitchStatementNode(parseExpression(pn.getChild("condition").getFirstChild()),
- parseSingleBlock(pn.getChild("statement").getFirstChild())));
+ SwitchStatementNode ssn=new SwitchStatementNode(parseExpression(pn.getChild("condition").getFirstChild()),
+ parseSingleBlock(pn.getChild("statement").getFirstChild()));
+ ssn.setNumLine(pn.getLine());
+ blockstatements.add(ssn);
} else if (isNode(pn,"switch_block_list")) {
// TODO add version for normal Java later
ParseNodeVector pnv=pn.getChildren();
for(int j=0; j<labelv.size(); j++) {
ParseNode labeldecl=labelv.elementAt(j);
if(isNode(labeldecl, "switch_label")) {
- slv.addElement(new SwitchLabelNode(parseExpression(labeldecl.getChild("constant_expression").getFirstChild()), false));
+ SwitchLabelNode sln=new SwitchLabelNode(parseExpression(labeldecl.getChild("constant_expression").getFirstChild()), false);
+ sln.setNumLine(labeldecl.getLine());
+ slv.addElement(sln);
} else if(isNode(labeldecl, "default_switch_label")) {
- slv.addElement(new SwitchLabelNode(null, true));
+ SwitchLabelNode sln=new SwitchLabelNode(null, true);
+ sln.setNumLine(labeldecl.getLine());
+ slv.addElement(sln);
}
}
- blockstatements.add(new SwitchBlockNode(slv,
- parseSingleBlock(sblockdecl.getChild("switch_statements").getFirstChild())));
+ SwitchBlockNode sbn=new SwitchBlockNode(slv,
+ parseSingleBlock(sblockdecl.getChild("switch_statements").getFirstChild()));
+ sbn.setNumLine(sblockdecl.getLine());
+
+ blockstatements.add(sbn);
}
}
Vector ccs=null;
if (pn.getChild("cons_checks")!=null)
ccs=parseChecks(pn.getChild("cons_checks"));
-
- blockstatements.add(new TaskExitNode(vfe, ccs, this.m_taskexitnum++));
+ TaskExitNode ten=new TaskExitNode(vfe, ccs, this.m_taskexitnum++);
+ ten.setNumLine(pn.getLine());
+ blockstatements.add(ten);
} else if (isNode(pn,"atomic")) {
BlockNode bn=parseBlockHelper(pn);
- blockstatements.add(new AtomicNode(bn));
+ AtomicNode an=new AtomicNode(bn);
+ an.setNumLine(pn.getLine());
+ blockstatements.add(an);
} else if (isNode(pn,"synchronized")) {
BlockNode bn=parseBlockHelper(pn.getChild("block"));
ExpressionNode en=parseExpression(pn.getChild("expr").getFirstChild());
- blockstatements.add(new SynchronizedNode(en, bn));
+ SynchronizedNode sn=new SynchronizedNode(en, bn);
+ sn.setNumLine(pn.getLine());
+ blockstatements.add(sn);
} else if (isNode(pn,"return")) {
if (isEmpty(pn.getTerminal()))
blockstatements.add(new ReturnNode());
else {
ExpressionNode en=parseExpression(pn.getFirstChild());
- blockstatements.add(new ReturnNode(en));
+ ReturnNode rn=new ReturnNode(en);
+ rn.setNumLine(pn.getLine());
+ blockstatements.add(rn);
}
} else if (isNode(pn,"block_statement_list")) {
BlockNode bn=parseBlockHelper(pn);
// no condition clause, make a 'true' expression as the condition
condition = (ExpressionNode)new LiteralNode("boolean", new Boolean(true));
}
- blockstatements.add(new LoopNode(init,condition,update,body));
+ LoopNode ln=new LoopNode(init,condition,update,body);
+ ln.setNumLine(pn.getLine());
+ blockstatements.add(ln);
} else if (isNode(pn,"whilestatement")) {
ExpressionNode condition=parseExpression(pn.getChild("condition").getFirstChild());
BlockNode body=parseSingleBlock(pn.getChild("statement").getFirstChild());
String stID=null;
if( pnID != null ) { stID=pnID.getFirstChild().getTerminal(); }
SESENode start=new SESENode(stID);
+ start.setNumLine(pn.getLine());
SESENode end =new SESENode(stID);
start.setEnd( end );
end.setStart( start );
blockstatements.addAll(parseSESEBlock(blockstatements,pn.getChild("body").getFirstChild()));
blockstatements.add(end);
} else if (isNode(pn,"continue")) {
- blockstatements.add(new ContinueBreakNode(false));
+ ContinueBreakNode cbn=new ContinueBreakNode(false);
+ cbn.setNumLine(pn.getLine());
+ blockstatements.add(cbn);
} else if (isNode(pn,"break")) {
- blockstatements.add(new ContinueBreakNode(true));
+ ContinueBreakNode cbn=new ContinueBreakNode(true);
+ cbn.setNumLine(pn.getLine());
+ blockstatements.add(cbn);
} else if (isNode(pn,"genreach")) {
String graphName = pn.getChild("graphName").getTerminal();