Class Pass3aVerifier.InstOperandConstraintVisitor

  • All Implemented Interfaces:
    Visitor
    Enclosing class:
    Pass3aVerifier

    private final class Pass3aVerifier.InstOperandConstraintVisitor
    extends EmptyVisitor
    This visitor class does the actual checking for the instruction operand's constraints.
    • Field Detail

      • constantPoolGen

        private final ConstantPoolGen constantPoolGen
        The ConstantPoolGen instance this Visitor operates on.
    • Constructor Detail

      • InstOperandConstraintVisitor

        InstOperandConstraintVisitor​(ConstantPoolGen constantPoolGen)
        Constructs a new instance.
    • Method Detail

      • constraintViolated

        private void constraintViolated​(Instruction i,
                                        java.lang.String message)
        A utility method to always raise an exception.
      • getMethod

        private Method getMethod​(JavaClass jc,
                                 InvokeInstruction invoke)
        Looks for the method referenced by the given invoke instruction in the given class.
        Parameters:
        jc - the class that defines the referenced method.
        invoke - the instruction that references the method.
        Returns:
        the referenced method or null if not found.
      • getMethodRecursive

        private Method getMethodRecursive​(JavaClass jc,
                                          InvokeInstruction invoke)
                                   throws java.lang.ClassNotFoundException
        Looks for the method referenced by the given invoke instruction in the given class or its super classes and super interfaces.
        Parameters:
        jc - the class that defines the referenced method.
        invoke - the instruction that references the method.
        Returns:
        the referenced method or null if not found.
        Throws:
        java.lang.ClassNotFoundException
      • indexValid

        private void indexValid​(Instruction i,
                                int idx)
        A utility method to raise an exception if the index is not a valid constant pool index.
      • maxLocals

        private int maxLocals()
        Utility method to return the max_locals value of the method verified by the surrounding Pass3aVerifier instance.
      • visitALOAD

        public void visitALOAD​(ALOAD o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitALOAD in interface Visitor
        Overrides:
        visitALOAD in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitASTORE

        public void visitASTORE​(ASTORE o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitASTORE in interface Visitor
        Overrides:
        visitASTORE in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitDLOAD

        public void visitDLOAD​(DLOAD o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitDLOAD in interface Visitor
        Overrides:
        visitDLOAD in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitDSTORE

        public void visitDSTORE​(DSTORE o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitDSTORE in interface Visitor
        Overrides:
        visitDSTORE in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitFLOAD

        public void visitFLOAD​(FLOAD o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitFLOAD in interface Visitor
        Overrides:
        visitFLOAD in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitFSTORE

        public void visitFSTORE​(FSTORE o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitFSTORE in interface Visitor
        Overrides:
        visitFSTORE in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitIINC

        public void visitIINC​(IINC o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitIINC in interface Visitor
        Overrides:
        visitIINC in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitILOAD

        public void visitILOAD​(ILOAD o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitILOAD in interface Visitor
        Overrides:
        visitILOAD in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitISTORE

        public void visitISTORE​(ISTORE o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitISTORE in interface Visitor
        Overrides:
        visitISTORE in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitLDC

        public void visitLDC​(LDC ldc)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitLDC in interface Visitor
        Overrides:
        visitLDC in class EmptyVisitor
        Parameters:
        ldc - the instruction.
      • visitLDC2_W

        public void visitLDC2_W​(LDC2_W o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitLDC2_W in interface Visitor
        Overrides:
        visitLDC2_W in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitLLOAD

        public void visitLLOAD​(LLOAD o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitLLOAD in interface Visitor
        Overrides:
        visitLLOAD in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitLoadClass

        public void visitLoadClass​(LoadClass loadClass)
        Assures the generic preconditions of a LoadClass instance. The referenced class is loaded and pass2-verified.
        Specified by:
        visitLoadClass in interface Visitor
        Overrides:
        visitLoadClass in class EmptyVisitor
        Parameters:
        loadClass - the load class.
      • visitLSTORE

        public void visitLSTORE​(LSTORE o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitLSTORE in interface Visitor
        Overrides:
        visitLSTORE in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitNEW

        public void visitNEW​(NEW o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitNEW in interface Visitor
        Overrides:
        visitNEW in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitNEWARRAY

        public void visitNEWARRAY​(NEWARRAY o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitNEWARRAY in interface Visitor
        Overrides:
        visitNEWARRAY in class EmptyVisitor
        Parameters:
        o - the instruction.
      • visitRET

        public void visitRET​(RET o)
        Checks if the constraints of operands of the said instruction(s) are satisfied.
        Specified by:
        visitRET in interface Visitor
        Overrides:
        visitRET in class EmptyVisitor
        Parameters:
        o - the instruction.