mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 02:08:04 +00:00
accurately depicted stack size
This commit is contained in:
parent
02039a5334
commit
acf7b4eff8
@ -98,7 +98,7 @@ public class TypedAssignment implements TypedStatement {
|
|||||||
}
|
}
|
||||||
ctx.getMv().visitFieldInsn(Opcodes.PUTFIELD, receiver, location.getName(), value.getType().getDescriptor());
|
ctx.getMv().visitFieldInsn(Opcodes.PUTFIELD, receiver, location.getName(), value.getType().getDescriptor());
|
||||||
System.out.println("PUTFIELD: " + receiver + " " + location.getName() + " " + value.getType().getDescriptor());
|
System.out.println("PUTFIELD: " + receiver + " " + location.getName() + " " + value.getType().getDescriptor());
|
||||||
|
ctx.popStack();
|
||||||
} else {
|
} else {
|
||||||
if(value.getType().getKind() == Type.Kind.REFERENCE) {
|
if(value.getType().getKind() == Type.Kind.REFERENCE) {
|
||||||
System.out.println("ASTORE " + ctx.getLocalVar(location.getName()).get().index());
|
System.out.println("ASTORE " + ctx.getLocalVar(location.getName()).get().index());
|
||||||
@ -115,5 +115,8 @@ public class TypedAssignment implements TypedStatement {
|
|||||||
location.getRecursiveOwnerChain().codeGen(ctx);
|
location.getRecursiveOwnerChain().codeGen(ctx);
|
||||||
ctx.pushAnonToStack();
|
ctx.pushAnonToStack();
|
||||||
}
|
}
|
||||||
|
if (location.getRecursiveOwnerChain() == null && location.getField()) {
|
||||||
|
ctx.pushStack("this");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,13 +47,15 @@ public class TypedReturn implements TypedStatement {
|
|||||||
public void codeGen(MethodContext ctx) {
|
public void codeGen(MethodContext ctx) {
|
||||||
if (ret == null) {
|
if (ret == null) {
|
||||||
ctx.getMv().visitInsn(Opcodes.RETURN);
|
ctx.getMv().visitInsn(Opcodes.RETURN);
|
||||||
|
System.out.println("RETURN");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("return: " + ret);
|
|
||||||
ret.codeGen(ctx);
|
ret.codeGen(ctx);
|
||||||
if (ret.getType().getKind() != Type.Kind.REFERENCE) {
|
if (ret.getType().getKind() != Type.Kind.REFERENCE) {
|
||||||
ctx.getMv().visitInsn(Opcodes.IRETURN);
|
ctx.getMv().visitInsn(Opcodes.IRETURN);
|
||||||
|
System.out.println("IRETURN");
|
||||||
} else {
|
} else {
|
||||||
ctx.getMv().visitInsn(Opcodes.ARETURN);
|
ctx.getMv().visitInsn(Opcodes.ARETURN);
|
||||||
|
System.out.println("ARETURN");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
public class ClassCanBeBytecoded {
|
public class ClassCanBeBytecoded {
|
||||||
|
public ClassCanBeBytecoded c;
|
||||||
public ClassCanBeBytecoded() {
|
public ClassCanBeBytecoded() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ public class ClassCanBeBytecoded {
|
|||||||
ClassCanBeBytecoded c;
|
ClassCanBeBytecoded c;
|
||||||
c = new ClassCanBeBytecoded(result);
|
c = new ClassCanBeBytecoded(result);
|
||||||
result = var1 + var1;
|
result = var1 + var1;
|
||||||
|
this.c = c;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user