/** * pop a non-wide type from the top of the stack */ public StackState pop(int no) { if (no == 0) { return this; } if (contents.size() < no) { throw new InvalidBytecodeException("cannot pop" + no + ", only " + contents.size() + " on stack " + toString()); } StackEntry type = contents.get(contents.size() - no); if (type.getType() == StackEntryType.TOP) { throw new InvalidBytecodeException("Pop" + no + " would split wide type " + toString()); } return new StackState(contents.subList(0, contents.size() - no), constPool); }
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 assertNotWideOnStack(int position, String message) { if (getStack().size() <= position) { throw new InvalidBytecodeException(message + " Stack State: " + getStack().toString()); } int index = getStack().getContents().size() - 1 - position; StackEntryType stype = getStack().getContents().get(index).getType(); if (stype == StackEntryType.TOP) { throw new InvalidBytecodeException(message + " Stack State: " + getStack().toString()); } }
public void assertNotWideOnStack(int position, String message) { if (getStack().size() <= position) { throw new InvalidBytecodeException(message + " Stack State: " + getStack().toString()); } int index = getStack().getContents().size() - 1 - position; StackEntryType stype = getStack().getContents().get(index).getType(); if (stype == StackEntryType.TOP) { throw new InvalidBytecodeException(message + " Stack State: " + getStack().toString()); } }
public void assertNotWideOnStack(int position, String message) { if (getStack().size() <= position) { throw new InvalidBytecodeException(message + " Stack State: " + getStack().toString()); } int index = getStack().getContents().size() - 1 - position; StackEntryType stype = getStack().getContents().get(index).getType(); if (stype == StackEntryType.TOP) { throw new InvalidBytecodeException(message + " Stack State: " + getStack().toString()); } }
public void assertNotWideOnStack(int position, String message) { if (getStack().size() <= position) { throw new InvalidBytecodeException(message + " Stack State: " + getStack().toString()); } int index = getStack().getContents().size() - 1 - position; StackEntryType stype = getStack().getContents().get(index).getType(); if (stype == StackEntryType.TOP) { throw new InvalidBytecodeException(message + " Stack State: " + getStack().toString()); } }
public void assertNotWideOnStack(int position, String message) { if (getStack().size() <= position) { throw new InvalidBytecodeException(message + " Stack State: " + getStack().toString()); } int index = getStack().getContents().size() - 1 - position; StackEntryType stype = getStack().getContents().get(index).getType(); if (stype == StackEntryType.TOP) { throw new InvalidBytecodeException(message + " Stack State: " + getStack().toString()); } }
public void putstatic(String className, String field, String descriptor) { if (!getStack().isOnTop(descriptor)) { throw new InvalidBytecodeException("Attempting to put wrong type into static field. Field:" + className + "." + field + " (" + descriptor + "). Stack State: " + getStack().toString()); } int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.PUTSTATIC); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.pop()); }
public void putstatic(String className, String field, String descriptor) { if (!getStack().isOnTop(descriptor)) { throw new InvalidBytecodeException("Attempting to put wrong type into static field. Field:" + className + "." + field + " (" + descriptor + "). Stack State: " + getStack().toString()); } int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.PUTSTATIC); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.pop()); }
public void putstatic(String className, String field, String descriptor) { if (!getStack().isOnTop(descriptor)) { throw new InvalidBytecodeException("Attempting to put wrong type into static field. Field:" + className + "." + field + " (" + descriptor + "). Stack State: " + getStack().toString()); } int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.PUTSTATIC); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.pop()); }
public void putstatic(String className, String field, String descriptor) { if (!getStack().isOnTop(descriptor)) { throw new InvalidBytecodeException("Attempting to put wrong type into static field. Field:" + className + "." + field + " (" + descriptor + "). Stack State: " + getStack().toString()); } int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.PUTSTATIC); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.pop()); }
public void putstatic(String className, String field, String descriptor) { if (!getStack().isOnTop(descriptor)) { throw new InvalidBytecodeException("Attempting to put wrong type into static field. Field:" + className + "." + field + " (" + descriptor + "). Stack State: " + getStack().toString()); } int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.PUTSTATIC); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.pop()); }
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()); }