Package org.jboss.classfilewriter

Examples of org.jboss.classfilewriter.InvalidBytecodeException


                    newContents.add(stackEntry);
                }
            }
            return new LocalVariableState(newContents, constPool);
        } else {
            throw new InvalidBytecodeException("entry is not an unitialized object. " + toString());
        }
    }
View Full Code Here


    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);
    }
View Full Code Here

        return new StackState(contents.subList(0, contents.size() - no), constPool);
    }

    public StackState dup() {
        if (contents.isEmpty()) {
            throw new InvalidBytecodeException("cannot dup empty stack");
        }
        StackEntry type = top();
        if (type.getType() == StackEntryType.TOP) {
            throw new InvalidBytecodeException("Cannot dup wide type");
        }
        return newStack(type);
    }
View Full Code Here

        return newStack(type);
    }

    public StackState dupX1() {
        if (contents.size() < 2) {
            throw new InvalidBytecodeException("cannot dup_x1, stack does not have enough items");
        }
        StackEntry type = top();
        if (type.getType() == StackEntryType.TOP) {
            throw new InvalidBytecodeException("Cannot dup_x1 wide type");
        }
        ArrayList<StackEntry> ret = new ArrayList<StackEntry>(1 + contents.size());
        for (int i = 0; i < contents.size(); ++i) {
            if (i == contents.size() - 2) {
                ret.add(top());
View Full Code Here

        return new StackState(ret, constPool);
    }

    public StackState dupX2() {
        if (contents.size() < 3) {
            throw new InvalidBytecodeException("cannot dup_x1, stack does not have enough items");
        }
        StackEntry type = top();
        if (type.getType() == StackEntryType.TOP) {
            throw new InvalidBytecodeException("Cannot dup_x1 wide type");
        }
        ArrayList<StackEntry> ret = new ArrayList<StackEntry>(1 + contents.size());
        for (int i = 0; i < contents.size(); ++i) {
            if (i == contents.size() - 3) {
                ret.add(top());
View Full Code Here

        return new StackState(ret, 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);
    }
View Full Code Here

        return newStack(t2, t1);
    }

    public StackState dup2X1() {
        if (contents.size() < 3) {
            throw new InvalidBytecodeException("cannot dup2X1, stack size is " + contents.size() + " " + toString());
        }
        StackEntry t1 = top();
        StackEntry t2 = top_1();
        StackEntry t3 = top_2();
        if (t2.getType() == StackEntryType.TOP) {
            throw new InvalidBytecodeException("Cannot dup2X1 when second type on stack is wide: " + toString());
        }
        if (t3.getType() == StackEntryType.TOP) {
            throw new InvalidBytecodeException("Cannot dup2X2 when third type on stack is wide: " + toString());
        }
        ArrayList<StackEntry> ret = new ArrayList<StackEntry>(2 + contents.size());
        for (int i = 0; i < contents.size(); ++i) {
            if (i == contents.size() - 3) {
                ret.add(t2);
View Full Code Here

        return new StackState(ret, constPool);
    }

    public StackState dup2X2() {
        if (contents.size() < 4) {
            throw new InvalidBytecodeException("cannot dup2X2, stack size is " + contents.size() + " " + toString());
        }
        StackEntry t1 = top();
        StackEntry t2 = top_1();
        StackEntry t4 = top_3();
        if (t2.getType() == StackEntryType.TOP) {
            throw new InvalidBytecodeException("Cannot dup2X2 when second type on stack is wide: " + toString());
        }
        if (t4.getType() == StackEntryType.TOP) {
            throw new InvalidBytecodeException("Cannot dup2X2 when fourth type on stack is wide: " + toString());
        }
        ArrayList<StackEntry> ret = new ArrayList<StackEntry>(2 + contents.size());
        for (int i = 0; i < contents.size(); ++i) {
            if (i == contents.size() - 4) {
                ret.add(t2);
View Full Code Here

    // Instruction methods, in alphabetical order

    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;"));
    }
View Full Code Here

    public void aastore() {
        assertTypeOnStack(StackEntryType.OBJECT, "aastore requires reference type on top of stack");
        assertTypeOnStack(1, StackEntryType.INT, "aastore requires an int on position 2 stack");
        if (!getStack().top_2().getDescriptor().startsWith("[")) {
            throw new InvalidBytecodeException("aaload needs an array in position 3 on the stack");
        }
        writeByte(Opcode.AASTORE);
        currentOffset++;
        advanceFrame(currentFrame.pop3());
    }
View Full Code Here

TOP

Related Classes of org.jboss.classfilewriter.InvalidBytecodeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.