public StackState dup2() { if (contents.size() <2) { throw new InvalidBytecodeException("cannot dup2, stack size is " + contents.size() + " " + toString()); } StackEntry t1 = top(); StackEntry t2 = top_1(); if (t2.getType() == StackEntryType.TOP) { throw new InvalidBytecodeException("Cannot dup2 when second type on stack is wide: " + toString()); } return newStack(t2, t1); }
public StackState dup2() { if (contents.size() <2) { throw new InvalidBytecodeException("cannot dup2, stack size is " + contents.size() + " " + toString()); } StackEntry t1 = top(); StackEntry t2 = top_1(); if (t2.getType() == StackEntryType.TOP) { throw new InvalidBytecodeException("Cannot dup2 when second type on stack is wide: " + toString()); } return newStack(t2, t1); }
public StackState dup2() { if (contents.size() <2) { throw new InvalidBytecodeException("cannot dup2, stack size is " + contents.size() + " " + toString()); } StackEntry t1 = top(); StackEntry t2 = top_1(); if (t2.getType() == StackEntryType.TOP) { throw new InvalidBytecodeException("Cannot dup2 when second type on stack is wide: " + toString()); } return newStack(t2, t1); }
public StackState dup2() { if (contents.size() <2) { throw new InvalidBytecodeException("cannot dup2, stack size is " + contents.size() + " " + toString()); } StackEntry t1 = top(); StackEntry t2 = top_1(); if (t2.getType() == StackEntryType.TOP) { throw new InvalidBytecodeException("Cannot dup2 when second type on stack is wide: " + toString()); } return newStack(t2, t1); }
public StackState dup2() { if (contents.size() <2) { throw new InvalidBytecodeException("cannot dup2, stack size is " + contents.size() + " " + toString()); } StackEntry t1 = top(); StackEntry t2 = top_1(); if (t2.getType() == StackEntryType.TOP) { throw new InvalidBytecodeException("Cannot dup2 when second type on stack is wide: " + toString()); } return newStack(t2, t1); }
public void aaload() { assertTypeOnStack(StackEntryType.INT, "aaload requires int on top of stack"); if (!getStack().top_1().getDescriptor().startsWith("[")) { throw new InvalidBytecodeException("aaload needs an array in position 2 on the stack"); } writeByte(Opcode.AALOAD); currentOffset++; advanceFrame(currentFrame.pop2push1("Ljava/lang/Object;")); }
public void aaload() { assertTypeOnStack(StackEntryType.INT, "aaload requires int on top of stack"); if (!getStack().top_1().getDescriptor().startsWith("[")) { throw new InvalidBytecodeException("aaload needs an array in position 2 on the stack"); } writeByte(Opcode.AALOAD); currentOffset++; advanceFrame(currentFrame.pop2push1("Ljava/lang/Object;")); }
public void aaload() { assertTypeOnStack(StackEntryType.INT, "aaload requires int on top of stack"); if (!getStack().top_1().getDescriptor().startsWith("[")) { throw new InvalidBytecodeException("aaload needs an array in position 2 on the stack"); } writeByte(Opcode.AALOAD); currentOffset++; advanceFrame(currentFrame.pop2push1("Ljava/lang/Object;")); }
public void aaload() { assertTypeOnStack(StackEntryType.INT, "aaload requires int on top of stack"); if (!getStack().top_1().getDescriptor().startsWith("[")) { throw new InvalidBytecodeException("aaload needs an array in position 2 on the stack"); } writeByte(Opcode.AALOAD); currentOffset++; advanceFrame(currentFrame.pop2push1("Ljava/lang/Object;")); }
public void aaload() { assertTypeOnStack(StackEntryType.INT, "aaload requires int on top of stack"); if (!getStack().top_1().getDescriptor().startsWith("[")) { throw new InvalidBytecodeException("aaload needs an array in position 2 on the stack"); } writeByte(Opcode.AALOAD); currentOffset++; advanceFrame(currentFrame.pop2push1("Ljava/lang/Object;")); }
/** * checks that the appropriate object type is on top of the stack */ public boolean isOnTop(String descriptor) { if (contents.isEmpty()) { return false; } StackEntry entry = StackEntry.of(descriptor, constPool); StackEntry top = top(); if (entry.isWide()) { if (contents.size() == 1) { return false; } return top_1().getType() == entry.getType(); } if (top.getType() == StackEntryType.NULL && entry.getType() == StackEntryType.OBJECT) { return true; } return top.getType() == entry.getType(); }
/** * Store the variable on top of the stack into a local variable, poping the variable from the stack. Wide types are handled * automatically */ public StackFrame store(int no) { StackEntry top = stackState.top(); StackState ns; LocalVariableState ls; if(top.getType() == StackEntryType.TOP) { //wide type StackEntry type = stackState.top_1(); ns = stackState.pop(2); ls = localVariableState.storeWide(no, type); } else { StackEntry type = stackState.top(); ns = stackState.pop(1); ls = localVariableState.store(no, type); } return new StackFrame(ns, ls, StackFrameType.FULL_FRAME); }
/** * Store the variable on top of the stack into a local variable, poping the variable from the stack. Wide types are handled * automatically */ public StackFrame store(int no) { StackEntry top = stackState.top(); StackState ns; LocalVariableState ls; if(top.getType() == StackEntryType.TOP) { //wide type StackEntry type = stackState.top_1(); ns = stackState.pop(2); ls = localVariableState.storeWide(no, type); } else { StackEntry type = stackState.top(); ns = stackState.pop(1); ls = localVariableState.store(no, type); } return new StackFrame(ns, ls, StackFrameType.FULL_FRAME); }
/** * Store the variable on top of the stack into a local variable, poping the variable from the stack. Wide types are handled * automatically */ public StackFrame store(int no) { StackEntry top = stackState.top(); StackState ns; LocalVariableState ls; if(top.getType() == StackEntryType.TOP) { //wide type StackEntry type = stackState.top_1(); ns = stackState.pop(2); ls = localVariableState.storeWide(no, type); } else { StackEntry type = stackState.top(); ns = stackState.pop(1); ls = localVariableState.store(no, type); } return new StackFrame(ns, ls, StackFrameType.FULL_FRAME); }
/** * Store the variable on top of the stack into a local variable, poping the variable from the stack. Wide types are handled * automatically */ public StackFrame store(int no) { StackEntry top = stackState.top(); StackState ns; LocalVariableState ls; if(top.getType() == StackEntryType.TOP) { //wide type StackEntry type = stackState.top_1(); ns = stackState.pop(2); ls = localVariableState.storeWide(no, type); } else { StackEntry type = stackState.top(); ns = stackState.pop(1); ls = localVariableState.store(no, type); } return new StackFrame(ns, ls, StackFrameType.FULL_FRAME); }
public void putfield(String className, String field, String descriptor) { if (!getStack().isOnTop(descriptor)) { throw new InvalidBytecodeException("Attempting to put wrong type into field. Field:" + className + "." + field + " (" + descriptor + "). Stack State: " + getStack().toString()); } if (getStack().top_1().getType() != StackEntryType.UNINITIALIZED_THIS) { assertTypeOnStack(1, StackEntryType.OBJECT, "expected object in position 2 on stack"); } int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.PUTFIELD); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.pop2()); }
public void putfield(String className, String field, String descriptor) { if (!getStack().isOnTop(descriptor)) { throw new InvalidBytecodeException("Attempting to put wrong type into field. Field:" + className + "." + field + " (" + descriptor + "). Stack State: " + getStack().toString()); } if (getStack().top_1().getType() != StackEntryType.UNINITIALIZED_THIS) { assertTypeOnStack(1, StackEntryType.OBJECT, "expected object in position 2 on stack"); } int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.PUTFIELD); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.pop2()); }
public void putfield(String className, String field, String descriptor) { if (!getStack().isOnTop(descriptor)) { throw new InvalidBytecodeException("Attempting to put wrong type into field. Field:" + className + "." + field + " (" + descriptor + "). Stack State: " + getStack().toString()); } if (getStack().top_1().getType() != StackEntryType.UNINITIALIZED_THIS) { assertTypeOnStack(1, StackEntryType.OBJECT, "expected object in position 2 on stack"); } int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.PUTFIELD); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.pop2()); }
public void putfield(String className, String field, String descriptor) { if (!getStack().isOnTop(descriptor)) { throw new InvalidBytecodeException("Attempting to put wrong type into field. Field:" + className + "." + field + " (" + descriptor + "). Stack State: " + getStack().toString()); } if (getStack().top_1().getType() != StackEntryType.UNINITIALIZED_THIS) { assertTypeOnStack(1, StackEntryType.OBJECT, "expected object in position 2 on stack"); } int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.PUTFIELD); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.pop2()); }
public void putfield(String className, String field, String descriptor) { if (!getStack().isOnTop(descriptor)) { throw new InvalidBytecodeException("Attempting to put wrong type into field. Field:" + className + "." + field + " (" + descriptor + "). Stack State: " + getStack().toString()); } if (getStack().top_1().getType() != StackEntryType.UNINITIALIZED_THIS) { assertTypeOnStack(1, StackEntryType.OBJECT, "expected object in position 2 on stack"); } int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.PUTFIELD); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.pop2()); }