From 17795394ff051ddfe02d717f6df327e63835a270 Mon Sep 17 00:00:00 2001
From: Alexander Kriegisch
Date: Fri, 15 Mar 2024 13:41:59 +0100
Subject: [PATCH] Remove bcel-builder/verifier-src
It looks as if the source code is never built and never used either.
Signed-off-by: Alexander Kriegisch
---
.../bcel/verifier/DescendingVisitor.java | 599 ----
.../bcel/verifier/EmptyClassVisitor.java | 241 --
.../bcel/verifier/EmptyInstVisitor.java | 259 --
.../bcel/verifier/GraphicalVerifier.java | 111 -
.../bcel/verifier/InstructionWalker.java | 459 ----
.../apache/bcel/verifier/NativeVerifier.java | 116 -
.../apache/bcel/verifier/PassVerifier.java | 143 -
.../apache/bcel/verifier/TransitiveHull.java | 137 -
.../bcel/verifier/VerificationResult.java | 135 -
.../apache/bcel/verifier/Verifier.java | 288 --
.../bcel/verifier/VerifierAppFrame.java | 409 ---
.../apache/bcel/verifier/VerifierFactory.java | 143 -
.../verifier/VerifierFactoryListModel.java | 107 -
.../verifier/VerifierFactoryObserver.java | 76 -
.../apache/bcel/verifier/VerifyDialog.java | 559 ----
.../exc/AssertionViolatedException.java | 107 -
.../exc/ClassConstraintException.java | 79 -
.../verifier/exc/CodeConstraintException.java | 77 -
.../verifier/exc/InvalidMethodException.java | 69 -
.../exc/LinkingConstraintException.java | 74 -
.../bcel/verifier/exc/LoadingException.java | 79 -
...ocalVariableInfoInconsistentException.java | 81 -
.../exc/StaticCodeConstraintException.java | 71 -
...ticCodeInstructionConstraintException.java | 74 -
...InstructionOperandConstraintException.java | 74 -
.../StructuralCodeConstraintException.java | 82 -
.../apache/bcel/verifier/exc/Utility.java | 76 -
.../verifier/exc/VerificationException.java | 82 -
.../VerifierConstraintViolatedException.java | 107 -
.../aspectj/apache/bcel/verifier/package.html | 25 -
.../bcel/verifier/statics/DOUBLE_Upper.java | 79 -
.../apache/bcel/verifier/statics/IntList.java | 85 -
.../bcel/verifier/statics/LONG_Upper.java | 79 -
.../verifier/statics/LocalVariableInfo.java | 144 -
.../verifier/statics/LocalVariablesInfo.java | 106 -
.../bcel/verifier/statics/Pass1Verifier.java | 215 --
.../bcel/verifier/statics/Pass2Verifier.java | 1490 ----------
.../bcel/verifier/statics/Pass3aVerifier.java | 1188 --------
.../statics/StringRepresentation.java | 268 --
.../apache/bcel/verifier/statics/package.html | 26 -
.../structurals/ControlFlowGraph.java | 456 ---
.../structurals/ExceptionHandler.java | 93 -
.../structurals/ExceptionHandlers.java | 108 -
.../structurals/ExecutionVisitor.java | 1136 --------
.../bcel/verifier/structurals/Frame.java | 150 -
.../verifier/structurals/GenericArray.java | 66 -
.../structurals/InstConstraintVisitor.java | 2444 -----------------
.../structurals/InstructionContext.java | 141 -
.../verifier/structurals/LocalVariables.java | 229 --
.../verifier/structurals/OperandStack.java | 275 --
.../verifier/structurals/Pass3bVerifier.java | 377 ---
.../bcel/verifier/structurals/Subroutine.java | 126 -
.../verifier/structurals/Subroutines.java | 670 -----
.../structurals/UninitializedObjectType.java | 97 -
.../bcel/verifier/structurals/package.html | 27 -
.../bcel/verifier/util/BCELFactory.java | 366 ---
.../apache/bcel/verifier/util/BCELifier.java | 341 ---
.../bcel/verifier/util/InstructionFinder.java | 440 ---
58 files changed, 16161 deletions(-)
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/DescendingVisitor.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/EmptyClassVisitor.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/EmptyInstVisitor.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/GraphicalVerifier.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/InstructionWalker.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/NativeVerifier.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/PassVerifier.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/TransitiveHull.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/VerificationResult.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/Verifier.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/VerifierAppFrame.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/VerifierFactory.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/VerifierFactoryListModel.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/VerifierFactoryObserver.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/VerifyDialog.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/AssertionViolatedException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/ClassConstraintException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/CodeConstraintException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/InvalidMethodException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/LinkingConstraintException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/LoadingException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/LocalVariableInfoInconsistentException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/StaticCodeConstraintException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/StaticCodeInstructionConstraintException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/StaticCodeInstructionOperandConstraintException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/StructuralCodeConstraintException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/Utility.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/VerificationException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/exc/VerifierConstraintViolatedException.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/package.html
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/DOUBLE_Upper.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/IntList.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/LONG_Upper.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/LocalVariableInfo.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/LocalVariablesInfo.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/Pass1Verifier.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/Pass2Verifier.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/Pass3aVerifier.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/StringRepresentation.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/package.html
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/ControlFlowGraph.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/ExceptionHandler.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/ExceptionHandlers.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/ExecutionVisitor.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/Frame.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/GenericArray.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/InstConstraintVisitor.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/InstructionContext.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/LocalVariables.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/OperandStack.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/Pass3bVerifier.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/Subroutine.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/Subroutines.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/UninitializedObjectType.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/package.html
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELFactory.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELifier.java
delete mode 100644 bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/InstructionFinder.java
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/DescendingVisitor.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/DescendingVisitor.java
deleted file mode 100644
index e803f5a92..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/DescendingVisitor.java
+++ /dev/null
@@ -1,599 +0,0 @@
-package org.aspectj.apache.bcel.verifier;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (https://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache BCEL" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache BCEL", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-import java.util.Stack;
-
-import org.aspectj.apache.bcel.classfile.AnnotationDefault;
-import org.aspectj.apache.bcel.classfile.Attribute;
-import org.aspectj.apache.bcel.classfile.AttributeUtils;
-import org.aspectj.apache.bcel.classfile.BootstrapMethods;
-import org.aspectj.apache.bcel.classfile.ClassVisitor;
-import org.aspectj.apache.bcel.classfile.Code;
-import org.aspectj.apache.bcel.classfile.CodeException;
-import org.aspectj.apache.bcel.classfile.Constant;
-import org.aspectj.apache.bcel.classfile.ConstantClass;
-import org.aspectj.apache.bcel.classfile.ConstantDouble;
-import org.aspectj.apache.bcel.classfile.ConstantDynamic;
-import org.aspectj.apache.bcel.classfile.ConstantFieldref;
-import org.aspectj.apache.bcel.classfile.ConstantFloat;
-import org.aspectj.apache.bcel.classfile.ConstantInteger;
-import org.aspectj.apache.bcel.classfile.ConstantInterfaceMethodref;
-import org.aspectj.apache.bcel.classfile.ConstantInvokeDynamic;
-import org.aspectj.apache.bcel.classfile.ConstantLong;
-import org.aspectj.apache.bcel.classfile.ConstantMethodHandle;
-import org.aspectj.apache.bcel.classfile.ConstantMethodType;
-import org.aspectj.apache.bcel.classfile.ConstantMethodref;
-import org.aspectj.apache.bcel.classfile.ConstantModule;
-import org.aspectj.apache.bcel.classfile.ConstantNameAndType;
-import org.aspectj.apache.bcel.classfile.ConstantPackage;
-import org.aspectj.apache.bcel.classfile.ConstantPool;
-import org.aspectj.apache.bcel.classfile.ConstantString;
-import org.aspectj.apache.bcel.classfile.ConstantUtf8;
-import org.aspectj.apache.bcel.classfile.ConstantValue;
-import org.aspectj.apache.bcel.classfile.Deprecated;
-import org.aspectj.apache.bcel.classfile.EnclosingMethod;
-import org.aspectj.apache.bcel.classfile.ExceptionTable;
-import org.aspectj.apache.bcel.classfile.Field;
-import org.aspectj.apache.bcel.classfile.InnerClass;
-import org.aspectj.apache.bcel.classfile.InnerClasses;
-import org.aspectj.apache.bcel.classfile.JavaClass;
-import org.aspectj.apache.bcel.classfile.LineNumber;
-import org.aspectj.apache.bcel.classfile.LineNumberTable;
-import org.aspectj.apache.bcel.classfile.LocalVariable;
-import org.aspectj.apache.bcel.classfile.LocalVariableTable;
-import org.aspectj.apache.bcel.classfile.LocalVariableTypeTable;
-import org.aspectj.apache.bcel.classfile.Method;
-import org.aspectj.apache.bcel.classfile.MethodParameters;
-import org.aspectj.apache.bcel.classfile.Module;
-import org.aspectj.apache.bcel.classfile.ModuleMainClass;
-import org.aspectj.apache.bcel.classfile.ModulePackages;
-import org.aspectj.apache.bcel.classfile.NestHost;
-import org.aspectj.apache.bcel.classfile.NestMembers;
-import org.aspectj.apache.bcel.classfile.Signature;
-import org.aspectj.apache.bcel.classfile.SourceFile;
-import org.aspectj.apache.bcel.classfile.StackMap;
-import org.aspectj.apache.bcel.classfile.StackMapEntry;
-import org.aspectj.apache.bcel.classfile.Synthetic;
-import org.aspectj.apache.bcel.classfile.Unknown;
-import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisAnnos;
-import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisParamAnnos;
-import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisTypeAnnos;
-import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisAnnos;
-import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisParamAnnos;
-import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisTypeAnnos;
-
-/**
- * Traverses a JavaClass with another Visitor object 'piggy-backed' that is
- * applied to all components of a JavaClass object. I.e. this class supplies the
- * traversal strategy, other classes can make use of it.
- *
- * @version $Id: DescendingVisitor.java,v 1.4 2009/09/15 19:40:22 aclement Exp $
- * @author M. Dahm
- */
-public class DescendingVisitor implements ClassVisitor {
- private JavaClass clazz;
- private ClassVisitor visitor;
- private Stack
Conventions:
- *
- * Type.VOID will never be pushed onto the stack. Type.DOUBLE and Type.LONG
- * that would normally take up two stack slots (like Double_HIGH and
- * Double_LOW) are represented by a simple single Type.DOUBLE or Type.LONG
- * object on the stack here.
- * If a two-slot type is stored into a local variable, the next variable
- * is given the type Type.UNKNOWN.
- *
- * @version $Id: ExecutionVisitor.java,v 1.3 2008/08/28 00:02:13 aclement Exp $
- * @author Enver Haase
- * @see #visitDSTORE(DSTORE o)
- * @see InstConstraintVisitor
- */
-public class ExecutionVisitor extends EmptyInstVisitor {
-
- /**
- * The executionframe we're operating on.
- */
- private Frame frame = null;
-
- /**
- * The ConstantPoolGen we're working with.
- * @see #setConstantPoolGen(ConstantPoolGen)
- */
- private ConstantPool cpg = null;
-
- /**
- * Constructor. Constructs a new instance of this class.
- */
- public ExecutionVisitor(){}
-
- /**
- * The OperandStack from the current Frame we're operating on.
- * @see #setFrame(Frame)
- */
- private OperandStack stack(){
- return frame.getStack();
- }
-
- /**
- * The LocalVariables from the current Frame we're operating on.
- * @see #setFrame(Frame)
- */
- private LocalVariables locals(){
- return frame.getLocals();
- }
-
- /**
- * Sets the ConstantPoolGen needed for symbolic execution.
- */
- public void setConstantPoolGen(ConstantPool cpg){
- this.cpg = cpg;
- }
-
- /**
- * The only method granting access to the single instance of
- * the ExecutionVisitor class. Before actively using this
- * instance, SET THE ConstantPoolGen FIRST.
- * @see #setConstantPoolGen(ConstantPoolGen)
- */
- public void setFrame(Frame f){
- this.frame = f;
- }
-
- ///** Symbolically executes the corresponding Java Virtual Machine instruction. */
- //public void visitWIDE(WIDE o){
- // The WIDE instruction is modelled as a flag
- // of the embedded instructions in BCEL.
- // Therefore BCEL checks for possible errors
- // when parsing in the .class file: We don't
- // have even the possibilty to care for WIDE
- // here.
- //}
-
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitAALOAD(Instruction o){
- stack().pop(); // pop the index int
-//System.out.print(stack().peek());
- Type t = stack().pop(); // Pop Array type
- if (t == Type.NULL){
- stack().push(Type.NULL);
- } // Do nothing stackwise --- a NullPointerException is thrown at Run-Time
- else{
- ArrayType at = (ArrayType) t;
- stack().push(at.getElementType());
- }
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitAASTORE(Instruction o){
- stack().pop();
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitACONST_NULL(Instruction o){
- stack().push(Type.NULL);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitALOAD(Instruction o){
- stack().push(locals().get(o.getIndex()));
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitANEWARRAY(Instruction o){
- stack().pop(); //count
- stack().push( new ArrayType(o.getType(cpg), 1) );
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitARETURN(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitARRAYLENGTH(Instruction o){
- stack().pop();
- stack().push(Type.INT);
- }
-
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitASTORE(Instruction o){
- locals().set(o.getIndex(), stack().pop());
- //System.err.println("TODO-DEBUG: set LV '"+o.getIndex()+"' to '"+locals().get(o.getIndex())+"'.");
- }
-
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitATHROW(Instruction o){
- Type t = stack().pop();
- stack().clear();
- if (t.equals(Type.NULL))
- stack().push(Type.getType("Ljava/lang/NullPointerException;"));
- else
- stack().push(t);
- }
-
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitBALOAD(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
-
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitBASTORE(Instruction o){
- stack().pop();
- stack().pop();
- stack().pop();
- }
-
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitBIPUSH(Instruction o){
- stack().push(Type.INT);
- }
-
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitCALOAD(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitCASTORE(Instruction o){
- stack().pop();
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitCHECKCAST(Instruction o){
- // It's possibly wrong to do so, but SUN's
- // ByteCode verifier seems to do (only) this, too.
- // TODO: One could use a sophisticated analysis here to check
- // if a type cannot possibly be cated to another and by
- // so doing predict the ClassCastException at run-time.
- stack().pop();
- stack().push(o.getType(cpg));
- }
-
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitD2F(Instruction o){
- stack().pop();
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitD2I(Instruction o){
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitD2L(Instruction o){
- stack().pop();
- stack().push(Type.LONG);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDADD(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDALOAD(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDASTORE(Instruction o){
- stack().pop();
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDCMPG(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDCMPL(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDCONST(Instruction o){
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDDIV(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDLOAD(Instruction o){
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDMUL(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDNEG(Instruction o){
- stack().pop();
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDREM(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDRETURN(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDSTORE(Instruction o){
- locals().set(o.getIndex(), stack().pop());
- locals().set(o.getIndex()+1, Type.UNKNOWN);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDSUB(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDUP(Instruction o){
- Type t = stack().pop();
- stack().push(t);
- stack().push(t);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDUP_X1(Instruction o){
- Type w1 = stack().pop();
- Type w2 = stack().pop();
- stack().push(w1);
- stack().push(w2);
- stack().push(w1);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDUP_X2(Instruction o){
- Type w1 = stack().pop();
- Type w2 = stack().pop();
- if (w2.getSize() == 2){
- stack().push(w1);
- stack().push(w2);
- stack().push(w1);
- }
- else{
- Type w3 = stack().pop();
- stack().push(w1);
- stack().push(w3);
- stack().push(w2);
- stack().push(w1);
- }
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDUP2(Instruction o){
- Type t = stack().pop();
- if (t.getSize() == 2){
- stack().push(t);
- stack().push(t);
- }
- else{ // t.getSize() is 1
- Type u = stack().pop();
- stack().push(u);
- stack().push(t);
- stack().push(u);
- stack().push(t);
- }
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDUP2_X1(Instruction o){
- Type t = stack().pop();
- if (t.getSize() == 2){
- Type u = stack().pop();
- stack().push(t);
- stack().push(u);
- stack().push(t);
- }
- else{ //t.getSize() is1
- Type u = stack().pop();
- Type v = stack().pop();
- stack().push(u);
- stack().push(t);
- stack().push(v);
- stack().push(u);
- stack().push(t);
- }
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitDUP2_X2(Instruction o){
- Type t = stack().pop();
- if (t.getSize() == 2){
- Type u = stack().pop();
- if (u.getSize() == 2){
- stack().push(t);
- stack().push(u);
- stack().push(t);
- }else{
- Type v = stack().pop();
- stack().push(t);
- stack().push(v);
- stack().push(u);
- stack().push(t);
- }
- }
- else{ //t.getSize() is 1
- Type u = stack().pop();
- Type v = stack().pop();
- if (v.getSize() == 2){
- stack().push(u);
- stack().push(t);
- stack().push(v);
- stack().push(u);
- stack().push(t);
- }else{
- Type w = stack().pop();
- stack().push(u);
- stack().push(t);
- stack().push(w);
- stack().push(v);
- stack().push(u);
- stack().push(t);
- }
- }
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitF2D(Instruction o){
- stack().pop();
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitF2I(Instruction o){
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitF2L(Instruction o){
- stack().pop();
- stack().push(Type.LONG);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFADD(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFALOAD(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFASTORE(Instruction o){
- stack().pop();
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFCMPG(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFCMPL(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFCONST(Instruction o){
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFDIV(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFLOAD(Instruction o){
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFMUL(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFNEG(Instruction o){
- stack().pop();
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFREM(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFRETURN(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFSTORE(Instruction o){
- locals().set(o.getIndex(), stack().pop());
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitFSUB(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitGETFIELD(FieldInstruction o){
- stack().pop();
- Type t = o.getFieldType(cpg);
- if ( t.equals(Type.BOOLEAN) ||
- t.equals(Type.CHAR) ||
- t.equals(Type.BYTE) ||
- t.equals(Type.SHORT) )
- t = Type.INT;
- stack().push(t);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitGETSTATIC(FieldInstruction o){
- Type t = o.getFieldType(cpg);
- if ( t.equals(Type.BOOLEAN) ||
- t.equals(Type.CHAR) ||
- t.equals(Type.BYTE) ||
- t.equals(Type.SHORT) )
- t = Type.INT;
- stack().push(t);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitGOTO(Instruction o){
- // no stack changes.
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitGOTO_W(Instruction o){
- // no stack changes.
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitI2B(Instruction o){
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitI2C(Instruction o){
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitI2D(Instruction o){
- stack().pop();
- stack().push(Type.DOUBLE);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitI2F(Instruction o){
- stack().pop();
- stack().push(Type.FLOAT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitI2L(Instruction o){
- stack().pop();
- stack().push(Type.LONG);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitI2S(Instruction o){
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIADD(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIALOAD(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIAND(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIASTORE(Instruction o){
- stack().pop();
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitICONST(Instruction o){
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIDIV(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIF_ACMPEQ(Instruction o){
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIF_ACMPNE(Instruction o){
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIF_ICMPEQ(Instruction o){
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIF_ICMPGE(Instruction o){
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIF_ICMPGT(Instruction o){
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIF_ICMPLE(Instruction o){
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIF_ICMPLT(Instruction o){
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIF_ICMPNE(Instruction o){
- stack().pop();
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIFEQ(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIFGE(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIFGT(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIFLE(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIFLT(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIFNE(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIFNONNULL(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIFNULL(Instruction o){
- stack().pop();
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIINC(IINC o){
- // stack is not changed.
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitILOAD(Instruction o){
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitIMUL(Instruction o){
- stack().pop();
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitINEG(Instruction o){
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitINSTANCEOF(Instruction o){
- stack().pop();
- stack().push(Type.INT);
- }
- /** Symbolically executes the corresponding Java Virtual Machine instruction. */
- public void visitINVOKEINTERFACE(INVOKEINTERFACE o){
- stack().pop(); //objectref
- for (int i=0; i.
- */
-
-
-/**
- * This class represents a JVM execution frame; that means,
- * a local variable array and an operand stack.
- *
- * @version $Id: Frame.java,v 1.2 2008/05/28 23:53:03 aclement Exp $
- * @author Enver Haase
- */
-
-public class Frame{
-
- /**
- * For instance initialization methods, it is important to remember
- * which instance it is that is not initialized yet. It will be
- * initialized invoking another constructor later.
- * NULL means the instance already *is* initialized.
- */
- protected static UninitializedObjectType _this;
-
- /**
- *
- */
- private LocalVariables locals;
-
- /**
- *
- */
- private OperandStack stack;
-
- /**
- *
- */
- public Frame(int maxLocals, int maxStack){
- locals = new LocalVariables(maxLocals);
- stack = new OperandStack(maxStack);
- }
-
- /**
- *
- */
- public Frame(LocalVariables locals, OperandStack stack){
- this.locals = locals;
- this.stack = stack;
- }
-
- /**
- *
- */
- protected Object clone(){
- Frame f = new Frame(locals.getClone(), stack.getClone());
- return f;
- }
-
- /**
- *
- */
- public Frame getClone(){
- return (Frame) clone();
- }
-
- /**
- *
- */
- public LocalVariables getLocals(){
- return locals;
- }
-
- /**
- *
- */
- public OperandStack getStack(){
- return stack;
- }
-
- /**
- *
- */
- public boolean equals(Object o){
- if (!(o instanceof Frame)) return false; // implies "null" is non-equal.
- Frame f = (Frame) o;
- return this.stack.equals(f.stack) && this.locals.equals(f.locals);
- }
-
- /**
- * Returns a String representation of the Frame instance.
- */
- public String toString(){
- String s="Local Variables:\n";
- s += locals;
- s += "OperandStack:\n";
- s += stack;
- return s;
- }
-}
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/GenericArray.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/GenericArray.java
deleted file mode 100644
index 895473cd3..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/GenericArray.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.aspectj.apache.bcel.verifier.structurals;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (https://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache BCEL" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache BCEL", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-
-/**
- * A placeholder class that can be used to create an ObjectType of which
- * has some of the properties arrays have. They implement java.lang.Cloneable
- * and java.io.Serializable and they extend java.lang.Object.
- *
- * @version $Id: GenericArray.java,v 1.2 2008/05/28 23:53:03 aclement Exp $
- * @author Enver Haase
- */
-public class GenericArray extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable{
-}
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/InstConstraintVisitor.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/InstConstraintVisitor.java
deleted file mode 100644
index e1e8f5f33..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/InstConstraintVisitor.java
+++ /dev/null
@@ -1,2444 +0,0 @@
-package org.aspectj.apache.bcel.verifier.structurals;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (https://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache BCEL" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache BCEL", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-
-import org.aspectj.apache.bcel.Constants;
-import org.aspectj.apache.bcel.Repository;
-import org.aspectj.apache.bcel.classfile.Constant;
-import org.aspectj.apache.bcel.classfile.ConstantClass;
-import org.aspectj.apache.bcel.classfile.ConstantDouble;
-import org.aspectj.apache.bcel.classfile.ConstantInteger;
-import org.aspectj.apache.bcel.classfile.ConstantFieldref;
-import org.aspectj.apache.bcel.classfile.ConstantFloat;
-import org.aspectj.apache.bcel.classfile.ConstantLong;
-import org.aspectj.apache.bcel.classfile.ConstantString;
-import org.aspectj.apache.bcel.classfile.ConstantPool;
-import org.aspectj.apache.bcel.classfile.Field;
-import org.aspectj.apache.bcel.classfile.JavaClass;
-import org.aspectj.apache.bcel.verifier.EmptyInstVisitor;
-import org.aspectj.apache.bcel.verifier.VerificationResult;
-import org.aspectj.apache.bcel.verifier.Verifier;
-import org.aspectj.apache.bcel.verifier.VerifierFactory;
-import org.aspectj.apache.bcel.verifier.exc.*;
-import org.aspectj.apache.bcel.generic.ArrayType;
-import org.aspectj.apache.bcel.generic.FieldInstruction;
-import org.aspectj.apache.bcel.generic.IINC;
-import org.aspectj.apache.bcel.generic.INVOKEINTERFACE;
-import org.aspectj.apache.bcel.generic.Instruction;
-import org.aspectj.apache.bcel.generic.InstructionBranch;
-import org.aspectj.apache.bcel.generic.InstructionLV;
-import org.aspectj.apache.bcel.generic.InvokeInstruction;
-import org.aspectj.apache.bcel.generic.LOOKUPSWITCH;
-import org.aspectj.apache.bcel.generic.MULTIANEWARRAY;
-import org.aspectj.apache.bcel.generic.MethodGen;
-import org.aspectj.apache.bcel.generic.ObjectType;
-import org.aspectj.apache.bcel.generic.RET;
-import org.aspectj.apache.bcel.generic.ReferenceType;
-import org.aspectj.apache.bcel.generic.ReturnaddressType;
-import org.aspectj.apache.bcel.generic.TABLESWITCH;
-import org.aspectj.apache.bcel.generic.Type;
-
-
-/**
- * A Visitor class testing for valid preconditions of JVM instructions.
- * The instance of this class will throw a StructuralCodeConstraintException
- * instance if an instruction is visitXXX()ed which has preconditions that are
- * not satisfied.
- * TODO: Currently, the JVM's behaviour concerning monitors (MONITORENTER,
- * MONITOREXIT) is not modeled in JustIce.
- *
- * @version $Id: InstConstraintVisitor.java,v 1.3 2008/08/28 00:02:13 aclement Exp $
- * @author Enver Haase
- * @see org.aspectj.apache.bcel.verifier.exc.StructuralCodeConstraintException
- * @see org.aspectj.apache.bcel.verifier.exc.LinkingConstraintException
- */
-public class InstConstraintVisitor extends EmptyInstVisitor {
-
- private static ObjectType GENERIC_ARRAY = new ObjectType("org.aspectj.apache.bcel.verifier.structurals.GenericArray");
-
- /**
- * The constructor. Constructs a new instance of this class.
- */
- public InstConstraintVisitor(){}
-
- /**
- * The Execution Frame we're working on.
- *
- * @see #setFrame(Frame f)
- * @see #locals()
- * @see #stack()
- */
- private Frame frame = null;
-
- private ConstantPool cpg = null;
-
- /**
- * The MethodGen we're working on.
- *
- * @see #setMethodGen(MethodGen mg)
- */
- private MethodGen mg = null;
-
- /**
- * The OperandStack we're working on.
- *
- * @see #setFrame(Frame f)
- */
- private OperandStack stack(){
- return frame.getStack();
- }
-
- /**
- * The LocalVariables we're working on.
- *
- * @see #setFrame(Frame f)
- */
- private LocalVariables locals(){
- return frame.getLocals();
- }
-
- /**
- * This method is called by the visitXXX() to notify the acceptor of this InstConstraintVisitor
- * that a constraint violation has occured. This is done by throwing an instance of a
- * StructuralCodeConstraintException.
- * @throws org.aspectj.apache.bcel.verifier.exc.StructuralCodeConstraintException always.
- */
- private void constraintViolated(Instruction violator, String description){
- String fq_classname = violator.getClass().getName();
- throw new StructuralCodeConstraintException("Instruction "+ fq_classname.substring(fq_classname.lastIndexOf('.')+1) +" constraint violated: " + description);
- }
-
- /**
- * This returns the single instance of the InstConstraintVisitor class.
- * To operate correctly, other values must have been set before actually
- * using the instance.
- * Use this method for performance reasons.
- *
- * @see #setConstantPoolGen(ConstantPoolGen cpg)
- * @see #setMethodGen(MethodGen mg)
- */
- public void setFrame(Frame f){
- this.frame = f;
- //if (singleInstance.mg == null || singleInstance.cpg == null) throw new AssertionViolatedException("Forgot to set important values first.");
- }
-
- /**
- * Sets the ConstantPoolGen instance needed for constraint
- * checking prior to execution.
- */
- public void setConstantPoolGen(ConstantPool cpg){
- this.cpg = cpg;
- }
-
- /**
- * Sets the MethodGen instance needed for constraint
- * checking prior to execution.
- */
- public void setMethodGen(MethodGen mg){
- this.mg = mg;
- }
-
- /**
- * Assures index is of type INT.
- * @throws org.aspectj.apache.bcel.verifier.exc.StructuralCodeConstraintException if the above constraint is not satisfied.
- */
- private void indexOfInt(Instruction o, Type index){
- if (! index.equals(Type.INT))
- constraintViolated(o, "The 'index' is not of type int but of type "+index+".");
- }
-
- /**
- * Assures the ReferenceType r is initialized (or Type.NULL).
- * Formally, this means (!(r instanceof UninitializedObjectType)), because
- * there are no uninitialized array types.
- * @throws org.aspectj.apache.bcel.verifier.exc.StructuralCodeConstraintException if the above constraint is not satisfied.
- */
- private void referenceTypeIsInitialized(Instruction o, ReferenceType r){
- if (r instanceof UninitializedObjectType){
- constraintViolated(o, "Working on an uninitialized object '"+r+"'.");
- }
- }
-
- /** Assures value is of type INT. */
- private void valueOfInt(Instruction o, Type value){
- if (! value.equals(Type.INT))
- constraintViolated(o, "The 'value' is not of type int but of type "+value+".");
- }
-
- /**
- * Assures arrayref is of ArrayType or NULL;
- * returns true if and only if arrayref is non-NULL.
- * @throws org.aspectj.apache.bcel.verifier.exc.StructuralCodeConstraintException if the above constraint is violated.
- */
- private boolean arrayrefOfArrayType(Instruction o, Type arrayref){
- if (! ((arrayref instanceof ArrayType) || arrayref.equals(Type.NULL)) )
- constraintViolated(o, "The 'arrayref' does not refer to an array but is of type "+arrayref+".");
- return (arrayref instanceof ArrayType);
- }
-
- /***************************************************************/
- /* MISC */
- /***************************************************************/
- /**
- * Ensures the general preconditions of an instruction that accesses the stack.
- * This method is here because BCEL has no such superinterface for the stack
- * accessing instructions; and there are funny unexpected exceptions in the
- * semantices of the superinterfaces and superclasses provided.
- * E.g. SWAP is a StackConsumer, but DUP_X1 is not a StackProducer.
- * Therefore, this method is called by all StackProducer, StackConsumer,
- * and StackInstruction instances via their visitXXX() method.
- * Unfortunately, as the superclasses and superinterfaces overlap, some instructions
- * cause this method to be called two or three times. [TODO: Fix this.]
- *
- * @see #visitStackConsumer(StackConsumer o)
- * @see #visitStackProducer(StackProducer o)
- * @see #visitStackInstruction(StackInstruction o)
- */
- private void _visitStackAccessor(Instruction o){
- int consume = o.consumeStack(cpg); // Stack values are always consumed first; then produced.
- if (consume > stack().slotsUsed()){
- constraintViolated((Instruction) o, "Cannot consume "+consume+" stack slots: only "+stack().slotsUsed()+" slot(s) left on stack!\nStack:\n"+stack());
- }
-
- int produce = o.produceStack(cpg) - ((Instruction) o).consumeStack(cpg); // Stack values are always consumed first; then produced.
- if ( produce + stack().slotsUsed() > stack().maxStack() ){
- constraintViolated((Instruction) o, "Cannot produce "+produce+" stack slots: only "+(stack().maxStack()-stack().slotsUsed())+" free stack slot(s) left.\nStack:\n"+stack());
- }
- }
-
- /***************************************************************/
- /* "generic"visitXXXX methods where XXXX is an interface */
- /* therefore, we don't know the order of visiting; but we know */
- /* these methods are called before the visitYYYY methods below */
- /***************************************************************/
-
- /**
- * Assures the generic preconditions of a LoadClass instance.
- * The referenced class is loaded and pass2-verified.
- */
- public void visitLoadClass(Instruction o){
- ObjectType t = o.getLoadClassType(cpg);
- if (t != null){// null means "no class is loaded"
- Verifier v = VerifierFactory.getVerifier(t.getClassName());
- VerificationResult vr = v.doPass2();
- if (vr.getStatus() != VerificationResult.VERIFIED_OK){
- constraintViolated((Instruction) o, "Class '"+o.getLoadClassType(cpg).getClassName()+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
- }
- }
- }
-
- /**
- * Ensures the general preconditions of a StackConsumer instance.
- */
- public void visitStackConsumer(Instruction o){
- _visitStackAccessor(o);
- }
-
- /**
- * Ensures the general preconditions of a StackProducer instance.
- */
- public void visitStackProducer(Instruction o){
- _visitStackAccessor(o);
- }
-
-
- /***************************************************************/
- /* "generic" visitYYYY methods where YYYY is a superclass. */
- /* therefore, we know the order of visiting; we know */
- /* these methods are called after the visitXXXX methods above. */
- /***************************************************************/
- public void visitCPInstruction(Instruction o){
- int idx = o.getIndex();
- if ((idx < 0) || (idx >= cpg.getSize())){
- throw new AssertionViolatedException("Huh?! Constant pool index of instruction '"+o+"' illegal? Pass 3a should have checked this!");
- }
- }
-
- public void visitFieldInstruction(Instruction o){
- // visitLoadClass(o) has been called before: Every FieldOrMethod
- // implements LoadClass.
- // visitCPInstruction(o) has been called before.
- // A FieldInstruction may be: GETFIELD, GETSTATIC, PUTFIELD, PUTSTATIC
- Constant c = cpg.getConstant(o.getIndex());
- if (!(c instanceof ConstantFieldref)){
- constraintViolated(o, "Index '"+o.getIndex()+"' should refer to a CONSTANT_Fieldref_info structure, but refers to '"+c+"'.");
- }
- // the o.getClassType(cpg) type has passed pass 2; see visitLoadClass(o).
- Type t = o.getType(cpg);
- if (t instanceof ObjectType){
- String name = ((ObjectType)t).getClassName();
- Verifier v = VerifierFactory.getVerifier( name );
- VerificationResult vr = v.doPass2();
- if (vr.getStatus() != VerificationResult.VERIFIED_OK){
- constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
- }
- }
- }
-
- public void visitInvokeInstruction(InvokeInstruction o){
- // visitLoadClass(o) has been called before: Every FieldOrMethod
- // implements LoadClass.
- // visitCPInstruction(o) has been called before.
- //TODO
- }
-
- public void visitStackInstruction(Instruction o){
- _visitStackAccessor(o);
- }
-
- /**
- * Assures the generic preconditions of a LocalVariableInstruction instance.
- * That is, the index of the local variable must be valid.
- */
- public void visitLocalVariableInstruction(InstructionLV o){
- if (locals().maxLocals() <= (o.getType(cpg).getSize()==1? o.getIndex() : o.getIndex()+1) ){
- constraintViolated(o, "The 'index' is not a valid index into the local variable array.");
- }
- }
-
- public void visitLoadInstruction(Instruction o){
- //visitLocalVariableInstruction(o) is called before, because it is more generic.
-
- // LOAD instructions must not read Type.UNKNOWN
- if (locals().get(o.getIndex()) == Type.UNKNOWN){
- constraintViolated(o, "Read-Access on local variable "+o.getIndex()+" with unknown content.");
- }
-
- // LOAD instructions, two-slot-values at index N must have Type.UNKNOWN
- // as a symbol for the higher halve at index N+1
- // [suppose some instruction put an int at N+1--- our double at N is defective]
- if (o.getType(cpg).getSize() == 2){
- if (locals().get(o.getIndex()+1) != Type.UNKNOWN){
- constraintViolated(o, "Reading a two-locals value from local variables "+o.getIndex()+" and "+(o.getIndex()+1)+" where the latter one is destroyed.");
- }
- }
-
- // LOAD instructions must read the correct type.
- if (!o.isALOAD()){
- if (locals().get(o.getIndex()) != o.getType(cpg) ){
- constraintViolated(o, "Local Variable type and LOADing Instruction type mismatch: Local Variable: '"+locals().get(o.getIndex())+"'; Instruction type: '"+o.getType(cpg)+"'.");
- }
- }
- else{ // we deal with an ALOAD
- if (!(locals().get(o.getIndex()) instanceof ReferenceType)){
- constraintViolated(o, "Local Variable type and LOADing Instruction type mismatch: Local Variable: '"+locals().get(o.getIndex())+"'; Instruction expects a ReferenceType.");
- }
- // ALOAD __IS ALLOWED__ to put uninitialized objects onto the stack!
- //referenceTypeIsInitialized(o, (ReferenceType) (locals().get(o.getIndex())));
- }
-
- // LOAD instructions must have enough free stack slots.
- if ((stack().maxStack() - stack().slotsUsed()) < o.getType(cpg).getSize()){
- constraintViolated(o, "Not enough free stack slots to load a '"+o.getType(cpg)+"' onto the OperandStack.");
- }
- }
-
- public void visitStoreInstruction(Instruction o){
- //visitLocalVariableInstruction(o) is called before, because it is more generic.
-
- if (stack().isEmpty()){ // Don't bother about 1 or 2 stack slots used. This check is implicitely done below while type checking.
- constraintViolated(o, "Cannot STORE: Stack to read from is empty.");
- }
-
- if (!o.isASTORE() ){
- if (! (stack().peek() == o.getType(cpg)) ){// the other xSTORE types are singletons in BCEL.
- constraintViolated(o, "Stack top type and STOREing Instruction type mismatch: Stack top: '"+stack().peek()+"'; Instruction type: '"+o.getType(cpg)+"'.");
- }
- }
- else{ // we deal with ASTORE
- Type stacktop = stack().peek();
- if ( (!(stacktop instanceof ReferenceType)) && (!(stacktop instanceof ReturnaddressType)) ){
- constraintViolated(o, "Stack top type and STOREing Instruction type mismatch: Stack top: '"+stack().peek()+"'; Instruction expects a ReferenceType or a ReturnadressType.");
- }
- if (stacktop instanceof ReferenceType){
- referenceTypeIsInitialized(o, (ReferenceType) stacktop);
- }
- }
- }
-
- public void visitReturnInstruction(Instruction o){
- if (o.getOpcode()==Constants.RETURN){
- return;
- }
- if (o.getOpcode()==Constants.ARETURN){
- if (stack().peek() == Type.NULL){
- return;
- }
- else{
- if (! (stack().peek() instanceof ReferenceType)){
- constraintViolated(o, "Reference type expected on top of stack, but is: '"+stack().peek()+"'.");
- }
- referenceTypeIsInitialized(o, (ReferenceType) (stack().peek()));
- //ReferenceType objectref = (ReferenceType) (stack().peek());
- // TODO: This can only be checked if using Staerk-et-al's "set of object types" instead of a
- // "wider cast object type" created during verification.
- //if (! (objectref.isAssignmentCompatibleWith(mg.getType())) ){
- // constraintViolated(o, "Type on stack top which should be returned is a '"+stack().peek()+"' which is not assignment compatible with the return type of this method, '"+mg.getType()+"'.");
- //}
- }
- }
- else{
- Type method_type = mg.getType();
- if (method_type == Type.BOOLEAN ||
- method_type == Type.BYTE ||
- method_type == Type.SHORT ||
- method_type == Type.CHAR){
- method_type = Type.INT;
- }
- if (! ( method_type.equals( stack().peek() ))){
- constraintViolated(o, "Current method has return type of '"+mg.getType()+"' expecting a '"+method_type+"' on top of the stack. But stack top is a '"+stack().peek()+"'.");
- }
- }
- }
-
- /***************************************************************/
- /* "special"visitXXXX methods for one type of instruction each */
- /***************************************************************/
-
- public void visitAALOAD(Instruction o){
- Type arrayref = stack().peek(1);
- Type index = stack().peek(0);
-
- indexOfInt(o, index);
- if (arrayrefOfArrayType(o, arrayref)){
- if (! (((ArrayType) arrayref).getElementType() instanceof ReferenceType)){
- constraintViolated(o, "The 'arrayref' does not refer to an array with elements of a ReferenceType but to an array of "+((ArrayType) arrayref).getElementType()+".");
- }
- referenceTypeIsInitialized(o, (ReferenceType) (((ArrayType) arrayref).getElementType()));
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitAASTORE(Instruction o){
- Type arrayref = stack().peek(2);
- Type index = stack().peek(1);
- Type value = stack().peek(0);
-
- indexOfInt(o, index);
- if (!(value instanceof ReferenceType)){
- constraintViolated(o, "The 'value' is not of a ReferenceType but of type "+value+".");
- }else{
- referenceTypeIsInitialized(o, (ReferenceType) value);
- }
- // Don't bother further with "referenceTypeIsInitialized()", there are no arrays
- // of an uninitialized object type.
- if (arrayrefOfArrayType(o, arrayref)){
- if (! (((ArrayType) arrayref).getElementType() instanceof ReferenceType)){
- constraintViolated(o, "The 'arrayref' does not refer to an array with elements of a ReferenceType but to an array of "+((ArrayType) arrayref).getElementType()+".");
- }
- if (! ((ReferenceType)value).isAssignmentCompatibleWith((ReferenceType) ((ArrayType) arrayref).getElementType())){
- constraintViolated(o, "The type of 'value' ('"+value+"') is not assignment compatible to the components of the array 'arrayref' refers to. ('"+((ArrayType) arrayref).getElementType()+"')");
- }
- }
- }
-
- public void visitACONST_NULL(Instruction o){
- // Nothing needs to be done here.
- }
-
- public void visitALOAD(Instruction o){
- //visitLoadInstruction(LoadInstruction) is called before.
- // Nothing else needs to be done here.
- }
-
- public void visitANEWARRAY(Instruction o){
- if (!stack().peek().equals(Type.INT))
- constraintViolated(o, "The 'count' at the stack top is not of type '"+Type.INT+"' but of type '"+stack().peek()+"'.");
- // The runtime constant pool item at that index must be a symbolic reference to a class,
- // array, or interface type. See Pass 3a.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitARETURN(Instruction o){
- if (! (stack().peek() instanceof ReferenceType) ){
- constraintViolated(o, "The 'objectref' at the stack top is not of a ReferenceType but of type '"+stack().peek()+"'.");
- }
- ReferenceType objectref = (ReferenceType) (stack().peek());
- referenceTypeIsInitialized(o, objectref);
-
- // The check below should already done via visitReturnInstruction(ReturnInstruction), see there.
- // It cannot be done using Staerk-et-al's "set of object types" instead of a
- // "wider cast object type", anyway.
- //if (! objectref.isAssignmentCompatibleWith(mg.getReturnType() )){
- // constraintViolated(o, "The 'objectref' type "+objectref+" at the stack top is not assignment compatible with the return type '"+mg.getReturnType()+"' of the method.");
- //}
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitARRAYLENGTH(Instruction o){
- Type arrayref = stack().peek(0);
- arrayrefOfArrayType(o, arrayref);
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitASTORE(Instruction o){
- if (! ( (stack().peek() instanceof ReferenceType) || (stack().peek() instanceof ReturnaddressType) ) ){
- constraintViolated(o, "The 'objectref' is not of a ReferenceType or of ReturnaddressType but of "+stack().peek()+".");
- }
- if (stack().peek() instanceof ReferenceType){
- referenceTypeIsInitialized(o, (ReferenceType) (stack().peek()) );
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitATHROW(Instruction o){
- // It's stated that 'objectref' must be of a ReferenceType --- but since Throwable is
- // not derived from an ArrayType, it follows that 'objectref' must be of an ObjectType or Type.NULL.
- if (! ((stack().peek() instanceof ObjectType) || (stack().peek().equals(Type.NULL))) ){
- constraintViolated(o, "The 'objectref' is not of an (initialized) ObjectType but of type "+stack().peek()+".");
- }
-
- // NULL is a subclass of every class, so to speak.
- if (stack().peek().equals(Type.NULL)) return;
-
- ObjectType exc = (ObjectType) (stack().peek());
- ObjectType throwable = (ObjectType) (Type.getType("Ljava/lang/Throwable;"));
- if ( (! (exc.subclassOf(throwable)) ) && (! (exc.equals(throwable))) ){
- constraintViolated(o, "The 'objectref' is not of class Throwable or of a subclass of Throwable, but of '"+stack().peek()+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitBALOAD(Instruction o){
- Type arrayref = stack().peek(1);
- Type index = stack().peek(0);
- indexOfInt(o, index);
- if (arrayrefOfArrayType(o, arrayref)){
- if (! ( (((ArrayType) arrayref).getElementType().equals(Type.BOOLEAN)) ||
- (((ArrayType) arrayref).getElementType().equals(Type.BYTE)) ) ){
- constraintViolated(o, "The 'arrayref' does not refer to an array with elements of a Type.BYTE or Type.BOOLEAN but to an array of '"+((ArrayType) arrayref).getElementType()+"'.");
- }
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitBASTORE(Instruction o){
- Type arrayref = stack().peek(2);
- Type index = stack().peek(1);
- Type value = stack().peek(0);
-
- indexOfInt(o, index);
- valueOfInt(o, value);
- if (arrayrefOfArrayType(o, arrayref)){
- if (! ( (((ArrayType) arrayref).getElementType().equals(Type.BOOLEAN)) ||
- (((ArrayType) arrayref).getElementType().equals(Type.BYTE)) ) )
- constraintViolated(o, "The 'arrayref' does not refer to an array with elements of a Type.BYTE or Type.BOOLEAN but to an array of '"+((ArrayType) arrayref).getElementType()+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitBIPUSH(Instruction o){
- // Nothing to do...
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitBREAKPOINT(Instruction o){
- throw new AssertionViolatedException("In this JustIce verification pass there should not occur an illegal instruction such as BREAKPOINT.");
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitCALOAD(Instruction o){
- Type arrayref = stack().peek(1);
- Type index = stack().peek(0);
-
- indexOfInt(o, index);
- arrayrefOfArrayType(o, arrayref);
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitCASTORE(Instruction o){
- Type arrayref = stack().peek(2);
- Type index = stack().peek(1);
- Type value = stack().peek(0);
-
- indexOfInt(o, index);
- valueOfInt(o, value);
- if (arrayrefOfArrayType(o, arrayref)){
- if (! ((ArrayType) arrayref).getElementType().equals(Type.CHAR) ){
- constraintViolated(o, "The 'arrayref' does not refer to an array with elements of type char but to an array of type "+((ArrayType) arrayref).getElementType()+".");
- }
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitCHECKCAST(Instruction o){
- // The objectref must be of type reference.
- Type objectref = stack().peek(0);
- if (!(objectref instanceof ReferenceType)){
- constraintViolated(o, "The 'objectref' is not of a ReferenceType but of type "+objectref+".");
- }
- else{
- referenceTypeIsInitialized(o, (ReferenceType) objectref);
- }
- // The unsigned indexbyte1 and indexbyte2 are used to construct an index into the runtime constant pool of the
- // current class (�3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The runtime constant
- // pool item at the index must be a symbolic reference to a class, array, or interface type.
- Constant c = cpg.getConstant(o.getIndex());
- if (! (c instanceof ConstantClass)){
- constraintViolated(o, "The Constant at 'index' is not a ConstantClass, but '"+c+"'.");
- }
- }
-
- public void visitD2F(Instruction o) { checkTop(o,Type.DOUBLE); }
- public void visitD2I(Instruction o) { checkTop(o,Type.DOUBLE); }
- public void visitD2L(Instruction o) { checkTop(o,Type.DOUBLE); }
-
- public void visitDADD(Instruction o){
- checkTop(o,Type.DOUBLE);
- if (stack().peek(1) != Type.DOUBLE){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'double', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- public void visitDALOAD(Instruction o){
- indexOfInt(o, stack().peek());
- if (stack().peek(1) == Type.NULL){
- return;
- }
- if (! (stack().peek(1) instanceof ArrayType)){
- constraintViolated(o, "Stack next-to-top must be of type double[] but is '"+stack().peek(1)+"'.");
- }
- Type t = ((ArrayType) (stack().peek(1))).getBasicType();
- if (t != Type.DOUBLE){
- constraintViolated(o, "Stack next-to-top must be of type double[] but is '"+stack().peek(1)+"'.");
- }
- }
-
- public void visitDASTORE(Instruction o){
- if (stack().peek() != Type.DOUBLE){
- constraintViolated(o, "The value at the stack top is not of type 'double', but of type '"+stack().peek()+"'.");
- }
- indexOfInt(o, stack().peek(1));
- if (stack().peek(2) == Type.NULL){
- return;
- }
- if (! (stack().peek(2) instanceof ArrayType)){
- constraintViolated(o, "Stack next-to-next-to-top must be of type double[] but is '"+stack().peek(2)+"'.");
- }
- Type t = ((ArrayType) (stack().peek(2))).getBasicType();
- if (t != Type.DOUBLE){
- constraintViolated(o, "Stack next-to-next-to-top must be of type double[] but is '"+stack().peek(2)+"'.");
- }
- }
-
- public void visitDCMPG(Instruction o){
- checkTop(o,Type.DOUBLE);
- if (stack().peek(1) != Type.DOUBLE){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'double', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- public void visitDCMPL(Instruction o){
- checkTop(o,Type.DOUBLE);
- if (stack().peek(1) != Type.DOUBLE){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'double', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- public void visitDCONST(Instruction o){
- // There's nothing to be done here.
- }
-
- public void visitDDIV(Instruction o){
- checkTop(o,Type.DOUBLE);
- if (stack().peek(1) != Type.DOUBLE){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'double', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- public void visitDLOAD(Instruction o){
- //visitLoadInstruction(LoadInstruction) is called before.
-
- // Nothing else needs to be done here.
- }
-
- public void visitDMUL(Instruction o){
- checkTop(o,Type.DOUBLE);
- if (stack().peek(1) != Type.DOUBLE){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'double', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- public void visitDNEG(Instruction o){
- checkTop(o,Type.DOUBLE);
- }
-
- public void visitDREM(Instruction o){
- checkTop(o,Type.DOUBLE);
- if (stack().peek(1) != Type.DOUBLE){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'double', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- private void checkTop(Instruction o,Type t) {
- if (stack().peek()!=t)
- constraintViolated(o, "The value at the stack top is not of type '"+t+"', but of type '"+stack().peek()+"'.");
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitDRETURN(Instruction o){
- checkTop(o,Type.DOUBLE);
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitDSTORE(Instruction o){
- //visitStoreInstruction(StoreInstruction) is called before.
-
- // Nothing else needs to be done here.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitDSUB(Instruction o){
- if (stack().peek() != Type.DOUBLE){
- constraintViolated(o, "The value at the stack top is not of type 'double', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.DOUBLE){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'double', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitDUP(Instruction o){
- if (stack().peek().getSize() != 1){
- constraintViolated(o, "Won't DUP type on stack top '"+stack().peek()+"' because it must occupy exactly one slot, not '"+stack().peek().getSize()+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitDUP_X1(Instruction o){
- if (stack().peek().getSize() != 1){
- constraintViolated(o, "Type on stack top '"+stack().peek()+"' should occupy exactly one slot, not '"+stack().peek().getSize()+"'.");
- }
- if (stack().peek(1).getSize() != 1){
- constraintViolated(o, "Type on stack next-to-top '"+stack().peek(1)+"' should occupy exactly one slot, not '"+stack().peek(1).getSize()+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitDUP_X2(Instruction o){
- if (stack().peek().getSize() != 1){
- constraintViolated(o, "Stack top type must be of size 1, but is '"+stack().peek()+"' of size '"+stack().peek().getSize()+"'.");
- }
- if (stack().peek(1).getSize() == 2){
- return; // Form 2, okay.
- }
- else{ //stack().peek(1).getSize == 1.
- if (stack().peek(2).getSize() != 1){
- constraintViolated(o, "If stack top's size is 1 and stack next-to-top's size is 1, stack next-to-next-to-top's size must also be 1, but is: '"+stack().peek(2)+"' of size '"+stack().peek(2).getSize()+"'.");
- }
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitDUP2(Instruction o){
- if (stack().peek().getSize() == 2){
- return; // Form 2, okay.
- }
- else{ //stack().peek().getSize() == 1.
- if (stack().peek(1).getSize() != 1){
- constraintViolated(o, "If stack top's size is 1, then stack next-to-top's size must also be 1. But it is '"+stack().peek(1)+"' of size '"+stack().peek(1).getSize()+"'.");
- }
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitDUP2_X1(Instruction o){
- if (stack().peek().getSize() == 2){
- if (stack().peek(1).getSize() != 1){
- constraintViolated(o, "If stack top's size is 2, then stack next-to-top's size must be 1. But it is '"+stack().peek(1)+"' of size '"+stack().peek(1).getSize()+"'.");
- }
- else{
- return; // Form 2
- }
- }
- else{ // stack top is of size 1
- if ( stack().peek(1).getSize() != 1 ){
- constraintViolated(o, "If stack top's size is 1, then stack next-to-top's size must also be 1. But it is '"+stack().peek(1)+"' of size '"+stack().peek(1).getSize()+"'.");
- }
- if ( stack().peek(2).getSize() != 1 ){
- constraintViolated(o, "If stack top's size is 1, then stack next-to-next-to-top's size must also be 1. But it is '"+stack().peek(2)+"' of size '"+stack().peek(2).getSize()+"'.");
- }
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitDUP2_X2(Instruction o){
-
- if (stack().peek(0).getSize() == 2){
- if (stack().peek(1).getSize() == 2){
- return; // Form 4
- }
- else{// stack top size is 2, next-to-top's size is 1
- if ( stack().peek(2).getSize() != 1 ){
- constraintViolated(o, "If stack top's size is 2 and stack-next-to-top's size is 1, then stack next-to-next-to-top's size must also be 1. But it is '"+stack().peek(2)+"' of size '"+stack().peek(2).getSize()+"'.");
- }
- else{
- return; // Form 2
- }
- }
- }
- else{// stack top is of size 1
- if (stack().peek(1).getSize() == 1){
- if ( stack().peek(2).getSize() == 2 ){
- return; // Form 3
- }
- else{
- if ( stack().peek(3).getSize() == 1){
- return; // Form 1
- }
- }
- }
- }
- constraintViolated(o, "The operand sizes on the stack do not match any of the four forms of usage of this instruction.");
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitF2D(Instruction o){
- if (stack().peek() != Type.FLOAT){
- constraintViolated(o, "The value at the stack top is not of type 'float', but of type '"+stack().peek()+"'.");
- }
- }
-
- public void visitF2I(Instruction o){
- checkTop(o,Type.FLOAT);
- }
-
- public void visitF2L(Instruction o){
- checkTop(o,Type.FLOAT);
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFADD(Instruction o){
- checkTop(o,Type.FLOAT);
- if (stack().peek(1) != Type.FLOAT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'float', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFALOAD(Instruction o){
- indexOfInt(o, stack().peek());
- if (stack().peek(1) == Type.NULL){
- return;
- }
- if (! (stack().peek(1) instanceof ArrayType)){
- constraintViolated(o, "Stack next-to-top must be of type float[] but is '"+stack().peek(1)+"'.");
- }
- Type t = ((ArrayType) (stack().peek(1))).getBasicType();
- if (t != Type.FLOAT){
- constraintViolated(o, "Stack next-to-top must be of type float[] but is '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFASTORE(Instruction o){
- checkTop(o,Type.FLOAT);
- indexOfInt(o, stack().peek(1));
- if (stack().peek(2) == Type.NULL){
- return;
- }
- if (! (stack().peek(2) instanceof ArrayType)){
- constraintViolated(o, "Stack next-to-next-to-top must be of type float[] but is '"+stack().peek(2)+"'.");
- }
- Type t = ((ArrayType) (stack().peek(2))).getBasicType();
- if (t != Type.FLOAT){
- constraintViolated(o, "Stack next-to-next-to-top must be of type float[] but is '"+stack().peek(2)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFCMPG(Instruction o){
- checkTop(o,Type.FLOAT);
- if (stack().peek(1) != Type.FLOAT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'float', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFCMPL(Instruction o){
- checkTop(o,Type.FLOAT);
- if (stack().peek(1) != Type.FLOAT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'float', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFCONST(Instruction o){
- // nothing to do here.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFDIV(Instruction o){
- checkTop(o,Type.FLOAT);
- if (stack().peek(1) != Type.FLOAT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'float', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFLOAD(Instruction o){
- //visitLoadInstruction(LoadInstruction) is called before.
-
- // Nothing else needs to be done here.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFMUL(Instruction o){
- checkTop(o,Type.FLOAT);
- if (stack().peek(1) != Type.FLOAT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'float', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFNEG(Instruction o){
- checkTop(o,Type.FLOAT);
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFREM(Instruction o){
- checkTop(o,Type.FLOAT);
- if (stack().peek(1) != Type.FLOAT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'float', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFRETURN(Instruction o){
- checkTop(o,Type.FLOAT);
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFSTORE(Instruction o){
- //visitStoreInstruction(StoreInstruction) is called before.
-
- // Nothing else needs to be done here.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitFSUB(Instruction o){
- if (stack().peek() != Type.FLOAT){
- constraintViolated(o, "The value at the stack top is not of type 'float', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.FLOAT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'float', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitGETFIELD(FieldInstruction o){
- Type objectref = stack().peek();
- if (! ( (objectref instanceof ObjectType) || (objectref == Type.NULL) ) ){
- constraintViolated(o, "Stack top should be an object reference that's not an array reference, but is '"+objectref+"'.");
- }
-
- String field_name = o.getFieldName(cpg);
-
- JavaClass jc = Repository.lookupClass(o.getClassType(cpg).getClassName());
- Field[] fields = jc.getFields();
- Field f = null;
- for (int i=0; i=0; i--){
- Type fromStack = stack().peek( (nargs-1) - i ); // 0 to nargs-1
- Type fromDesc = argtypes[i];
- if (fromDesc == Type.BOOLEAN ||
- fromDesc == Type.BYTE ||
- fromDesc == Type.CHAR ||
- fromDesc == Type.SHORT){
- fromDesc = Type.INT;
- }
- if (! fromStack.equals(fromDesc)){
- if (fromStack instanceof ReferenceType && fromDesc instanceof ReferenceType){
- //ReferenceType rFromStack = (ReferenceType) fromStack;
- //ReferenceType rFromDesc = (ReferenceType) fromDesc;
- // TODO: This can only be checked when using Staerk-et-al's "set of object types"
- // instead of a "wider cast object type" created during verification.
- //if ( ! rFromStack.isAssignmentCompatibleWith(rFromDesc) ){
- // constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack (which is not assignment compatible).");
- //}
- }
- else{
- constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack.");
- }
- }
- }
-
- Type objref = stack().peek(nargs);
- if (objref == Type.NULL){
- return;
- }
- if (! (objref instanceof ReferenceType) ){
- constraintViolated(o, "Expecting a reference type as 'objectref' on the stack, not a '"+objref+"'.");
- }
- referenceTypeIsInitialized(o, (ReferenceType) objref);
- if (!(objref instanceof ObjectType)){
- if (!(objref instanceof ArrayType)){
- constraintViolated(o, "Expecting an ObjectType as 'objectref' on the stack, not a '"+objref+"'."); // could be a ReturnaddressType
- }
- else{
- objref = GENERIC_ARRAY;
- }
- }
-
- // String objref_classname = ((ObjectType) objref).getClassName();
- // String theInterface = o.getClassName(cpg);
- // TODO: This can only be checked if we're using Staerk-et-al's "set of object types"
- // instead of "wider cast object types" generated during verification.
- //if ( ! Repository.implementationOf(objref_classname, theInterface) ){
- // constraintViolated(o, "The 'objref' item '"+objref+"' does not implement '"+theInterface+"' as expected.");
- //}
-
- int counted_count = 1; // 1 for the objectref
- for (int i=0; i=0; i--){
- Type fromStack = stack().peek( (nargs-1) - i ); // 0 to nargs-1
- Type fromDesc = argtypes[i];
- if (fromDesc == Type.BOOLEAN ||
- fromDesc == Type.BYTE ||
- fromDesc == Type.CHAR ||
- fromDesc == Type.SHORT){
- fromDesc = Type.INT;
- }
- if (! fromStack.equals(fromDesc)){
- if (fromStack instanceof ReferenceType && fromDesc instanceof ReferenceType){
- ReferenceType rFromStack = (ReferenceType) fromStack;
- ReferenceType rFromDesc = (ReferenceType) fromDesc;
- // TODO: This can only be checked using Staerk-et-al's "set of object types", not
- // using a "wider cast object type".
- if ( ! rFromStack.isAssignmentCompatibleWith(rFromDesc) ){
- constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack (which is not assignment compatible).");
- }
- }
- else{
- constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack.");
- }
- }
- }
-
- Type objref = stack().peek(nargs);
- if (objref == Type.NULL){
- return;
- }
- if (! (objref instanceof ReferenceType) ){
- constraintViolated(o, "Expecting a reference type as 'objectref' on the stack, not a '"+objref+"'.");
- }
- String objref_classname = null;
- if ( !(o.getMethodName(cpg).equals(Constants.CONSTRUCTOR_NAME))){
- referenceTypeIsInitialized(o, (ReferenceType) objref);
- if (!(objref instanceof ObjectType)){
- if (!(objref instanceof ArrayType)){
- constraintViolated(o, "Expecting an ObjectType as 'objectref' on the stack, not a '"+objref+"'."); // could be a ReturnaddressType
- }
- else{
- objref = GENERIC_ARRAY;
- }
- }
-
- objref_classname = ((ObjectType) objref).getClassName();
- }
- else{
- if (!(objref instanceof UninitializedObjectType)){
- constraintViolated(o, "Expecting an UninitializedObjectType as 'objectref' on the stack, not a '"+objref+"'. Otherwise, you couldn't invoke a method since an array has no methods (not to speak of a return address).");
- }
- objref_classname = ((UninitializedObjectType) objref).getInitialized().getClassName();
- }
-
-
- String theClass = o.getClassName(cpg);
- if ( ! Repository.instanceOf(objref_classname, theClass) ){
- constraintViolated(o, "The 'objref' item '"+objref+"' does not implement '"+theClass+"' as expected.");
- }
-
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitINVOKESTATIC(InvokeInstruction o){
- // Method is not native, otherwise pass 3 would not happen.
-
- Type t = o.getType(cpg);
- if (t instanceof ObjectType){
- String name = ((ObjectType)t).getClassName();
- Verifier v = VerifierFactory.getVerifier( name );
- VerificationResult vr = v.doPass2();
- if (vr.getStatus() != VerificationResult.VERIFIED_OK){
- constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
- }
- }
-
- Type[] argtypes = o.getArgumentTypes(cpg);
- int nargs = argtypes.length;
-
- for (int i=nargs-1; i>=0; i--){
- Type fromStack = stack().peek( (nargs-1) - i ); // 0 to nargs-1
- Type fromDesc = argtypes[i];
- if (fromDesc == Type.BOOLEAN ||
- fromDesc == Type.BYTE ||
- fromDesc == Type.CHAR ||
- fromDesc == Type.SHORT){
- fromDesc = Type.INT;
- }
- if (! fromStack.equals(fromDesc)){
- if (fromStack instanceof ReferenceType && fromDesc instanceof ReferenceType){
- ReferenceType rFromStack = (ReferenceType) fromStack;
- ReferenceType rFromDesc = (ReferenceType) fromDesc;
- // TODO: This check can possibly only be done using Staerk-et-al's "set of object types"
- // instead of a "wider cast object type" created during verification.
- if ( ! rFromStack.isAssignmentCompatibleWith(rFromDesc) ){
- constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack (which is not assignment compatible).");
- }
- }
- else{
- constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack.");
- }
- }
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitINVOKEVIRTUAL(InvokeInstruction o){
- // the o.getClassType(cpg) type has passed pass 2; see visitLoadClass(o).
-
- Type t = o.getType(cpg);
- if (t instanceof ObjectType){
- String name = ((ObjectType)t).getClassName();
- Verifier v = VerifierFactory.getVerifier( name );
- VerificationResult vr = v.doPass2();
- if (vr.getStatus() != VerificationResult.VERIFIED_OK){
- constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
- }
- }
-
-
- Type[] argtypes = o.getArgumentTypes(cpg);
- int nargs = argtypes.length;
-
- for (int i=nargs-1; i>=0; i--){
- Type fromStack = stack().peek( (nargs-1) - i ); // 0 to nargs-1
- Type fromDesc = argtypes[i];
- if (fromDesc == Type.BOOLEAN ||
- fromDesc == Type.BYTE ||
- fromDesc == Type.CHAR ||
- fromDesc == Type.SHORT){
- fromDesc = Type.INT;
- }
- if (! fromStack.equals(fromDesc)){
- if (fromStack instanceof ReferenceType && fromDesc instanceof ReferenceType){
- ReferenceType rFromStack = (ReferenceType) fromStack;
- ReferenceType rFromDesc = (ReferenceType) fromDesc;
- // TODO: This can possibly only be checked when using Staerk-et-al's "set of object types" instead
- // of a single "wider cast object type" created during verification.
- if ( ! rFromStack.isAssignmentCompatibleWith(rFromDesc) ){
- constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack (which is not assignment compatible).");
- }
- }
- else{
- constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack.");
- }
- }
- }
-
- Type objref = stack().peek(nargs);
- if (objref == Type.NULL){
- return;
- }
- if (! (objref instanceof ReferenceType) ){
- constraintViolated(o, "Expecting a reference type as 'objectref' on the stack, not a '"+objref+"'.");
- }
- referenceTypeIsInitialized(o, (ReferenceType) objref);
- if (!(objref instanceof ObjectType)){
- if (!(objref instanceof ArrayType)){
- constraintViolated(o, "Expecting an ObjectType as 'objectref' on the stack, not a '"+objref+"'."); // could be a ReturnaddressType
- }
- else{
- objref = GENERIC_ARRAY;
- }
- }
-
- String objref_classname = ((ObjectType) objref).getClassName();
-
- String theClass = o.getClassName(cpg);
-
- if ( ! Repository.instanceOf(objref_classname, theClass) ){
- constraintViolated(o, "The 'objref' item '"+objref+"' does not implement '"+theClass+"' as expected.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitIOR(Instruction o){
- if (stack().peek() != Type.INT){
- constraintViolated(o, "The value at the stack top is not of type 'int', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.INT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'int', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitIREM(Instruction o){
- if (stack().peek() != Type.INT){
- constraintViolated(o, "The value at the stack top is not of type 'int', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.INT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'int', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitIRETURN(Instruction o){
- if (stack().peek() != Type.INT){
- constraintViolated(o, "The value at the stack top is not of type 'int', but of type '"+stack().peek()+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitISHL(Instruction o){
- checkTop(o,Type.INT);
- if (stack().peek(1) != Type.INT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'int', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitISHR(Instruction o){
- checkTop(o,Type.INT);
- if (stack().peek(1) != Type.INT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'int', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitISTORE(Instruction o){
- //visitStoreInstruction(StoreInstruction) is called before.
-
- // Nothing else needs to be done here.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitISUB(Instruction o){
- checkTop(o,Type.INT);
- if (stack().peek(1) != Type.INT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'int', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitIUSHR(Instruction o){
- checkTop(o,Type.INT);
- if (stack().peek(1) != Type.INT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'int', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitIXOR(Instruction o){
- if (stack().peek() != Type.INT){
- constraintViolated(o, "The value at the stack top is not of type 'int', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.INT){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'int', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitJSR(InstructionBranch o){
- // nothing to do here.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitJSR_W(InstructionBranch o){
- // nothing to do here.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitL2D(Instruction o){
- if (stack().peek() != Type.LONG){
- constraintViolated(o, "The value at the stack top is not of type 'long', but of type '"+stack().peek()+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitL2F(Instruction o){
- if (stack().peek() != Type.LONG){
- constraintViolated(o, "The value at the stack top is not of type 'long', but of type '"+stack().peek()+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitL2I(Instruction o){
- if (stack().peek() != Type.LONG){
- constraintViolated(o, "The value at the stack top is not of type 'long', but of type '"+stack().peek()+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLADD(Instruction o){
- if (stack().peek() != Type.LONG){
- constraintViolated(o, "The value at the stack top is not of type 'long', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLALOAD(Instruction o){
- indexOfInt(o, stack().peek());
- if (stack().peek(1) == Type.NULL){
- return;
- }
- if (! (stack().peek(1) instanceof ArrayType)){
- constraintViolated(o, "Stack next-to-top must be of type long[] but is '"+stack().peek(1)+"'.");
- }
- Type t = ((ArrayType) (stack().peek(1))).getBasicType();
- if (t != Type.LONG){
- constraintViolated(o, "Stack next-to-top must be of type long[] but is '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLAND(Instruction o){
- if (stack().peek() != Type.LONG){
- constraintViolated(o, "The value at the stack top is not of type 'long', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLASTORE(Instruction o){
- if (stack().peek() != Type.LONG){
- constraintViolated(o, "The value at the stack top is not of type 'long', but of type '"+stack().peek()+"'.");
- }
- indexOfInt(o, stack().peek(1));
- if (stack().peek(2) == Type.NULL){
- return;
- }
- if (! (stack().peek(2) instanceof ArrayType)){
- constraintViolated(o, "Stack next-to-next-to-top must be of type long[] but is '"+stack().peek(2)+"'.");
- }
- Type t = ((ArrayType) (stack().peek(2))).getBasicType();
- if (t != Type.LONG){
- constraintViolated(o, "Stack next-to-next-to-top must be of type long[] but is '"+stack().peek(2)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLCMP(Instruction o){
- if (stack().peek() != Type.LONG){
- constraintViolated(o, "The value at the stack top is not of type 'long', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLCONST(Instruction o){
- // Nothing to do here.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLDC(Instruction o){
- // visitCPInstruction is called first.
-
- Constant c = cpg.getConstant(o.getIndex());
- if (! ( ( c instanceof ConstantInteger) ||
- ( c instanceof ConstantFloat ) ||
- ( c instanceof ConstantString ) ) ){
- constraintViolated(o, "Referenced constant should be a CONSTANT_Integer, a CONSTANT_Float or a CONSTANT_String, but is '"+c+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLDC_W(Instruction o){
- // visitCPInstruction is called first.
-
- Constant c = cpg.getConstant(o.getIndex());
- if (! ( ( c instanceof ConstantInteger) ||
- ( c instanceof ConstantFloat ) ||
- ( c instanceof ConstantString ) ) ){
- constraintViolated(o, "Referenced constant should be a CONSTANT_Integer, a CONSTANT_Float or a CONSTANT_String, but is '"+c+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLDC2_W(Instruction o){
- // visitCPInstruction is called first.
-
- Constant c = cpg.getConstant(o.getIndex());
- if (! ( ( c instanceof ConstantLong) ||
- ( c instanceof ConstantDouble ) ) ){
- constraintViolated(o, "Referenced constant should be a CONSTANT_Integer, a CONSTANT_Float or a CONSTANT_String, but is '"+c+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLDIV(Instruction o){
- if (stack().peek() != Type.LONG){
- constraintViolated(o, "The value at the stack top is not of type 'long', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLLOAD(Instruction o){
- //visitLoadInstruction(LoadInstruction) is called before.
-
- // Nothing else needs to be done here.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLMUL(Instruction o){
- if (stack().peek() != Type.LONG){
- constraintViolated(o, "The value at the stack top is not of type 'long', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- public void visitLNEG(Instruction o){
- checkTop(o,Type.LONG);
- }
-
- public void visitLOOKUPSWITCH(LOOKUPSWITCH o){
- checkTop(o,Type.INT);
- // See also pass 3a.
- }
-
- public void visitLOR(Instruction o){
- if (stack().peek() != Type.LONG){
- constraintViolated(o, "The value at the stack top is not of type 'long', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- public void visitLREM(Instruction o){
- checkTop(o,Type.LONG);
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- public void visitLRETURN(Instruction o) { checkTop(o,Type.LONG); }
- public void visitLSHL(Instruction o){
- checkTop(o,Type.INT);
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLSHR(Instruction o){
- if (stack().peek() != Type.INT){
- constraintViolated(o, "The value at the stack top is not of type 'int', but of type '"+stack().peek()+"'.");
- }
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLSTORE(Instruction o){
- //visitStoreInstruction(StoreInstruction) is called before.
-
- // Nothing else needs to be done here.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLSUB(Instruction o){
- checkTop(o,Type.LONG);
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLUSHR(Instruction o){
- checkTop(o,Type.INT);
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitLXOR(Instruction o){
- checkTop(o,Type.LONG);
- if (stack().peek(1) != Type.LONG){
- constraintViolated(o, "The value at the stack next-to-top is not of type 'long', but of type '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitMONITORENTER(Instruction o){
- if (! ((stack().peek()) instanceof ReferenceType)){
- constraintViolated(o, "The stack top should be of a ReferenceType, but is '"+stack().peek()+"'.");
- }
- referenceTypeIsInitialized(o, (ReferenceType) (stack().peek()) );
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitMONITOREXIT(Instruction o){
- if (! ((stack().peek()) instanceof ReferenceType)){
- constraintViolated(o, "The stack top should be of a ReferenceType, but is '"+stack().peek()+"'.");
- }
- referenceTypeIsInitialized(o, (ReferenceType) (stack().peek()) );
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitMULTIANEWARRAY(MULTIANEWARRAY o){
- int dimensions = o.getDimensions();
- // Dimensions argument is okay: see Pass 3a.
- for (int i=0; i, see Pass 3a.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitRET(RET o){
- if (! (locals().get(o.getIndex()) instanceof ReturnaddressType)){
- constraintViolated(o, "Expecting a ReturnaddressType in local variable "+o.getIndex()+".");
- }
- if (locals().get(o.getIndex()) == ReturnaddressType.NO_TARGET){
- throw new AssertionViolatedException("Oops: RET expecting a target!");
- }
- // Other constraints such as non-allowed overlapping subroutines are enforced
- // while building the Subroutines data structure.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitRETURN(Instruction o){
- if (mg.getName().equals(Constants.CONSTRUCTOR_NAME)){// If we leave an method
- if ((Frame._this != null) && (!(mg.getClassName().equals(Type.OBJECT.getClassName()))) ) {
- constraintViolated(o, "Leaving a constructor that itself did not call a constructor.");
- }
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitSALOAD(Instruction o){
- indexOfInt(o, stack().peek());
- if (stack().peek(1) == Type.NULL){
- return;
- }
- if (! (stack().peek(1) instanceof ArrayType)){
- constraintViolated(o, "Stack next-to-top must be of type short[] but is '"+stack().peek(1)+"'.");
- }
- Type t = ((ArrayType) (stack().peek(1))).getBasicType();
- if (t != Type.SHORT){
- constraintViolated(o, "Stack next-to-top must be of type short[] but is '"+stack().peek(1)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitSASTORE(Instruction o){
- if (stack().peek() != Type.INT){
- constraintViolated(o, "The value at the stack top is not of type 'int', but of type '"+stack().peek()+"'.");
- }
- indexOfInt(o, stack().peek(1));
- if (stack().peek(2) == Type.NULL){
- return;
- }
- if (! (stack().peek(2) instanceof ArrayType)){
- constraintViolated(o, "Stack next-to-next-to-top must be of type short[] but is '"+stack().peek(2)+"'.");
- }
- Type t = ((ArrayType) (stack().peek(2))).getBasicType();
- if (t != Type.SHORT){
- constraintViolated(o, "Stack next-to-next-to-top must be of type short[] but is '"+stack().peek(2)+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitSIPUSH(Instruction o){
- // nothing to do here. Generic visitXXX() methods did the trick before.
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitSWAP(Instruction o){
- if (stack().peek().getSize() != 1){
- constraintViolated(o, "The value at the stack top is not of size '1', but of size '"+stack().peek().getSize()+"'.");
- }
- if (stack().peek(1).getSize() != 1){
- constraintViolated(o, "The value at the stack next-to-top is not of size '1', but of size '"+stack().peek(1).getSize()+"'.");
- }
- }
-
- /**
- * Ensures the specific preconditions of the said instruction.
- */
- public void visitTABLESWITCH(TABLESWITCH o){
- indexOfInt(o, stack().peek());
- // See Pass 3a.
- }
-
-}
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/InstructionContext.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/InstructionContext.java
deleted file mode 100644
index 7b7b9d60c..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/InstructionContext.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.aspectj.apache.bcel.verifier.structurals;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (https://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache BCEL" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache BCEL", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-
-import java.util.ArrayList;
-
-import org.aspectj.apache.bcel.generic.InstructionHandle;
-
-/**
- * An InstructionContext offers convenient access
- * to information like control flow successors and
- * such.
- *
- * @version $Id: InstructionContext.java,v 1.3 2009/09/09 19:56:20 aclement Exp $
- * @author Enver Haase
- */
-public interface InstructionContext{
-
- /**
- * The getTag and setTag methods may be used for
- * temporary flagging, such as graph colouring.
- * Nothing in the InstructionContext object depends
- * on the value of the tag. JustIce does not use it.
- *
- * @see #setTag(int tag)
- */
- public int getTag();
-
- /**
- * The getTag and setTag methods may be used for
- * temporary flagging, such as graph colouring.
- * Nothing in the InstructionContext object depends
- * on the value of the tag. JustIce does not use it.
- *
- * @see #getTag()
- */
- public void setTag(int tag);
-
- /**
- * This method symbolically executes the Instruction
- * held in the InstructionContext.
- * It "merges in" the incoming execution frame situation
- * (see The Java Virtual Machine Specification, 2nd
- * edition, page 146).
- * By so doing, the outgoing execution frame situation
- * is calculated.
- *
- * This method is JustIce-specific and is usually of
- * no sense for users of the ControlFlowGraph class.
- * They should use getInstruction().accept(Visitor),
- * possibly in conjunction with the ExecutionVisitor.
- *
- *
- * @see ControlFlowGraph
- * @see ExecutionVisitor
- * @see #getOutFrame(ArrayList)
- * @return true - if and only if the "outgoing" frame situation
- * changed from the one before execute()ing.
- */
- boolean execute(Frame inFrame, ArrayList executionPredecessors, InstConstraintVisitor icv, ExecutionVisitor ev);
-
- /**
- * This method returns the outgoing execution frame situation;
- * therefore it has to be calculated by execute(Frame, ArrayList)
- * first.
- *
- * @see #execute(Frame, ArrayList, InstConstraintVisitor, ExecutionVisitor)
- */
- Frame getOutFrame(ArrayList executionPredecessors);
-
- /**
- * Returns the InstructionHandle this InstructionContext is wrapped around.
- *
- * @return The InstructionHandle this InstructionContext is wrapped around.
- */
- InstructionHandle getInstruction();
-
- /**
- * Returns the usual control flow successors.
- * @see #getExceptionHandlers()
- */
- InstructionContext[] getSuccessors();
-
- /**
- * Returns the exception handlers that protect this instruction.
- * They are special control flow successors.
- */
- ExceptionHandler[] getExceptionHandlers();
-}
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/LocalVariables.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/LocalVariables.java
deleted file mode 100644
index 8aed044bc..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/LocalVariables.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.aspectj.apache.bcel.verifier.structurals;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (https://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache BCEL" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache BCEL", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-
-import org.aspectj.apache.bcel.generic.Type;
-import org.aspectj.apache.bcel.generic.ReferenceType;
-import org.aspectj.apache.bcel.verifier.exc.*;
-
-/**
- * This class implements an array of local variables used for symbolic JVM
- * simulation.
- *
- * @version $Id: LocalVariables.java,v 1.2 2008/05/28 23:53:02 aclement Exp $
- * @author Enver Haase
- */
-public class LocalVariables{
- /** The Type[] containing the local variable slots. */
- private Type[] locals;
-
- /**
- * Creates a new LocalVariables object.
- */
- public LocalVariables(int maxLocals){
- locals = new Type[maxLocals];
- for (int i=0; i.
- */
-
-import org.aspectj.apache.bcel.generic.*;
-import org.aspectj.apache.bcel.verifier.exc.*;
-import java.util.*;
-
-/**
- * This class implements a stack used for symbolic JVM stack simulation.
- * [It's used an an operand stack substitute.]
- * Elements of this stack are org.aspectj.apache.bcel.generic.Type objects.
- *
- * @version $Id: OperandStack.java,v 1.3 2009/09/09 19:56:20 aclement Exp $
- * @author Enver Haase
- */
-public class OperandStack{
-
- /** We hold the stack information here. */
- private ArrayList stack = new ArrayList();
-
- /** The maximum number of stack slots this OperandStack instance may hold. */
- private int maxStack;
-
- /**
- * Creates an empty stack with a maximum of maxStack slots.
- */
- public OperandStack(int maxStack){
- this.maxStack = maxStack;
- }
-
- /**
- * Creates an otherwise empty stack with a maximum of maxStack slots and
- * the ObjectType 'obj' at the top.
- */
- public OperandStack(int maxStack, ObjectType obj){
- this.maxStack = maxStack;
- this.push(obj);
- }
- /**
- * Returns a deep copy of this object; that means, the clone operates
- * on a new stack. However, the Type objects on the stack are
- * shared.
- */
- protected Object clone(){
- OperandStack newstack = new OperandStack(this.maxStack);
- newstack.stack = (ArrayList) this.stack.clone();
- return newstack;
- }
-
- /**
- * Clears the stack.
- */
- public void clear(){
- stack = new ArrayList();
- }
-
- /**
- * Returns true if and only if this OperandStack
- * equals another, meaning equal lengths and equal
- * objects on the stacks.
- */
- public boolean equals(Object o){
- if (!(o instanceof OperandStack)) return false;
- OperandStack s = (OperandStack) o;
- return this.stack.equals(s.stack);
- }
-
- /**
- * Returns a (typed!) clone of this.
- *
- * @see #clone()
- */
- public OperandStack getClone(){
- return (OperandStack) this.clone();
- }
-
- /**
- * Returns true IFF this OperandStack is empty.
- */
- public boolean isEmpty(){
- return stack.isEmpty();
- }
-
- /**
- * Returns the number of stack slots this stack can hold.
- */
- public int maxStack(){
- return this.maxStack;
- }
-
- /**
- * Returns the element on top of the stack. The element is not popped off the stack!
- */
- public Type peek(){
- return peek(0);
- }
-
- /**
- * Returns the element that's i elements below the top element; that means,
- * iff i==0 the top element is returned. The element is not popped off the stack!
- */
- public Type peek(int i){
- return stack.get(size()-i-1);
- }
-
- /**
- * Returns the element on top of the stack. The element is popped off the stack.
- */
- public Type pop(){
- Type e = stack.remove(size()-1);
- return e;
- }
-
- /**
- * Pops i elements off the stack. ALWAYS RETURNS "null"!!!
- */
- public Type pop(int i){
- for (int j=0; j= maxStack){
- throw new AssertionViolatedException("OperandStack too small, should have thrown proper Exception elsewhere. Stack: "+this);
- }
- stack.add(type);
- }
-
- /**
- * Returns the size of this OperandStack; that means, how many Type objects there are.
- */
- int size(){
- return stack.size();
- }
-
- /**
- * Returns the number of stack slots used.
- * @see #maxStack()
- */
- public int slotsUsed(){
- /* XXX change this to a better implementation using a variable
- that keeps track of the actual slotsUsed()-value monitoring
- all push()es and pop()s.
- */
- int slots = 0;
- for (int i=0; i.
- */
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Random;
-import java.util.Vector;
-
-import org.aspectj.apache.bcel.Constants;
-import org.aspectj.apache.bcel.Repository;
-import org.aspectj.apache.bcel.classfile.JavaClass;
-import org.aspectj.apache.bcel.classfile.Method;
-import org.aspectj.apache.bcel.classfile.ConstantPool;
-import org.aspectj.apache.bcel.generic.InstructionBranch;
-import org.aspectj.apache.bcel.generic.InstructionHandle;
-import org.aspectj.apache.bcel.generic.MethodGen;
-import org.aspectj.apache.bcel.generic.ObjectType;
-import org.aspectj.apache.bcel.generic.RET;
-import org.aspectj.apache.bcel.generic.ReturnaddressType;
-import org.aspectj.apache.bcel.generic.Type;
-import org.aspectj.apache.bcel.verifier.PassVerifier;
-import org.aspectj.apache.bcel.verifier.VerificationResult;
-import org.aspectj.apache.bcel.verifier.Verifier;
-import org.aspectj.apache.bcel.verifier.exc.AssertionViolatedException;
-import org.aspectj.apache.bcel.verifier.exc.VerifierConstraintViolatedException;
-
-/**
- * This PassVerifier verifies a method of class file according to pass 3,
- * so-called structural verification as described in The Java Virtual Machine
- * Specification, 2nd edition.
- * More detailed information is to be found at the do_verify() method's
- * documentation.
- *
- * @version $Id: Pass3bVerifier.java,v 1.3 2009/09/09 19:56:20 aclement Exp $
- * @author Enver Haase
- * @see #do_verify()
- */
-
-public final class Pass3bVerifier extends PassVerifier{
- /* TODO: Throughout pass 3b, upper halves of LONG and DOUBLE
- are represented by Type.UNKNOWN. This should be changed
- in favour of LONG_Upper and DOUBLE_Upper as in pass 2. */
-
- /**
- * An InstructionContextQueue is a utility class that holds
- * (InstructionContext, ArrayList) pairs in a Queue data structure.
- * This is used to hold information about InstructionContext objects
- * externally --- i.e. that information is not saved inside the
- * InstructionContext object itself. This is useful to save the
- * execution path of the symbolic execution of the
- * Pass3bVerifier - this is not information
- * that belongs into the InstructionContext object itself.
- * Only at "execute()"ing
- * time, an InstructionContext object will get the current information
- * we have about its symbolic execution predecessors.
- */
- private static final class InstructionContextQueue{
- private Vector ics = new Vector(); // Type: InstructionContext
- private Vector> ecs = new Vector>(); // Type: ArrayList (of InstructionContext)
- public void add(InstructionContext ic, ArrayList executionChain){
- ics.add(ic);
- ecs.add(executionChain);
- }
- public boolean isEmpty(){
- return ics.isEmpty();
- }
- public void remove(){
- this.remove(0);
- }
- public void remove(int i){
- ics.remove(i);
- ecs.remove(i);
- }
- public InstructionContext getIC(int i){
- return ics.get(i);
- }
- public ArrayList getEC(int i){
- return ecs.get(i);
- }
- public int size(){
- return ics.size();
- }
- } // end Inner Class InstructionContextQueue
-
- /** In DEBUG mode, the verification algorithm is not randomized. */
- private static final boolean DEBUG = true;
-
- /** The Verifier that created this. */
- private Verifier myOwner;
-
- /** The method number to verify. */
- private int method_no;
-
- /**
- * This class should only be instantiated by a Verifier.
- *
- * @see org.aspectj.apache.bcel.verifier.Verifier
- */
- public Pass3bVerifier(Verifier owner, int method_no){
- myOwner = owner;
- this.method_no = method_no;
- }
-
- /**
- * Whenever the outgoing frame
- * situation of an InstructionContext changes, all its successors are
- * put [back] into the queue [as if they were unvisited].
- * The proof of termination is about the existence of a
- * fix point of frame merging.
- */
- private void circulationPump(ControlFlowGraph cfg, InstructionContext start, Frame vanillaFrame, InstConstraintVisitor icv, ExecutionVisitor ev){
- final Random random = new Random();
- InstructionContextQueue icq = new InstructionContextQueue();
-
- start.execute(vanillaFrame, new ArrayList(), icv, ev); // new ArrayList() <=> no Instruction was executed before
- // => Top-Level routine (no jsr call before)
- icq.add(start, new ArrayList());
-
- // LOOP!
- while (!icq.isEmpty()){
- InstructionContext u;
- ArrayList ec;
- if (!DEBUG){
- int r = random.nextInt(icq.size());
- u = icq.getIC(r);
- ec = icq.getEC(r);
- icq.remove(r);
- }
- else{
- u = icq.getIC(0);
- ec = icq.getEC(0);
- icq.remove(0);
- }
-
- ArrayList oldchain = (ArrayList) (ec.clone());
- ArrayList newchain = (ArrayList) (ec.clone());
- newchain.add(u);
-
- if ((u.getInstruction().getInstruction()) instanceof RET){
-//System.err.println(u);
- // We can only follow _one_ successor, the one after the
- // JSR that was recently executed.
- RET ret = (RET) (u.getInstruction().getInstruction());
- ReturnaddressType t = (ReturnaddressType) u.getOutFrame(oldchain).getLocals().get(ret.getIndex());
- InstructionContext theSuccessor = cfg.contextOf(t.getTarget());
-
- // Sanity check
- InstructionContext lastJSR = null;
- int skip_jsr = 0;
- for (int ss=oldchain.size()-1; ss >= 0; ss--){
- if (skip_jsr < 0){
- throw new AssertionViolatedException("More RET than JSR in execution chain?!");
- }
-//System.err.println("+"+oldchain.get(ss));
- if (oldchain.get(ss).getInstruction().getInstruction().isJsrInstruction()) {
- if (skip_jsr == 0){
- lastJSR = oldchain.get(ss);
- break;
- }
- else{
- skip_jsr--;
- }
- }
- if (oldchain.get(ss).getInstruction().getInstruction() instanceof RET){
- skip_jsr++;
- }
- }
- if (lastJSR == null){
- throw new AssertionViolatedException("RET without a JSR before in ExecutionChain?! EC: '"+oldchain+"'.");
- }
- InstructionBranch jsr = (InstructionBranch) (lastJSR.getInstruction().getInstruction());
- if ( theSuccessor != (cfg.contextOf(jsr.physicalSuccessor())) ){
- throw new AssertionViolatedException("RET '"+u.getInstruction()+"' info inconsistent: jump back to '"+theSuccessor+"' or '"+cfg.contextOf(jsr.physicalSuccessor())+"'?");
- }
-
- if (theSuccessor.execute(u.getOutFrame(oldchain), newchain, icv, ev)){
- icq.add(theSuccessor, (ArrayList) newchain.clone());
- }
- }
- else{// "not a ret"
-
- // Normal successors. Add them to the queue of successors.
- InstructionContext[] succs = u.getSuccessors();
- for (int s=0; s) newchain.clone());
- }
- }
- }// end "not a ret"
-
- // Exception Handlers. Add them to the queue of successors.
- // [subroutines are never protected; mandated by JustIce]
- ExceptionHandler[] exc_hds = u.getExceptionHandlers();
- for (int s=0; s(), icv, ev)){
- icq.add(v, new ArrayList());
- }
- }
-
- }// while (!icq.isEmpty()) END
-
- InstructionHandle ih = start.getInstruction();
- do{
- if ((ih.getInstruction().isReturnInstruction()) && (!(cfg.isDead(ih)))) {
- InstructionContext ic = cfg.contextOf(ih);
- Frame f = ic.getOutFrame(new ArrayList()); // TODO: This is buggy, we check only the top-level return instructions this way. Maybe some maniac returns from a method when in a subroutine?
- LocalVariables lvs = f.getLocals();
- for (int i=0; i.
- */
-
-import org.aspectj.apache.bcel.generic.*;
-
-/**
- * This interface defines properties of JVM bytecode subroutines.
- * Note that it is 'abused' to maintain the top-level code in a
- * consistent fashion, too.
- *
- * @version $Id: Subroutine.java,v 1.2 2008/05/28 23:53:02 aclement Exp $
- * @author Enver Haase
- */
-public interface Subroutine{
- /**
- * Returns all the JsrInstructions that have the
- * first instruction of this subroutine as their target.
- * Must not be invoked on the 'top-level subroutine'.
- */
- public InstructionHandle[] getEnteringJsrInstructions();
-
- /**
- * Returns the one and only RET that leaves the subroutine.
- * Note that JustIce has a pretty rigid notion of a subroutine.
- * Must not be invoked on the 'top-level subroutine'.
- *
- * @see org.aspectj.apache.bcel.verifier.structurals.Subroutines
- */
- public InstructionHandle getLeavingRET();
-
- /**
- * Returns all instructions that together form this subroutine.
- * Note that an instruction is part of exactly one subroutine
- * (the top-level code is considered to be a special subroutine) -
- * else it is not reachable at all (dead code).
- */
- public InstructionHandle[] getInstructions();
-
- /**
- * Returns if the given InstructionHandle refers to an instruction
- * that is part of this subroutine. This is a convenience method
- * that saves iteration over the InstructionHandle objects returned
- * by getInstructions().
- *
- * @see #getInstructions()
- */
- public boolean contains(InstructionHandle inst);
-
- /**
- * Returns an int[] containing the indices of the local variable slots
- * accessed by this Subroutine (read-accessed, write-accessed or both);
- * local variables referenced by subroutines of this subroutine are
- * not included.
- *
- * @see #getRecursivelyAccessedLocalsIndices()
- */
- public int[] getAccessedLocalsIndices();
-
- /**
- * Returns an int[] containing the indices of the local variable slots
- * accessed by this Subroutine (read-accessed, write-accessed or both);
- * local variables referenced by subroutines of this subroutine are
- * included.
- *
- * @see #getAccessedLocalsIndices()
- */
- public int[] getRecursivelyAccessedLocalsIndices();
-
- /**
- * Returns the subroutines that are directly called from this subroutine.
- */
- public Subroutine[] subSubs();
-}
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/Subroutines.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/Subroutines.java
deleted file mode 100644
index 285bc4a34..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/Subroutines.java
+++ /dev/null
@@ -1,670 +0,0 @@
-package org.aspectj.apache.bcel.verifier.structurals;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (https://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache BCEL" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache BCEL", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-
-import org.aspectj.apache.bcel.Constants;
-import org.aspectj.apache.bcel.generic.*;
-import org.aspectj.apache.bcel.verifier.exc.*;
-import java.awt.Color;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-
- /**
- * Instances of this class contain information about the subroutines
- * found in a code array of a method.
- * This implementation considers the top-level (the instructions
- * reachable without a JSR or JSR_W starting off from the first
- * instruction in a code array of a method) being a special subroutine;
- * see getTopLevel() for that.
- * Please note that the definition of subroutines in the Java Virtual
- * Machine Specification, Second Edition is somewhat incomplete.
- * Therefore, JustIce uses an own, more rigid notion.
- * Basically, a subroutine is a piece of code that starts at the target
- * of a JSR of JSR_W instruction and ends at a corresponding RET
- * instruction. Note also that the control flow of a subroutine
- * may be complex and non-linear; and that subroutines may be nested.
- * JustIce also mandates subroutines not to be protected by exception
- * handling code (for the sake of control flow predictability).
- * To understand JustIce's notion of subroutines, please read
- *
- * TODO: refer to the paper.
- *
- * @version $Id: Subroutines.java,v 1.4 2009/09/09 19:56:20 aclement Exp $
- * @author Enver Haase
- * @see #getTopLevel()
- */
-public class Subroutines{
- /**
- * This inner class implements the Subroutine interface.
- */
- private class SubroutineImpl implements Subroutine{
- /**
- * UNSET, a symbol for an uninitialized localVariable
- * field. This is used for the "top-level" Subroutine;
- * i.e. no subroutine.
- */
- private final static int UNSET = -1;
-
- /**
- * The Local Variable slot where the first
- * instruction of this subroutine (an ASTORE) stores
- * the JsrInstruction's ReturnAddress in and
- * the RET of this subroutine operates on.
- */
- private int localVariable = UNSET;
-
- /** The instructions that belong to this subroutine. */
- private HashSet instructions = new HashSet(); // Elements: InstructionHandle
-
- /*
- * Refer to the Subroutine interface for documentation.
- */
- public boolean contains(InstructionHandle inst){
- return instructions.contains(inst);
- }
-
- /**
- * The JSR or JSR_W instructions that define this
- * subroutine by targeting it.
- */
- private HashSet theJSRs = new HashSet();
-
- /**
- * The RET instruction that leaves this subroutine.
- */
- private InstructionHandle theRET;
-
- /**
- * Returns a String representation of this object, merely
- * for debugging purposes.
- * (Internal) Warning: Verbosity on a problematic subroutine may cause
- * stack overflow errors due to recursive subSubs() calls.
- * Don't use this, then.
- */
- public String toString(){
- String ret = "Subroutine: Local variable is '"+localVariable+"', JSRs are '"+theJSRs+"', RET is '"+theRET+"', Instructions: '"+instructions.toString()+"'.";
-
- ret += " Accessed local variable slots: '";
- int[] alv = getAccessedLocalsIndices();
- for (int i=0; i iter = instructions.iterator();
- InstructionHandle ret = null;
- while(iter.hasNext()){
- InstructionHandle actual = (InstructionHandle) iter.next();
- if (actual.getInstruction() instanceof RET){
- if (ret != null){
- throw new StructuralCodeConstraintException("Subroutine with more then one RET detected: '"+ret+"' and '"+actual+"'.");
- }
- else{
- ret = actual;
- }
- }
- }
- if (ret == null){
- throw new StructuralCodeConstraintException("Subroutine without a RET detected.");
- }
- if (((RET) ret.getInstruction()).getIndex() != localVariable){
- throw new StructuralCodeConstraintException("Subroutine uses '"+ret+"' which does not match the correct local variable '"+localVariable+"'.");
- }
- theRET = ret;
- }
-
- /*
- * Refer to the Subroutine interface for documentation.
- */
- public InstructionHandle[] getEnteringJsrInstructions(){
- if (this == TOPLEVEL) {
- throw new AssertionViolatedException("getLeavingRET() called on top level pseudo-subroutine.");
- }
- InstructionHandle[] jsrs = new InstructionHandle[theJSRs.size()];
- return (theJSRs.toArray(jsrs));
- }
-
- /**
- * Adds a new JSR or JSR_W that has this subroutine as its target.
- */
- public void addEnteringJsrInstruction(InstructionHandle jsrInst){
- if ( (jsrInst == null) || (! (jsrInst.getInstruction().isJsrInstruction()))){
- throw new AssertionViolatedException("Expecting JsrInstruction InstructionHandle.");
- }
- if (localVariable == UNSET){
- throw new AssertionViolatedException("Set the localVariable first!");
- }
- else{
- // Something is wrong when an ASTORE is targeted that does not operate on the same local variable than the rest of the
- // JsrInstruction-targets and the RET.
- // (We don't know out leader here so we cannot check if we're really targeted!)
- if (localVariable != ( (((InstructionBranch) jsrInst.getInstruction()).getTarget().getInstruction())).getIndex()){
- throw new AssertionViolatedException("Setting a wrong JsrInstruction.");
- }
- }
- theJSRs.add(jsrInst);
- }
-
- /*
- * Refer to the Subroutine interface for documentation.
- */
- public InstructionHandle getLeavingRET(){
- if (this == TOPLEVEL) {
- throw new AssertionViolatedException("getLeavingRET() called on top level pseudo-subroutine.");
- }
- return theRET;
- }
-
- /*
- * Refer to the Subroutine interface for documentation.
- */
- public InstructionHandle[] getInstructions(){
- InstructionHandle[] ret = new InstructionHandle[instructions.size()];
- return instructions.toArray(ret);
- }
-
- /*
- * Adds an instruction to this subroutine.
- * All instructions must have been added before invoking setLeavingRET().
- * @see #setLeavingRET
- */
- void addInstruction(InstructionHandle ih){
- if (theRET != null){
- throw new AssertionViolatedException("All instructions must have been added before invoking setLeavingRET().");
- }
- instructions.add(ih);
- }
-
- /* Satisfies Subroutine.getRecursivelyAccessedLocalsIndices(). */
- public int[] getRecursivelyAccessedLocalsIndices(){
- HashSet s = new HashSet();
- int[] lvs = getAccessedLocalsIndices();
- for (int j=0; j i = s.iterator();
- int j=-1;
- while (i.hasNext()){
- j++;
- ret[j] = i.next().intValue();
- }
- return ret;
- }
-
- /**
- * A recursive helper method for getRecursivelyAccessedLocalsIndices().
- * @see #getRecursivelyAccessedLocalsIndices()
- */
- private void _getRecursivelyAccessedLocalsIndicesHelper(HashSet s, Subroutine[] subs){
- for (int i=0; i acc = new HashSet();
- if (theRET == null && this != TOPLEVEL){
- throw new AssertionViolatedException("This subroutine object must be built up completely before calculating accessed locals.");
- }
- Iterator i = instructions.iterator();
- while (i.hasNext()){
- InstructionHandle ih = (InstructionHandle) i.next();
- // RET is not a LocalVariableInstruction in the current version of BCEL.
- if (ih.getInstruction() instanceof InstructionLV || ih.getInstruction() instanceof RET){
- int idx = ((ih.getInstruction())).getIndex();
- acc.add(new Integer(idx));
- // LONG? DOUBLE?.
- try{
- // LocalVariableInstruction instances are typed without the need to look into
- // the constant pool.
- if (ih.getInstruction() instanceof InstructionLV){
- int s = ((InstructionLV) ih.getInstruction()).getType(null).getSize();
- if (s==2) acc.add(new Integer(idx+1));
- }
- }
- catch(RuntimeException re){
- throw new AssertionViolatedException("Oops. BCEL did not like NULL as a ConstantPoolGen object.");
- }
- }
- }
-
- int[] ret = new int[acc.size()];
- i = acc.iterator();
- int j=-1;
- while (i.hasNext()){
- j++;
- ret[j] = ((Integer) i.next()).intValue();
- }
- return ret;
- }
-
- /*
- * Satisfies Subroutine.subSubs().
- */
- public Subroutine[] subSubs(){
- HashSet h = new HashSet();
-
- Iterator i = instructions.iterator();
- while (i.hasNext()){
- Instruction inst = ((InstructionHandle) i.next()).getInstruction();
- if (inst.isJsrInstruction()){
- InstructionHandle targ = ((InstructionBranch) inst).getTarget();
- h.add(getSubroutine(targ));
- }
- }
- Subroutine[] ret = new Subroutine[h.size()];
- return h.toArray(ret);
- }
-
- /*
- * Sets the local variable slot the ASTORE that is targeted
- * by the JsrInstructions of this subroutine operates on.
- * This subroutine's RET operates on that same local variable
- * slot, of course.
- */
- void setLocalVariable(int i){
- if (localVariable != UNSET){
- throw new AssertionViolatedException("localVariable set twice.");
- }
- else{
- localVariable = i;
- }
- }
-
- /**
- * The default constructor.
- */
- public SubroutineImpl(){
- }
-
- }// end Inner Class SubrouteImpl
-
- /**
- * The Hashtable containing the subroutines found.
- * Key: InstructionHandle of the leader of the subroutine.
- * Elements: SubroutineImpl objects.
- */
- private Hashtable subroutines = new Hashtable();
-
- /**
- * This is referring to a special subroutine, namely the
- * top level. This is not really a subroutine but we use
- * it to distinguish between top level instructions and
- * unreachable instructions.
- */
- public final Subroutine TOPLEVEL;
-
- /**
- * Constructor.
- * @param il A MethodGen object representing method to
- * create the Subroutine objects of.
- */
- public Subroutines(MethodGen mg){
-
- InstructionHandle[] all = mg.getInstructionList().getInstructionHandles();
- CodeExceptionGen[] handlers = mg.getExceptionHandlers();
-
- // Define our "Toplevel" fake subroutine.
- TOPLEVEL = new SubroutineImpl();
-
- // Calculate "real" subroutines.
- HashSet sub_leaders = new HashSet(); // Elements: InstructionHandle
- InstructionHandle ih = all[0];
- for (int i=0; i iter = sub_leaders.iterator();
- while (iter.hasNext()){
- SubroutineImpl sr = new SubroutineImpl();
- InstructionHandle astore = (iter.next());
- sr.setLocalVariable( ( (astore.getInstruction())).getIndex() );
- subroutines.put(astore, sr);
- }
-
- // Fake it a bit. We want a virtual "TopLevel" subroutine.
- subroutines.put(all[0], TOPLEVEL);
- sub_leaders.add(all[0]);
-
- // Tell the subroutines about their JsrInstructions.
- // Note that there cannot be a JSR targeting the top-level
- // since "Jsr 0" is disallowed in Pass 3a.
- // Instructions shared by a subroutine and the toplevel are
- // disallowed and checked below, after the BFS.
- for (int i=0; i instructions_assigned = new HashSet(); // we don't want to assign an instruction to two or more Subroutine objects.
-
- Hashtable colors = new Hashtable(); //Graph colouring. Key: InstructionHandle, Value: java.awt.Color .
-
- iter = sub_leaders.iterator();
- while (iter.hasNext()){
- // Do some BFS with "actual" as the root of the graph.
- InstructionHandle actual = (iter.next());
- // Init colors
- for (int i=0; i Q = new ArrayList();
- Q.add(actual); // add(Obj) adds to the end, remove(0) removes from the start.
-
- /* BFS ALGORITHM MODIFICATION: Start out with multiple "root" nodes, as exception handlers are starting points of top-level code, too. [why top-level? TODO: Refer to the special JustIce notion of subroutines.]*/
- if (actual == all[0]){
- for (int j=0; j subs = subroutines.elements();
- while (subs.hasMoreElements()){
- Subroutine sub = subs.nextElement();
- if (sub != subroutines.get(all[0])){ // We don't want to forbid top-level exception handlers.
- if (sub.contains(_protected)){
- throw new StructuralCodeConstraintException("Subroutine instruction '"+_protected+"' is protected by an exception handler, '"+handlers[i]+"'. This is forbidden by the JustIce verifier due to its clear definition of subroutines.");
- }
- }
- }
- _protected = _protected.getNext();
- }
- }
-
- // Now make sure no subroutine is calling a subroutine
- // that uses the same local variable for the RET as themselves
- // (recursively).
- // This includes that subroutines may not call themselves
- // recursively, even not through intermediate calls to other
- // subroutines.
- noRecursiveCalls(getTopLevel(), new HashSet());
-
- }
-
- /**
- * This (recursive) utility method makes sure that
- * no subroutine is calling a subroutine
- * that uses the same local variable for the RET as themselves
- * (recursively).
- * This includes that subroutines may not call themselves
- * recursively, even not through intermediate calls to other
- * subroutines.
- *
- * @throws StructuralCodeConstraintException if the above constraint is not satisfied.
- */
- private void noRecursiveCalls(Subroutine sub, HashSet set){
- Subroutine[] subs = sub.subSubs();
-
- for (int i=0; i i = subroutines.values().iterator();
- while (i.hasNext()){
- Subroutine s = i.next();
- if (s.contains(any)) return s;
- }
-System.err.println("DEBUG: Please verify '"+any+"' lies in dead code.");
- return null;
- //throw new AssertionViolatedException("No subroutine for InstructionHandle found (DEAD CODE?).");
- }
-
- /**
- * For easy handling, the piece of code that is not a
- * subroutine, the top-level, is also modeled as a Subroutine
- * object.
- * It is a special Subroutine object where you must not invoke
- * getEnteringJsrInstructions() or getLeavingRET().
- *
- * @see Subroutine#getEnteringJsrInstructions()
- * @see Subroutine#getLeavingRET()
- */
- public Subroutine getTopLevel(){
- return TOPLEVEL;
- }
- /**
- * A utility method that calculates the successors of a given InstructionHandle
- * in the same subroutine. That means, a RET does not have any successors
- * as defined here. A JsrInstruction has its physical successor as its successor
- * (opposed to its target) as defined here.
- */
- private static InstructionHandle[] getSuccessors(InstructionHandle instruction){
- final InstructionHandle[] empty = new InstructionHandle[0];
- final InstructionHandle[] single = new InstructionHandle[1];
- final InstructionHandle[] pair = new InstructionHandle[2];
-
- Instruction inst = instruction.getInstruction();
-
- if (inst instanceof RET){
- return empty;
- }
-
- // Terminates method normally.
- if (inst.isReturnInstruction()){
- return empty;
- }
-
- // Terminates method abnormally, because JustIce mandates
- // subroutines not to be protected by exception handlers.
- if (inst.getOpcode()==Constants.ATHROW){
- return empty;
- }
-
- // See method comment.
- if (inst.isJsrInstruction()){
- single[0] = instruction.getNext();
- return single;
- }
-
- if (inst.getOpcode()==Constants.GOTO || inst.getOpcode()==Constants.GOTO_W){
- single[0] = ((InstructionBranch) inst).getTarget();
- return single;
- }
-
- if (inst instanceof InstructionBranch){
- if (inst instanceof InstructionSelect){
- // BCEL's getTargets() returns only the non-default targets,
- // thanks to Eli Tilevich for reporting.
- InstructionHandle[] matchTargets = ((InstructionSelect) inst).getTargets();
- InstructionHandle[] ret = new InstructionHandle[matchTargets.length+1];
- ret[0] = ((InstructionSelect) inst).getTarget();
- System.arraycopy(matchTargets, 0, ret, 1, matchTargets.length);
- return ret;
- }
- else{
- pair[0] = instruction.getNext();
- pair[1] = ((InstructionBranch) inst).getTarget();
- return pair;
- }
- }
-
- // default case: Fall through.
- single[0] = instruction.getNext();
- return single;
- }
-
- /**
- * Returns a String representation of this object; merely for debugging puposes.
- */
- public String toString(){
- return "---\n"+subroutines.toString()+"\n---\n";
- }
-}
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/UninitializedObjectType.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/UninitializedObjectType.java
deleted file mode 100644
index 1a4b5d369..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/UninitializedObjectType.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.aspectj.apache.bcel.verifier.structurals;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (https://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache BCEL" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache BCEL", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-
-import org.aspectj.apache.bcel.*;
-import org.aspectj.apache.bcel.generic.*;
-
-/**
- * This class represents an uninitialized object type; see The Java
- * Virtual Machine Specification, Second Edition, page 147: 4.9.4 for
- * more details.
- *
- * @version $Id: UninitializedObjectType.java,v 1.2 2008/05/28 23:53:03 aclement Exp $
- * @author Enver Haase
- */
-public class UninitializedObjectType extends ReferenceType implements Constants{
-
- /** The "initialized" version. */
- private ObjectType initialized;
-
- /** Creates a new instance. */
- public UninitializedObjectType(ObjectType t){
- super(T_UNKNOWN, "");
- initialized = t;
- }
-
- /**
- * Returns the ObjectType of the same class as the one of the uninitialized object
- * represented by this UninitializedObjectType instance.
- */
- public ObjectType getInitialized(){
- return initialized;
- }
-
- /**
- * Returns true on equality of this and o.
- * Equality means the ObjectType instances of "initialized"
- * equal one another in this and the o instance.
- *
- */
- public boolean equals(Object o){
- if (! (o instanceof UninitializedObjectType)) return false;
- return initialized.equals(((UninitializedObjectType)o).initialized);
- }
-}
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/package.html b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/package.html
deleted file mode 100644
index b937a2938..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/structurals/package.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-Provides a PassVerifier class mostly used internally by JustIce, yielding a control flow graph for public use as
-a nice side effect.
-
-
Package Specification
-
-Contained in this package is a PassVerifier class for use with the JustIce verifier and its utility classes.
-Only the pass performing what Sun calls "Structural Constraints on Java Virtual Machine Code"
-has a PassVerifier class here. JustIce calls this pass "Pass 3b".
-
-
Related Documentation
-
-For a simple demonstration of JustIce working, please see:
-
-
-
-
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELFactory.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELFactory.java
deleted file mode 100644
index 0b7912bc0..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELFactory.java
+++ /dev/null
@@ -1,366 +0,0 @@
-package org.aspectj.apache.bcel.verifier.util;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.aspectj.apache.bcel.Constants;
-import org.aspectj.apache.bcel.classfile.ConstantPool;
-import org.aspectj.apache.bcel.classfile.Utility;
-import org.aspectj.apache.bcel.generic.BranchHandle;
-import org.aspectj.apache.bcel.generic.CodeExceptionGen;
-import org.aspectj.apache.bcel.generic.FieldInstruction;
-import org.aspectj.apache.bcel.generic.IINC;
-import org.aspectj.apache.bcel.generic.Instruction;
-import org.aspectj.apache.bcel.generic.InstructionBranch;
-import org.aspectj.apache.bcel.generic.InstructionByte;
-import org.aspectj.apache.bcel.generic.InstructionCP;
-import org.aspectj.apache.bcel.generic.InstructionConstants;
-import org.aspectj.apache.bcel.generic.InstructionHandle;
-import org.aspectj.apache.bcel.generic.InstructionSelect;
-import org.aspectj.apache.bcel.generic.InvokeInstruction;
-import org.aspectj.apache.bcel.generic.MULTIANEWARRAY;
-import org.aspectj.apache.bcel.generic.MethodGen;
-import org.aspectj.apache.bcel.generic.ObjectType;
-import org.aspectj.apache.bcel.generic.RET;
-import org.aspectj.apache.bcel.generic.Type;
-import org.aspectj.apache.bcel.verifier.InstructionWalker;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (https://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache BCEL" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache BCEL", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-
-/**
- * Factory creates il.append() statements, and sets instruction targets. A helper class for BCELifier.
- *
- * @see BCELifier
- * @version $Id: BCELFactory.java,v 1.6 2009/09/14 20:29:10 aclement Exp $
- * @author M. Dahm
- */
-class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
- private final MethodGen _mg;
- private final PrintWriter _out;
- private final ConstantPool _cp;
-
- BCELFactory(MethodGen mg, PrintWriter out) {
- _mg = mg;
- _cp = mg.getConstantPool();
- _out = out;
- }
-
- private final HashMap branch_map = new HashMap(); // Map
-
- public void start() {
- if (!_mg.isAbstract() && !_mg.isNative()) {
- for (InstructionHandle ih = _mg.getInstructionList().getStart(); ih != null; ih = ih.getNext()) {
- Instruction i = ih.getInstruction();
-
- if (i instanceof InstructionBranch) {
- branch_map.put(i, ih); // memorize container
- }
-
- if (ih.hasTargeters()) {
- if (i instanceof InstructionBranch) {
- _out.println(" InstructionHandle ih_" + ih.getPosition() + ";");
- } else {
- _out.print(" InstructionHandle ih_" + ih.getPosition() + " = ");
- }
- } else {
- _out.print(" ");
- }
-
- if (!visitInstruction(i)) {
- InstructionWalker.accept(i, this);
- }
- }
-
- updateBranchTargets();
- updateExceptionHandlers();
- }
- }
-
- private boolean visitInstruction(Instruction i) {
- short opcode = i.getOpcode();
-
- if (InstructionConstants.INSTRUCTIONS[opcode] != null && !i.isConstantInstruction() && !i.isReturnInstruction()) { // Handled
- // below
- _out.println("il.append(InstructionConstants." + i.getName().toUpperCase() + ");");
- return true;
- }
-
- return false;
- }
-
- public void visitLocalVariableInstruction(Instruction i) {
- short opcode = i.getOpcode();
- Type type = i.getType(_cp);
-
- if (opcode == Constants.IINC) {
- _out.println("il.append(new IINC(" + i.getIndex() + ", " + ((IINC) i).getIncrement() + "));");
- } else {
- String kind = opcode < Constants.ISTORE ? "Load" : "Store";
- _out.println("il.append(_factory.create" + kind + "(" + BCELifier.printType(type) + ", " + i.getIndex() + "));");
- }
- }
-
- @Override
- public void visitArrayInstruction(Instruction i) {
- short opcode = i.getOpcode();
- Type type = i.getType(_cp);
- String kind = opcode < Constants.IASTORE ? "Load" : "Store";
-
- _out.println("il.append(_factory.createArray" + kind + "(" + BCELifier.printType(type) + "));");
- }
-
- public void visitFieldInstruction(FieldInstruction i) {
- short opcode = i.getOpcode();
-
- String class_name = i.getClassName(_cp);
- String field_name = i.getFieldName(_cp);
- Type type = i.getFieldType(_cp);
-
- _out.println("il.append(_factory.createFieldAccess(\"" + class_name + "\", \"" + field_name + "\", "
- + BCELifier.printType(type) + ", " + "Constants." + Constants.OPCODE_NAMES[opcode].toUpperCase() + "));");
- }
-
- @Override
- public void visitInvokeInstruction(InvokeInstruction i) {
- short opcode = i.getOpcode();
- String class_name = i.getClassName(_cp);
- String method_name = i.getMethodName(_cp);
- Type type = i.getReturnType(_cp);
- Type[] arg_types = i.getArgumentTypes(_cp);
-
- _out.println("il.append(_factory.createInvoke(\"" + class_name + "\", \"" + method_name + "\", "
- + BCELifier.printType(type) + ", " + BCELifier.printArgumentTypes(arg_types) + ", " + "Constants."
- + Constants.OPCODE_NAMES[opcode].toUpperCase() + "));");
- }
-
- @Override
- public void visitAllocationInstruction(Instruction i) {
- Type type;
-
- if (i.isConstantPoolInstruction()) {
- type = ((InstructionCP) i).getType(_cp);
- } else {
- type = ((InstructionByte) i).getType();
- }
-
- short opcode = i.getOpcode();
- int dim = 1;
-
- switch (opcode) {
- case Constants.NEW:
- _out.println("il.append(_factory.createNew(\"" + ((ObjectType) type).getClassName() + "\"));");
- break;
-
- case Constants.MULTIANEWARRAY:
- dim = ((MULTIANEWARRAY) i).getDimensions();
- case Constants.ANEWARRAY:
- case Constants.NEWARRAY:
- _out.println("il.append(_factory.createNewArray(" + BCELifier.printType(type) + ", (short) " + dim + "));");
- break;
-
- default:
- throw new RuntimeException("Oops: " + opcode);
- }
- }
-
- private void createConstant(Object value) {
- String embed = value.toString();
-
- if (value instanceof String) {
- embed = '"' + Utility.convertString(value.toString()) + '"';
- } else if (value instanceof Character) {
- embed = "(char)0x" + Integer.toHexString(((Character) value).charValue());
- }
-
- _out.println("il.append(new PUSH(_cp, " + embed + "));");
- }
-
- @Override
- public void visitLDC(Instruction i) {
- createConstant(i.getValue(_cp));
- }
-
- @Override
- public void visitLDC2_W(Instruction i) {
- createConstant(i.getValue(_cp));
- }
-
- @Override
- public void visitConstantPushInstruction(Instruction i) {
- createConstant(i.getValue());
- }
-
- @Override
- public void visitINSTANCEOF(Instruction i) {
- Type type = i.getType(_cp);
-
- _out.println("il.append(new INSTANCEOF(_cp.addClass(" + BCELifier.printType(type) + ")));");
- }
-
- @Override
- public void visitCHECKCAST(Instruction i) {
- Type type = i.getType(_cp);
-
- _out.println("il.append(_factory.createCheckCast(" + BCELifier.printType(type) + "));");
- }
-
- @Override
- public void visitReturnInstruction(Instruction i) {
- Type type = i.getType(_cp);
-
- _out.println("il.append(_factory.createReturn(" + BCELifier.printType(type) + "));");
- }
-
- // Memorize BranchInstructions that need an update
- private final ArrayList branches = new ArrayList();
-
- @Override
- public void visitBranchInstruction(InstructionBranch bi) {
- BranchHandle bh = (BranchHandle) branch_map.get(bi);
- int pos = bh.getPosition();
- String name = bi.getName() + "_" + pos;
-
- if (bi instanceof InstructionSelect) {
- InstructionSelect s = (InstructionSelect) bi;
- branches.add(bi);
-
- StringBuffer args = new StringBuffer("new int[] { ");
- int[] matchs = s.getMatchs();
-
- for (int i = 0; i < matchs.length; i++) {
- args.append(matchs[i]);
-
- if (i < matchs.length - 1) {
- args.append(", ");
- }
- }
-
- args.append(" }");
-
- _out.print(" Select " + name + " = new " + bi.getName().toUpperCase() + "(" + args + ", new InstructionHandle[] { ");
-
- for (int i = 0; i < matchs.length; i++) {
- _out.print("null");
-
- if (i < matchs.length - 1) {
- _out.print(", ");
- }
- }
-
- _out.println(");");
- } else {
- int t_pos = bh.getTarget().getPosition();
- String target;
-
- if (pos > t_pos) {
- target = "ih_" + t_pos;
- } else {
- branches.add(bi);
- target = "null";
- }
-
- _out.println(" BranchInstruction " + name + " = _factory.createBranchInstruction(" + "Constants."
- + bi.getName().toUpperCase() + ", " + target + ");");
- }
-
- if (bh.hasTargeters()) {
- _out.println(" ih_" + pos + " = il.append(" + name + ");");
- } else {
- _out.println(" il.append(" + name + ");");
- }
- }
-
- @Override
- public void visitRET(RET i) {
- _out.println("il.append(new RET(" + i.getIndex() + ")));");
- }
-
- private void updateBranchTargets() {
- for (Iterator i = branches.iterator(); i.hasNext();) {
- InstructionBranch bi = i.next();
- BranchHandle bh = (BranchHandle) branch_map.get(bi);
- int pos = bh.getPosition();
- String name = bi.getName() + "_" + pos;
- int t_pos = bh.getTarget().getPosition();
-
- _out.println(" " + name + ".setTarget(ih_" + t_pos + ");");
-
- if (bi instanceof InstructionSelect) {
- InstructionHandle[] ihs = ((InstructionSelect) bi).getTargets();
-
- for (int j = 0; j < ihs.length; j++) {
- t_pos = ihs[j].getPosition();
-
- _out.println(" " + name + ".setTarget(" + j + ", ih_" + t_pos + ");");
- }
- }
- }
- }
-
- private void updateExceptionHandlers() {
- CodeExceptionGen[] handlers = _mg.getExceptionHandlers();
-
- for (int i = 0; i < handlers.length; i++) {
- CodeExceptionGen h = handlers[i];
- String type = h.getCatchType() == null ? "null" : BCELifier.printType(h.getCatchType());
-
- _out.println(" method.addExceptionHandler(" + "ih_" + h.getStartPC().getPosition() + ", " + "ih_"
- + h.getEndPC().getPosition() + ", " + "ih_" + h.getHandlerPC().getPosition() + ", " + type + ");");
- }
- }
-}
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELifier.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELifier.java
deleted file mode 100644
index 0e2eddb00..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELifier.java
+++ /dev/null
@@ -1,341 +0,0 @@
-package org.aspectj.apache.bcel.verifier.util;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (https://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache BCEL" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache BCEL", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-import java.io.OutputStream;
-import java.io.PrintWriter;
-
-import org.aspectj.apache.bcel.Constants;
-import org.aspectj.apache.bcel.Repository;
-import org.aspectj.apache.bcel.classfile.ClassParser;
-import org.aspectj.apache.bcel.classfile.ConstantValue;
-import org.aspectj.apache.bcel.classfile.Field;
-import org.aspectj.apache.bcel.classfile.JavaClass;
-import org.aspectj.apache.bcel.classfile.Method;
-import org.aspectj.apache.bcel.classfile.Utility;
-import org.aspectj.apache.bcel.generic.ArrayType;
-import org.aspectj.apache.bcel.classfile.ConstantPool;
-import org.aspectj.apache.bcel.generic.MethodGen;
-import org.aspectj.apache.bcel.generic.Type;
-
-/**
- * This class takes a given JavaClass object and converts it to a
- * Java program that creates that very class using BCEL. This
- * gives new users of BCEL a useful example showing how things
- * are done with BCEL. It does not cover all features of BCEL,
- * but tries to mimic hand-written code as close as possible.
- *
- * @version $Id: BCELifier.java,v 1.2 2008/05/28 23:53:04 aclement Exp $
- * @author M. Dahm
- */
-public class BCELifier extends org.aspectj.apache.bcel.verifier.EmptyClassVisitor {
- private JavaClass _clazz;
- private PrintWriter _out;
- private ConstantPool _cp;
-
- /** @param clazz Java class to "decompile"
- * @param out where to output Java program
- */
- public BCELifier(JavaClass clazz, OutputStream out) {
- _clazz = clazz;
- _out = new PrintWriter(out);
- _cp = new ConstantPool(_clazz.getConstantPool().getConstantPool());
- }
-
- /** Start Java code generation
- */
- public void start() {
- visitJavaClass(_clazz);
- _out.flush();
- }
-
- public void visitJavaClass(JavaClass clazz) {
- String class_name = clazz.getClassName();
- String super_name = clazz.getSuperclassName();
- String package_name = clazz.getPackageName();
- String inter = BCELifier.printArray(clazz.getInterfaceNames(),
- false, true);
- if(!"".equals(package_name)) {
- class_name = class_name.substring(package_name.length() + 1);
- _out.println("package " + package_name + ";\n");
- }
-
- _out.println("import org.aspectj.apache.bcel.generic.*;");
- _out.println("import org.aspectj.apache.bcel.classfile.*;");
- _out.println("import org.aspectj.apache.bcel.*;");
- _out.println("import java.io.*;\n");
-
- _out.println("public class " + class_name + "Creator implements Constants {");
- _out.println(" private InstructionFactory _factory;");
- _out.println(" private ConstantPoolGen _cp;");
- _out.println(" private ClassGen _cg;\n");
-
- _out.println(" public " + class_name + "Creator() {");
- _out.println(" _cg = new ClassGen(\"" +
- (("".equals(package_name))? class_name :
- package_name + "." + class_name) +
- "\", \"" + super_name + "\", " +
- "\"" + clazz.getSourceFileName() + "\", " +
- printFlags(clazz.getModifiers(), true) + ", " +
- "new String[] { " + inter + " });\n");
-
- _out.println(" _cp = _cg.getConstantPool();");
- _out.println(" _factory = new InstructionFactory(_cg, _cp);");
- _out.println(" }\n");
-
- printCreate();
-
- Field[] fields = clazz.getFields();
-
- if(fields.length > 0) {
- _out.println(" private void createFields() {");
- _out.println(" FieldGen field;");
-
- for(int i=0; i < fields.length; i++) {
- fields[i].accept(this);
- }
-
- _out.println(" }\n");
- }
-
- Method[] methods = clazz.getMethods();
-
- for(int i=0; i < methods.length; i++) {
- _out.println(" private void createMethod_" + i + "() {");
-
- methods[i].accept(this);
- _out.println(" }\n");
- }
-
- printMain();
- _out.println("}");
- }
-
- private void printCreate() {
- _out.println(" public void create(OutputStream out) throws IOException {");
-
- Field[] fields = _clazz.getFields();
- if(fields.length > 0) {
- _out.println(" createFields();");
- }
-
- Method[] methods = _clazz.getMethods();
- for(int i=0; i < methods.length; i++) {
- _out.println(" createMethod_" + i + "();");
- }
-
- _out.println(" _cg.getJavaClass().dump(out);");
-
- _out.println(" }\n");
- }
-
- private void printMain() {
- String class_name = _clazz.getClassName();
-
- _out.println(" public static void main(String[] args) throws Exception {");
- _out.println(" " + class_name + "Creator creator = new " +
- class_name + "Creator();");
- _out.println(" creator.create(new FileOutputStream(\"" + class_name +
- ".class\"));");
- _out.println(" }");
- }
-
- public void visitField(Field field) {
- _out.println("\n field = new FieldGen(" +
- printFlags(field.getModifiers()) +
- ", " + printType(field.getSignature()) + ", \"" +
- field.getName() + "\", _cp);");
-
- ConstantValue cv = field.getConstantValue();
-
- if(cv != null) {
- String value = cv.toString();
- _out.println(" field.setInitValue(" + value + ")");
- }
-
- _out.println(" _cg.addField(field.getField());");
- }
-
- public void visitMethod(Method method) {
- MethodGen mg = new MethodGen(method, _clazz.getClassName(), _cp);
-
- Type result_type = mg.getReturnType();
- Type[] arg_types = mg.getArgumentTypes();
-
- _out.println(" InstructionList il = new InstructionList();");
- _out.println(" MethodGen method = new MethodGen(" +
- printFlags(method.getModifiers()) +
- ", " + printType(result_type) +
- ", " + printArgumentTypes(arg_types) + ", " +
- "new String[] { " +
- BCELifier.printArray(mg.getArgumentNames(), false, true) +
- " }, \"" + method.getName() + "\", \"" +
- _clazz.getClassName() + "\", il, _cp);\n");
-
- BCELFactory factory = new BCELFactory(mg, _out);
- factory.start();
-
- _out.println(" method.setMaxStack();");
- _out.println(" method.setMaxLocals();");
- _out.println(" _cg.addMethod(method.getMethod());");
- _out.println(" il.dispose();");
- }
-
- public static final String printArray(Object[] obj, boolean braces,
- boolean quote) {
- if(obj == null)
- return null;
-
- StringBuffer buf = new StringBuffer();
- if(braces)
- buf.append('{');
-
- for(int i=0; i < obj.length; i++) {
- if(obj[i] != null) {
- buf.append((quote? "\"" : "") + obj[i].toString() + (quote? "\"" : ""));
- } else {
- buf.append("null");
- }
-
- if(i < obj.length - 1) {
- buf.append(", ");
- }
- }
-
- if(braces)
- buf.append('}');
-
- return buf.toString();
- }
-
-static String printFlags(int flags) {
- return printFlags(flags, false);
- }
-
- static String printFlags(int flags, boolean for_class) {
- if(flags == 0)
- return "0";
-
- StringBuffer buf = new StringBuffer();
- for(int i=0, pow=1; i <= Constants.MAX_ACC_FLAG; i++) {
- if((flags & pow) != 0) {
- if((pow == Constants.ACC_SYNCHRONIZED) && for_class)
- buf.append("ACC_SUPER | ");
- else
- buf.append("ACC_" + Constants.ACCESS_NAMES[i].toUpperCase() + " | ");
- }
-
- pow <<= 1;
- }
-
- String str = buf.toString();
- return str.substring(0, str.length() - 3);
- }
-
- static String printArgumentTypes(Type[] arg_types) {
- if(arg_types.length == 0)
- return "Type.NO_ARGS";
-
- StringBuffer args = new StringBuffer();
-
- for(int i=0; i < arg_types.length; i++) {
- args.append(printType(arg_types[i]));
-
- if(i < arg_types.length - 1)
- args.append(", ");
- }
-
- return "new Type[] { " + args.toString() + " }";
- }
-
- static String printType(Type type) {
- return printType(type.getSignature());
- }
-
- static String printType(String signature) {
- Type type = Type.getType(signature);
- byte t = type.getType();
-
- if(t <= Constants.T_VOID) {
- return "Type." + Constants.TYPE_NAMES[t].toUpperCase();
- } else if(type.toString().equals("java.lang.String")) {
- return "Type.STRING";
- } else if(type.toString().equals("java.lang.Object")) {
- return "Type.OBJECT";
- } else if(type.toString().equals("java.lang.StringBuffer")) {
- return "Type.STRINGBUFFER";
- } else if(type instanceof ArrayType) {
- ArrayType at = (ArrayType)type;
-
- return "new ArrayType(" + printType(at.getBasicType()) +
- ", " + at.getDimensions() + ")";
- } else {
- return "new ObjectType(\"" + Utility.signatureToString(signature, false) +
- "\")";
- }
- }
-
- /** Default main method
- */
- public static void main(String[] argv) throws Exception {
- JavaClass java_class;
- String name = argv[0];
-
- if((java_class = Repository.lookupClass(name)) == null)
- java_class = new ClassParser(name).parse(); // May throw IOException
-
- BCELifier bcelifier = new BCELifier(java_class, System.out);
- bcelifier.start();
- }
-}
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/InstructionFinder.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/InstructionFinder.java
deleted file mode 100644
index a695ac9db..000000000
--- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/InstructionFinder.java
+++ /dev/null
@@ -1,440 +0,0 @@
-package org.aspectj.apache.bcel.verifier.util;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (https://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache BCEL" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache BCEL", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-
-import java.util.*;
-import org.aspectj.apache.bcel.Constants;
-import org.aspectj.apache.bcel.generic.*;
-import org.apache.regexp.*;
-
-/**
- * InstructionFinder is a tool to search for given instructions patterns,
- * i.e., match sequences of instructions in an instruction list via
- * regular expressions. This can be used, e.g., in order to implement
- * a peep hole optimizer that looks for code patterns and replaces
- * them with faster equivalents.
- *
- *
This class internally uses the
- * Regexp package to search for regular expressions.
- *
- * A typical application would look like this:
-
- InstructionFinder f = new InstructionFinder(il);
- String pat = "IfInstruction ICONST_0 GOTO ICONST_1 NOP (IFEQ|IFNE)";
-
- for(Iterator i = f.search(pat, constraint); i.hasNext(); ) {
- InstructionHandle[] match = (InstructionHandle[])i.next();
- ...
- il.delete(match[1], match[5]);
- ...
- }
-
- * @version $Id: InstructionFinder.java,v 1.4 2009/09/09 19:56:20 aclement Exp $
- * @author M. Dahm
- * @see Instruction
- * @see InstructionList
- */
-public class InstructionFinder {
- private static final int OFFSET = 32767; // char + OFFSET is outside of LATIN-1
- private static final int NO_OPCODES = 256; // Potential number, some are not used
-
- private static final HashMap map = new HashMap(); // Map
-
- private InstructionList il;
- private String il_string; // instruction list as string
- private InstructionHandle[] handles; // map instruction list to array
-
- /**
- * @param il instruction list to search for given patterns
- */
- public InstructionFinder(InstructionList il) {
- this.il = il;
- reread();
- }
-
- /**
- * Reread the instruction list, e.g., after you've altered the list upon a match.
- */
- public final void reread() {
- int size = il.getLength();
- char[] buf = new char[size]; // Create a string with length equal to il length
- handles = il.getInstructionHandles();
-
- // Map opcodes to characters
- for(int i=0; i < size; i++)
- buf[i] = makeChar(handles[i].getInstruction().getOpcode());
-
- il_string = new String(buf);
- }
-
- /**
- * Map symbolic instruction names like "getfield" to a single character.
- *
- * @param pattern instruction pattern in lower case
- * @return encoded string for a pattern such as "BranchInstruction".
- */
- private static final String mapName(String pattern) {
- String result = map.get(pattern);
-
- if(result != null)
- return result;
-
- for(short i=0; i < NO_OPCODES; i++)
- if(pattern.equals(Constants.OPCODE_NAMES[i]))
- return "" + makeChar(i);
-
- throw new RuntimeException("Instruction unknown: " + pattern);
- }
-
- /**
- * Replace symbolic names of instructions with the appropiate character and remove
- * all white space from string. Meta characters such as +, * are ignored.
- *
- * @param pattern The pattern to compile
- * @return translated regular expression string
- */
- private static final String compilePattern(String pattern) {
- String lower = pattern.toLowerCase();
- StringBuffer buf = new StringBuffer();
- int size = pattern.length();
-
- for(int i=0; i < size; i++) {
- char ch = lower.charAt(i);
-
- if(Character.isLetterOrDigit(ch)) {
- StringBuffer name = new StringBuffer();
-
- while((Character.isLetterOrDigit(ch) || ch == '_') && i < size) {
- name.append(ch);
-
- if(++i < size)
- ch = lower.charAt(i);
- else
- break;
- }
-
- i--;
-
- buf.append(mapName(name.toString()));
- } else if(!Character.isWhitespace(ch))
- buf.append(ch);
- }
-
- return buf.toString();
- }
-
- /**
- * @return the matched piece of code as an array of instruction (handles)
- */
- private InstructionHandle[] getMatch(int matched_from, int match_length) {
- InstructionHandle[] match = new InstructionHandle[match_length];
- System.arraycopy(handles, matched_from, match, 0, match_length);
-
- return match;
- }
-
- /**
- * Search for the given pattern in the instruction list. You can search for any valid
- * opcode via its symbolic name, e.g. "istore". You can also use a super class or
- * an interface name to match a whole set of instructions, e.g. "BranchInstruction" or
- * "LoadInstruction". "istore" is also an alias for all "istore_x" instructions. Additional
- * aliases are "if" for "ifxx", "if_icmp" for "if_icmpxx", "if_acmp" for "if_acmpxx".
- *
- * Consecutive instruction names must be separated by white space which will be removed
- * during the compilation of the pattern.
- *
- * For the rest the usual pattern matching rules for regular expressions apply.