Package org.jboss.byteman.rule.exception

Examples of org.jboss.byteman.rule.exception.CompileException


            // we popped four args
            compileContext.addStackCount(-4);
        }

        if (compileContext.getStackCount() !=  currentStack) {
            throw new CompileException("StaticExpression.compileAssign : invalid stack height " + compileContext.getStackCount() + " expecting " + currentStack);
        }
    }
View Full Code Here


            }
        }

        // ensure we have only increased the stack by the return value size
        if (compileContext.getStackCount() != currentStack + expected) {
            throw new CompileException("DollarExpression.compile : invalid stack height " + compileContext.getStackCount() + " expecting " + (currentStack + expected));
        }

    }
View Full Code Here

        int currentStack = compileContext.getStackCount();
        int size = ((type.getNBytes() > 4) ? 2 : 1);

        if (index == HELPER_IDX) {
            // not allowed to reassign the helper binding
            throw new CompileException("DollarExpression.compileAssign : invalid assignment to helper binding $$");
        } else {
            // value to be assigned is TOS and will already be coerced to the correct value type
            // copy it so we leave it as a a return value on the stack
            if (size == 2) {
                mv.visitInsn(Opcodes.DUP2);
            } else {
                mv.visitInsn(Opcodes.DUP);
            }
            // stack the current helper then insert it below the value
            mv.visitVarInsn(Opcodes.ALOAD, 0);
            if (size == 2) {
                // use a DUP_X2 to push a copy below the value then pop the redundant value
                mv.visitInsn(Opcodes.DUP_X2);
                mv.visitInsn(Opcodes.POP);
            } else {
                // we can just swap the two values
                mv.visitInsn(Opcodes.SWAP);
            }
            // stack the name for the variable and swap below the value
            mv.visitLdcInsn(targetName);
            if (size == 2) {
                // use a DUP_X2 to push a copy below the value then pop the redundant value
                mv.visitInsn(Opcodes.DUP_X2);
                // this is the high water mark
                // at this point the stack has gone from [ .. val1 val2]  to [.. val1 val2 helper name val1 val2 name]
                compileContext.addStackCount(5);
                mv.visitInsn(Opcodes.POP);
                compileContext.addStackCount(-1);
            } else {
                // this is the high water mark
                // at this point the stack has gone from [ .. val]  to [.. val helper val name]
                compileContext.addStackCount(3);
                // we can just swap the two values
                mv.visitInsn(Opcodes.SWAP);
            }
            // ensure we have an object
            compileObjectConversion(type, Type.OBJECT, mv, compileContext);

            // call the setBinding method
            mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.internalName(HelperAdapter.class), "setBinding", "(Ljava/lang/String;Ljava/lang/Object;)V");

            // the call will remove 3 from the stack height
            compileContext.addStackCount(-3);

            // ok, the stack height should be as it was
            if (compileContext.getStackCount() != currentStack) {
                throw new CompileException("variable.compileAssignment : invalid stack height " + compileContext.getStackCount() + " expecting " + currentStack);
            }
        }
    }
View Full Code Here

        mv.visitLdcInsn(org.objectweb.asm.Type.getType(ownerType.getTargetClass()));
        // we added one object
        compileContext.addStackCount(1);
        // check the stack height is ok
        if (compileContext.getStackCount() != currentStack + expected) {
            throw new CompileException("ClassLiteralExpression.compile : invalid stack height " + compileContext.getStackCount() + " expecting " + (currentStack + expected));
        }
    }
View Full Code Here

        }
        // we have either a 1 words or a 2 words result
        // check that the stack height is what we expect

        if (compileContext.getStackCount() != currentStack + expected) {
            throw new CompileException("ShiftExpression.compile : invalid stack height " + compileContext.getStackCount() + " expecting " + currentStack + expected);
        }
    }
View Full Code Here

        lhs.compileAssign(mv, compileContext);

        // ok, the stack height should be increased by the expecdted bytecount
        if (compileContext.getStackCount() != currentStack + expected) {
            throw new CompileException("AssignExpression.compileAssignment : invalid stack height " + compileContext.getStackCount() + " expecting " + (currentStack + expected));
        }
    }
View Full Code Here

                compileTypeConversion(Type.OBJECT, type, mv, compileContext);
            }
        }
        // check the stack height is ok
        if (compileContext.getStackCount() != currentStack + expected) {
            throw new CompileException("FieldExpression.compile : invalid stack height " + compileContext.getStackCount() + " expecting " + (currentStack + expected));
        }
    }
View Full Code Here

                compileContext.addStackCount(-4);
            }

            // check the stack height is ok
            if (compileContext.getStackCount() != currentStack) {
                throw new CompileException("FieldExpression.compileAssign : invalid stack height " + compileContext.getStackCount() + " expecting " + (currentStack));
            }
        }
    }
View Full Code Here

            }
        }

        // check stack height
        if (compileContext.getStackCount() != currentStack + expected) {
            throw new CompileException("ArrayExpression.compile : invalid stack height " + compileContext.getStackCount() + " expecting " + (currentStack + expected));
        }

        // we needed room for an aray and an index or for a one or two word result
        // but the recursive evaluations will have made sure the max stack is big enough
        // so there is no need to update the maximum stack height
View Full Code Here

            }
        }

        // check stack height
        if (compileContext.getStackCount() != currentStack) {
            throw new CompileException("ArrayExpression.compile : invalid stack height " + compileContext.getStackCount() + " expecting " + currentStack);
        }

        // we needed room for an aray and an index or for a one or two word result
        // but the recursive evaluations will have made sure the max stack is big enough
        // so there is no need to update the maximum stack height
View Full Code Here

TOP

Related Classes of org.jboss.byteman.rule.exception.CompileException

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.