From 6fe085391acac7f16bd4c39de623e8bb8d1da192 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 15 Feb 2007 14:43:11 +0000 Subject: [PATCH] repairing HEAD --- .../bcel/classfile/AttributeReader.java | 97 +++ .../bcel/classfile/annotation/Annotation.java | 130 +++ .../annotation/AnnotationElementValue.java | 51 ++ .../annotation/ArrayElementValue.java | 66 ++ .../annotation/ClassElementValue.java | 53 ++ .../annotation/ElementNameValuePair.java | 62 ++ .../classfile/annotation/ElementValue.java | 112 +++ .../annotation/EnumElementValue.java | 62 ++ .../annotation/SimpleElementValue.java | 169 ++++ .../apache/bcel/classfile/package.html | 14 + .../aspectj/apache/bcel/generic/AALOAD.java | 87 ++ .../aspectj/apache/bcel/generic/AASTORE.java | 87 ++ .../apache/bcel/generic/ACONST_NULL.java | 94 ++ .../aspectj/apache/bcel/generic/ALOAD.java | 92 ++ .../apache/bcel/generic/ANEWARRAY.java | 114 +++ .../aspectj/apache/bcel/generic/ARETURN.java | 88 ++ .../apache/bcel/generic/ARRAYLENGTH.java | 92 ++ .../aspectj/apache/bcel/generic/ASTORE.java | 92 ++ .../aspectj/apache/bcel/generic/ATHROW.java | 92 ++ .../bcel/generic/AllocationInstruction.java | 64 ++ .../bcel/generic/ArithmeticInstruction.java | 106 +++ .../apache/bcel/generic/ArrayInstruction.java | 106 +++ .../aspectj/apache/bcel/generic/BALOAD.java | 87 ++ .../aspectj/apache/bcel/generic/BASTORE.java | 87 ++ .../aspectj/apache/bcel/generic/BIPUSH.java | 131 +++ .../apache/bcel/generic/BREAKPOINT.java | 79 ++ .../bcel/generic/BranchInstruction.java | 246 ++++++ .../aspectj/apache/bcel/generic/CALOAD.java | 87 ++ .../aspectj/apache/bcel/generic/CASTORE.java | 87 ++ .../apache/bcel/generic/CHECKCAST.java | 117 +++ .../apache/bcel/generic/CPInstruction.java | 169 ++++ .../apache/bcel/generic/ClassObserver.java | 67 ++ .../bcel/generic/CompoundInstruction.java | 76 ++ .../apache/bcel/generic/ConstantPoolGen.java | 802 ++++++++++++++++++ .../bcel/generic/ConstantPushInstruction.java | 70 ++ .../bcel/generic/ConversionInstruction.java | 102 +++ .../org/aspectj/apache/bcel/generic/D2F.java | 87 ++ .../org/aspectj/apache/bcel/generic/D2I.java | 87 ++ .../org/aspectj/apache/bcel/generic/D2L.java | 87 ++ .../org/aspectj/apache/bcel/generic/DADD.java | 88 ++ .../aspectj/apache/bcel/generic/DALOAD.java | 87 ++ .../aspectj/apache/bcel/generic/DASTORE.java | 87 ++ .../aspectj/apache/bcel/generic/DCMPG.java | 93 ++ .../aspectj/apache/bcel/generic/DCMPL.java | 92 ++ .../aspectj/apache/bcel/generic/DCONST.java | 111 +++ .../org/aspectj/apache/bcel/generic/DDIV.java | 88 ++ .../aspectj/apache/bcel/generic/DLOAD.java | 92 ++ .../org/aspectj/apache/bcel/generic/DMUL.java | 88 ++ .../org/aspectj/apache/bcel/generic/DNEG.java | 85 ++ .../org/aspectj/apache/bcel/generic/DREM.java | 88 ++ .../aspectj/apache/bcel/generic/DRETURN.java | 87 ++ .../aspectj/apache/bcel/generic/DSTORE.java | 92 ++ .../org/aspectj/apache/bcel/generic/DSUB.java | 88 ++ .../org/aspectj/apache/bcel/generic/DUP.java | 84 ++ .../org/aspectj/apache/bcel/generic/DUP2.java | 84 ++ .../aspectj/apache/bcel/generic/DUP2_X1.java | 82 ++ .../aspectj/apache/bcel/generic/DUP2_X2.java | 82 ++ .../aspectj/apache/bcel/generic/DUP_X1.java | 82 ++ .../aspectj/apache/bcel/generic/DUP_X2.java | 82 ++ .../apache/bcel/generic/ExceptionThrower.java | 79 ++ .../org/aspectj/apache/bcel/generic/F2D.java | 87 ++ .../org/aspectj/apache/bcel/generic/F2I.java | 87 ++ .../org/aspectj/apache/bcel/generic/F2L.java | 87 ++ .../org/aspectj/apache/bcel/generic/FADD.java | 87 ++ .../aspectj/apache/bcel/generic/FALOAD.java | 87 ++ .../aspectj/apache/bcel/generic/FASTORE.java | 87 ++ .../aspectj/apache/bcel/generic/FCMPG.java | 91 ++ .../aspectj/apache/bcel/generic/FCMPL.java | 91 ++ .../aspectj/apache/bcel/generic/FCONST.java | 113 +++ .../org/aspectj/apache/bcel/generic/FDIV.java | 87 ++ .../aspectj/apache/bcel/generic/FLOAD.java | 92 ++ .../org/aspectj/apache/bcel/generic/FMUL.java | 87 ++ .../org/aspectj/apache/bcel/generic/FNEG.java | 85 ++ .../org/aspectj/apache/bcel/generic/FREM.java | 87 ++ .../aspectj/apache/bcel/generic/FRETURN.java | 87 ++ .../aspectj/apache/bcel/generic/FSTORE.java | 92 ++ .../org/aspectj/apache/bcel/generic/FSUB.java | 87 ++ .../apache/bcel/generic/FieldObserver.java | 67 ++ .../aspectj/apache/bcel/generic/GETFIELD.java | 117 +++ .../apache/bcel/generic/GETSTATIC.java | 113 +++ .../org/aspectj/apache/bcel/generic/GOTO.java | 122 +++ .../aspectj/apache/bcel/generic/GOTO_W.java | 110 +++ .../apache/bcel/generic/GotoInstruction.java | 75 ++ .../org/aspectj/apache/bcel/generic/I2B.java | 87 ++ .../org/aspectj/apache/bcel/generic/I2C.java | 87 ++ .../org/aspectj/apache/bcel/generic/I2D.java | 87 ++ .../org/aspectj/apache/bcel/generic/I2F.java | 87 ++ .../org/aspectj/apache/bcel/generic/I2L.java | 87 ++ .../org/aspectj/apache/bcel/generic/I2S.java | 85 ++ .../org/aspectj/apache/bcel/generic/IADD.java | 87 ++ .../aspectj/apache/bcel/generic/IALOAD.java | 88 ++ .../org/aspectj/apache/bcel/generic/IAND.java | 85 ++ .../aspectj/apache/bcel/generic/IASTORE.java | 88 ++ .../aspectj/apache/bcel/generic/ICONST.java | 109 +++ .../org/aspectj/apache/bcel/generic/IDIV.java | 94 ++ .../org/aspectj/apache/bcel/generic/IFEQ.java | 98 +++ .../org/aspectj/apache/bcel/generic/IFGE.java | 98 +++ .../org/aspectj/apache/bcel/generic/IFGT.java | 98 +++ .../org/aspectj/apache/bcel/generic/IFLE.java | 98 +++ .../org/aspectj/apache/bcel/generic/IFLT.java | 98 +++ .../org/aspectj/apache/bcel/generic/IFNE.java | 98 +++ .../apache/bcel/generic/IFNONNULL.java | 97 +++ .../aspectj/apache/bcel/generic/IFNULL.java | 98 +++ .../apache/bcel/generic/IF_ACMPEQ.java | 97 +++ .../apache/bcel/generic/IF_ACMPNE.java | 98 +++ .../apache/bcel/generic/IF_ICMPEQ.java | 98 +++ .../apache/bcel/generic/IF_ICMPGE.java | 98 +++ .../apache/bcel/generic/IF_ICMPGT.java | 98 +++ .../apache/bcel/generic/IF_ICMPLE.java | 98 +++ .../apache/bcel/generic/IF_ICMPLT.java | 98 +++ .../apache/bcel/generic/IF_ICMPNE.java | 98 +++ .../aspectj/apache/bcel/generic/ILOAD.java | 92 ++ .../aspectj/apache/bcel/generic/IMPDEP1.java | 80 ++ .../aspectj/apache/bcel/generic/IMPDEP2.java | 80 ++ .../org/aspectj/apache/bcel/generic/IMUL.java | 87 ++ .../org/aspectj/apache/bcel/generic/INEG.java | 85 ++ .../apache/bcel/generic/INSTANCEOF.java | 106 +++ .../apache/bcel/generic/INVOKESPECIAL.java | 113 +++ .../apache/bcel/generic/INVOKESTATIC.java | 110 +++ .../apache/bcel/generic/INVOKEVIRTUAL.java | 112 +++ .../org/aspectj/apache/bcel/generic/IOR.java | 85 ++ .../org/aspectj/apache/bcel/generic/IREM.java | 94 ++ .../aspectj/apache/bcel/generic/IRETURN.java | 87 ++ .../org/aspectj/apache/bcel/generic/ISHL.java | 85 ++ .../org/aspectj/apache/bcel/generic/ISHR.java | 85 ++ .../aspectj/apache/bcel/generic/ISTORE.java | 92 ++ .../org/aspectj/apache/bcel/generic/ISUB.java | 87 ++ .../aspectj/apache/bcel/generic/IUSHR.java | 85 ++ .../org/aspectj/apache/bcel/generic/IXOR.java | 85 ++ .../apache/bcel/generic/IfInstruction.java | 82 ++ .../bcel/generic/IndexedInstruction.java | 68 ++ .../bcel/generic/InstructionListObserver.java | 67 ++ .../org/aspectj/apache/bcel/generic/JSR.java | 119 +++ .../aspectj/apache/bcel/generic/JSR_W.java | 110 +++ .../apache/bcel/generic/JsrInstruction.java | 115 +++ .../org/aspectj/apache/bcel/generic/L2D.java | 85 ++ .../org/aspectj/apache/bcel/generic/L2F.java | 85 ++ .../org/aspectj/apache/bcel/generic/L2I.java | 85 ++ .../org/aspectj/apache/bcel/generic/LADD.java | 86 ++ .../aspectj/apache/bcel/generic/LALOAD.java | 87 ++ .../org/aspectj/apache/bcel/generic/LAND.java | 86 ++ .../aspectj/apache/bcel/generic/LASTORE.java | 87 ++ .../org/aspectj/apache/bcel/generic/LCMP.java | 92 ++ .../aspectj/apache/bcel/generic/LCONST.java | 111 +++ .../org/aspectj/apache/bcel/generic/LDC.java | 172 ++++ .../aspectj/apache/bcel/generic/LDC2_W.java | 116 +++ .../aspectj/apache/bcel/generic/LDC_W.java | 88 ++ .../org/aspectj/apache/bcel/generic/LDIV.java | 91 ++ .../aspectj/apache/bcel/generic/LLOAD.java | 89 ++ .../org/aspectj/apache/bcel/generic/LMUL.java | 86 ++ .../org/aspectj/apache/bcel/generic/LNEG.java | 85 ++ .../org/aspectj/apache/bcel/generic/LOR.java | 85 ++ .../org/aspectj/apache/bcel/generic/LREM.java | 88 ++ .../aspectj/apache/bcel/generic/LRETURN.java | 85 ++ .../org/aspectj/apache/bcel/generic/LSHL.java | 85 ++ .../org/aspectj/apache/bcel/generic/LSHR.java | 85 ++ .../aspectj/apache/bcel/generic/LSTORE.java | 89 ++ .../org/aspectj/apache/bcel/generic/LSUB.java | 86 ++ .../aspectj/apache/bcel/generic/LUSHR.java | 85 ++ .../org/aspectj/apache/bcel/generic/LXOR.java | 85 ++ .../apache/bcel/generic/LoadClass.java | 86 ++ .../apache/bcel/generic/LoadInstruction.java | 101 +++ .../generic/LocalVariableInstruction.java | 224 +++++ .../apache/bcel/generic/MONITORENTER.java | 88 ++ .../apache/bcel/generic/MONITOREXIT.java | 88 ++ .../apache/bcel/generic/MethodObserver.java | 67 ++ .../org/aspectj/apache/bcel/generic/NEW.java | 110 +++ .../aspectj/apache/bcel/generic/NEWARRAY.java | 140 +++ .../org/aspectj/apache/bcel/generic/NOP.java | 80 ++ .../org/aspectj/apache/bcel/generic/POP.java | 85 ++ .../org/aspectj/apache/bcel/generic/POP2.java | 85 ++ .../org/aspectj/apache/bcel/generic/PUSH.java | 199 +++++ .../aspectj/apache/bcel/generic/PUTFIELD.java | 118 +++ .../apache/bcel/generic/PUTSTATIC.java | 114 +++ .../apache/bcel/generic/PopInstruction.java | 68 ++ .../apache/bcel/generic/PushInstruction.java | 73 ++ .../aspectj/apache/bcel/generic/RETURN.java | 85 ++ .../bcel/generic/ReturnInstruction.java | 104 +++ .../aspectj/apache/bcel/generic/SALOAD.java | 85 ++ .../aspectj/apache/bcel/generic/SASTORE.java | 85 ++ .../aspectj/apache/bcel/generic/SIPUSH.java | 128 +++ .../org/aspectj/apache/bcel/generic/SWAP.java | 84 ++ .../aspectj/apache/bcel/generic/SWITCH.java | 187 ++++ .../aspectj/apache/bcel/generic/Select.java | 254 ++++++ .../apache/bcel/generic/StackConsumer.java | 68 ++ .../apache/bcel/generic/StackInstruction.java | 83 ++ .../apache/bcel/generic/StackProducer.java | 69 ++ .../apache/bcel/generic/StoreInstruction.java | 101 +++ .../apache/bcel/generic/TypedInstruction.java | 67 ++ .../bcel/generic/UnconditionalBranch.java | 67 ++ .../generic/VariableLengthInstruction.java | 70 ++ .../annotation/AnnotationElementValueGen.java | 63 ++ .../generic/annotation/AnnotationGen.java | 166 ++++ .../annotation/ArrayElementValueGen.java | 100 +++ .../annotation/ClassElementValueGen.java | 81 ++ .../annotation/ElementNameValuePairGen.java | 86 ++ .../generic/annotation/ElementValueGen.java | 146 ++++ .../annotation/EnumElementValueGen.java | 101 +++ .../annotation/SimpleElementValueGen.java | 206 +++++ .../aspectj/apache/bcel/generic/package.html | 16 + .../src/org/aspectj/apache/bcel/package.html | 17 + .../apache/bcel/util/AttributeHTML.java | 272 ++++++ .../aspectj/apache/bcel/util/Class2HTML.java | 270 ++++++ .../aspectj/apache/bcel/util/ClassLoader.java | 227 +++++ .../aspectj/apache/bcel/util/ClassSet.java | 96 +++ .../aspectj/apache/bcel/util/ClassStack.java | 73 ++ .../aspectj/apache/bcel/util/CodeHTML.java | 632 ++++++++++++++ .../apache/bcel/util/ConstantHTML.java | 274 ++++++ .../aspectj/apache/bcel/util/JavaWrapper.java | 152 ++++ .../aspectj/apache/bcel/util/MethodHTML.java | 208 +++++ .../org/aspectj/apache/bcel/util/package.html | 25 + .../apache/bcel/verifier/exc/package.html | 24 + .../bcel/verifier/structurals/package.html | 27 + 213 files changed, 22041 insertions(+) create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/classfile/AttributeReader.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/ClassElementValue.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/ElementNameValuePair.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/ElementValue.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/EnumElementValue.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/SimpleElementValue.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/classfile/package.html create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/AALOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/AASTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ACONST_NULL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ALOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ANEWARRAY.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ARETURN.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ARRAYLENGTH.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ASTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ATHROW.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/AllocationInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ArithmeticInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ArrayInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/BALOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/BASTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/BIPUSH.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/BREAKPOINT.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/BranchInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/CALOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/CASTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/CHECKCAST.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/CPInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ClassObserver.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/CompoundInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ConstantPoolGen.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ConstantPushInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ConversionInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/D2F.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/D2I.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/D2L.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DADD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DALOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DASTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DCMPG.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DCMPL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DCONST.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DDIV.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DLOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DMUL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DNEG.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DREM.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DRETURN.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DSTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DSUB.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DUP.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2_X1.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2_X2.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DUP_X1.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/DUP_X2.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ExceptionThrower.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/F2D.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/F2I.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/F2L.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FADD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FALOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FASTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FCMPG.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FCMPL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FCONST.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FDIV.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FLOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FMUL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FNEG.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FREM.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FRETURN.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FSTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FSUB.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/FieldObserver.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/GETFIELD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/GETSTATIC.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/GOTO.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/GOTO_W.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/GotoInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/I2B.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/I2C.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/I2D.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/I2F.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/I2L.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/I2S.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IADD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IALOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IAND.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IASTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ICONST.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IDIV.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IFEQ.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IFGE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IFGT.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IFLE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IFLT.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IFNE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IFNONNULL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IFNULL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ACMPEQ.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ACMPNE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPEQ.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPGE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPGT.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPLE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPLT.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPNE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ILOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IMPDEP1.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IMPDEP2.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IMUL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/INEG.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/INSTANCEOF.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKESPECIAL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKESTATIC.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKEVIRTUAL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IOR.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IREM.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IRETURN.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ISHL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ISHR.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ISTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ISUB.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IUSHR.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IXOR.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IfInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/IndexedInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionListObserver.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/JSR.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/JSR_W.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/JsrInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/L2D.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/L2F.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/L2I.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LADD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LALOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LAND.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LASTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LCMP.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LCONST.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LDC.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LDC2_W.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LDC_W.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LDIV.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LLOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LMUL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LNEG.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LOR.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LREM.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LRETURN.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LSHL.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LSHR.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LSTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LSUB.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LUSHR.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LXOR.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LoadClass.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LoadInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/MONITORENTER.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/MONITOREXIT.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/MethodObserver.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/NEW.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/NEWARRAY.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/NOP.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/POP.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/POP2.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/PUSH.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/PUTFIELD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/PUTSTATIC.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/PopInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/PushInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/RETURN.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/ReturnInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/SALOAD.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/SASTORE.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/SIPUSH.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/SWAP.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/SWITCH.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/Select.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/StackConsumer.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/StackInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/StackProducer.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/StoreInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/TypedInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/UnconditionalBranch.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/VariableLengthInstruction.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/AnnotationElementValueGen.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/AnnotationGen.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/ArrayElementValueGen.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/ClassElementValueGen.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/ElementNameValuePairGen.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/ElementValueGen.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/EnumElementValueGen.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/SimpleElementValueGen.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/generic/package.html create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/package.html create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/util/AttributeHTML.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/util/Class2HTML.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoader.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/util/ClassSet.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/util/ClassStack.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/util/CodeHTML.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/util/ConstantHTML.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/util/JavaWrapper.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/util/MethodHTML.java create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/util/package.html create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/verifier/exc/package.html create mode 100644 bcel-builder/src/org/aspectj/apache/bcel/verifier/structurals/package.html diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/AttributeReader.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/AttributeReader.java new file mode 100644 index 000000000..63f4c7c9b --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/AttributeReader.java @@ -0,0 +1,97 @@ +package org.aspectj.apache.bcel.classfile; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Unknown (non-standard) attributes may be read via user-defined factory + * objects that can be registered with the Attribute.addAttributeReader + * method. These factory objects should implement this interface. + + * @see Attribute + * @version $Id: AttributeReader.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public interface AttributeReader { + /** + When this attribute reader is added via the static method + Attribute.addAttributeReader, an attribute name is associated with it. + As the class file parser parses attributes, it will call various + AttributeReaders based on the name of the attributes it is + constructing. + + @param name_index An index into the constant pool, indexing a + ConstantUtf8 that represents the name of the attribute. + + @param length The length of the data contained in the attribute. This + is written into the constant pool and should agree with what the + factory expects the length to be. + + @param file This is the data input stream that the factory needs to read + its data from. + + @param constant_pool This is the constant pool associated with the + Attribute that we are constructing. + + @return The user-defined AttributeReader should take this data and use + it to construct an attribute. In the case of errors, a null can be + returned which will cause the parsing of the class file to fail. + + @see Attribute#addAttributeReader( String, AttributeReader ) + */ + public Attribute createAttribute(int name_index, + int length, + java.io.DataInputStream file, + ConstantPool constant_pool); +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java new file mode 100644 index 000000000..4b609fd06 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java @@ -0,0 +1,130 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement initial implementation + * ******************************************************************/ +package org.aspectj.apache.bcel.classfile.annotation; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.aspectj.apache.bcel.Constants; +import org.aspectj.apache.bcel.classfile.ConstantPool; +import org.aspectj.apache.bcel.classfile.ConstantUtf8; +import org.aspectj.apache.bcel.classfile.Utility; + +/** + * An annotation is an immutable object (AnnotationGen is the mutable variant) - it basically contains a list + * of name-value pairs. + */ +public class Annotation { + private int typeIndex; + private List /* ElementNameValuePair */ evs = new ArrayList(); + private ConstantPool cpool; + private boolean isRuntimeVisible; + + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("ANNOTATION ["+getTypeSignature()+"] ["+ + (isRuntimeVisible?"runtimeVisible":"runtimeInvisible")+"] ["); + for (Iterator iter = evs.iterator(); iter.hasNext();) { + ElementNameValuePair element = (ElementNameValuePair) iter.next(); + sb.append(element.toString()); + if (iter.hasNext()) sb.append(","); + } + sb.append("]"); + return sb.toString(); + } + + private Annotation(ConstantPool cpool) { + this.cpool = cpool; + } + + public Annotation(int index,ConstantPool cpool,boolean visible) { + this.cpool = cpool; + this.typeIndex = index; + this.isRuntimeVisible = visible; + } + + protected static Annotation read(DataInputStream dis,ConstantPool cpool,boolean isRuntimeVisible) throws IOException { + Annotation a = new Annotation(cpool); + a.typeIndex = dis.readUnsignedShort(); + int elemValuePairCount = dis.readUnsignedShort(); + for (int i=0;i0) { + result.append("("); + for (Iterator iter = getValues().iterator(); iter.hasNext();) { + ElementNameValuePair element = (ElementNameValuePair) iter.next(); + result.append(element.toShortString()); + } + result.append(")"); + } + return result.toString(); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java new file mode 100644 index 000000000..1959f20d8 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java @@ -0,0 +1,51 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial implementation {date} + * ******************************************************************/ +package org.aspectj.apache.bcel.classfile.annotation; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.aspectj.apache.bcel.classfile.ConstantPool; + +/** + * An element value that is an annotation. + */ +public class AnnotationElementValue extends ElementValue { + + // For annotation element values, this is the annotation + private Annotation a; + + public AnnotationElementValue(int type, Annotation annotation, ConstantPool cpool) { + super(type,cpool); + if (type != ANNOTATION) + throw new RuntimeException("Only element values of type annotation can be built with this ctor"); + this.a = annotation; + } + + public void dump(DataOutputStream dos) throws IOException { + dos.writeByte(type); // u1 type of value (ANNOTATION == '@') + a.dump(dos); + } + + public String stringifyValue() { + StringBuffer sb = new StringBuffer(); + sb.append(a.toString()); + return sb.toString(); + } + + public String toString() { + return stringifyValue(); + } + + public Annotation getAnnotation() { return a;} + +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java new file mode 100644 index 000000000..6feeeddf4 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java @@ -0,0 +1,66 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial implementation {date} + * ******************************************************************/ + +package org.aspectj.apache.bcel.classfile.annotation; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.aspectj.apache.bcel.classfile.ConstantPool; + + +public class ArrayElementValue extends ElementValue { + + // For array types, this is the array + private ElementValue[] evalues; + + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("{"); + for (int i = 0; i < evalues.length; i++) { + sb.append(evalues[i].toString()); + if ((i+1) + + + + + +

+This package contains the classes that describe the structure of a +Java class file and a class file parser. +

+ + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/AALOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/AALOAD.java new file mode 100644 index 000000000..9cde2dbe2 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/AALOAD.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * AALOAD - Load reference from array + *
Stack: ..., arrayref, index -> value
+ * + * @version $Id: AALOAD.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class AALOAD extends ArrayInstruction implements StackProducer { + /** Load reference from array + */ + public AALOAD() { + super(org.aspectj.apache.bcel.Constants.AALOAD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitAALOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/AASTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/AASTORE.java new file mode 100644 index 000000000..bb72b2bcb --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/AASTORE.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * AASTORE - Store into reference array + *
Stack: ..., arrayref, index, value -> ...
+ * + * @version $Id: AASTORE.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class AASTORE extends ArrayInstruction implements StackConsumer { + /** Store into reference array + */ + public AASTORE() { + super(org.aspectj.apache.bcel.Constants.AASTORE); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitAASTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ACONST_NULL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ACONST_NULL.java new file mode 100644 index 000000000..513dcdfc9 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ACONST_NULL.java @@ -0,0 +1,94 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ACONST_NULL - Push null reference + *
Stack: ... -> ..., null
+ * + * @version $Id: ACONST_NULL.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class ACONST_NULL extends Instruction + implements PushInstruction, TypedInstruction { + /** + * Push null reference + */ + public ACONST_NULL() { + super(org.aspectj.apache.bcel.Constants.ACONST_NULL, (short)1); + } + + /** @return Type.NULL + */ + public Type getType(ConstantPoolGen cp) { + return Type.NULL; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitPushInstruction(this); + v.visitTypedInstruction(this); + v.visitACONST_NULL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ALOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ALOAD.java new file mode 100644 index 000000000..6a2407b7b --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ALOAD.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ALOAD - Load reference from local variable + *
Stack: ... -> ..., objectref
+ * + * @version $Id: ALOAD.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class ALOAD extends LoadInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + ALOAD() { + super(org.aspectj.apache.bcel.Constants.ALOAD, org.aspectj.apache.bcel.Constants.ALOAD_0); + } + + /** Load reference from local variable + * @param n index of local variable + */ + public ALOAD(int n) { + super(org.aspectj.apache.bcel.Constants.ALOAD, org.aspectj.apache.bcel.Constants.ALOAD_0, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + super.accept(v); + v.visitALOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ANEWARRAY.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ANEWARRAY.java new file mode 100644 index 000000000..5b4b7fc21 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ANEWARRAY.java @@ -0,0 +1,114 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; + +/** + * ANEWARRAY - Create new array of references + *
Stack: ..., count -> ..., arrayref
+ * + * @version $Id: ANEWARRAY.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class ANEWARRAY extends CPInstruction + implements LoadClass, AllocationInstruction, ExceptionThrower, StackProducer { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + ANEWARRAY() {} + + public ANEWARRAY(int index) { + super(org.aspectj.apache.bcel.Constants.ANEWARRAY, index); + } + + public Class[] getExceptions(){ + Class[] cs = new Class[1 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length]; + + System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, + cs, 0, ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length); + cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = + ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION; + return cs; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitLoadClass(this); + v.visitAllocationInstruction(this); + v.visitExceptionThrower(this); + v.visitStackProducer(this); + v.visitTypedInstruction(this); + v.visitCPInstruction(this); + v.visitANEWARRAY(this); + } + + public ObjectType getLoadClassType(ConstantPoolGen cpg) { + Type t = getType(cpg); + + if (t instanceof ArrayType){ + t = ((ArrayType) t).getBasicType(); + } + + return (t instanceof ObjectType)? (ObjectType) t : null; + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ARETURN.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ARETURN.java new file mode 100644 index 000000000..2ac33236f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ARETURN.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ARETURN - Return reference from method + *
Stack: ..., objectref -> <empty>
+ * + * @version $Id: ARETURN.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class ARETURN extends ReturnInstruction { + /** + * Return reference from method + */ + public ARETURN() { + super(org.aspectj.apache.bcel.Constants.ARETURN); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackConsumer(this); + v.visitReturnInstruction(this); + v.visitARETURN(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ARRAYLENGTH.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ARRAYLENGTH.java new file mode 100644 index 000000000..9ad8c4163 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ARRAYLENGTH.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ARRAYLENGTH - Get length of array + *
Stack: ..., arrayref -> ..., length
+ * + * @version $Id: ARRAYLENGTH.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class ARRAYLENGTH extends Instruction + implements ExceptionThrower, StackProducer { + /** Get length of array + */ + public ARRAYLENGTH() { + super(org.aspectj.apache.bcel.Constants.ARRAYLENGTH, (short)1); + } + + /** @return exceptions this instruction may cause + */ + public Class[] getExceptions() { + return new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION }; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitStackProducer(this); + v.visitARRAYLENGTH(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ASTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ASTORE.java new file mode 100644 index 000000000..c7289980d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ASTORE.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ASTORE - Store reference into local variable + *
Stack ..., objectref -> ... 
+ * + * @version $Id: ASTORE.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class ASTORE extends StoreInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + ASTORE() { + super(org.aspectj.apache.bcel.Constants.ASTORE, org.aspectj.apache.bcel.Constants.ASTORE_0); + } + + /** Store reference into local variable + * @param n index of local variable + */ + public ASTORE(int n) { + super(org.aspectj.apache.bcel.Constants.ASTORE, org.aspectj.apache.bcel.Constants.ASTORE_0, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + super.accept(v); + v.visitASTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ATHROW.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ATHROW.java new file mode 100644 index 000000000..060ef501e --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ATHROW.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ATHROW - Throw exception + *
Stack: ..., objectref -> objectref
+ * + * @version $Id: ATHROW.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class ATHROW extends Instruction implements UnconditionalBranch, ExceptionThrower { + /** + * Throw exception + */ + public ATHROW() { + super(org.aspectj.apache.bcel.Constants.ATHROW, (short)1); + } + + /** @return exceptions this instruction may cause + */ + public Class[] getExceptions() { + return new Class[] { org.aspectj.apache.bcel.ExceptionConstants.THROWABLE }; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitUnconditionalBranch(this); + v.visitExceptionThrower(this); + v.visitATHROW(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/AllocationInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/AllocationInstruction.java new file mode 100644 index 000000000..2b4816391 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/AllocationInstruction.java @@ -0,0 +1,64 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denote family of instructions that allocates space in the heap. + * + * @version $Id: AllocationInstruction.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public interface AllocationInstruction {} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ArithmeticInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ArithmeticInstruction.java new file mode 100644 index 000000000..47c4d379f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ArithmeticInstruction.java @@ -0,0 +1,106 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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; +/** + * Super class for the family of arithmetic instructions. + * + * @version $Id: ArithmeticInstruction.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public abstract class ArithmeticInstruction extends Instruction + implements TypedInstruction, StackProducer, StackConsumer { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + ArithmeticInstruction() {} + + /** + * @param opcode of instruction + */ + protected ArithmeticInstruction(short opcode) { + super(opcode, (short)1); + } + + /** @return type associated with the instruction + */ + public Type getType(ConstantPoolGen cp) { + switch(opcode) { + case Constants.DADD: case Constants.DDIV: case Constants.DMUL: + case Constants.DNEG: case Constants.DREM: case Constants.DSUB: + return Type.DOUBLE; + + case Constants.FADD: case Constants.FDIV: case Constants.FMUL: + case Constants.FNEG: case Constants.FREM: case Constants.FSUB: + return Type.FLOAT; + + case Constants.IADD: case Constants.IAND: case Constants.IDIV: + case Constants.IMUL: case Constants.INEG: case Constants.IOR: case Constants.IREM: + case Constants.ISHL: case Constants.ISHR: case Constants.ISUB: + case Constants.IUSHR: case Constants.IXOR: + return Type.INT; + + case Constants.LADD: case Constants.LAND: case Constants.LDIV: + case Constants.LMUL: case Constants.LNEG: case Constants.LOR: case Constants.LREM: + case Constants.LSHL: case Constants.LSHR: case Constants.LSUB: + case Constants.LUSHR: case Constants.LXOR: + return Type.LONG; + + default: // Never reached + throw new ClassGenException("Unknown type " + opcode); + } + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ArrayInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ArrayInstruction.java new file mode 100644 index 000000000..586ca39eb --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ArrayInstruction.java @@ -0,0 +1,106 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Super class for instructions dealing with array access such as IALOAD. + * + * @version $Id: ArrayInstruction.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public abstract class ArrayInstruction extends Instruction + implements ExceptionThrower, TypedInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + ArrayInstruction() {} + + /** + * @param opcode of instruction + */ + protected ArrayInstruction(short opcode) { + super(opcode, (short)1); + } + + public Class[] getExceptions() { + return org.aspectj.apache.bcel.ExceptionConstants.EXCS_ARRAY_EXCEPTION; + } + + /** @return type associated with the instruction + */ + public Type getType(ConstantPoolGen cp) { + switch(opcode) { + case org.aspectj.apache.bcel.Constants.IALOAD: case org.aspectj.apache.bcel.Constants.IASTORE: + return Type.INT; + case org.aspectj.apache.bcel.Constants.CALOAD: case org.aspectj.apache.bcel.Constants.CASTORE: + return Type.CHAR; + case org.aspectj.apache.bcel.Constants.BALOAD: case org.aspectj.apache.bcel.Constants.BASTORE: + return Type.BYTE; + case org.aspectj.apache.bcel.Constants.SALOAD: case org.aspectj.apache.bcel.Constants.SASTORE: + return Type.SHORT; + case org.aspectj.apache.bcel.Constants.LALOAD: case org.aspectj.apache.bcel.Constants.LASTORE: + return Type.LONG; + case org.aspectj.apache.bcel.Constants.DALOAD: case org.aspectj.apache.bcel.Constants.DASTORE: + return Type.DOUBLE; + case org.aspectj.apache.bcel.Constants.FALOAD: case org.aspectj.apache.bcel.Constants.FASTORE: + return Type.FLOAT; + case org.aspectj.apache.bcel.Constants.AALOAD: case org.aspectj.apache.bcel.Constants.AASTORE: + return Type.OBJECT; + + default: throw new ClassGenException("Oops: unknown case in switch" + opcode); + } + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/BALOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/BALOAD.java new file mode 100644 index 000000000..01c9cb758 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/BALOAD.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * BALOAD - Load byte or boolean from array + *
Stack: ..., arrayref, index -> ..., value
+ * + * @version $Id: BALOAD.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class BALOAD extends ArrayInstruction implements StackProducer { + /** Load byte or boolean from array + */ + public BALOAD() { + super(org.aspectj.apache.bcel.Constants.BALOAD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitBALOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/BASTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/BASTORE.java new file mode 100644 index 000000000..66cfff340 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/BASTORE.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * BASTORE - Store into byte or boolean array + *
Stack: ..., arrayref, index, value -> ...
+ * + * @version $Id: BASTORE.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class BASTORE extends ArrayInstruction implements StackConsumer { + /** Store byte or boolean into array + */ + public BASTORE() { + super(org.aspectj.apache.bcel.Constants.BASTORE); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitBASTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/BIPUSH.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/BIPUSH.java new file mode 100644 index 000000000..b9f74b484 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/BIPUSH.java @@ -0,0 +1,131 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.*; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * BIPUSH - Push byte on stack + * + *
Stack: ... -> ..., value
+ * + * @version $Id: BIPUSH.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class BIPUSH extends Instruction implements ConstantPushInstruction { + private byte b; + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + BIPUSH() {} + + /** Push byte on stack + */ + public BIPUSH(byte b) { + super(org.aspectj.apache.bcel.Constants.BIPUSH, (short)2); + this.b = b; + } + + /** + * Dump instruction as byte code to stream out. + */ + public void dump(DataOutputStream out) throws IOException { + super.dump(out); + out.writeByte(b); + } + + /** + * @return mnemonic for instruction + */ + public String toString(boolean verbose) { + return super.toString(verbose) + " " + b; + } + + /** + * Read needed data (e.g. index) from file. + */ + protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException + { + length = 2; + b = bytes.readByte(); + } + + public Number getValue() { return new Integer(b); } + + /** @return Type.BYTE + */ + public Type getType(ConstantPoolGen cp) { + return Type.BYTE; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitPushInstruction(this); + v.visitStackProducer(this); + v.visitTypedInstruction(this); + v.visitConstantPushInstruction(this); + v.visitBIPUSH(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/BREAKPOINT.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/BREAKPOINT.java new file mode 100644 index 000000000..2f8c4d1ae --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/BREAKPOINT.java @@ -0,0 +1,79 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * BREAKPOINT, JVM dependent, ignored by default + * + * @version $Id: BREAKPOINT.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class BREAKPOINT extends Instruction { + public BREAKPOINT() { + super(org.aspectj.apache.bcel.Constants.BREAKPOINT, (short)1); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitBREAKPOINT(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/BranchInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/BranchInstruction.java new file mode 100644 index 000000000..6b3cc331f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/BranchInstruction.java @@ -0,0 +1,246 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.*; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * Abstract super class for branching instructions like GOTO, IFEQ, etc.. + * Branch instructions may have a variable length, namely GOTO, JSR, + * LOOKUPSWITCH and TABLESWITCH. + * + * @see InstructionList + * @version $Id: BranchInstruction.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public abstract class BranchInstruction extends Instruction implements InstructionTargeter { + protected int index; // Branch target relative to this instruction + protected InstructionHandle target; // Target object in instruction list + protected int position; // Byte code offset + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + BranchInstruction() {} + + /** Common super constructor + * @param opcodee Instruction opcode + * @param target instruction to branch to + */ + protected BranchInstruction(short opcode, InstructionHandle target) { + super(opcode, (short)3); + setTarget(target); + } + + /** + * Dump instruction as byte code to stream out. + * @param out Output stream + */ + public void dump(DataOutputStream out) throws IOException { + out.writeByte(opcode); + + index = getTargetOffset(); + + if(Math.abs(index) >= 32767) // too large for short + throw new ClassGenException("Branch target offset too large for short"); + + out.writeShort(index); // May be negative, i.e., point backwards + } + + /** + * @param target branch target + * @return the offset to `target' relative to this instruction + */ + protected int getTargetOffset(InstructionHandle target) { + if(target == null) + throw new ClassGenException("Target of " + super.toString(true) + + " is invalid null handle"); + + int t = target.getPosition(); + + if(t < 0) + throw new ClassGenException("Invalid branch target position offset for " + + super.toString(true) + ":" + t + ":" + target); + + return t - position; + } + + /** + * @return the offset to this instruction's target + */ + protected int getTargetOffset() { return getTargetOffset(target); } + + /** + * Called by InstructionList.setPositions when setting the position for every + * instruction. In the presence of variable length instructions `setPositions' + * performs multiple passes over the instruction list to calculate the + * correct (byte) positions and offsets by calling this function. + * + * @param offset additional offset caused by preceding (variable length) instructions + * @param max_offset the maximum offset that may be caused by these instructions + * @return additional offset caused by possible change of this instruction's length + */ + protected int updatePosition(int offset, int max_offset) { + position += offset; + return 0; + } + + /** + * Long output format: + * + * <position in byte code> + * <name of opcode> "["<opcode number>"]" + * "("<length of instruction>")" + * "<"<target instruction>">" "@"<branch target offset> + * + * @param verbose long/short format switch + * @return mnemonic for instruction + */ + public String toString(boolean verbose) { + String s = super.toString(verbose); + String t = "null"; + + if(verbose) { + if(target != null) { + if(target.getInstruction() == this) + t = ""; + else if(target.getInstruction() == null) + t = ""; + else + t = target.getInstruction().toString(false); // Avoid circles + } + } else { + if(target != null) { + index = getTargetOffset(); + t = "" + (index + position); + } + } + + return s + " -> " + t; + } + + /** + * Read needed data (e.g. index) from file. Conversion to a InstructionHandle + * is done in InstructionList(byte[]). + * + * @param bytes input stream + * @param wide wide prefix? + * @see InstructionList + */ + protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException + { + length = 3; + index = bytes.readShort(); + } + + /** + * @return target offset in byte code + */ + public final int getIndex() { return index; } + + /** + * @return target of branch instruction + */ + public InstructionHandle getTarget() { return target; } + + /** + * Set branch target + * @param target branch target + */ + public void setTarget(InstructionHandle target) { + notifyTarget(this.target, target, this); + this.target = target; + } + + /** + * Used by BranchInstruction, LocalVariableGen, CodeExceptionGen + */ + static final void notifyTarget(InstructionHandle old_ih, InstructionHandle new_ih, + InstructionTargeter t) { + if(old_ih != null) + old_ih.removeTargeter(t); + if(new_ih != null) + new_ih.addTargeter(t); + } + + /** + * @param old_ih old target + * @param new_ih new target + */ + public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) { + if(target == old_ih) + setTarget(new_ih); + else + throw new ClassGenException("Not targeting " + old_ih + ", but " + target); + } + + /** + * @return true, if ih is target of this instruction + */ + public boolean containsTarget(InstructionHandle ih) { + return (target == ih); + } + + /** + * Inform target that it's not targeted anymore. + */ + void dispose() { + setTarget(null); + index=-1; + position=-1; + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/CALOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/CALOAD.java new file mode 100644 index 000000000..304af2c8d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/CALOAD.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * CALOAD - Load char from array + *
Stack: ..., arrayref, index -> ..., value
+ * + * @version $Id: CALOAD.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class CALOAD extends ArrayInstruction implements StackProducer { + /** Load char from array + */ + public CALOAD() { + super(org.aspectj.apache.bcel.Constants.CALOAD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitCALOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/CASTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/CASTORE.java new file mode 100644 index 000000000..a4ab30e13 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/CASTORE.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * CASTORE - Store into char array + *
Stack: ..., arrayref, index, value -> ...
+ * + * @version $Id: CASTORE.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class CASTORE extends ArrayInstruction implements StackConsumer { + /** Store char into array + */ + public CASTORE() { + super(org.aspectj.apache.bcel.Constants.CASTORE); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitCASTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/CHECKCAST.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/CHECKCAST.java new file mode 100644 index 000000000..c28373797 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/CHECKCAST.java @@ -0,0 +1,117 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; +/** + * CHECKCAST - Check whether object is of given type + *
Stack: ..., objectref -> ..., objectref
+ * + * @version $Id: CHECKCAST.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class CHECKCAST extends CPInstruction + implements LoadClass, ExceptionThrower, StackProducer, StackConsumer { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + CHECKCAST() {} + + /** Check whether object is of given type + * @param n index to class in constant pool + */ + public CHECKCAST(int index) { + super(org.aspectj.apache.bcel.Constants.CHECKCAST, index); + } + + /** @return exceptions this instruction may cause + */ + public Class[] getExceptions() { + Class[] cs = new Class[1 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length]; + + System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, + cs, 0, ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length); + cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = + ExceptionConstants.CLASS_CAST_EXCEPTION; + return cs; + } + + public ObjectType getLoadClassType(ConstantPoolGen cpg) { + Type t = getType(cpg); + + if(t instanceof ArrayType) + t = ((ArrayType) t).getBasicType(); + + return (t instanceof ObjectType)? (ObjectType) t : null; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitLoadClass(this); + v.visitExceptionThrower(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitTypedInstruction(this); + v.visitCPInstruction(this); + v.visitCHECKCAST(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/CPInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/CPInstruction.java new file mode 100644 index 000000000..ee588daa6 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/CPInstruction.java @@ -0,0 +1,169 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.DataOutputStream; +import java.io.IOException; + +import org.aspectj.apache.bcel.classfile.Constant; +import org.aspectj.apache.bcel.classfile.ConstantClass; +import org.aspectj.apache.bcel.classfile.ConstantPool; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * Abstract super class for instructions that use an index into the + * constant pool such as LDC, INVOKEVIRTUAL, etc. + * + * @see ConstantPoolGen + * @see LDC + * @see INVOKEVIRTUAL + * + * @version $Id: CPInstruction.java,v 1.6 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public abstract class CPInstruction extends Instruction + implements TypedInstruction, IndexedInstruction +{ + protected int index; // index to constant pool + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + CPInstruction() {} + + /** + * @param index to constant pool + */ + protected CPInstruction(short opcode, int index) { + super(opcode, (short)3); + setIndex(index); + } + + /** + * Dump instruction as byte code to stream out. + * @param out Output stream + */ + public void dump(DataOutputStream out) throws IOException { + out.writeByte(opcode); + out.writeShort(index); + } + + /** + * Long output format: + * + * <name of opcode> "["<opcode number>"]" + * "("<length of instruction>")" "<"< constant pool index>">" + * + * @param verbose long/short format switch + * @return mnemonic for instruction + */ + public String toString(boolean verbose) { + return super.toString(verbose) + " " + index; + } + + /** + * @return mnemonic for instruction with symbolic references resolved + */ + public String toString(ConstantPool cp) { + Constant c = cp.getConstant(index); + String str = cp.constantToString(c); + + if(c instanceof ConstantClass) + str = str.replace('.', '/'); + + return org.aspectj.apache.bcel.Constants.OPCODE_NAMES[opcode] + " " + str; + } + + /** + * Read needed data (i.e., index) from file. + * @param bytes input stream + * @param wide wide prefix? + */ + protected void initFromFile(ByteSequence bytes, boolean wide) + throws IOException + { + setIndex(bytes.readUnsignedShort()); + length = 3; + } + + /** + * @return index in constant pool referred by this instruction. + */ + public final int getIndex() { return index; } + + /** + * Set the index to constant pool. + * @param index in constant pool. + */ + public void setIndex(int index) { + if(index < 0) + throw new ClassGenException("Negative index value: " + index); + + this.index = index; + } + + /** @return type related with this instruction. + */ + public Type getType(ConstantPoolGen cpg) { + ConstantPool cp = cpg.getConstantPool(); + String name = cp.getConstantString(index, org.aspectj.apache.bcel.Constants.CONSTANT_Class); + + if(!name.startsWith("[")) + name = "L" + name + ";"; + + return Type.getType(name); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ClassObserver.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ClassObserver.java new file mode 100644 index 000000000..37b5828c9 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ClassObserver.java @@ -0,0 +1,67 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Implement this interface if you're interested in changes to a ClassGen object + * and register yourself with addObserver(). + * + * @version $Id: ClassObserver.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public interface ClassObserver { + public void notify(ClassGen clazz); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/CompoundInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/CompoundInstruction.java new file mode 100644 index 000000000..78d1d3b38 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/CompoundInstruction.java @@ -0,0 +1,76 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Wrapper class for `compound' operations, virtual instructions that + * don't exist as byte code, but give a useful meaning. For example, + * the (virtual) PUSH instruction takes an arbitray argument and produces the + * appropiate code at dump time (ICONST, LDC, BIPUSH, ...). Also you can use the + * SWITCH instruction as a useful template for either LOOKUPSWITCH or + * TABLESWITCH. + * + * The interface provides the possibilty for the user to write + * `templates' or `macros' for such reuseable code patterns. + * + * @version $Id: CompoundInstruction.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + * @see PUSH + * @see SWITCH + */ +public interface CompoundInstruction { + public InstructionList getInstructionList(); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ConstantPoolGen.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ConstantPoolGen.java new file mode 100644 index 000000000..289c8b061 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ConstantPoolGen.java @@ -0,0 +1,802 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.HashMap; + +import org.aspectj.apache.bcel.Constants; +import org.aspectj.apache.bcel.classfile.Constant; +import org.aspectj.apache.bcel.classfile.ConstantCP; +import org.aspectj.apache.bcel.classfile.ConstantClass; +import org.aspectj.apache.bcel.classfile.ConstantDouble; +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.ConstantLong; +import org.aspectj.apache.bcel.classfile.ConstantMethodref; +import org.aspectj.apache.bcel.classfile.ConstantNameAndType; +import org.aspectj.apache.bcel.classfile.ConstantPool; +import org.aspectj.apache.bcel.classfile.ConstantString; +import org.aspectj.apache.bcel.classfile.ConstantUtf8; + +/** + * This class is used to build up a constant pool. The user adds + * constants via `addXXX' methods, `addString', `addClass', + * etc.. These methods return an index into the constant + * pool. Finally, `getFinalConstantPool()' returns the constant pool + * built up. Intermediate versions of the constant pool can be + * obtained with `getConstantPool()'. A constant pool has capacity for + * Constants.MAX_SHORT entries. Note that the first (0) is used by the + * JVM and that Double and Long constants need two slots. + * + * @version $Id: ConstantPoolGen.java,v 1.5 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + * @see Constant + */ +public class ConstantPoolGen implements java.io.Serializable { + protected int size = 1024; // Inital size, sufficient in most cases + protected Constant[] constants = new Constant[size]; + protected int index = 1; // First entry (0) used by JVM + + private static final String METHODREF_DELIM = ":"; + private static final String IMETHODREF_DELIM = "#"; + private static final String FIELDREF_DELIM = "&"; + private static final String NAT_DELIM = "%"; + + private static class Index implements java.io.Serializable { + int index; + Index(int i) { index = i; } + } + + /** + * Initialize with given array of constants. + * + * @param c array of given constants, new ones will be appended + */ + public ConstantPoolGen(Constant[] cs) { + if(cs.length > size) { + size = cs.length; + constants = new Constant[size]; + } + + System.arraycopy(cs, 0, constants, 0, cs.length); + + if(cs.length > 0) + index = cs.length; + + for(int i=1; i < index; i++) { + Constant c = constants[i]; + + if(c instanceof ConstantString) { + ConstantString s = (ConstantString)c; + ConstantUtf8 u8 = (ConstantUtf8)constants[s.getStringIndex()]; + + string_table.put(u8.getBytes(), new Index(i)); + } else if(c instanceof ConstantClass) { + ConstantClass s = (ConstantClass)c; + ConstantUtf8 u8 = (ConstantUtf8)constants[s.getNameIndex()]; + + class_table.put(u8.getBytes(), new Index(i)); + } else if(c instanceof ConstantNameAndType) { + ConstantNameAndType n = (ConstantNameAndType)c; + ConstantUtf8 u8 = (ConstantUtf8)constants[n.getNameIndex()]; + ConstantUtf8 u8_2 = (ConstantUtf8)constants[n.getSignatureIndex()]; + + n_a_t_table.put(u8.getBytes() + NAT_DELIM + u8_2.getBytes(), new Index(i)); + } else if(c instanceof ConstantUtf8) { + ConstantUtf8 u = (ConstantUtf8)c; + + utf8_table.put(u.getBytes(), new Index(i)); + } else if(c instanceof ConstantCP) { + ConstantCP m = (ConstantCP)c; + ConstantClass clazz = (ConstantClass)constants[m.getClassIndex()]; + ConstantNameAndType n = (ConstantNameAndType)constants[m.getNameAndTypeIndex()]; + + ConstantUtf8 u8 = (ConstantUtf8)constants[clazz.getNameIndex()]; + String class_name = u8.getBytes().replace('/', '.'); + + u8 = (ConstantUtf8)constants[n.getNameIndex()]; + String method_name = u8.getBytes(); + + u8 = (ConstantUtf8)constants[n.getSignatureIndex()]; + String signature = u8.getBytes(); + + String delim = METHODREF_DELIM; + + if(c instanceof ConstantInterfaceMethodref) + delim = IMETHODREF_DELIM; + else if(c instanceof ConstantFieldref) + delim = FIELDREF_DELIM; + + cp_table.put(class_name + delim + method_name + delim + signature, new Index(i)); + } + } + } + + /** + * Initialize with given constant pool. + */ + public ConstantPoolGen(ConstantPool cp) { + this(cp.getConstantPool()); + } + + /** + * Create empty constant pool. + */ + public ConstantPoolGen() {} + + /** Resize internal array of constants. + */ + protected void adjustSize() { + if(index + 3 >= size) { + Constant[] cs = constants; + + size *= 2; + constants = new Constant[size]; + System.arraycopy(cs, 0, constants, 0, index); + } + } + + private HashMap string_table = new HashMap(); + + /** + * Look for ConstantString in ConstantPool containing String `str'. + * + * @param str String to search for + * @return index on success, -1 otherwise + */ + public int lookupString(String str) { + Index index = (Index)string_table.get(str); + return (index != null)? index.index : -1; + } + + /** + * Add a new String constant to the ConstantPool, if it is not already in there. + * + * @param str String to add + * @return index of entry + */ + public int addString(String str) { + int ret; + + if((ret = lookupString(str)) != -1) + return ret; // Already in CP + + int utf8 = addUtf8(str); + + adjustSize(); + + ConstantString s = new ConstantString(utf8); + + ret = index; + constants[index++] = s; + + string_table.put(str, new Index(ret)); + + return ret; + } + + private HashMap class_table = new HashMap(); + + /** + * Look for ConstantClass in ConstantPool named `str'. + * + * @param str String to search for + * @return index on success, -1 otherwise + */ + public int lookupClass(String str) { + Index index = (Index)class_table.get(str.replace('.', '/')); + return (index != null)? index.index : -1; + } + + private int addClass_(String clazz) { + int ret; + + if((ret = lookupClass(clazz)) != -1) + return ret; // Already in CP + + adjustSize(); + + ConstantClass c = new ConstantClass(addUtf8(clazz)); + + ret = index; + constants[index++] = c; + + class_table.put(clazz, new Index(ret)); + + return ret; + } + + /** + * Add a new Class reference to the ConstantPool, if it is not already in there. + * + * @param str Class to add + * @return index of entry + */ + public int addClass(String str) { + return addClass_(str.replace('.', '/')); + } + + /** + * Add a new Class reference to the ConstantPool for a given type. + * + * @param str Class to add + * @return index of entry + */ + public int addClass(ObjectType type) { + //BCELBUG:? Should this we getClassName() - perhaps it should be getSignature() ?!? + return addClass(type.getClassName()); +// return addClass(type.getSignature()); + } + + /** + * Add a reference to an array class (e.g. String[][]) as needed by MULTIANEWARRAY + * instruction, e.g. to the ConstantPool. + * + * @param type type of array class + * @return index of entry + */ + public int addArrayClass(ArrayType type) { + return addClass_(type.getSignature()); + } + + /** + * Look for ConstantInteger in ConstantPool. + * + * @param n integer number to look for + * @return index on success, -1 otherwise + */ + public int lookupInteger(int n) { + for(int i=1; i < index; i++) { + if(constants[i] instanceof ConstantInteger) { + ConstantInteger c = (ConstantInteger)constants[i]; + + if(c.getBytes() == n) + return i; + } + } + + return -1; + } + + /** + * Add a new Integer constant to the ConstantPool, if it is not already in there. + * + * @param n integer number to add + * @return index of entry + */ + public int addInteger(int n) { + int ret; + + if((ret = lookupInteger(n)) != -1) + return ret; // Already in CP + + adjustSize(); + + ret = index; + constants[index++] = new ConstantInteger(n); + + return ret; + } + + /** + * Look for ConstantFloat in ConstantPool. + * + * @param n Float number to look for + * @return index on success, -1 otherwise + */ + public int lookupFloat(float n) { + int bits = Float.floatToIntBits(n); + + for(int i=1; i < index; i++) { + if(constants[i] instanceof ConstantFloat) { + ConstantFloat c = (ConstantFloat)constants[i]; + + if(Float.floatToIntBits(c.getBytes()) == bits) + return i; + } + } + + return -1; + } + + /** + * Add a new Float constant to the ConstantPool, if it is not already in there. + * + * @param n Float number to add + * @return index of entry + */ + public int addFloat(float n) { + int ret; + + if((ret = lookupFloat(n)) != -1) + return ret; // Already in CP + + adjustSize(); + + ret = index; + constants[index++] = new ConstantFloat(n); + + return ret; + } + + private HashMap utf8_table = new HashMap(); + + /** + * Look for ConstantUtf8 in ConstantPool. + * + * @param n Utf8 string to look for + * @return index on success, -1 otherwise + */ + public int lookupUtf8(String n) { + Index index = (Index)utf8_table.get(n); + + return (index != null)? index.index : -1; + } + + /** + * Add a new Utf8 constant to the ConstantPool, if it is not already in there. + * + * @param n Utf8 string to add + * @return index of entry + */ + public int addUtf8(String n) { + int ret; + + if((ret = lookupUtf8(n)) != -1) + return ret; // Already in CP + + adjustSize(); + + ret = index; + constants[index++] = new ConstantUtf8(n); + + utf8_table.put(n, new Index(ret)); + + return ret; + } + + /** + * Look for ConstantLong in ConstantPool. + * + * @param n Long number to look for + * @return index on success, -1 otherwise + */ + public int lookupLong(long n) { + for(int i=1; i < index; i++) { + if(constants[i] instanceof ConstantLong) { + ConstantLong c = (ConstantLong)constants[i]; + + if(c.getBytes() == n) + return i; + } + } + + return -1; + } + + /** + * Add a new long constant to the ConstantPool, if it is not already in there. + * + * @param n Long number to add + * @return index of entry + */ + public int addLong(long n) { + int ret; + + if((ret = lookupLong(n)) != -1) + return ret; // Already in CP + + adjustSize(); + + ret = index; + constants[index] = new ConstantLong(n); + index += 2; // Wastes one entry according to spec + + return ret; + } + + /** + * Look for ConstantDouble in ConstantPool. + * + * @param n Double number to look for + * @return index on success, -1 otherwise + */ + public int lookupDouble(double n) { + long bits = Double.doubleToLongBits(n); + + for(int i=1; i < index; i++) { + if(constants[i] instanceof ConstantDouble) { + ConstantDouble c = (ConstantDouble)constants[i]; + + if(Double.doubleToLongBits(c.getBytes()) == bits) + return i; + } + } + + return -1; + } + + /** + * Add a new double constant to the ConstantPool, if it is not already in there. + * + * @param n Double number to add + * @return index of entry + */ + public int addDouble(double n) { + int ret; + + if((ret = lookupDouble(n)) != -1) + return ret; // Already in CP + + adjustSize(); + + ret = index; + constants[index] = new ConstantDouble(n); + index += 2; // Wastes one entry according to spec + + return ret; + } + + private HashMap n_a_t_table = new HashMap(); + + /** + * Look for ConstantNameAndType in ConstantPool. + * + * @param name of variable/method + * @param signature of variable/method + * @return index on success, -1 otherwise + */ + public int lookupNameAndType(String name, String signature) { + Index index = (Index)n_a_t_table.get(name + NAT_DELIM + signature); + return (index != null)? index.index : -1; + } + + /** + * Add a new NameAndType constant to the ConstantPool if it is not already + * in there. + * + * @param n NameAndType string to add + * @return index of entry + */ + public int addNameAndType(String name, String signature) { + int ret; + int name_index, signature_index; + + if((ret = lookupNameAndType(name, signature)) != -1) + return ret; // Already in CP + + adjustSize(); + + name_index = addUtf8(name); + signature_index = addUtf8(signature); + ret = index; + constants[index++] = new ConstantNameAndType(name_index, signature_index); + + n_a_t_table.put(name + NAT_DELIM + signature, new Index(ret)); + return ret; + } + + private HashMap cp_table = new HashMap(); + + /** + * Look for ConstantMethodref in ConstantPool. + * + * @param class_name Where to find method + * @param method_name Guess what + * @param signature return and argument types + * @return index on success, -1 otherwise + */ + public int lookupMethodref(String class_name, String method_name, String signature) { + Index index = (Index)cp_table.get(class_name + METHODREF_DELIM + method_name + + METHODREF_DELIM + signature); + return (index != null)? index.index : -1; + } + + public int lookupMethodref(MethodGen method) { + return lookupMethodref(method.getClassName(), method.getName(), + method.getSignature()); + } + + /** + * Add a new Methodref constant to the ConstantPool, if it is not already + * in there. + * + * @param n Methodref string to add + * @return index of entry + */ + public int addMethodref(String class_name, String method_name, String signature) { + int ret, class_index, name_and_type_index; + + if((ret = lookupMethodref(class_name, method_name, signature)) != -1) + return ret; // Already in CP + + adjustSize(); + + name_and_type_index = addNameAndType(method_name, signature); + class_index = addClass(class_name); + ret = index; + constants[index++] = new ConstantMethodref(class_index, name_and_type_index); + + cp_table.put(class_name + METHODREF_DELIM + method_name + + METHODREF_DELIM + signature, new Index(ret)); + + return ret; + } + + public int addMethodref(MethodGen method) { + return addMethodref(method.getClassName(), method.getName(), + method.getSignature()); + } + + /** + * Look for ConstantInterfaceMethodref in ConstantPool. + * + * @param class_name Where to find method + * @param method_name Guess what + * @param signature return and argument types + * @return index on success, -1 otherwise + */ + public int lookupInterfaceMethodref(String class_name, String method_name, String signature) { + Index index = (Index)cp_table.get(class_name + IMETHODREF_DELIM + method_name + + IMETHODREF_DELIM + signature); + return (index != null)? index.index : -1; + } + + public int lookupInterfaceMethodref(MethodGen method) { + return lookupInterfaceMethodref(method.getClassName(), method.getName(), + method.getSignature()); + } + + /** + * Add a new InterfaceMethodref constant to the ConstantPool, if it is not already + * in there. + * + * @param n InterfaceMethodref string to add + * @return index of entry + */ + public int addInterfaceMethodref(String class_name, String method_name, String signature) { + int ret, class_index, name_and_type_index; + + if((ret = lookupInterfaceMethodref(class_name, method_name, signature)) != -1) + return ret; // Already in CP + + adjustSize(); + + class_index = addClass(class_name); + name_and_type_index = addNameAndType(method_name, signature); + ret = index; + constants[index++] = new ConstantInterfaceMethodref(class_index, name_and_type_index); + + cp_table.put(class_name + IMETHODREF_DELIM + method_name + + IMETHODREF_DELIM + signature, new Index(ret)); + + return ret; + } + + public int addInterfaceMethodref(MethodGen method) { + return addInterfaceMethodref(method.getClassName(), method.getName(), + method.getSignature()); + } + + /** + * Look for ConstantFieldref in ConstantPool. + * + * @param class_name Where to find method + * @param field_name Guess what + * @param signature return and argument types + * @return index on success, -1 otherwise + */ + public int lookupFieldref(String class_name, String field_name, String signature) { + Index index = (Index)cp_table.get(class_name + FIELDREF_DELIM + field_name + + FIELDREF_DELIM + signature); + return (index != null)? index.index : -1; + } + + /** + * Add a new Fieldref constant to the ConstantPool, if it is not already + * in there. + * + * @param n Fieldref string to add + * @return index of entry + */ + public int addFieldref(String class_name, String field_name, String signature) { + int ret; + int class_index, name_and_type_index; + + if((ret = lookupFieldref(class_name, field_name, signature)) != -1) + return ret; // Already in CP + + adjustSize(); + + class_index = addClass(class_name); + name_and_type_index = addNameAndType(field_name, signature); + ret = index; + constants[index++] = new ConstantFieldref(class_index, name_and_type_index); + + cp_table.put(class_name + FIELDREF_DELIM + field_name + FIELDREF_DELIM + signature, new Index(ret)); + + return ret; + } + + /** + * @param i index in constant pool + * @return constant pool entry at index i + */ + public Constant getConstant(int i) { return constants[i]; } + + /** + * Use with care! + * + * @param i index in constant pool + * @param c new constant pool entry at index i + */ + public void setConstant(int i, Constant c) { constants[i] = c; } + + /** + * @return intermediate constant pool + */ + public ConstantPool getConstantPool() { + return new ConstantPool(constants); + } + + /** + * @return current size of constant pool + */ + public int getSize() { + return index; + } + + /** + * @return constant pool with proper length + */ + public ConstantPool getFinalConstantPool() { + Constant[] cs = new Constant[index]; + + System.arraycopy(constants, 0, cs, 0, index); + + return new ConstantPool(cs); + } + + /** + * @return String representation. + */ + public String toString() { + StringBuffer buf = new StringBuffer(); + + for(int i=1; i < index; i++) + buf.append(i + ")" + constants[i] + "\n"); + + return buf.toString(); + } + + /** Import constant from another ConstantPool and return new index. + */ + public int addConstant(Constant c, ConstantPoolGen cp) { + Constant[] constants = cp.getConstantPool().getConstantPool(); + + switch(c.getTag()) { + case Constants.CONSTANT_String: { + ConstantString s = (ConstantString)c; + ConstantUtf8 u8 = (ConstantUtf8)constants[s.getStringIndex()]; + + return addString(u8.getBytes()); + } + + case Constants.CONSTANT_Class: { + ConstantClass s = (ConstantClass)c; + ConstantUtf8 u8 = (ConstantUtf8)constants[s.getNameIndex()]; + + return addClass(u8.getBytes()); + } + + case Constants.CONSTANT_NameAndType: { + ConstantNameAndType n = (ConstantNameAndType)c; + ConstantUtf8 u8 = (ConstantUtf8)constants[n.getNameIndex()]; + ConstantUtf8 u8_2 = (ConstantUtf8)constants[n.getSignatureIndex()]; + + return addNameAndType(u8.getBytes(), u8_2.getBytes()); + } + + case Constants.CONSTANT_Utf8: + return addUtf8(((ConstantUtf8)c).getBytes()); + + case Constants.CONSTANT_Double: + return addDouble(((ConstantDouble)c).getBytes()); + + case Constants.CONSTANT_Float: + return addFloat(((ConstantFloat)c).getBytes()); + + case Constants.CONSTANT_Long: + return addLong(((ConstantLong)c).getBytes()); + + case Constants.CONSTANT_Integer: + return addInteger(((ConstantInteger)c).getBytes()); + + case Constants.CONSTANT_InterfaceMethodref: case Constants.CONSTANT_Methodref: + case Constants.CONSTANT_Fieldref: { + ConstantCP m = (ConstantCP)c; + ConstantClass clazz = (ConstantClass)constants[m.getClassIndex()]; + ConstantNameAndType n = (ConstantNameAndType)constants[m.getNameAndTypeIndex()]; + ConstantUtf8 u8 = (ConstantUtf8)constants[clazz.getNameIndex()]; + String class_name = u8.getBytes().replace('/', '.'); + + u8 = (ConstantUtf8)constants[n.getNameIndex()]; + String name = u8.getBytes(); + + u8 = (ConstantUtf8)constants[n.getSignatureIndex()]; + String signature = u8.getBytes(); + + switch(c.getTag()) { + case Constants.CONSTANT_InterfaceMethodref: + return addInterfaceMethodref(class_name, name, signature); + + case Constants.CONSTANT_Methodref: + return addMethodref(class_name, name, signature); + + case Constants.CONSTANT_Fieldref: + return addFieldref(class_name, name, signature); + + default: // Never reached + throw new RuntimeException("Unknown constant type " + c); + } + } + + default: // Never reached + throw new RuntimeException("Unknown constant type " + c); + } + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ConstantPushInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ConstantPushInstruction.java new file mode 100644 index 000000000..defceb613 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ConstantPushInstruction.java @@ -0,0 +1,70 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denotes a push instruction that produces a literal on the stack + * such as SIPUSH, BIPUSH, ICONST, etc. + * + * @version $Id: ConstantPushInstruction.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + + * @see ICONST + * @see SIPUSH + */ +public interface ConstantPushInstruction extends PushInstruction, TypedInstruction { + public Number getValue(); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ConversionInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ConversionInstruction.java new file mode 100644 index 000000000..5a70c4c03 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ConversionInstruction.java @@ -0,0 +1,102 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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; +/** + * Super class for the x2y family of instructions. + * + * @version $Id: ConversionInstruction.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public abstract class ConversionInstruction extends Instruction + implements TypedInstruction, StackProducer, StackConsumer { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + ConversionInstruction() {} + + /** + * @param opcode opcode of instruction + */ + protected ConversionInstruction(short opcode) { + super(opcode, (short)1); + } + + /** @return type associated with the instruction + */ + public Type getType(ConstantPoolGen cp) { + switch(opcode) { + case Constants.D2I: case Constants.F2I: case Constants.L2I: + return Type.INT; + case Constants.D2F: case Constants.I2F: case Constants.L2F: + return Type.FLOAT; + case Constants.D2L: case Constants.F2L: case Constants.I2L: + return Type.LONG; + case Constants.F2D: case Constants.I2D: case Constants.L2D: + return Type.DOUBLE; + case Constants.I2B: + return Type.BYTE; + case Constants.I2C: + return Type.CHAR; + case Constants.I2S: + return Type.SHORT; + + default: // Never reached + throw new ClassGenException("Unknown type " + opcode); + } + } +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/D2F.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/D2F.java new file mode 100644 index 000000000..e96e57cd3 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/D2F.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * D2F - Convert double to float + *
Stack: ..., value.word1, value.word2 -> ..., result
+ * + * @version $Id: D2F.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class D2F extends ConversionInstruction { + /** Convert double to float + */ + public D2F() { + super(org.aspectj.apache.bcel.Constants.D2F); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitD2F(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/D2I.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/D2I.java new file mode 100644 index 000000000..e8e2045f9 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/D2I.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * D2I - Convert double to int + *
Stack: ..., value.word1, value.word2 -> ..., result
+ * + * @version $Id: D2I.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class D2I extends ConversionInstruction { + /** Convert double to int + */ + public D2I() { + super(org.aspectj.apache.bcel.Constants.D2I); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitD2I(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/D2L.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/D2L.java new file mode 100644 index 000000000..96fc34dc1 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/D2L.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * D2L - Convert double to long + *
Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2
+ * + * @version $Id: D2L.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class D2L extends ConversionInstruction { + /** Convert double to long + */ + public D2L() { + super(org.aspectj.apache.bcel.Constants.D2L); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitD2L(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DADD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DADD.java new file mode 100644 index 000000000..fcfa6a283 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DADD.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DADD - Add doubles + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result.word1, result1.word2 + * + * @version $Id: DADD.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class DADD extends ArithmeticInstruction { + /** Add doubles + */ + public DADD() { + super(org.aspectj.apache.bcel.Constants.DADD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitDADD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DALOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DALOAD.java new file mode 100644 index 000000000..c0016cb6d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DALOAD.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DALOAD - Load double from array + *
Stack: ..., arrayref, index -> ..., result.word1, result.word2
+ * + * @version $Id: DALOAD.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class DALOAD extends ArrayInstruction implements StackProducer { + /** Load double from array + */ + public DALOAD() { + super(org.aspectj.apache.bcel.Constants.DALOAD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitDALOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DASTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DASTORE.java new file mode 100644 index 000000000..154b9bc75 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DASTORE.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DASTORE - Store into double array + *
Stack: ..., arrayref, index, value.word1, value.word2 -> ...
+ * + * @version $Id: DASTORE.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class DASTORE extends ArrayInstruction implements StackConsumer { + /** Store double into array + */ + public DASTORE() { + super(org.aspectj.apache.bcel.Constants.DASTORE); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitDASTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DCMPG.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DCMPG.java new file mode 100644 index 000000000..54de21ffa --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DCMPG.java @@ -0,0 +1,93 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DCMPG - Compare doubles: value1 > value2 + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result + * + * @version $Id: DCMPG.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class DCMPG extends Instruction + implements TypedInstruction, StackProducer, StackConsumer { + + public DCMPG() { + super(org.aspectj.apache.bcel.Constants.DCMPG, (short)1); + } + + /** @return Type.DOUBLE + */ + public Type getType(ConstantPoolGen cp) { + return Type.DOUBLE; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitDCMPG(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DCMPL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DCMPL.java new file mode 100644 index 000000000..a868da420 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DCMPL.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DCMPL - Compare doubles: value1 < value2 + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result + * + * @version $Id: DCMPL.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class DCMPL extends Instruction + implements TypedInstruction, StackProducer, StackConsumer { + public DCMPL() { + super(org.aspectj.apache.bcel.Constants.DCMPL, (short)1); + } + + /** @return Type.DOUBLE + */ + public Type getType(ConstantPoolGen cp) { + return Type.DOUBLE; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitDCMPL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DCONST.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DCONST.java new file mode 100644 index 000000000..8580af29c --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DCONST.java @@ -0,0 +1,111 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DCONST - Push 0.0 or 1.0, other values cause an exception + * + *
Stack: ... -> ..., 
+ * + * @version $Id: DCONST.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class DCONST extends Instruction + implements ConstantPushInstruction, TypedInstruction { + private double value; + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + DCONST() {} + + public DCONST(double f) { + super(org.aspectj.apache.bcel.Constants.DCONST_0, (short)1); + + if(f == 0.0) + opcode = org.aspectj.apache.bcel.Constants.DCONST_0; + else if(f == 1.0) + opcode = org.aspectj.apache.bcel.Constants.DCONST_1; + else + throw new ClassGenException("DCONST can be used only for 0.0 and 1.0: " + f); + + value = f; + } + + public Number getValue() { return new Double(value); } + + /** @return Type.DOUBLE + */ + public Type getType(ConstantPoolGen cp) { + return Type.DOUBLE; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitPushInstruction(this); + v.visitStackProducer(this); + v.visitTypedInstruction(this); + v.visitConstantPushInstruction(this); + v.visitDCONST(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DDIV.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DDIV.java new file mode 100644 index 000000000..54ab8a87f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DDIV.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DDIV - Divide doubles + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result.word1, result.word2 + * + * @version $Id: DDIV.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class DDIV extends ArithmeticInstruction { + /** Divide doubles + */ + public DDIV() { + super(org.aspectj.apache.bcel.Constants.DDIV); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitDDIV(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DLOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DLOAD.java new file mode 100644 index 000000000..bc22a9f66 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DLOAD.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DLOAD - Load double from local variable + *
Stack ... -> ..., result.word1, result.word2
+ * + * @version $Id: DLOAD.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class DLOAD extends LoadInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + DLOAD() { + super(org.aspectj.apache.bcel.Constants.DLOAD, org.aspectj.apache.bcel.Constants.DLOAD_0); + } + + /** Load double from local variable + * @param n index of local variable + */ + public DLOAD(int n) { + super(org.aspectj.apache.bcel.Constants.DLOAD, org.aspectj.apache.bcel.Constants.DLOAD_0, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + super.accept(v); + v.visitDLOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DMUL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DMUL.java new file mode 100644 index 000000000..309074c75 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DMUL.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DMUL - Multiply doubles + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result.word1, result.word2 + * + * @version $Id: DMUL.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class DMUL extends ArithmeticInstruction { + /** Multiply doubles + */ + public DMUL() { + super(org.aspectj.apache.bcel.Constants.DMUL); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitDMUL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DNEG.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DNEG.java new file mode 100644 index 000000000..14fa78e2d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DNEG.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DNEG - Negate double + *
Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2
+ * + * @version $Id: DNEG.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class DNEG extends ArithmeticInstruction { + public DNEG() { + super(org.aspectj.apache.bcel.Constants.DNEG); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitDNEG(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DREM.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DREM.java new file mode 100644 index 000000000..d6a7e215d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DREM.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DREM - Remainder of doubles + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result.word1, result.word2 + * + * @version $Id: DREM.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class DREM extends ArithmeticInstruction { + /** Remainder of doubles + */ + public DREM() { + super(org.aspectj.apache.bcel.Constants.DREM); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitDREM(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DRETURN.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DRETURN.java new file mode 100644 index 000000000..774d1d38e --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DRETURN.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DRETURN - Return double from method + *
Stack: ..., value.word1, value.word2 -> <empty>
+ * + * @version $Id: DRETURN.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class DRETURN extends ReturnInstruction { + /** Return double from method + */ + public DRETURN() { + super(org.aspectj.apache.bcel.Constants.DRETURN); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackConsumer(this); + v.visitReturnInstruction(this); + v.visitDRETURN(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DSTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DSTORE.java new file mode 100644 index 000000000..89cf5714d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DSTORE.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DSTORE - Store double into local variable + *
Stack: ..., value.word1, value.word2 -> ... 
+ * + * @version $Id: DSTORE.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class DSTORE extends StoreInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + DSTORE() { + super(org.aspectj.apache.bcel.Constants.DSTORE, org.aspectj.apache.bcel.Constants.DSTORE_0); + } + + /** Store double into local variable + * @param n index of local variable + */ + public DSTORE(int n) { + super(org.aspectj.apache.bcel.Constants.DSTORE, org.aspectj.apache.bcel.Constants.DSTORE_0, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + super.accept(v); + v.visitDSTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DSUB.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DSUB.java new file mode 100644 index 000000000..7a6aae238 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DSUB.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DSUB - Substract doubles + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result.word1, result.word2 + * + * @version $Id: DSUB.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class DSUB extends ArithmeticInstruction { + /** Substract doubles + */ + public DSUB() { + super(org.aspectj.apache.bcel.Constants.DSUB); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitDSUB(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP.java new file mode 100644 index 000000000..3d8abe3e0 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP.java @@ -0,0 +1,84 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DUP - Duplicate top operand stack word + *
Stack: ..., word -> ..., word, word
+ * + * @version $Id: DUP.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class DUP extends StackInstruction implements PushInstruction { + public DUP() { + super(org.aspectj.apache.bcel.Constants.DUP); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitPushInstruction(this); + v.visitStackInstruction(this); + v.visitDUP(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2.java new file mode 100644 index 000000000..984cae75f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2.java @@ -0,0 +1,84 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DUP2 - Duplicate two top operand stack words + *
Stack: ..., word2, word1 -> ..., word2, word1, word2, word1
+ * + * @version $Id: DUP2.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class DUP2 extends StackInstruction implements PushInstruction { + public DUP2() { + super(org.aspectj.apache.bcel.Constants.DUP2); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitPushInstruction(this); + v.visitStackInstruction(this); + v.visitDUP2(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2_X1.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2_X1.java new file mode 100644 index 000000000..df3be6435 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2_X1.java @@ -0,0 +1,82 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DUP2_X1 - Duplicate two top operand stack words and put three down + *
Stack: ..., word3, word2, word1 -> ..., word2, word1, word3, word2, word1
+ * + * @version $Id: DUP2_X1.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class DUP2_X1 extends StackInstruction { + public DUP2_X1() { + super(org.aspectj.apache.bcel.Constants.DUP2_X1); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackInstruction(this); + v.visitDUP2_X1(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2_X2.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2_X2.java new file mode 100644 index 000000000..070429e00 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP2_X2.java @@ -0,0 +1,82 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DUP2_X2 - Duplicate two top operand stack words and put four down + *
Stack: ..., word4, word3, word2, word1 -> ..., word2, word1, word4, word3, word2, word1
+ * + * @version $Id: DUP2_X2.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class DUP2_X2 extends StackInstruction { + public DUP2_X2() { + super(org.aspectj.apache.bcel.Constants.DUP2_X2); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackInstruction(this); + v.visitDUP2_X2(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP_X1.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP_X1.java new file mode 100644 index 000000000..e22e7ecb7 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP_X1.java @@ -0,0 +1,82 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DUP_X1 - Duplicate top operand stack word and put two down + *
Stack: ..., word2, word1 -> ..., word1, word2, word1
+ * + * @version $Id: DUP_X1.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class DUP_X1 extends StackInstruction { + public DUP_X1() { + super(org.aspectj.apache.bcel.Constants.DUP_X1); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackInstruction(this); + v.visitDUP_X1(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP_X2.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP_X2.java new file mode 100644 index 000000000..80e85ac75 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/DUP_X2.java @@ -0,0 +1,82 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * DUP_X2 - Duplicate top operand stack word and put three down + *
Stack: ..., word3, word2, word1 -> ..., word1, word3, word2, word1
+ * + * @version $Id: DUP_X2.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class DUP_X2 extends StackInstruction { + public DUP_X2() { + super(org.aspectj.apache.bcel.Constants.DUP_X2); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackInstruction(this); + v.visitDUP_X2(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ExceptionThrower.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ExceptionThrower.java new file mode 100644 index 000000000..cf33dbd87 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ExceptionThrower.java @@ -0,0 +1,79 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denote an instruction that may throw a run-time or a linking + * exception (or both) during execution. This is not quite the truth + * as such; because all instructions may throw an + * java.lang.VirtualMachineError. These exceptions are omitted. + * + * The Lava Language Specification specifies exactly which + * RUN-TIME and which LINKING exceptions each + * instruction may throw which is reflected by the implementers. Due + * to the structure of the JVM specification, it may be possible that + * an Instruction implementing this interface returns a Class[] of + * size 0. + * + * Please note that we speak of an "exception" here when we mean any + * "Throwable" object; so this term is equally used for "Exception" + * and "Error" objects. + * + * @version $Id: ExceptionThrower.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author Enver Haase + */ +public interface ExceptionThrower { + public java.lang.Class[] getExceptions(); +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/F2D.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/F2D.java new file mode 100644 index 000000000..4c191f8cf --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/F2D.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * F2D - Convert float to double + *
Stack: ..., value -> ..., result.word1, result.word2
+ * + * @version $Id: F2D.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class F2D extends ConversionInstruction { + /** Convert float to double + */ + public F2D() { + super(org.aspectj.apache.bcel.Constants.F2D); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitF2D(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/F2I.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/F2I.java new file mode 100644 index 000000000..7d06df7af --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/F2I.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * F2I - Convert float to int + *
Stack: ..., value -> ..., result
+ * + * @version $Id: F2I.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class F2I extends ConversionInstruction { + /** Convert float to int + */ + public F2I() { + super(org.aspectj.apache.bcel.Constants.F2I); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitF2I(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/F2L.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/F2L.java new file mode 100644 index 000000000..6d7f8b012 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/F2L.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * F2L - Convert float to long + *
Stack: ..., value -> ..., result.word1, result.word2
+ * + * @version $Id: F2L.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class F2L extends ConversionInstruction { + /** Convert float to long + */ + public F2L() { + super(org.aspectj.apache.bcel.Constants.F2L); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitF2L(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FADD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FADD.java new file mode 100644 index 000000000..d0f531485 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FADD.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FADD - Add floats + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: FADD.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class FADD extends ArithmeticInstruction { + /** Add floats + */ + public FADD() { + super(org.aspectj.apache.bcel.Constants.FADD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitFADD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FALOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FALOAD.java new file mode 100644 index 000000000..d6e206c98 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FALOAD.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FALOAD - Load float from array + *
Stack: ..., arrayref, index -> ..., value
+ * + * @version $Id: FALOAD.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class FALOAD extends ArrayInstruction implements StackProducer { + /** Load float from array + */ + public FALOAD() { + super(org.aspectj.apache.bcel.Constants.FALOAD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitFALOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FASTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FASTORE.java new file mode 100644 index 000000000..ccc29c330 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FASTORE.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FASTORE - Store into float array + *
Stack: ..., arrayref, index, value -> ...
+ * + * @version $Id: FASTORE.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class FASTORE extends ArrayInstruction implements StackConsumer { + /** Store float into array + */ + public FASTORE() { + super(org.aspectj.apache.bcel.Constants.FASTORE); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitFASTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FCMPG.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FCMPG.java new file mode 100644 index 000000000..fac7916c4 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FCMPG.java @@ -0,0 +1,91 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FCMPG - Compare floats: value1 > value2 + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: FCMPG.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class FCMPG extends Instruction + implements TypedInstruction, StackProducer, StackConsumer { + public FCMPG() { + super(org.aspectj.apache.bcel.Constants.FCMPG, (short)1); + } + + /** @return Type.FLOAT + */ + public Type getType(ConstantPoolGen cp) { + return Type.FLOAT; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitFCMPG(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FCMPL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FCMPL.java new file mode 100644 index 000000000..b469d0433 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FCMPL.java @@ -0,0 +1,91 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FCMPL - Compare floats: value1 < value2 + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: FCMPL.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class FCMPL extends Instruction + implements TypedInstruction, StackProducer, StackConsumer { + public FCMPL() { + super(org.aspectj.apache.bcel.Constants.FCMPL, (short)1); + } + + /** @return Type.FLOAT + */ + public Type getType(ConstantPoolGen cp) { + return Type.FLOAT; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitFCMPL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FCONST.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FCONST.java new file mode 100644 index 000000000..65b8e6d64 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FCONST.java @@ -0,0 +1,113 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FCONST - Push 0.0, 1.0 or 2.0, other values cause an exception + * + *
Stack: ... -> ..., 
+ * + * @version $Id: FCONST.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class FCONST extends Instruction + implements ConstantPushInstruction, TypedInstruction { + private float value; + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + FCONST() {} + + public FCONST(float f) { + super(org.aspectj.apache.bcel.Constants.FCONST_0, (short)1); + + if(f == 0.0) + opcode = org.aspectj.apache.bcel.Constants.FCONST_0; + else if(f == 1.0) + opcode = org.aspectj.apache.bcel.Constants.FCONST_1; + else if(f == 2.0) + opcode = org.aspectj.apache.bcel.Constants.FCONST_2; + else + throw new ClassGenException("FCONST can be used only for 0.0, 1.0 and 2.0: " + f); + + value = f; + } + + public Number getValue() { return new Float(value); } + + /** @return Type.FLOAT + */ + public Type getType(ConstantPoolGen cp) { + return Type.FLOAT; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitPushInstruction(this); + v.visitStackProducer(this); + v.visitTypedInstruction(this); + v.visitConstantPushInstruction(this); + v.visitFCONST(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FDIV.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FDIV.java new file mode 100644 index 000000000..6a907eddc --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FDIV.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FDIV - Divide floats + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: FDIV.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class FDIV extends ArithmeticInstruction { + /** Divide floats + */ + public FDIV() { + super(org.aspectj.apache.bcel.Constants.FDIV); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitFDIV(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FLOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FLOAD.java new file mode 100644 index 000000000..349f07361 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FLOAD.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FLOAD - Load float from local variable + *
Stack ... -> ..., result
+ * + * @version $Id: FLOAD.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class FLOAD extends LoadInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + FLOAD() { + super(org.aspectj.apache.bcel.Constants.FLOAD, org.aspectj.apache.bcel.Constants.FLOAD_0); + } + + /** Load float from local variable + * @param n index of local variable + */ + public FLOAD(int n) { + super(org.aspectj.apache.bcel.Constants.FLOAD, org.aspectj.apache.bcel.Constants.FLOAD_0, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + super.accept(v); + v.visitFLOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FMUL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FMUL.java new file mode 100644 index 000000000..7be9541b6 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FMUL.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FMUL - Multiply floats + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: FMUL.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class FMUL extends ArithmeticInstruction { + /** Multiply floats + */ + public FMUL() { + super(org.aspectj.apache.bcel.Constants.FMUL); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitFMUL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FNEG.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FNEG.java new file mode 100644 index 000000000..72a684c82 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FNEG.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FNEG - Negate float + *
Stack: ..., value -> ..., result
+ * + * @version $Id: FNEG.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class FNEG extends ArithmeticInstruction { + public FNEG() { + super(org.aspectj.apache.bcel.Constants.FNEG); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitFNEG(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FREM.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FREM.java new file mode 100644 index 000000000..bc4944e4f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FREM.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FREM - Remainder of floats + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: FREM.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class FREM extends ArithmeticInstruction { + /** Remainder of floats + */ + public FREM() { + super(org.aspectj.apache.bcel.Constants.FREM); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitFREM(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FRETURN.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FRETURN.java new file mode 100644 index 000000000..0a5cdc3d1 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FRETURN.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FRETURN - Return float from method + *
Stack: ..., value -> <empty>
+ * + * @version $Id: FRETURN.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class FRETURN extends ReturnInstruction { + /** Return float from method + */ + public FRETURN() { + super(org.aspectj.apache.bcel.Constants.FRETURN); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackConsumer(this); + v.visitReturnInstruction(this); + v.visitFRETURN(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FSTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FSTORE.java new file mode 100644 index 000000000..31b64eca4 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FSTORE.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FSTORE - Store float into local variable + *
Stack: ..., value -> ... 
+ * + * @version $Id: FSTORE.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class FSTORE extends StoreInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + FSTORE() { + super(org.aspectj.apache.bcel.Constants.FSTORE, org.aspectj.apache.bcel.Constants.FSTORE_0); + } + + /** Store float into local variable + * @param n index of local variable + */ + public FSTORE(int n) { + super(org.aspectj.apache.bcel.Constants.FSTORE, org.aspectj.apache.bcel.Constants.FSTORE_0, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + super.accept(v); + v.visitFSTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FSUB.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FSUB.java new file mode 100644 index 000000000..ccdd9c290 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FSUB.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * FSUB - Substract floats + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: FSUB.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class FSUB extends ArithmeticInstruction { + /** Substract floats + */ + public FSUB() { + super(org.aspectj.apache.bcel.Constants.FSUB); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitFSUB(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/FieldObserver.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/FieldObserver.java new file mode 100644 index 000000000..b794b05ce --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/FieldObserver.java @@ -0,0 +1,67 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Imnplement this interface if you're interested in changes to a FieldGen object + * and register yourself with addObserver(). + * + * @version $Id: FieldObserver.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public interface FieldObserver { + public void notify(FieldGen field); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/GETFIELD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/GETFIELD.java new file mode 100644 index 000000000..6ce0b9e7a --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/GETFIELD.java @@ -0,0 +1,117 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; + +/** + * GETFIELD - Fetch field from object + *
Stack: ..., objectref -> ..., value
+ * OR + *
Stack: ..., objectref -> ..., value.word1, value.word2
+ * + * @version $Id: GETFIELD.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class GETFIELD extends FieldInstruction + implements ExceptionThrower, StackConsumer, StackProducer { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + GETFIELD() {} + + public GETFIELD(int index) { + super(Constants.GETFIELD, index); + } + + public int produceStack(ConstantPoolGen cpg) { return getFieldSize(cpg); } + + public Class[] getExceptions() { + Class[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; + + System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, + cs, 0, ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); + + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+1] = + ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = + ExceptionConstants.NULL_POINTER_EXCEPTION; + + return cs; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitStackConsumer(this); + v.visitStackProducer(this); + v.visitTypedInstruction(this); + v.visitLoadClass(this); + v.visitCPInstruction(this); + v.visitFieldOrMethod(this); + v.visitFieldInstruction(this); + v.visitGETFIELD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/GETSTATIC.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/GETSTATIC.java new file mode 100644 index 000000000..344147caf --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/GETSTATIC.java @@ -0,0 +1,113 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; + +/** + * GETSTATIC - Fetch static field from class + *
Stack: ..., -> ..., value
+ * OR + *
Stack: ..., -> ..., value.word1, value.word2
+ * + * @version $Id: GETSTATIC.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class GETSTATIC extends FieldInstruction implements PushInstruction, ExceptionThrower { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + GETSTATIC() {} + + public GETSTATIC(int index) { + super(Constants.GETSTATIC, index); + } + + public int produceStack(ConstantPoolGen cpg) { return getFieldSize(cpg); } + + public Class[] getExceptions() { + Class[] cs = new Class[1 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; + + System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, + cs, 0, ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = + ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; + + return cs; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitPushInstruction(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitLoadClass(this); + v.visitCPInstruction(this); + v.visitFieldOrMethod(this); + v.visitFieldInstruction(this); + v.visitGETSTATIC(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/GOTO.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/GOTO.java new file mode 100644 index 000000000..b02845d0b --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/GOTO.java @@ -0,0 +1,122 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.*; + +/** + * GOTO - Branch always (to relative offset, not absolute address) + * + * @version $Id: GOTO.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class GOTO extends GotoInstruction implements VariableLengthInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + GOTO() {} + + public GOTO(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.GOTO, target); + } + + /** + * Dump instruction as byte code to stream out. + * @param out Output stream + */ + public void dump(DataOutputStream out) throws IOException { + index = getTargetOffset(); + if(opcode == org.aspectj.apache.bcel.Constants.GOTO) + super.dump(out); + else { // GOTO_W + index = getTargetOffset(); + out.writeByte(opcode); + out.writeInt(index); + } + } + + /** Called in pass 2 of InstructionList.setPositions() in order to update + * the branch target, that may shift due to variable length instructions. + */ + protected int updatePosition(int offset, int max_offset) { + int i = getTargetOffset(); // Depending on old position value + + position += offset; // Position may be shifted by preceding expansions + + if(Math.abs(i) >= (32767 - max_offset)) { // to large for short (estimate) + opcode = org.aspectj.apache.bcel.Constants.GOTO_W; + length = 5; + return 2; // 5 - 3 + } + + return 0; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitVariableLengthInstruction(this); + v.visitUnconditionalBranch(this); + v.visitBranchInstruction(this); + v.visitGotoInstruction(this); + v.visitGOTO(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/GOTO_W.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/GOTO_W.java new file mode 100644 index 000000000..81d5c9f6c --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/GOTO_W.java @@ -0,0 +1,110 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.*; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * GOTO_W - Branch always (to relative offset, not absolute address) + * + * @version $Id: GOTO_W.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class GOTO_W extends GotoInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + GOTO_W() {} + + public GOTO_W(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.GOTO_W, target); + length = 5; + } + + /** + * Dump instruction as byte code to stream out. + * @param out Output stream + */ + public void dump(DataOutputStream out) throws IOException { + index = getTargetOffset(); + out.writeByte(opcode); + out.writeInt(index); + } + + /** + * Read needed data (e.g. index) from file. + */ + protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException + { + index = bytes.readInt(); + length = 5; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitUnconditionalBranch(this); + v.visitBranchInstruction(this); + v.visitGotoInstruction(this); + v.visitGOTO_W(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/GotoInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/GotoInstruction.java new file mode 100644 index 000000000..b776b20fb --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/GotoInstruction.java @@ -0,0 +1,75 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Super class for GOTO + * + * @version $Id: GotoInstruction.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public abstract class GotoInstruction extends BranchInstruction + implements UnconditionalBranch +{ + GotoInstruction(short opcode, InstructionHandle target) { + super(opcode, target); + } + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + GotoInstruction(){} +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/I2B.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2B.java new file mode 100644 index 000000000..c888ace94 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2B.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * I2B - Convert int to byte + *
Stack: ..., value -> ..., result
+ * + * @version $Id: I2B.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class I2B extends ConversionInstruction { + /** Convert int to byte + */ + public I2B() { + super(org.aspectj.apache.bcel.Constants.I2B); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitI2B(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/I2C.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2C.java new file mode 100644 index 000000000..66706f338 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2C.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * I2C - Convert int to char + *
Stack: ..., value -> ..., result
+ * + * @version $Id: I2C.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class I2C extends ConversionInstruction { + /** Convert int to char + */ + public I2C() { + super(org.aspectj.apache.bcel.Constants.I2C); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitI2C(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/I2D.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2D.java new file mode 100644 index 000000000..8f26e4de2 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2D.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * I2D - Convert int to double + *
Stack: ..., value -> ..., result.word1, result.word2
+ * + * @version $Id: I2D.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class I2D extends ConversionInstruction { + /** Convert int to double + */ + public I2D() { + super(org.aspectj.apache.bcel.Constants.I2D); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitI2D(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/I2F.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2F.java new file mode 100644 index 000000000..1484ef006 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2F.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * I2F - Convert int to float + *
Stack: ..., value -> ..., result
+ * + * @version $Id: I2F.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class I2F extends ConversionInstruction { + /** Convert int to float + */ + public I2F() { + super(org.aspectj.apache.bcel.Constants.I2F); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitI2F(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/I2L.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2L.java new file mode 100644 index 000000000..d9056847d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2L.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * I2L - Convert int to long + *
Stack: ..., value -> ..., result.word1, result.word2
+ * + * @version $Id: I2L.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class I2L extends ConversionInstruction { + /** Convert int to long + */ + public I2L() { + super(org.aspectj.apache.bcel.Constants.I2L); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitI2L(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/I2S.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2S.java new file mode 100644 index 000000000..7abfa4e0d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/I2S.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * I2S - Convert int to short + *
Stack: ..., value -> ..., result
+ * + * @version $Id: I2S.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class I2S extends ConversionInstruction { + public I2S() { + super(org.aspectj.apache.bcel.Constants.I2S); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitI2S(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IADD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IADD.java new file mode 100644 index 000000000..9649bec21 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IADD.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IADD - Add ints + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: IADD.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class IADD extends ArithmeticInstruction { + /** Add ints + */ + public IADD() { + super(org.aspectj.apache.bcel.Constants.IADD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitIADD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IALOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IALOAD.java new file mode 100644 index 000000000..2b7cf1c8b --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IALOAD.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IALOAD - Load int from array + *
Stack: ..., arrayref, index -> ..., value
+ * + * @version $Id: IALOAD.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class IALOAD extends ArrayInstruction implements StackProducer { + /** + * Load int from array + */ + public IALOAD() { + super(org.aspectj.apache.bcel.Constants.IALOAD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitIALOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IAND.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IAND.java new file mode 100644 index 000000000..8f3327c45 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IAND.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IAND - Bitwise AND int + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: IAND.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class IAND extends ArithmeticInstruction { + public IAND() { + super(org.aspectj.apache.bcel.Constants.IAND); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitIAND(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IASTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IASTORE.java new file mode 100644 index 000000000..50810a194 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IASTORE.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IASTORE - Store into int array + *
Stack: ..., arrayref, index, value -> ...
+ * + * @version $Id: IASTORE.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class IASTORE extends ArrayInstruction implements StackConsumer { + /** + * Store into int array + */ + public IASTORE() { + super(org.aspectj.apache.bcel.Constants.IASTORE); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitIASTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ICONST.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ICONST.java new file mode 100644 index 000000000..6dc60a2df --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ICONST.java @@ -0,0 +1,109 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ICONST - Push value between -1, ..., 5, other values cause an exception + * + *
Stack: ... -> ..., 
+ * + * @version $Id: ICONST.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class ICONST extends Instruction + implements ConstantPushInstruction, TypedInstruction { + private int value; + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + ICONST() {} + + public ICONST(int i) { + super(org.aspectj.apache.bcel.Constants.ICONST_0, (short)1); + + if((i >= -1) && (i <= 5)) + opcode = (short)(org.aspectj.apache.bcel.Constants.ICONST_0 + i); // Even works for i == -1 + else + throw new ClassGenException("ICONST can be used only for value between -1 and 5: " + + i); + value = i; + } + + public Number getValue() { return new Integer(value); } + + /** @return Type.INT + */ + public Type getType(ConstantPoolGen cp) { + return Type.INT; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitPushInstruction(this); + v.visitStackProducer(this); + v.visitTypedInstruction(this); + v.visitConstantPushInstruction(this); + v.visitICONST(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IDIV.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IDIV.java new file mode 100644 index 000000000..6772e3854 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IDIV.java @@ -0,0 +1,94 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IDIV - Divide ints + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: IDIV.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class IDIV extends ArithmeticInstruction implements ExceptionThrower { + /** Divide ints + */ + public IDIV() { + super(org.aspectj.apache.bcel.Constants.IDIV); + } + + /** @return exceptions this instruction may cause + */ + public Class[] getExceptions() { + return new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION }; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitIDIV(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IFEQ.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFEQ.java new file mode 100644 index 000000000..d5c71129c --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFEQ.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IFEQ - Branch if int comparison with zero succeeds + * + *
Stack: ..., value -> ...
+ * + * @version $Id: IFEQ.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class IFEQ extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IFEQ() {} + + public IFEQ(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IFEQ, target); + } + + /** + * @return negation of instruction, e.g. IFEQ.negate() == IFNE + */ + public IfInstruction negate() { + return new IFNE(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIFEQ(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IFGE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFGE.java new file mode 100644 index 000000000..e7867a253 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFGE.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IFGE - Branch if int comparison with zero succeeds + * + *
Stack: ..., value -> ...
+ * + * @version $Id: IFGE.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class IFGE extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IFGE() {} + + public IFGE(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IFGE, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IFLT(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIFGE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IFGT.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFGT.java new file mode 100644 index 000000000..b65c77405 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFGT.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IFGT - Branch if int comparison with zero succeeds + * + *
Stack: ..., value -> ...
+ * + * @version $Id: IFGT.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class IFGT extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IFGT() {} + + public IFGT(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IFGT, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IFLE(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIFGT(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IFLE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFLE.java new file mode 100644 index 000000000..dc9b4681f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFLE.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IFLE - Branch if int comparison with zero succeeds + * + *
Stack: ..., value -> ...
+ * + * @version $Id: IFLE.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class IFLE extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IFLE() {} + + public IFLE(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IFLE, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IFGT(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIFLE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IFLT.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFLT.java new file mode 100644 index 000000000..cce27f87b --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFLT.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IFLT - Branch if int comparison with zero succeeds + * + *
Stack: ..., value -> ...
+ * + * @version $Id: IFLT.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class IFLT extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IFLT() {} + + public IFLT(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IFLT, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IFGE(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIFLT(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IFNE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFNE.java new file mode 100644 index 000000000..10806551f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFNE.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IFNE - Branch if int comparison with zero succeeds + * + *
Stack: ..., value -> ...
+ * + * @version $Id: IFNE.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class IFNE extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IFNE() {} + + public IFNE(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IFNE, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IFEQ(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIFNE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IFNONNULL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFNONNULL.java new file mode 100644 index 000000000..896f5a02e --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFNONNULL.java @@ -0,0 +1,97 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IFNONNULL - Branch if reference is not null + * + *
Stack: ..., reference -> ...
+ * + * @version $Id: IFNONNULL.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class IFNONNULL extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IFNONNULL() {} + + public IFNONNULL(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IFNONNULL, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IFNULL(target); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIFNONNULL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IFNULL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFNULL.java new file mode 100644 index 000000000..5f6e34b13 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IFNULL.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IFNULL - Branch if reference is not null + * + *
Stack: ..., reference -> ...
+ * + * @version $Id: IFNULL.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class IFNULL extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IFNULL() {} + + public IFNULL(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IFNULL, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IFNONNULL(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIFNULL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ACMPEQ.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ACMPEQ.java new file mode 100644 index 000000000..a8dea7078 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ACMPEQ.java @@ -0,0 +1,97 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IF_ACMPEQ - Branch if reference comparison succeeds + * + *
Stack: ..., value1, value2 -> ...
+ * + * @version $Id: IF_ACMPEQ.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class IF_ACMPEQ extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IF_ACMPEQ() {} + + public IF_ACMPEQ(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IF_ACMPEQ, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IF_ACMPNE(target); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIF_ACMPEQ(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ACMPNE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ACMPNE.java new file mode 100644 index 000000000..f33f0701d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ACMPNE.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IF_ACMPNE - Branch if reference comparison doesn't succeed + * + *
Stack: ..., value1, value2 -> ...
+ * + * @version $Id: IF_ACMPNE.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class IF_ACMPNE extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IF_ACMPNE() {} + + public IF_ACMPNE(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IF_ACMPNE, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IF_ACMPEQ(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIF_ACMPNE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPEQ.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPEQ.java new file mode 100644 index 000000000..4ab93bdbb --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPEQ.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IF_ICMPEQ - Branch if int comparison succeeds + * + *
Stack: ..., value1, value2 -> ...
+ * + * @version $Id: IF_ICMPEQ.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class IF_ICMPEQ extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IF_ICMPEQ() {} + + public IF_ICMPEQ(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IF_ICMPEQ, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IF_ICMPNE(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIF_ICMPEQ(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPGE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPGE.java new file mode 100644 index 000000000..6db3ddee1 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPGE.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IF_ICMPGE - Branch if int comparison succeeds + * + *
Stack: ..., value1, value2 -> ...
+ * + * @version $Id: IF_ICMPGE.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class IF_ICMPGE extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IF_ICMPGE() {} + + public IF_ICMPGE(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IF_ICMPGE, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IF_ICMPLT(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIF_ICMPGE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPGT.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPGT.java new file mode 100644 index 000000000..9646169b9 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPGT.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IF_ICMPGT - Branch if int comparison succeeds + * + *
Stack: ..., value1, value2 -> ...
+ * + * @version $Id: IF_ICMPGT.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class IF_ICMPGT extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IF_ICMPGT() {} + + public IF_ICMPGT(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IF_ICMPGT, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IF_ICMPLE(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIF_ICMPGT(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPLE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPLE.java new file mode 100644 index 000000000..3cd156551 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPLE.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IF_ICMPLE - Branch if int comparison succeeds + * + *
Stack: ..., value1, value2 -> ...
+ * + * @version $Id: IF_ICMPLE.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class IF_ICMPLE extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IF_ICMPLE() {} + + public IF_ICMPLE(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IF_ICMPLE, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IF_ICMPGT(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIF_ICMPLE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPLT.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPLT.java new file mode 100644 index 000000000..fdfaf9430 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPLT.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IF_ICMPLT - Branch if int comparison succeeds + * + *
Stack: ..., value1, value2 -> ...
+ * + * @version $Id: IF_ICMPLT.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class IF_ICMPLT extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IF_ICMPLT() {} + + public IF_ICMPLT(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IF_ICMPLT, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IF_ICMPGE(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIF_ICMPLT(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPNE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPNE.java new file mode 100644 index 000000000..e425664fc --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IF_ICMPNE.java @@ -0,0 +1,98 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IF_ICMPNE - Branch if int comparison doesn't succeed + * + *
Stack: ..., value1, value2 -> ...
+ * + * @version $Id: IF_ICMPNE.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class IF_ICMPNE extends IfInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IF_ICMPNE() {} + + public IF_ICMPNE(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.IF_ICMPNE, target); + } + + /** + * @return negation of instruction + */ + public IfInstruction negate() { + return new IF_ICMPEQ(target); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitBranchInstruction(this); + v.visitIfInstruction(this); + v.visitIF_ICMPNE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ILOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ILOAD.java new file mode 100644 index 000000000..c0a978684 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ILOAD.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ILOAD - Load int from local variable onto stack + *
Stack: ... -> ..., result
+ * + * @version $Id: ILOAD.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class ILOAD extends LoadInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + ILOAD() { + super(org.aspectj.apache.bcel.Constants.ILOAD, org.aspectj.apache.bcel.Constants.ILOAD_0); + } + + /** Load int from local variable + * @param n index of local variable + */ + public ILOAD(int n) { + super(org.aspectj.apache.bcel.Constants.ILOAD, org.aspectj.apache.bcel.Constants.ILOAD_0, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + super.accept(v); + v.visitILOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IMPDEP1.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IMPDEP1.java new file mode 100644 index 000000000..db2813206 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IMPDEP1.java @@ -0,0 +1,80 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IMPDEP1 - Implementation dependent + * + * @version $Id: IMPDEP1.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class IMPDEP1 extends Instruction { + public IMPDEP1() { + super(org.aspectj.apache.bcel.Constants.IMPDEP1, (short)1); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitIMPDEP1(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IMPDEP2.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IMPDEP2.java new file mode 100644 index 000000000..0056798ba --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IMPDEP2.java @@ -0,0 +1,80 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IMPDEP2 - Implementation dependent + * + * @version $Id: IMPDEP2.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class IMPDEP2 extends Instruction { + public IMPDEP2() { + super(org.aspectj.apache.bcel.Constants.IMPDEP2, (short)1); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitIMPDEP2(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IMUL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IMUL.java new file mode 100644 index 000000000..83fdc3f9d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IMUL.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IMUL - Multiply ints + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: IMUL.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class IMUL extends ArithmeticInstruction { + /** Multiply ints + */ + public IMUL() { + super(org.aspectj.apache.bcel.Constants.IMUL); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitIMUL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/INEG.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/INEG.java new file mode 100644 index 000000000..6713e5d5a --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/INEG.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * INEG - Negate int + *
Stack: ..., value -> ..., result
+ * + * @version $Id: INEG.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class INEG extends ArithmeticInstruction { + public INEG() { + super(org.aspectj.apache.bcel.Constants.INEG); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitINEG(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/INSTANCEOF.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/INSTANCEOF.java new file mode 100644 index 000000000..921f93523 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/INSTANCEOF.java @@ -0,0 +1,106 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * INSTANCEOF - Determine if object is of given type + *
Stack: ..., objectref -> ..., result
+ * + * @version $Id: INSTANCEOF.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class INSTANCEOF extends CPInstruction + implements LoadClass, ExceptionThrower, StackProducer, StackConsumer { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + INSTANCEOF() {} + + public INSTANCEOF(int index) { + super(org.aspectj.apache.bcel.Constants.INSTANCEOF, index); + } + + public Class[] getExceptions() { + return org.aspectj.apache.bcel.ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION; + } + + public ObjectType getLoadClassType(ConstantPoolGen cpg) { + Type t = getType(cpg); + + if(t instanceof ArrayType) + t = ((ArrayType) t).getBasicType(); + + return (t instanceof ObjectType)? (ObjectType) t : null; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitLoadClass(this); + v.visitExceptionThrower(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitTypedInstruction(this); + v.visitCPInstruction(this); + v.visitINSTANCEOF(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKESPECIAL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKESPECIAL.java new file mode 100644 index 000000000..dc44e9d52 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKESPECIAL.java @@ -0,0 +1,113 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; + +/** + * INVOKESPECIAL - Invoke instance method; special handling for superclass, private + * and instance initialization method invocations + * + *
Stack: ..., objectref, [arg1, [arg2 ...]] -> ...
+ * + * @version $Id: INVOKESPECIAL.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class INVOKESPECIAL extends InvokeInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + INVOKESPECIAL() {} + + public INVOKESPECIAL(int index) { + super(Constants.INVOKESPECIAL, index); + } + + public Class[] getExceptions() { + Class[] cs = new Class[4 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; + + System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, + cs, 0, ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); + + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+3] = ExceptionConstants.UNSATISFIED_LINK_ERROR; + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+2] = ExceptionConstants.ABSTRACT_METHOD_ERROR; + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION; + + return cs; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackConsumer(this); + v.visitStackProducer(this); + v.visitLoadClass(this); + v.visitCPInstruction(this); + v.visitFieldOrMethod(this); + v.visitInvokeInstruction(this); + v.visitINVOKESPECIAL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKESTATIC.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKESTATIC.java new file mode 100644 index 000000000..29cb85296 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKESTATIC.java @@ -0,0 +1,110 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; + +/** + * INVOKESTATIC - Invoke a class (static) method + * + *
Stack: ..., [arg1, [arg2 ...]] -> ...
+ * + * @version $Id: INVOKESTATIC.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class INVOKESTATIC extends InvokeInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + INVOKESTATIC() {} + + public INVOKESTATIC(int index) { + super(Constants.INVOKESTATIC, index); + } + + public Class[] getExceptions() { + Class[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; + + System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, + cs, 0, ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); + + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.UNSATISFIED_LINK_ERROR; + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; + + return cs; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackConsumer(this); + v.visitStackProducer(this); + v.visitLoadClass(this); + v.visitCPInstruction(this); + v.visitFieldOrMethod(this); + v.visitInvokeInstruction(this); + v.visitINVOKESTATIC(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKEVIRTUAL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKEVIRTUAL.java new file mode 100644 index 000000000..987082916 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/INVOKEVIRTUAL.java @@ -0,0 +1,112 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; + +/** + * INVOKEVIRTUAL - Invoke instance method; dispatch based on class + * + *
Stack: ..., objectref, [arg1, [arg2 ...]] -> ...
+ * + * @version $Id: INVOKEVIRTUAL.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class INVOKEVIRTUAL extends InvokeInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + INVOKEVIRTUAL() {} + + public INVOKEVIRTUAL(int index) { + super(Constants.INVOKEVIRTUAL, index); + } + + public Class[] getExceptions() { + Class[] cs = new Class[4 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; + + System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, + cs, 0, ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); + + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+3] = ExceptionConstants.UNSATISFIED_LINK_ERROR; + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+2] = ExceptionConstants.ABSTRACT_METHOD_ERROR; + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+1] = ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = ExceptionConstants.NULL_POINTER_EXCEPTION; + + return cs; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackConsumer(this); + v.visitStackProducer(this); + v.visitLoadClass(this); + v.visitCPInstruction(this); + v.visitFieldOrMethod(this); + v.visitInvokeInstruction(this); + v.visitINVOKEVIRTUAL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IOR.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IOR.java new file mode 100644 index 000000000..5834b92fe --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IOR.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IOR - Bitwise OR int + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: IOR.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class IOR extends ArithmeticInstruction { + public IOR() { + super(org.aspectj.apache.bcel.Constants.IOR); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitIOR(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IREM.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IREM.java new file mode 100644 index 000000000..0744a1303 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IREM.java @@ -0,0 +1,94 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IREM - Remainder of int + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: IREM.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class IREM extends ArithmeticInstruction implements ExceptionThrower { + /** Remainder of ints + */ + public IREM() { + super(org.aspectj.apache.bcel.Constants.IREM); + } + + /** @return exceptions this instruction may cause + */ + public Class[] getExceptions() { + return new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION }; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitIREM(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IRETURN.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IRETURN.java new file mode 100644 index 000000000..44e2f736a --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IRETURN.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IRETURN - Return int from method + *
Stack: ..., value -> <empty>
+ * + * @version $Id: IRETURN.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class IRETURN extends ReturnInstruction { + /** Return int from method + */ + public IRETURN() { + super(org.aspectj.apache.bcel.Constants.IRETURN); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackConsumer(this); + v.visitReturnInstruction(this); + v.visitIRETURN(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ISHL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ISHL.java new file mode 100644 index 000000000..f94680300 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ISHL.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ISHL - Arithmetic shift left int + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: ISHL.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class ISHL extends ArithmeticInstruction { + public ISHL() { + super(org.aspectj.apache.bcel.Constants.ISHL); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitISHL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ISHR.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ISHR.java new file mode 100644 index 000000000..84617dc8d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ISHR.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ISHR - Arithmetic shift right int + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: ISHR.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class ISHR extends ArithmeticInstruction { + public ISHR() { + super(org.aspectj.apache.bcel.Constants.ISHR); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitISHR(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ISTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ISTORE.java new file mode 100644 index 000000000..621cacd84 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ISTORE.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ISTORE - Store int from stack into local variable + *
Stack: ..., value -> ... 
+ * + * @version $Id: ISTORE.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class ISTORE extends StoreInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + ISTORE() { + super(org.aspectj.apache.bcel.Constants.ISTORE, org.aspectj.apache.bcel.Constants.ISTORE_0); + } + + /** Store int into local variable + * @param n index of local variable + */ + public ISTORE(int n) { + super(org.aspectj.apache.bcel.Constants.ISTORE, org.aspectj.apache.bcel.Constants.ISTORE_0, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + super.accept(v); + v.visitISTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ISUB.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ISUB.java new file mode 100644 index 000000000..1b5044528 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ISUB.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * ISUB - Substract ints + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: ISUB.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class ISUB extends ArithmeticInstruction { + /** Substract ints + */ + public ISUB() { + super(org.aspectj.apache.bcel.Constants.ISUB); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitISUB(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IUSHR.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IUSHR.java new file mode 100644 index 000000000..417cb5d91 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IUSHR.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IUSHR - Logical shift right int + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: IUSHR.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class IUSHR extends ArithmeticInstruction { + public IUSHR() { + super(org.aspectj.apache.bcel.Constants.IUSHR); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitIUSHR(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IXOR.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IXOR.java new file mode 100644 index 000000000..08e81227b --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IXOR.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * IXOR - Bitwise XOR int + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: IXOR.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class IXOR extends ArithmeticInstruction { + public IXOR() { + super(org.aspectj.apache.bcel.Constants.IXOR); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitIXOR(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IfInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IfInstruction.java new file mode 100644 index 000000000..b591fba1a --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IfInstruction.java @@ -0,0 +1,82 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Super class for the IFxxx family of instructions. + * + * @version $Id: IfInstruction.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public abstract class IfInstruction extends BranchInstruction implements StackConsumer { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + IfInstruction() {} + + /** + * @param instruction Target instruction to branch to + */ + protected IfInstruction(short opcode, InstructionHandle target) { + super(opcode, target); + } + + /** + * @return negation of instruction, e.g. IFEQ.negate() == IFNE + */ + public abstract IfInstruction negate(); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/IndexedInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/IndexedInstruction.java new file mode 100644 index 000000000..4a7ac229f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/IndexedInstruction.java @@ -0,0 +1,68 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denote entity that refers to an index, e.g. local variable instructions, + * RET, CPInstruction, etc. + * + * @version $Id: IndexedInstruction.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public interface IndexedInstruction { + public int getIndex(); + public void setIndex(int index); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionListObserver.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionListObserver.java new file mode 100644 index 000000000..21b03f5fc --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionListObserver.java @@ -0,0 +1,67 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Implement this interface if you're interested in changes to an InstructionList object + * and register yourself with addObserver(). + * + * @version $Id: InstructionListObserver.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public interface InstructionListObserver { + public void notify(InstructionList list); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/JSR.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/JSR.java new file mode 100644 index 000000000..27d878aeb --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/JSR.java @@ -0,0 +1,119 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.*; + +/** + * JSR - Jump to subroutine + * + * @version $Id: JSR.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class JSR extends JsrInstruction implements VariableLengthInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + JSR() {} + + public JSR(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.JSR, target); + } + + /** + * Dump instruction as byte code to stream out. + * @param out Output stream + */ + public void dump(DataOutputStream out) throws IOException { + index = getTargetOffset(); + if(opcode == org.aspectj.apache.bcel.Constants.JSR) + super.dump(out); + else { // JSR_W + index = getTargetOffset(); + out.writeByte(opcode); + out.writeInt(index); + } + } + + protected int updatePosition(int offset, int max_offset) { + int i = getTargetOffset(); // Depending on old position value + + position += offset; // Position may be shifted by preceding expansions + + if(Math.abs(i) >= (32767 - max_offset)) { // to large for short (estimate) + opcode = org.aspectj.apache.bcel.Constants.JSR_W; + length = 5; + return 2; // 5 - 3 + } + + return 0; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitVariableLengthInstruction(this); + v.visitBranchInstruction(this); + v.visitJsrInstruction(this); + v.visitJSR(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/JSR_W.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/JSR_W.java new file mode 100644 index 000000000..03db5a55a --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/JSR_W.java @@ -0,0 +1,110 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.*; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * JSR_W - Jump to subroutine + * + * @version $Id: JSR_W.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class JSR_W extends JsrInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + JSR_W() {} + + public JSR_W(InstructionHandle target) { + super(org.aspectj.apache.bcel.Constants.JSR_W, target); + length = 5; + } + + /** + * Dump instruction as byte code to stream out. + * @param out Output stream + */ + public void dump(DataOutputStream out) throws IOException { + index = getTargetOffset(); + out.writeByte(opcode); + out.writeInt(index); + } + + /** + * Read needed data (e.g. index) from file. + */ + protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException + { + index = bytes.readInt(); + length = 5; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitBranchInstruction(this); + v.visitJsrInstruction(this); + v.visitJSR_W(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/JsrInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/JsrInstruction.java new file mode 100644 index 000000000..971024200 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/JsrInstruction.java @@ -0,0 +1,115 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Super class for JSR - Jump to subroutine + * + * @version $Id: JsrInstruction.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public abstract class JsrInstruction extends BranchInstruction + implements UnconditionalBranch, TypedInstruction, StackProducer +{ + JsrInstruction(short opcode, InstructionHandle target) { + super(opcode, target); + } + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + JsrInstruction(){} + + /** @return return address type + */ + public Type getType(ConstantPoolGen cp) { + return new ReturnaddressType(physicalSuccessor()); + } + + /** + * Returns an InstructionHandle to the physical successor + * of this JsrInstruction. For this method to work, + * this JsrInstruction object must not be shared between + * multiple InstructionHandle objects! + * Formally, there must not be InstructionHandle objects + * i, j where i != j and i.getInstruction() == this == + * j.getInstruction(). + * @return an InstructionHandle to the "next" instruction that + * will be executed when RETurned from a subroutine. + */ + public InstructionHandle physicalSuccessor(){ + InstructionHandle ih = this.target; + + // Rewind! + while(ih.getPrev() != null) + ih = ih.getPrev(); + + // Find the handle for "this" JsrInstruction object. + while(ih.getInstruction() != this) + ih = ih.getNext(); + + InstructionHandle toThis = ih; + + while(ih != null){ + ih = ih.getNext(); + if ((ih != null) && (ih.getInstruction() == this)) + throw new RuntimeException("physicalSuccessor() called on a shared JsrInstruction."); + } + + // Return the physical successor + return toThis.getNext(); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/L2D.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/L2D.java new file mode 100644 index 000000000..9238bfaed --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/L2D.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * L2D - Convert long to double + *
Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2
+ * + * @version $Id: L2D.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class L2D extends ConversionInstruction { + public L2D() { + super(org.aspectj.apache.bcel.Constants.L2D); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitL2D(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/L2F.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/L2F.java new file mode 100644 index 000000000..868193c49 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/L2F.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * L2F - Convert long to float + *
Stack: ..., value.word1, value.word2 -> ..., result
+ * + * @version $Id: L2F.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class L2F extends ConversionInstruction { + public L2F() { + super(org.aspectj.apache.bcel.Constants.L2F); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitL2F(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/L2I.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/L2I.java new file mode 100644 index 000000000..1d2290280 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/L2I.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * L2I - Convert long to int + *
Stack: ..., value.word1, value.word2 -> ..., result
+ * + * @version $Id: L2I.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class L2I extends ConversionInstruction { + public L2I() { + super(org.aspectj.apache.bcel.Constants.L2I); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitConversionInstruction(this); + v.visitL2I(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LADD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LADD.java new file mode 100644 index 000000000..0d50221b8 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LADD.java @@ -0,0 +1,86 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LADD - Add longs + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result.word1, result.word2 + * + * @version $Id: LADD.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class LADD extends ArithmeticInstruction { + public LADD() { + super(org.aspectj.apache.bcel.Constants.LADD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLADD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LALOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LALOAD.java new file mode 100644 index 000000000..a97f251a7 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LALOAD.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LALOAD - Load long from array + *
Stack: ..., arrayref, index -> ..., value1, value2
+ * + * @version $Id: LALOAD.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class LALOAD extends ArrayInstruction implements StackProducer { + /** Load long from array + */ + public LALOAD() { + super(org.aspectj.apache.bcel.Constants.LALOAD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitLALOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LAND.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LAND.java new file mode 100644 index 000000000..0ae6b85e5 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LAND.java @@ -0,0 +1,86 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LAND - Bitwise AND longs + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result.word1, result.word2 + * + * @version $Id: LAND.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class LAND extends ArithmeticInstruction { + public LAND() { + super(org.aspectj.apache.bcel.Constants.LAND); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLAND(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LASTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LASTORE.java new file mode 100644 index 000000000..8e3fabe8c --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LASTORE.java @@ -0,0 +1,87 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LASTORE - Store into long array + *
Stack: ..., arrayref, index, value.word1, value.word2 -> ...
+ * + * @version $Id: LASTORE.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class LASTORE extends ArrayInstruction implements StackConsumer { + /** Store long into array + */ + public LASTORE() { + super(org.aspectj.apache.bcel.Constants.LASTORE); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitLASTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LCMP.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LCMP.java new file mode 100644 index 000000000..d916e05b6 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LCMP.java @@ -0,0 +1,92 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LCMP - Compare longs: + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result <= -1, 0, 1> + * + * @version $Id: LCMP.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class LCMP extends Instruction + implements TypedInstruction, StackProducer, StackConsumer +{ + public LCMP() { + super(org.aspectj.apache.bcel.Constants.LCMP, (short)1); + } + + /** @return Type.LONG + */ + public Type getType(ConstantPoolGen cp) { + return Type.LONG; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitLCMP(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LCONST.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LCONST.java new file mode 100644 index 000000000..495ad14a6 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LCONST.java @@ -0,0 +1,111 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LCONST - Push 0 or 1, other values cause an exception + * + *
Stack: ... -> ..., 
+ * + * @version $Id: LCONST.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class LCONST extends Instruction + implements ConstantPushInstruction, TypedInstruction { + private long value; + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + LCONST() {} + + public LCONST(long l) { + super(org.aspectj.apache.bcel.Constants.LCONST_0, (short)1); + + if(l == 0) + opcode = org.aspectj.apache.bcel.Constants.LCONST_0; + else if(l == 1) + opcode = org.aspectj.apache.bcel.Constants.LCONST_1; + else + throw new ClassGenException("LCONST can be used only for 0 and 1: " + l); + + value = l; + } + + public Number getValue() { return new Long(value); } + + /** @return Type.LONG + */ + public Type getType(ConstantPoolGen cp) { + return Type.LONG; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitPushInstruction(this); + v.visitStackProducer(this); + v.visitTypedInstruction(this); + v.visitConstantPushInstruction(this); + v.visitLCONST(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LDC.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LDC.java new file mode 100644 index 000000000..5fe7d9607 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LDC.java @@ -0,0 +1,172 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.*; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * LDC - Push item from constant pool. + * + *
Stack: ... -> ..., item
+ * + * @version $Id: LDC.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class LDC extends CPInstruction + implements PushInstruction, ExceptionThrower, TypedInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + LDC() {} + + public LDC(int index) { + super(org.aspectj.apache.bcel.Constants.LDC_W, index); + setSize(); + } + + // Adjust to proper size + protected final void setSize() { + if(index <= org.aspectj.apache.bcel.Constants.MAX_BYTE) { // Fits in one byte? + opcode = org.aspectj.apache.bcel.Constants.LDC; + length = 2; + } else { + opcode = org.aspectj.apache.bcel.Constants.LDC_W; + length = 3; + } + } + + /** + * Dump instruction as byte code to stream out. + * @param out Output stream + */ + public void dump(DataOutputStream out) throws IOException { + out.writeByte(opcode); + + if(length == 2) + out.writeByte(index); + else // Applies for LDC_W + out.writeShort(index); + } + + /** + * Set the index to constant pool and adjust size. + */ + public final void setIndex(int index) { + super.setIndex(index); + setSize(); + } + + /** + * Read needed data (e.g. index) from file. + */ + protected void initFromFile(ByteSequence bytes, boolean wide) + throws IOException + { + length = 2; + index = bytes.readUnsignedByte(); + } + + public Object getValue(ConstantPoolGen cpg) { + org.aspectj.apache.bcel.classfile.Constant c = cpg.getConstantPool().getConstant(index); + + switch(c.getTag()) { + case org.aspectj.apache.bcel.Constants.CONSTANT_String: + int i = ((org.aspectj.apache.bcel.classfile.ConstantString)c).getStringIndex(); + c = cpg.getConstantPool().getConstant(i); + return ((org.aspectj.apache.bcel.classfile.ConstantUtf8)c).getBytes(); + + case org.aspectj.apache.bcel.Constants.CONSTANT_Float: + return new Float(((org.aspectj.apache.bcel.classfile.ConstantFloat)c).getBytes()); + + case org.aspectj.apache.bcel.Constants.CONSTANT_Integer: + return new Integer(((org.aspectj.apache.bcel.classfile.ConstantInteger)c).getBytes()); + + default: // Never reached + throw new RuntimeException("Unknown or invalid constant type at " + index); + } + } + + public Type getType(ConstantPoolGen cpg) { + switch(cpg.getConstantPool().getConstant(index).getTag()) { + case org.aspectj.apache.bcel.Constants.CONSTANT_String: return Type.STRING; + case org.aspectj.apache.bcel.Constants.CONSTANT_Float: return Type.FLOAT; + case org.aspectj.apache.bcel.Constants.CONSTANT_Integer: return Type.INT; + default: // Never reached + throw new RuntimeException("Unknown or invalid constant type at " + index); + } + } + + public Class[] getExceptions() { + return org.aspectj.apache.bcel.ExceptionConstants.EXCS_STRING_RESOLUTION; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitPushInstruction(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitCPInstruction(this); + v.visitLDC(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LDC2_W.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LDC2_W.java new file mode 100644 index 000000000..84c3e23b7 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LDC2_W.java @@ -0,0 +1,116 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LDC2_W - Push long or double from constant pool + * + *
Stack: ... -> ..., item.word1, item.word2
+ * + * @version $Id: LDC2_W.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class LDC2_W extends CPInstruction + implements PushInstruction, TypedInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + LDC2_W() {} + + public LDC2_W(int index) { + super(org.aspectj.apache.bcel.Constants.LDC2_W, index); + } + + public Type getType(ConstantPoolGen cpg) { + switch(cpg.getConstantPool().getConstant(index).getTag()) { + case org.aspectj.apache.bcel.Constants.CONSTANT_Long: return Type.LONG; + case org.aspectj.apache.bcel.Constants.CONSTANT_Double: return Type.DOUBLE; + default: // Never reached + throw new RuntimeException("Unknown constant type " + opcode); + } + } + + public Number getValue(ConstantPoolGen cpg) { + org.aspectj.apache.bcel.classfile.Constant c = cpg.getConstantPool().getConstant(index); + + switch(c.getTag()) { + case org.aspectj.apache.bcel.Constants.CONSTANT_Long: + return new Long(((org.aspectj.apache.bcel.classfile.ConstantLong)c).getBytes()); + + case org.aspectj.apache.bcel.Constants.CONSTANT_Double: + return new Double(((org.aspectj.apache.bcel.classfile.ConstantDouble)c).getBytes()); + + default: // Never reached + throw new RuntimeException("Unknown or invalid constant type at " + index); + } + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitPushInstruction(this); + v.visitTypedInstruction(this); + v.visitCPInstruction(this); + v.visitLDC2_W(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LDC_W.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LDC_W.java new file mode 100644 index 000000000..9d145d9ae --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LDC_W.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.IOException; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * LDC_W - Push item from constant pool (wide index) + * + *
Stack: ... -> ..., item.word1, item.word2
+ * + * @version $Id: LDC_W.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class LDC_W extends LDC { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + LDC_W() {} + + public LDC_W(int index) { + super(index); + } + + /** + * Read needed data (i.e., index) from file. + */ + protected void initFromFile(ByteSequence bytes, boolean wide) + throws IOException + { + setIndex(bytes.readUnsignedShort()); + // Override just in case it has been changed + // opcode = org.aspectj.apache.bcel.Constants.LDC_W; + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LDIV.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LDIV.java new file mode 100644 index 000000000..c9ac0a18e --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LDIV.java @@ -0,0 +1,91 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LDIV - Divide longs + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result.word1, result.word2 + * + * @version $Id: LDIV.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class LDIV extends ArithmeticInstruction implements ExceptionThrower { + public LDIV() { + super(org.aspectj.apache.bcel.Constants.LDIV); + } + + public Class[] getExceptions() { + return new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION }; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLDIV(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LLOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LLOAD.java new file mode 100644 index 000000000..77269df81 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LLOAD.java @@ -0,0 +1,89 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LLOAD - Load long from local variable + *
Stack ... -> ..., result.word1, result.word2
+ * + * @version $Id: LLOAD.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class LLOAD extends LoadInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + LLOAD() { + super(org.aspectj.apache.bcel.Constants.LLOAD, org.aspectj.apache.bcel.Constants.LLOAD_0); + } + + public LLOAD(int n) { + super(org.aspectj.apache.bcel.Constants.LLOAD, org.aspectj.apache.bcel.Constants.LLOAD_0, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + super.accept(v); + v.visitLLOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LMUL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LMUL.java new file mode 100644 index 000000000..2e5ac54db --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LMUL.java @@ -0,0 +1,86 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LMUL - Multiply longs + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result.word1, result.word2 + * + * @version $Id: LMUL.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class LMUL extends ArithmeticInstruction { + public LMUL() { + super(org.aspectj.apache.bcel.Constants.LMUL); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLMUL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LNEG.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LNEG.java new file mode 100644 index 000000000..ed73a206d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LNEG.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LNEG - Negate long + *
Stack: ..., value.word1, value.word2 -> ..., result.word1, result.word2
+ * + * @version $Id: LNEG.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class LNEG extends ArithmeticInstruction { + public LNEG() { + super(org.aspectj.apache.bcel.Constants.LNEG); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLNEG(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LOR.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LOR.java new file mode 100644 index 000000000..fd626aca7 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LOR.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LOR - Bitwise OR long + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: LOR.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class LOR extends ArithmeticInstruction { + public LOR() { + super(org.aspectj.apache.bcel.Constants.LOR); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLOR(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LREM.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LREM.java new file mode 100644 index 000000000..8baa4445a --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LREM.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LREM - Remainder of long + *
Stack: ..., value1, value2 -> result
+ * + * @version $Id: LREM.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class LREM extends ArithmeticInstruction implements ExceptionThrower { + public LREM() { + super(org.aspectj.apache.bcel.Constants.LREM); + } + + public Class[] getExceptions() { return new Class[] { org.aspectj.apache.bcel.ExceptionConstants.ARITHMETIC_EXCEPTION }; } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLREM(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LRETURN.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LRETURN.java new file mode 100644 index 000000000..09f0f7059 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LRETURN.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LRETURN - Return long from method + *
Stack: ..., value.word1, value.word2 -> <empty>
+ * + * @version $Id: LRETURN.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class LRETURN extends ReturnInstruction { + public LRETURN() { + super(org.aspectj.apache.bcel.Constants.LRETURN); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackConsumer(this); + v.visitReturnInstruction(this); + v.visitLRETURN(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LSHL.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LSHL.java new file mode 100644 index 000000000..623025ed4 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LSHL.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LSHL - Arithmetic shift left long + *
Stack: ..., value1.word1, value1.word2, value2 -> ..., result.word1, result.word2
+ * + * @version $Id: LSHL.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class LSHL extends ArithmeticInstruction { + public LSHL() { + super(org.aspectj.apache.bcel.Constants.LSHL); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLSHL(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LSHR.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LSHR.java new file mode 100644 index 000000000..34f207bd8 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LSHR.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LSHR - Arithmetic shift right long + *
Stack: ..., value1.word1, value1.word2, value2 -> ..., result.word1, result.word2
+ * + * @version $Id: LSHR.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class LSHR extends ArithmeticInstruction { + public LSHR() { + super(org.aspectj.apache.bcel.Constants.LSHR); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLSHR(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LSTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LSTORE.java new file mode 100644 index 000000000..bb2a85aae --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LSTORE.java @@ -0,0 +1,89 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LSTORE - Store long into local variable + *
Stack: ..., value.word1, value.word2 -> ... 
+ * + * @version $Id: LSTORE.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class LSTORE extends StoreInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + LSTORE() { + super(org.aspectj.apache.bcel.Constants.LSTORE, org.aspectj.apache.bcel.Constants.LSTORE_0); + } + + public LSTORE(int n) { + super(org.aspectj.apache.bcel.Constants.LSTORE, org.aspectj.apache.bcel.Constants.LSTORE_0, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + super.accept(v); + v.visitLSTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LSUB.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LSUB.java new file mode 100644 index 000000000..7bd44226f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LSUB.java @@ -0,0 +1,86 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LSUB - Substract longs + *
Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 ->
+ * ..., result.word1, result.word2 + * + * @version $Id: LSUB.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class LSUB extends ArithmeticInstruction { + public LSUB() { + super(org.aspectj.apache.bcel.Constants.LSUB); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLSUB(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LUSHR.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LUSHR.java new file mode 100644 index 000000000..38819f1b6 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LUSHR.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LUSHR - Logical shift right long + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: LUSHR.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class LUSHR extends ArithmeticInstruction { + public LUSHR() { + super(org.aspectj.apache.bcel.Constants.LUSHR); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLUSHR(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LXOR.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LXOR.java new file mode 100644 index 000000000..a6867e3d1 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LXOR.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * LXOR - Bitwise XOR long + *
Stack: ..., value1, value2 -> ..., result
+ * + * @version $Id: LXOR.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class LXOR extends ArithmeticInstruction { + public LXOR() { + super(org.aspectj.apache.bcel.Constants.LXOR); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitTypedInstruction(this); + v.visitStackProducer(this); + v.visitStackConsumer(this); + v.visitArithmeticInstruction(this); + v.visitLXOR(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LoadClass.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LoadClass.java new file mode 100644 index 000000000..6b0d3c0d8 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LoadClass.java @@ -0,0 +1,86 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denotes that an instruction may start the process of loading and resolving + * the referenced class in the Virtual Machine. + * + * @version $Id: LoadClass.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public interface LoadClass { + /** + * Returns the ObjectType of the referenced class or interface + * that may be loaded and resolved. + * @return object type that may be loaded or null if a primitive is + * referenced + */ + public ObjectType getLoadClassType(ConstantPoolGen cpg); + + /** + * Returns the type associated with this instruction. + * LoadClass instances are always typed, but this type + * does not always refer to the type of the class or interface + * that it possibly forces to load. For example, GETFIELD would + * return the type of the field and not the type of the class + * where the field is defined. + * If no class is forced to be loaded, null is returned. + * An example for this is an ANEWARRAY instruction that creates + * an int[][]. + * @see #getLoadClassType(ConstantPoolGen) + */ + public Type getType(ConstantPoolGen cpg); +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LoadInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LoadInstruction.java new file mode 100644 index 000000000..d7b66af5a --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LoadInstruction.java @@ -0,0 +1,101 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denotes an unparameterized instruction to load a value from a local + * variable, e.g. ILOAD. + * + * @version $Id: LoadInstruction.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public abstract class LoadInstruction extends LocalVariableInstruction + implements PushInstruction +{ + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + * tag and length are defined in readInstruction and initFromFile, respectively. + */ + LoadInstruction(short canon_tag, short c_tag) { + super(canon_tag, c_tag); + } + + /** + * @param opcode Instruction opcode + * @param c_tag Instruction number for compact version, ALOAD_0, e.g. + * @param n local variable index (unsigned short) + */ + protected LoadInstruction(short opcode, short c_tag, int n) { + super(opcode, c_tag, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitPushInstruction(this); + v.visitTypedInstruction(this); + v.visitLocalVariableInstruction(this); + v.visitLoadInstruction(this); + } +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableInstruction.java new file mode 100644 index 000000000..0cd2c9823 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableInstruction.java @@ -0,0 +1,224 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.DataOutputStream; +import java.io.IOException; + +import org.aspectj.apache.bcel.Constants; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * Abstract super class for instructions dealing with local variables. + * + * @version $Id: LocalVariableInstruction.java,v 1.7 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public abstract class LocalVariableInstruction extends Instruction + implements TypedInstruction, IndexedInstruction { + protected int n = -1; // index of referenced variable + private short c_tag = -1; // compact version, such as ILOAD_0 + private short canon_tag = -1; // canonical tag such as ILOAD + + private final boolean wide() { return n > Constants.MAX_BYTE; } + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + * tag and length are defined in readInstruction and initFromFile, respectively. + */ + LocalVariableInstruction(short canon_tag, short c_tag) { + super(); + this.canon_tag = canon_tag; + this.c_tag = c_tag; + } + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Also used by IINC()! + */ + LocalVariableInstruction() { + } + + /** + * @param opcode Instruction opcode + * @param c_tag Instruction number for compact version, ALOAD_0, e.g. + * @param n local variable index (unsigned short) + */ + protected LocalVariableInstruction(short opcode, short c_tag, int n) { + super(opcode, (short)2); + + this.c_tag = c_tag; + canon_tag = opcode; + + setIndex(n); + } + + /** + * Dump instruction as byte code to stream out. + * @param out Output stream + */ + public void dump(DataOutputStream out) throws IOException { + if(wide()) // Need WIDE prefix ? + out.writeByte(Constants.WIDE); + + out.writeByte(opcode); + + if(length > 1) { // Otherwise ILOAD_n, instruction, e.g. + if(wide()) + out.writeShort(n); + else + out.writeByte(n); + } + } + + /** + * Long output format: + * + * <name of opcode> "["<opcode number>"]" + * "("<length of instruction>")" "<"< local variable index>">" + * + * @param verbose long/short format switch + * @return mnemonic for instruction + */ + public String toString(boolean verbose) { + if(((opcode >= Constants.ILOAD_0) && + (opcode <= Constants.ALOAD_3)) || + ((opcode >= Constants.ISTORE_0) && + (opcode <= Constants.ASTORE_3))) + return super.toString(verbose); + else + return super.toString(verbose) + " " + n; + } + + /** + * Read needed data (e.g. index) from file. + * PRE: (ILOAD <= tag <= ALOAD_3) || (ISTORE <= tag <= ASTORE_3) + */ + protected void initFromFile(ByteSequence bytes, boolean wide) + throws IOException + { + if(wide) { + n = bytes.readUnsignedShort(); + } else if(((opcode >= Constants.ILOAD) && + (opcode <= Constants.ALOAD)) || + ((opcode >= Constants.ISTORE) && + (opcode <= Constants.ASTORE))) { + n = bytes.readUnsignedByte(); + } else if(opcode <= Constants.ALOAD_3) { // compact load instruction such as ILOAD_2 + n = (opcode - Constants.ILOAD_0) % 4; + } else { // Assert ISTORE_0 <= tag <= ASTORE_3 + n = (opcode - Constants.ISTORE_0) % 4; + } + workOutLength(); + } + + private void workOutLength() { + if(n >= 0 && n <= 3) { // Use more compact instruction xLOAD_n + opcode = (short)(c_tag + n); + length = 1; + } else { + opcode = canon_tag; + if(wide()) length = 4; + else length = 2; + } + } + + /** + * @return local variable index referred by this instruction. + */ + public final int getIndex() { return n; } + + /** + * Set the local variable index + */ + public void setIndex(int n) { + if((n < 0) || (n > Constants.MAX_SHORT)) + throw new ClassGenException("Illegal value: " + n); + + this.n = n; + workOutLength(); + } + + /** @return canonical tag for instruction, e.g., ALOAD for ALOAD_0 + */ + public short getCanonicalTag() { + return canon_tag; + } + + /** + * Returns the type associated with the instruction - + * in case of ALOAD or ASTORE Type.OBJECT is returned. + * This is just a bit incorrect, because ALOAD and ASTORE + * may work on every ReferenceType (including Type.NULL) and + * ASTORE may even work on a ReturnaddressType . + * @return type associated with the instruction + */ + public Type getType(ConstantPoolGen cp) { + switch(canon_tag) { + case Constants.ILOAD: case Constants.ISTORE: + return Type.INT; + case Constants.LLOAD: case Constants.LSTORE: + return Type.LONG; + case Constants.DLOAD: case Constants.DSTORE: + return Type.DOUBLE; + case Constants.FLOAD: case Constants.FSTORE: + return Type.FLOAT; + case Constants.ALOAD: case Constants.ASTORE: + return Type.OBJECT; + + default: throw new ClassGenException("Oops: unknown case in switch" + canon_tag); + } + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/MONITORENTER.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/MONITORENTER.java new file mode 100644 index 000000000..7dd47e6c9 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/MONITORENTER.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * MONITORENTER - Enter monitor for object + *
Stack: ..., objectref -> ...
+ * + * @version $Id: MONITORENTER.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class MONITORENTER extends Instruction + implements ExceptionThrower, StackConsumer { + public MONITORENTER() { + super(org.aspectj.apache.bcel.Constants.MONITORENTER, (short)1); + } + + public Class[] getExceptions() { + return new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION }; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitStackConsumer(this); + v.visitMONITORENTER(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/MONITOREXIT.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/MONITOREXIT.java new file mode 100644 index 000000000..3bf42a5b2 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/MONITOREXIT.java @@ -0,0 +1,88 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * MONITOREXIT - Exit monitor for object + *
Stack: ..., objectref -> ...
+ * + * @version $Id: MONITOREXIT.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class MONITOREXIT extends Instruction + implements ExceptionThrower, StackConsumer { + public MONITOREXIT() { + super(org.aspectj.apache.bcel.Constants.MONITOREXIT, (short)1); + } + + public Class[] getExceptions() { + return new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NULL_POINTER_EXCEPTION }; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitStackConsumer(this); + v.visitMONITOREXIT(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/MethodObserver.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/MethodObserver.java new file mode 100644 index 000000000..518f9f025 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/MethodObserver.java @@ -0,0 +1,67 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Implement this interface if you're interested in changes to a MethodGen object + * and register yourself with addObserver(). + * + * @version $Id: MethodObserver.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public interface MethodObserver { + public void notify(MethodGen method); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/NEW.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/NEW.java new file mode 100644 index 000000000..79887c349 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/NEW.java @@ -0,0 +1,110 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; + +/** + * NEW - Create new object + *
Stack: ... -> ..., objectref
+ * + * @version $Id: NEW.java,v 1.6 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class NEW extends CPInstruction + implements LoadClass, AllocationInstruction, ExceptionThrower, StackProducer { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + NEW() {} + + public NEW(int index) { + super(org.aspectj.apache.bcel.Constants.NEW, index); + } + + public Class[] getExceptions(){ + Class[] cs = new Class[2 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length]; + + System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0, + cs, 0, ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length); + + cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length+1] = ExceptionConstants.INSTANTIATION_ERROR; + cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length] = ExceptionConstants.ILLEGAL_ACCESS_ERROR; + + return cs; + } + + public ObjectType getLoadClassType(ConstantPoolGen cpg) { + return (ObjectType)getType(cpg); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitLoadClass(this); + v.visitAllocationInstruction(this); + v.visitExceptionThrower(this); + v.visitStackProducer(this); + v.visitTypedInstruction(this); + v.visitCPInstruction(this); + v.visitNEW(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/NEWARRAY.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/NEWARRAY.java new file mode 100644 index 000000000..e3bda6825 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/NEWARRAY.java @@ -0,0 +1,140 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.*; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * NEWARRAY - Create new array of basic type (int, short, ...) + *
Stack: ..., count -> ..., arrayref
+ * type must be one of T_INT, T_SHORT, ... + * + * @version $Id: NEWARRAY.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class NEWARRAY extends Instruction + implements AllocationInstruction, ExceptionThrower, StackProducer { + private byte type; + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + NEWARRAY() {} + + public NEWARRAY(byte type) { + super(org.aspectj.apache.bcel.Constants.NEWARRAY, (short)2); + this.type = type; + } + + public NEWARRAY(BasicType type) { + this(type.getType()); + } + + /** + * Dump instruction as byte code to stream out. + * @param out Output stream + */ + public void dump(DataOutputStream out) throws IOException { + out.writeByte(opcode); + out.writeByte(type); + } + + /** + * @return numeric code for basic element type + */ + public final byte getTypecode() { return type; } + + /** + * @return type of constructed array + */ + public final Type getType() { + return new ArrayType(BasicType.getType(type), 1); + } + + /** + * @return mnemonic for instruction + */ + public String toString(boolean verbose) { + return super.toString(verbose) + " " + org.aspectj.apache.bcel.Constants.TYPE_NAMES[type]; + } + /** + * Read needed data (e.g. index) from file. + */ + protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException + { + type = bytes.readByte(); + length = 2; + } + + public Class[] getExceptions() { + return new Class[] { org.aspectj.apache.bcel.ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION }; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitAllocationInstruction(this); + v.visitExceptionThrower(this); + v.visitStackProducer(this); + v.visitNEWARRAY(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/NOP.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/NOP.java new file mode 100644 index 000000000..aefe11487 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/NOP.java @@ -0,0 +1,80 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * NOP - Do nothing + * + * @version $Id: NOP.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class NOP extends Instruction { + public NOP() { + super(org.aspectj.apache.bcel.Constants.NOP, (short)1); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitNOP(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/POP.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/POP.java new file mode 100644 index 000000000..5670b11eb --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/POP.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * POP - Pop top operand stack word + * + *
Stack: ..., word -> ...
+ * + * @version $Id: POP.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class POP extends StackInstruction implements PopInstruction { + public POP() { + super(org.aspectj.apache.bcel.Constants.POP); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitPopInstruction(this); + v.visitStackInstruction(this); + v.visitPOP(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/POP2.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/POP2.java new file mode 100644 index 000000000..8637a4793 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/POP2.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * POP2 - Pop two top operand stack words + * + *
Stack: ..., word2, word1 -> ...
+ * + * @version $Id: POP2.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public class POP2 extends StackInstruction implements PopInstruction { + public POP2() { + super(org.aspectj.apache.bcel.Constants.POP2); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitPopInstruction(this); + v.visitStackInstruction(this); + v.visitPOP2(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/PUSH.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/PUSH.java new file mode 100644 index 000000000..9727183ad --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/PUSH.java @@ -0,0 +1,199 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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; + +/** + * Wrapper class for push operations, which are implemented either as BIPUSH, + * LDC or xCONST_n instructions. + * + * @version $Id: PUSH.java,v 1.7 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public final class PUSH + implements CompoundInstruction, VariableLengthInstruction, InstructionConstants +{ + private Instruction instruction; + + /** + * This constructor also applies for values of type short, char, byte + * + * @param cp Constant pool + * @param value to be pushed + */ + public PUSH(ConstantPoolGen cp, int value) { + if((value >= -1) && (value <= 5)) // Use ICONST_n + instruction = INSTRUCTIONS[Constants.ICONST_0 + value]; + else if((value >= -128) && (value <= 127)) // Use BIPUSH + instruction = new BIPUSH((byte)value); + else if((value >= -32768) && (value <= 32767)) // Use SIPUSH + instruction = new SIPUSH((short)value); + else // If everything fails create a Constant pool entry + instruction = new LDC(cp.addInteger(value)); + } + + public PUSH(ConstantPoolGen cp, ObjectType t) { + instruction = new LDC_W(cp.addClass(t)); + } + + /** + * @param cp Constant pool + * @param value to be pushed + */ + public PUSH(ConstantPoolGen cp, boolean value) { + instruction = INSTRUCTIONS[Constants.ICONST_0 + (value? 1 : 0)]; + } + + /** + * @param cp Constant pool + * @param value to be pushed + */ + public PUSH(ConstantPoolGen cp, float value) { + if(value == 0.0) + instruction = FCONST_0; + else if(value == 1.0) + instruction = FCONST_1; + else if(value == 2.0) + instruction = FCONST_2; + else // Create a Constant pool entry + instruction = new LDC(cp.addFloat(value)); + } + + /** + * @param cp Constant pool + * @param value to be pushed + */ + public PUSH(ConstantPoolGen cp, long value) { + if(value == 0) + instruction = LCONST_0; + else if(value == 1) + instruction = LCONST_1; + else // Create a Constant pool entry + instruction = new LDC2_W(cp.addLong(value)); + } + + /** + * @param cp Constant pool + * @param value to be pushed + */ + public PUSH(ConstantPoolGen cp, double value) { + if(value == 0.0) + instruction = DCONST_0; + else if(value == 1.0) + instruction = DCONST_1; + else // Create a Constant pool entry + instruction = new LDC2_W(cp.addDouble(value)); + } + + /** + * @param cp Constant pool + * @param value to be pushed + */ + public PUSH(ConstantPoolGen cp, String value) { + if(value == null) + instruction = ACONST_NULL; + else // Create a Constant pool entry + instruction = new LDC(cp.addString(value)); + } + + /** + * @param cp Constant pool + * @param value to be pushed + */ + public PUSH(ConstantPoolGen cp, Number value) { + if((value instanceof Integer) || (value instanceof Short) || (value instanceof Byte)) + instruction = new PUSH(cp, value.intValue()).instruction; + else if(value instanceof Double) + instruction = new PUSH(cp, value.doubleValue()).instruction; + else if(value instanceof Float) + instruction = new PUSH(cp, value.floatValue()).instruction; + else if(value instanceof Long) + instruction = new PUSH(cp, value.longValue()).instruction; + else + throw new ClassGenException("What's this: " + value); + } + + /** + * @param cp Constant pool + * @param value to be pushed + */ + public PUSH(ConstantPoolGen cp, Character value) { + this(cp, (int)value.charValue()); + } + + /** + * @param cp Constant pool + * @param value to be pushed + */ + public PUSH(ConstantPoolGen cp, Boolean value) { + this(cp, value.booleanValue()); + } + + public final InstructionList getInstructionList() { + return new InstructionList(instruction); + } + + public final Instruction getInstruction() { + return instruction; + } + + /** + * @return mnemonic for instruction + */ + public String toString() { + return instruction.toString() + " (PUSH)"; + } +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/PUTFIELD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/PUTFIELD.java new file mode 100644 index 000000000..7ecea6514 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/PUTFIELD.java @@ -0,0 +1,118 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; + +/** + * PUTFIELD - Put field in object + *
Stack: ..., objectref, value -> ...
+ * OR + *
Stack: ..., objectref, value.word1, value.word2 -> ...
+ * + * @version $Id: PUTFIELD.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class PUTFIELD + extends FieldInstruction + implements PopInstruction,ExceptionThrower{ + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + PUTFIELD() {} + + public PUTFIELD(int index) { + super(Constants.PUTFIELD, index); + } + + public int consumeStack(ConstantPoolGen cpg) { return getFieldSize(cpg) + 1; } + + public Class[] getExceptions() { + Class[] cs = new Class[2 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; + + System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, + cs, 0, ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); + + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length+1] = + ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = + ExceptionConstants.NULL_POINTER_EXCEPTION; + + return cs; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitStackConsumer(this); + v.visitPopInstruction(this); + v.visitTypedInstruction(this); + v.visitLoadClass(this); + v.visitCPInstruction(this); + v.visitFieldOrMethod(this); + v.visitFieldInstruction(this); + v.visitPUTFIELD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/PUTSTATIC.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/PUTSTATIC.java new file mode 100644 index 000000000..74d3e55a2 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/PUTSTATIC.java @@ -0,0 +1,114 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; + +/** + * PUTSTATIC - Put static field in class + *
Stack: ..., value -> ...
+ * OR + *
Stack: ..., value.word1, value.word2 -> ...
+ * + * @version $Id: PUTSTATIC.java,v 1.4 2007/02/15 14:43:12 aclement Exp $ + * @author M. Dahm + */ +public class PUTSTATIC extends FieldInstruction + implements ExceptionThrower, PopInstruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + PUTSTATIC() {} + + public PUTSTATIC(int index) { + super(Constants.PUTSTATIC, index); + } + + public int consumeStack(ConstantPoolGen cpg) { return getFieldSize(cpg); } + + public Class[] getExceptions() { + Class[] cs = new Class[1 + ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length]; + + System.arraycopy(ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION, 0, + cs, 0, ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length); + cs[ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION.length] = + ExceptionConstants.INCOMPATIBLE_CLASS_CHANGE_ERROR; + + return cs; + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitStackConsumer(this); + v.visitPopInstruction(this); + v.visitTypedInstruction(this); + v.visitLoadClass(this); + v.visitCPInstruction(this); + v.visitFieldOrMethod(this); + v.visitFieldInstruction(this); + v.visitPUTSTATIC(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/PopInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/PopInstruction.java new file mode 100644 index 000000000..7fc08f449 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/PopInstruction.java @@ -0,0 +1,68 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denotes an unparameterized instruction to pop a value on top from the stack, + * such as ISTORE, POP, PUTSTATIC. + * + * @version $Id: PopInstruction.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + * @see ISTORE + * @see POP + */ +public interface PopInstruction extends StackConsumer { +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/PushInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/PushInstruction.java new file mode 100644 index 000000000..30ea6e84a --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/PushInstruction.java @@ -0,0 +1,73 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denotes an unparameterized instruction to produce a value on top of the stack, + * such as ILOAD, LDC, SIPUSH, DUP, ICONST, etc. + * + * @version $Id: PushInstruction.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + + * @see ILOAD + * @see ICONST + * @see LDC + * @see DUP + * @see SIPUSH + * @see GETSTATIC + */ +public interface PushInstruction extends StackProducer { +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/RETURN.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/RETURN.java new file mode 100644 index 000000000..dcecb0cec --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/RETURN.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * RETURN - Return from void method + *
Stack: ... -> <empty>
+ * + * @version $Id: RETURN.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class RETURN extends ReturnInstruction { + public RETURN() { + super(org.aspectj.apache.bcel.Constants.RETURN); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitStackConsumer(this); + v.visitReturnInstruction(this); + v.visitRETURN(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/ReturnInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/ReturnInstruction.java new file mode 100644 index 000000000..3ce8b531d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/ReturnInstruction.java @@ -0,0 +1,104 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.ExceptionConstants; + +/** + * Super class for the xRETURN family of instructions. + * + * @version $Id: ReturnInstruction.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public abstract class ReturnInstruction extends Instruction + implements ExceptionThrower, TypedInstruction, StackConsumer { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + ReturnInstruction() {} + + /** + * @param opcode of instruction + */ + protected ReturnInstruction(short opcode) { + super(opcode, (short)1); + } + + public Type getType() { + switch(opcode) { + case Constants.IRETURN: return Type.INT; + case Constants.LRETURN: return Type.LONG; + case Constants.FRETURN: return Type.FLOAT; + case Constants.DRETURN: return Type.DOUBLE; + case Constants.ARETURN: return Type.OBJECT; + case Constants.RETURN: return Type.VOID; + + default: // Never reached + throw new ClassGenException("Unknown type " + opcode); + } + } + + public Class[] getExceptions() { + return new Class[] { ExceptionConstants.ILLEGAL_MONITOR_STATE }; + } + + /** @return type associated with the instruction + */ + public Type getType(ConstantPoolGen cp) { + return getType(); + } +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/SALOAD.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/SALOAD.java new file mode 100644 index 000000000..15941e9f8 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/SALOAD.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * SALOAD - Load short from array + *
Stack: ..., arrayref, index -> ..., value
+ * + * @version $Id: SALOAD.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public class SALOAD extends ArrayInstruction implements StackProducer { + public SALOAD() { + super(org.aspectj.apache.bcel.Constants.SALOAD); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackProducer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitSALOAD(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/SASTORE.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/SASTORE.java new file mode 100644 index 000000000..308a330a2 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/SASTORE.java @@ -0,0 +1,85 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * SASTORE - Store into short array + *
Stack: ..., arrayref, index, value -> ...
+ * + * @version $Id: SASTORE.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + */ +public class SASTORE extends ArrayInstruction implements StackConsumer { + public SASTORE() { + super(org.aspectj.apache.bcel.Constants.SASTORE); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitExceptionThrower(this); + v.visitTypedInstruction(this); + v.visitArrayInstruction(this); + v.visitSASTORE(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/SIPUSH.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/SIPUSH.java new file mode 100644 index 000000000..aab6bfdbf --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/SIPUSH.java @@ -0,0 +1,128 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.*; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * SIPUSH - Push short + * + *
Stack: ... -> ..., value
+ * + * @version $Id: SIPUSH.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public class SIPUSH extends Instruction implements ConstantPushInstruction { + private short b; + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + SIPUSH() {} + + public SIPUSH(short b) { + super(org.aspectj.apache.bcel.Constants.SIPUSH, (short)3); + this.b = b; + } + + /** + * Dump instruction as short code to stream out. + */ + public void dump(DataOutputStream out) throws IOException { + super.dump(out); + out.writeShort(b); + } + + /** + * @return mnemonic for instruction + */ + public String toString(boolean verbose) { + return super.toString(verbose) + " " + b; + } + + /** + * Read needed data (e.g. index) from file. + */ + protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException + { + length = 3; + b = bytes.readShort(); + } + + public Number getValue() { return new Integer(b); } + + /** @return Type.SHORT + */ + public Type getType(ConstantPoolGen cp) { + return Type.SHORT; + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitPushInstruction(this); + v.visitStackProducer(this); + v.visitTypedInstruction(this); + v.visitConstantPushInstruction(this); + v.visitSIPUSH(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/SWAP.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/SWAP.java new file mode 100644 index 000000000..c2b2739ac --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/SWAP.java @@ -0,0 +1,84 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * SWAP - Swa top operand stack word + *
Stack: ..., word2, word1 -> ..., word1, word2
+ * + * @version $Id: SWAP.java,v 1.4 2007/02/15 14:43:11 aclement Exp $ + * @author M. Dahm + */ +public class SWAP extends StackInstruction implements StackConsumer, StackProducer { + public SWAP() { + super(org.aspectj.apache.bcel.Constants.SWAP); + } + + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitStackProducer(this); + v.visitStackInstruction(this); + v.visitSWAP(this); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/SWITCH.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/SWITCH.java new file mode 100644 index 000000000..d7c849fcb --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/SWITCH.java @@ -0,0 +1,187 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * SWITCH - Branch depending on int value, generates either LOOKUPSWITCH or + * TABLESWITCH instruction, depending on whether the match values (int[]) can be + * sorted with no gaps between the numbers. + * + * @version $Id: SWITCH.java,v 1.6 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public final class SWITCH implements CompoundInstruction { + private int[] match; + private InstructionHandle[] targets; + private Select instruction; + private int match_length; + + /** + * Template for switch() constructs. If the match array can be + * sorted in ascending order with gaps no larger than max_gap + * between the numbers, a TABLESWITCH instruction is generated, and + * a LOOKUPSWITCH otherwise. The former may be more efficient, but + * needs more space. + * + * Note, that the key array always will be sorted, though we leave + * the original arrays unaltered. + * + * @param match array of match values (case 2: ... case 7: ..., etc.) + * @param targets the instructions to be branched to for each case + * @param target the default target + * @param max_gap maximum gap that may between case branches + */ + public SWITCH(int[] match, InstructionHandle[] targets, + InstructionHandle target, int max_gap) { + this.match = (int[])match.clone(); + this.targets = (InstructionHandle[])targets.clone(); + + if((match_length = match.length) < 2) // (almost) empty switch, or just default + if (match.length==0) { + instruction = new LOOKUPSWITCH(match,targets,target); + } else { + instruction = new TABLESWITCH(match,targets,target); + } + else { + sort(0, match_length - 1); + + if(matchIsOrdered(max_gap)) { + fillup(max_gap, target); + + instruction = new TABLESWITCH(this.match, this.targets, target); + } + else + instruction = new LOOKUPSWITCH(this.match, this.targets, target); + } + } + + public SWITCH(int[] match, InstructionHandle[] targets, + InstructionHandle target) { + this(match, targets, target, 1); + } + + private final void fillup(int max_gap, InstructionHandle target) { + int max_size = match_length + match_length * max_gap; + int[] m_vec = new int[max_size]; + InstructionHandle[] t_vec = new InstructionHandle[max_size]; + int count = 1; + + m_vec[0] = match[0]; + t_vec[0] = targets[0]; + + for(int i=1; i < match_length; i++) { + int prev = match[i-1]; + int gap = match[i] - prev; + + for(int j=1; j < gap; j++) { + m_vec[count] = prev + j; + t_vec[count] = target; + count++; + } + + m_vec[count] = match[i]; + t_vec[count] = targets[i]; + count++; + } + + match = new int[count]; + targets = new InstructionHandle[count]; + + System.arraycopy(m_vec, 0, match, 0, count); + System.arraycopy(t_vec, 0, targets, 0, count); + } + + /** + * Sort match and targets array with QuickSort. + */ + private final void sort(int l, int r) { + int i = l, j = r; + int h, m = match[(l + r) / 2]; + InstructionHandle h2; + + do { + while(match[i] < m) i++; + while(m < match[j]) j--; + + if(i <= j) { + h=match[i]; match[i]=match[j]; match[j]=h; // Swap elements + h2=targets[i]; targets[i]=targets[j]; targets[j]=h2; // Swap instructions, too + i++; j--; + } + } while(i <= j); + + if(l < j) sort(l, j); + if(i < r) sort(i, r); + } + + /** + * @return match is sorted in ascending order with no gap bigger than max_gap? + */ + private final boolean matchIsOrdered(int max_gap) { + for(int i=1; i < match_length; i++) { + int diff = (match[i]-match[i-1]); + if(diff > max_gap || diff<0) return false; + } + return true; + } + + public final InstructionList getInstructionList() { + return new InstructionList(instruction); + } + + public final Instruction getInstruction() { + return instruction; + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/Select.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/Select.java new file mode 100644 index 000000000..76e81526f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/Select.java @@ -0,0 +1,254 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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.*; +import org.aspectj.apache.bcel.util.ByteSequence; + +/** + * Select - Abstract super class for LOOKUPSWITCH and TABLESWITCH instructions. + * + * @version $Id: Select.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + * @see LOOKUPSWITCH + * @see TABLESWITCH + * @see InstructionList + */ +public abstract class Select extends BranchInstruction + implements VariableLengthInstruction, StackProducer +{ + protected int[] match; // matches, i.e., case 1: ... + protected int[] indices; // target offsets + protected InstructionHandle[] targets; // target objects in instruction list + protected int fixed_length; // fixed length defined by subclasses + protected int match_length; // number of cases + protected int padding = 0; // number of pad bytes for alignment + + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + Select() {} + + /** + * (Match, target) pairs for switch. + * `Match' and `targets' must have the same length of course. + * + * @param match array of matching values + * @param targets instruction targets + * @param target default instruction target + */ + Select(short opcode, int[] match, InstructionHandle[] targets, + InstructionHandle target) { + super(opcode, target); + + this.targets = targets; + for(int i=0; i < targets.length; i++) + notifyTarget(null, targets[i], this); + + this.match = match; + + if((match_length = match.length) != targets.length) + throw new ClassGenException("Match and target array have not the same length"); + + indices = new int[match_length]; + } + + /** + * Since this is a variable length instruction, it may shift the following + * instructions which then need to update their position. + * + * Called by InstructionList.setPositions when setting the position for every + * instruction. In the presence of variable length instructions `setPositions' + * performs multiple passes over the instruction list to calculate the + * correct (byte) positions and offsets by calling this function. + * + * @param offset additional offset caused by preceding (variable length) instructions + * @param max_offset the maximum offset that may be caused by these instructions + * @return additional offset caused by possible change of this instruction's length + */ + protected int updatePosition(int offset, int max_offset) { + position += offset; // Additional offset caused by preceding SWITCHs, GOTOs, etc. + + short old_length = length; + + /* Alignment on 4-byte-boundary, + 1, because of tag byte. + */ + padding = (4 - ((position + 1) % 4)) % 4; + length = (short)(fixed_length + padding); // Update length + + return length - old_length; + } + + /** + * Dump instruction as byte code to stream out. + * @param out Output stream + */ + public void dump(DataOutputStream out) throws IOException { + out.writeByte(opcode); + + for(int i=0; i < padding; i++) // Padding bytes + out.writeByte(0); + + index = getTargetOffset(); // Write default target offset + out.writeInt(index); + } + + /** + * Read needed data (e.g. index) from file. + */ + protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException + { + padding = (4 - (bytes.getIndex() % 4)) % 4; // Compute number of pad bytes + + for(int i=0; i < padding; i++) { + bytes.readByte(); + } + + // Default branch target common for both cases (TABLESWITCH, LOOKUPSWITCH) + index = bytes.readInt(); + } + + /** + * @return mnemonic for instruction + */ + public String toString(boolean verbose) { + StringBuffer buf = new StringBuffer(super.toString(verbose)); + + if(verbose) { + for(int i=0; i < match_length; i++) { + String s = "null"; + + if(targets[i] != null) + s = targets[i].getInstruction().toString(); + + buf.append("(" + match[i] + ", " + s + " = {" + indices[i] + "})"); + } + } + else + buf.append(" ..."); + + return buf.toString(); + } + + /** + * Set branch target for `i'th case + */ + public void setTarget(int i, InstructionHandle target) { + notifyTarget(targets[i], target, this); + targets[i] = target; + } + + /** + * @param old_ih old target + * @param new_ih new target + */ + public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) { + boolean targeted = false; + + if(target == old_ih) { + targeted = true; + setTarget(new_ih); + } + + for(int i=0; i < targets.length; i++) { + if(targets[i] == old_ih) { + targeted = true; + setTarget(i, new_ih); + } + } + + if(!targeted) + throw new ClassGenException("Not targeting " + old_ih); + } + + /** + * @return true, if ih is target of this instruction + */ + public boolean containsTarget(InstructionHandle ih) { + if(target == ih) + return true; + + for(int i=0; i < targets.length; i++) + if(targets[i] == ih) + return true; + + return false; + } + + /** + * Inform targets that they're not targeted anymore. + */ + void dispose() { + super.dispose(); + + for(int i=0; i < targets.length; i++) + targets[i].removeTargeter(this); + } + + /** + * @return array of match indices + */ + public int[] getMatchs() { return match; } + + /** + * @return array of match target offsets + */ + public int[] getIndices() { return indices; } + + /** + * @return array of match targets + */ + public InstructionHandle[] getTargets() { return targets; } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/StackConsumer.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/StackConsumer.java new file mode 100644 index 000000000..67fe1c94b --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/StackConsumer.java @@ -0,0 +1,68 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denote an instruction that may consume a value from the stack. + * + * @version $Id: StackConsumer.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public interface StackConsumer { + /** @return how many words are consumed from stack + */ + public int consumeStack(ConstantPoolGen cpg); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/StackInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/StackInstruction.java new file mode 100644 index 000000000..ff71bfa0e --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/StackInstruction.java @@ -0,0 +1,83 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Super class for stack operations like DUP and POP. + * + * @version $Id: StackInstruction.java,v 1.4 2007/02/15 14:43:14 aclement Exp $ + * @author M. Dahm + */ +public abstract class StackInstruction extends Instruction { + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + */ + StackInstruction() {} + + /** + * @param opcode instruction opcode + */ + protected StackInstruction(short opcode) { + super(opcode, (short)1); + } + + /** @return Type.UNKNOWN + */ + public Type getType(ConstantPoolGen cp) { + return Type.UNKNOWN; + } +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/StackProducer.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/StackProducer.java new file mode 100644 index 000000000..3d4c52b9d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/StackProducer.java @@ -0,0 +1,69 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denote an instruction that may produce a value on top of the stack + * (this excludes DUP_X1, e.g.) + * + * @version $Id: StackProducer.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public interface StackProducer { + /** @return how many words are produced on stack + */ + public int produceStack(ConstantPoolGen cpg); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/StoreInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/StoreInstruction.java new file mode 100644 index 000000000..706e81d35 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/StoreInstruction.java @@ -0,0 +1,101 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denotes an unparameterized instruction to store a value into a local variable, + * e.g. ISTORE. + * + * @version $Id: StoreInstruction.java,v 1.4 2007/02/15 14:43:15 aclement Exp $ + * @author M. Dahm + */ +public abstract class StoreInstruction extends LocalVariableInstruction + implements PopInstruction +{ + /** + * Empty constructor needed for the Class.newInstance() statement in + * Instruction.readInstruction(). Not to be used otherwise. + * tag and length are defined in readInstruction and initFromFile, respectively. + */ + StoreInstruction(short canon_tag, short c_tag) { + super(canon_tag, c_tag); + } + + /** + * @param opcode Instruction opcode + * @param c_tag Instruction number for compact version, ASTORE_0, e.g. + * @param n local variable index (unsigned short) + */ + protected StoreInstruction(short opcode, short c_tag, int n) { + super(opcode, c_tag, n); + } + + /** + * Call corresponding visitor method(s). The order is: + * Call visitor methods of implemented interfaces first, then + * call methods according to the class hierarchy in descending order, + * i.e., the most specific visitXXX() call comes last. + * + * @param v Visitor object + */ + public void accept(Visitor v) { + v.visitStackConsumer(this); + v.visitPopInstruction(this); + v.visitTypedInstruction(this); + v.visitLocalVariableInstruction(this); + v.visitStoreInstruction(this); + } +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/TypedInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/TypedInstruction.java new file mode 100644 index 000000000..c09662c7b --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/TypedInstruction.java @@ -0,0 +1,67 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Get the type associated with an instruction, int for ILOAD, or the type + * of the field of a PUTFIELD instruction, e.g.. + * + * @version $Id: TypedInstruction.java,v 1.4 2007/02/15 14:43:13 aclement Exp $ + * @author M. Dahm + */ +public interface TypedInstruction { + public Type getType(ConstantPoolGen cpg); +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/UnconditionalBranch.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/UnconditionalBranch.java new file mode 100644 index 000000000..163116044 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/UnconditionalBranch.java @@ -0,0 +1,67 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denotes an instruction to perform an unconditional branch, i.e., GOTO, JSR. + * + * @version $Id: UnconditionalBranch.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + + * @see GOTO + * @see JSR + */ +public interface UnconditionalBranch {} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/VariableLengthInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/VariableLengthInstruction.java new file mode 100644 index 000000000..6ba9f0d3f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/VariableLengthInstruction.java @@ -0,0 +1,70 @@ +package org.aspectj.apache.bcel.generic; + +/* ==================================================================== + * 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 (http://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 + * . + */ + +/** + * Denotes an instruction to be a variable length instruction, such as + * GOTO, JSR, LOOKUPSWITCH and TABLESWITCH. + * + * @version $Id: VariableLengthInstruction.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + + * @see GOTO + * @see JSR + * @see LOOKUPSWITCH + * @see TABLESWITCH + */ +public interface VariableLengthInstruction {} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/AnnotationElementValueGen.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/AnnotationElementValueGen.java new file mode 100644 index 000000000..0ee425de9 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/AnnotationElementValueGen.java @@ -0,0 +1,63 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial implementation {date} + * ******************************************************************/ + +package org.aspectj.apache.bcel.generic.annotation; + +import java.io.DataOutputStream; +import java.io.IOException; + +import org.aspectj.apache.bcel.classfile.annotation.AnnotationElementValue; +import org.aspectj.apache.bcel.classfile.annotation.ElementValue; +import org.aspectj.apache.bcel.generic.ConstantPoolGen; + + +public class AnnotationElementValueGen extends ElementValueGen { + + // For annotation element values, this is the annotation + private AnnotationGen a; + + public AnnotationElementValueGen(AnnotationGen a,ConstantPoolGen cpool) { + super(ANNOTATION,cpool); + this.a = a; + } + + public AnnotationElementValueGen(int type, AnnotationGen annotation, ConstantPoolGen cpool) { + super(type,cpool); + if (type != ANNOTATION) + throw new RuntimeException("Only element values of type annotation can be built with this ctor"); + this.a = annotation; + } + + public AnnotationElementValueGen(AnnotationElementValue value, ConstantPoolGen cpool,boolean copyPoolEntries) { + super(ANNOTATION,cpool); + a = new AnnotationGen(value.getAnnotation(),cpool,copyPoolEntries); + } + + public void dump(DataOutputStream dos) throws IOException { + dos.writeByte(type); // u1 type of value (ANNOTATION == '@') + a.dump(dos); + } + + public String stringifyValue() { + throw new RuntimeException("Not implemented yet"); + } + + /** + * Return immutable variant of this AnnotationElementValueGen + */ + public ElementValue getElementValue() { + return new AnnotationElementValue(this.type,a.getAnnotation(),cpGen.getConstantPool()); + } + + public AnnotationGen getAnnotation() { return a;} + +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/AnnotationGen.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/AnnotationGen.java new file mode 100644 index 000000000..7b758c17e --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/annotation/AnnotationGen.java @@ -0,0 +1,166 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement initial implementation + * ******************************************************************/ +package org.aspectj.apache.bcel.generic.annotation; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.aspectj.apache.bcel.classfile.ConstantUtf8; +import org.aspectj.apache.bcel.classfile.annotation.Annotation; +import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePair; +import org.aspectj.apache.bcel.generic.ConstantPoolGen; +import org.aspectj.apache.bcel.generic.ObjectType; + +public class AnnotationGen { + private int typeIndex; + private List /* ElementNameValuePairGen */ evs; + private ConstantPoolGen cpool; + private boolean isRuntimeVisible = false; + + /** + * Here we are taking a fixed annotation of type Annotation and building a + * modifiable AnnotationGen object. If the pool passed in is for a different + * class file, then copyPoolEntries should have been passed as true as that + * will force us to do a deep copy of the annotation and move the cpool entries + * across. + * We need to copy the type and the element name value pairs and the visibility. + */ + public AnnotationGen(Annotation a,ConstantPoolGen cpool,boolean copyPoolEntries) { + this.cpool = cpool; + + if (copyPoolEntries) { + typeIndex = cpool.addUtf8(a.getTypeSignature()); + } else { + typeIndex = a.getTypeIndex(); + } + + isRuntimeVisible = a.isRuntimeVisible(); + + evs = copyValues(a.getValues(),cpool,copyPoolEntries); + } + + private List copyValues(List in,ConstantPoolGen cpool,boolean copyPoolEntries) { + List out = new ArrayList(); + for (Iterator iter = in.iterator(); iter.hasNext();) { + ElementNameValuePair nvp = (ElementNameValuePair) iter.next(); + out.add(new ElementNameValuePairGen(nvp,cpool,copyPoolEntries)); + } + return out; + } + + private AnnotationGen(ConstantPoolGen cpool) { + this.cpool = cpool; + } + + /** + * Retrieve an immutable version of this AnnotationGen + */ + public Annotation getAnnotation() { + Annotation a = new Annotation(typeIndex,cpool.getConstantPool(),isRuntimeVisible); + for (Iterator iter = evs.iterator(); iter.hasNext();) { + ElementNameValuePairGen element = (ElementNameValuePairGen) iter.next(); + a.addElementNameValuePair(element.getElementNameValuePair()); + } + return a; + } + + public AnnotationGen(ObjectType type,List /*ElementNameValuePairGen*/ elements,boolean vis,ConstantPoolGen cpool) { + this.cpool = cpool; + this.typeIndex = cpool.addUtf8(type.getSignature()); + evs = elements; + isRuntimeVisible = vis; + } + + public static AnnotationGen read(DataInputStream dis,ConstantPoolGen cpool,boolean b) throws IOException { + AnnotationGen a = new AnnotationGen(cpool); + a.typeIndex = dis.readUnsignedShort(); + int elemValuePairCount = dis.readUnsignedShort(); + for (int i=0;i + + + + + +

+This package contains the "generic" part of the +Byte Code Engineering +Library, i.e., classes to dynamically modify class objects and +byte code instructions. +

+ + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/package.html b/bcel-builder/src/org/aspectj/apache/bcel/package.html new file mode 100644 index 000000000..a77c3cdc1 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/package.html @@ -0,0 +1,17 @@ + + + + + + +

+This package contains basic classes for the +Byte Code Engineering Library + and constants defined by the + + JVM specification. +

+ + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/AttributeHTML.java b/bcel-builder/src/org/aspectj/apache/bcel/util/AttributeHTML.java new file mode 100644 index 000000000..a59c2c215 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/AttributeHTML.java @@ -0,0 +1,272 @@ +package org.aspectj.apache.bcel.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 (http://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.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; + +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.Code; +import org.aspectj.apache.bcel.classfile.CodeException; +import org.aspectj.apache.bcel.classfile.ConstantPool; +import org.aspectj.apache.bcel.classfile.ConstantUtf8; +import org.aspectj.apache.bcel.classfile.ConstantValue; +import org.aspectj.apache.bcel.classfile.ExceptionTable; +import org.aspectj.apache.bcel.classfile.InnerClass; +import org.aspectj.apache.bcel.classfile.InnerClasses; +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.SourceFile; +import org.aspectj.apache.bcel.classfile.Utility; + +/** + * Convert found attributes into HTML file. + * + * @version $Id: AttributeHTML.java,v 1.5 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + * + */ +final class AttributeHTML implements org.aspectj.apache.bcel.Constants { + private String class_name; // name of current class + private PrintWriter file; // file to write to + private int attr_count = 0; + private ConstantHTML constant_html; + private ConstantPool constant_pool; + + AttributeHTML(String dir, String class_name, ConstantPool constant_pool, + ConstantHTML constant_html) throws IOException + { + this.class_name = class_name; + this.constant_pool = constant_pool; + this.constant_html = constant_html; + + file = new PrintWriter(new FileOutputStream(dir + class_name + "_attributes.html")); + file.println(""); + } + + private final String codeLink(int link, int method_number) { + return "" + + link + ""; + } + + final void close() { + file.println("
"); + file.close(); + } + + final void writeAttribute(Attribute attribute, String anchor) throws IOException { + writeAttribute(attribute, anchor, 0); + } + + final void writeAttribute(Attribute attribute, String anchor, int method_number) throws IOException { + byte tag = attribute.getTag(); + int index; + + if(tag == ATTR_UNKNOWN) // Don't know what to do about this one + return; + + attr_count++; // Increment number of attributes found so far + + if(attr_count % 2 == 0) + file.print(""); + else + file.print(""); + + file.println("

" + attr_count + " " + ATTRIBUTE_NAMES[tag] + "

"); + + /* Handle different attributes + */ + switch(tag) { + case ATTR_CODE: + Code c = (Code)attribute; + + // Some directly printable values + file.print("
  • Maximum stack size = " + c.getMaxStack() + + "
  • \n
  • Number of local variables = " + + c.getMaxLocals() + "
  • \n
  • Byte code
\n"); + + // Get handled exceptions and list them + CodeException[] ce = c.getExceptionTable(); + int len = ce.length; + + if(len > 0) { + file.print("

Exceptions handled

    "); + + for(int i=0; i < len; i++) { + int catch_type = ce[i].getCatchType(); // Index in constant pool + + file.print("
  • "); + + if(catch_type != 0) + file.print(constant_html.referenceConstant(catch_type)); // Create Link to _cp.html + else + file.print("Any Exception"); + + file.print("
    (Ranging from lines " + codeLink(ce[i].getStartPC(), method_number) + + " to " + codeLink(ce[i].getEndPC(), method_number) + ", handled at line " + + codeLink(ce[i].getHandlerPC(), method_number) + ")
  • "); + } + file.print("
"); + } + break; + + case ATTR_CONSTANT_VALUE: + index = ((ConstantValue)attribute).getConstantValueIndex(); + + // Reference _cp.html + file.print("\n"); + break; + + case ATTR_SOURCE_FILE: + index = ((SourceFile)attribute).getSourceFileIndex(); + + // Reference _cp.html + file.print("\n"); + break; + + case ATTR_EXCEPTIONS: + // List thrown exceptions + int[] indices = ((ExceptionTable)attribute).getExceptionIndexTable(); + + file.print("\n"); + break; + + case ATTR_LINE_NUMBER_TABLE: + LineNumber[] line_numbers =((LineNumberTable)attribute).getLineNumberTable(); + + // List line number pairs + file.print("

"); + + for(int i=0; i < line_numbers.length; i++) { + file.print("(" + line_numbers[i].getStartPC() + ", " + line_numbers[i].getLineNumber() + ")"); + + if(i < line_numbers.length - 1) + file.print(", "); // breakable + } + break; + + case ATTR_LOCAL_VARIABLE_TABLE: + LocalVariable[] vars = ((LocalVariableTable)attribute).getLocalVariableTable(); + + // List name, range and type + file.print("

    "); + + for(int i=0; i < vars.length; i++) { + index = vars[i].getSignatureIndex(); + String signature = ((ConstantUtf8)constant_pool.getConstant(index, CONSTANT_Utf8)).getBytes(); + signature = Utility.signatureToString(signature, false); + int start = vars[i].getStartPC(); + int end = (start + vars[i].getLength()); + + file.println("
  • " + Class2HTML.referenceType(signature) + + " " + vars[i].getName() + " in slot %" + vars[i].getIndex() + + "
    Valid from lines " + + "" + + start + " to " + + "" + + end + "
  • "); + } + file.print("
\n"); + + break; + + case ATTR_INNER_CLASSES: + InnerClass[] classes = ((InnerClasses)attribute).getInnerClasses(); + + // List inner classes + file.print("
    "); + + for(int i=0; i < classes.length; i++) { + String name, access; + + index = classes[i].getInnerNameIndex(); + if(index > 0) + name =((ConstantUtf8)constant_pool.getConstant(index, CONSTANT_Utf8)).getBytes(); + else + name = "<anonymous>"; + + access = Utility.accessToString(classes[i].getInnerAccessFlags()); + + file.print("
  • " + access + " "+ + constant_html.referenceConstant(classes[i].getInnerClassIndex()) + + " in class " + + constant_html.referenceConstant(classes[i].getOuterClassIndex()) + + " named " + name + "
  • \n"); + } + + file.print("
\n"); + break; + + default: // Such as Unknown attribute or Deprecated + file.print("

" + attribute.toString()); + } + + file.println(""); + file.flush(); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/Class2HTML.java b/bcel-builder/src/org/aspectj/apache/bcel/util/Class2HTML.java new file mode 100644 index 000000000..3ab60c891 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/Class2HTML.java @@ -0,0 +1,270 @@ +package org.aspectj.apache.bcel.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 (http://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.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; + +import org.aspectj.apache.bcel.Constants; +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.ClassParser; +import org.aspectj.apache.bcel.classfile.ConstantPool; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.Utility; + +/** + * Read class file(s) and convert them into HTML files. + * + * Given a JavaClass object "class" that is in package "package" five files + * will be created in the specified directory. + * + *

    + *
  1. "package"."class".html as the main file which defines the frames for + * the following subfiles. + *
  2. "package"."class"_attributes.html contains all (known) attributes found in the file + *
  3. "package"."class"_cp.html contains the constant pool + *
  4. "package"."class"_code.html contains the byte code + *
  5. "package"."class"_methods.html contains references to all methods and fields of the class + *
+ * + * All subfiles reference each other appropiately, e.g. clicking on a + * method in the Method's frame will jump to the appropiate method in + * the Code frame. + * + * @version $Id: Class2HTML.java,v 1.6 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm +*/ +public class Class2HTML implements Constants +{ + private JavaClass java_class; // current class object + private String dir; + + private static String class_package; // name of package, unclean to make it static, but ... + private static String class_name; // name of current class, dito + private static ConstantPool constant_pool; + + /** + * Write contents of the given JavaClass into HTML files. + * + * @param java_class The class to write + * @param dir The directory to put the files in + */ + public Class2HTML(JavaClass java_class, String dir) throws IOException { + Method[] methods = java_class.getMethods(); + + this.java_class = java_class; + this.dir = dir; + class_name = java_class.getClassName(); // Remember full name + constant_pool = java_class.getConstantPool(); + + // Get package name by tacking off everything after the last `.' + int index = class_name.lastIndexOf('.'); + if(index > -1) + class_package = class_name.substring(0, index); + else + class_package = ""; // default package + + ConstantHTML constant_html = new ConstantHTML(dir, class_name, class_package, methods, + constant_pool); + + /* Attributes can't be written in one step, so we just open a file + * which will be written consequently. + */ + AttributeHTML attribute_html = new AttributeHTML(dir, class_name, constant_pool, constant_html); + + MethodHTML method_html = new MethodHTML(dir, class_name, methods, java_class.getFields(), + constant_html, attribute_html); + // Write main file (with frames, yuk) + writeMainHTML(attribute_html); + new CodeHTML(dir, class_name, methods, constant_pool, constant_html); + attribute_html.close(); + } + + public static void main(String argv[]) + { + String[] file_name = new String[argv.length]; + int files=0; + ClassParser parser=null; + JavaClass java_class=null; + String zip_file = null; + char sep = System.getProperty("file.separator").toCharArray()[0]; + String dir = "." + sep; // Where to store HTML files + + try { + /* Parse command line arguments. + */ + for(int i=0; i < argv.length; i++) { + if(argv[i].charAt(0) == '-') { // command line switch + if(argv[i].equals("-d")) { // Specify target directory, default `.´ + dir = argv[++i]; + + if(!dir.endsWith("" + sep)) + dir = dir + sep; + + new File(dir).mkdirs(); // Create target directory if necessary + } + else if(argv[i].equals("-zip")) + zip_file = argv[++i]; + else + System.out.println("Unknown option " + argv[i]); + } + else // add file name to list */ + file_name[files++] = argv[i]; + } + + if(files == 0) + System.err.println("Class2HTML: No input files specified."); + else { // Loop through files ... + for(int i=0; i < files; i++) { + System.out.print("Processing " + file_name[i] + "..."); + if(zip_file == null) + parser = new ClassParser(file_name[i]); // Create parser object from file + else + parser = new ClassParser(zip_file, file_name[i]); // Create parser object from zip file + + java_class = parser.parse(); + new Class2HTML(java_class, dir); + System.out.println("Done."); + } + } + } catch(Exception e) { + System.out.println(e); + e.printStackTrace(System.out); + } + } + + /** + * Utility method that converts a class reference in the constant pool, + * i.e., an index to a string. + */ + static String referenceClass(int index) { + String str = constant_pool.getConstantString(index, CONSTANT_Class); + str = Utility.compactClassName(str); + str = Utility.compactClassName(str, class_package + ".", true); + + return "" + str + ""; + } + + static final String referenceType(String type) { + String short_type = Utility.compactClassName(type); + short_type = Utility.compactClassName(short_type, class_package + ".", true); + + int index = type.indexOf('['); // Type is an array? + if(index > -1) + type = type.substring(0, index); // Tack of the `[' + + // test for basic type + if(type.equals("int") || type.equals("short") || type.equals("boolean") || type.equals("void") || + type.equals("char") || type.equals("byte") || type.equals("long") || type.equals("double") || + type.equals("float")) + return "" + type + ""; + else + return "" + short_type + ""; + } + + static String toHTML(String str) { + StringBuffer buf = new StringBuffer(); + + try { // Filter any characters HTML doesn't like such as < and > in particular + for(int i=0; i < str.length(); i++) { + char ch; + + switch(ch=str.charAt(i)) { + case '<': buf.append("<"); break; + case '>': buf.append(">"); break; + case '\n': buf.append("\\n"); break; + case '\r': buf.append("\\r"); break; + default: buf.append(ch); + } + } + } catch(StringIndexOutOfBoundsException e) {} // Never occurs + + return buf.toString(); + } + + private void writeMainHTML(AttributeHTML attribute_html) throws IOException { + PrintWriter file = new PrintWriter(new FileOutputStream(dir + class_name + ".html")); + Attribute[] attributes = java_class.getAttributes(); + + file.println("\n" + "Documentation for " + class_name + "" + + "\n" + + "\n" + + "\n" + + + "\n" + + "\n" + + "\n" + + + "\n" + + "\n" + + "\n" + + "" + ); + + file.close(); + + for(int i=0; i < attributes.length; i++) + attribute_html.writeAttribute(attributes[i], "class" + i); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoader.java b/bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoader.java new file mode 100644 index 000000000..47000eb65 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoader.java @@ -0,0 +1,227 @@ +package org.aspectj.apache.bcel.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 (http://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.ByteArrayInputStream; +import java.util.Hashtable; + +import org.aspectj.apache.bcel.Constants; +import org.aspectj.apache.bcel.classfile.ClassParser; +import org.aspectj.apache.bcel.classfile.ConstantClass; +import org.aspectj.apache.bcel.classfile.ConstantPool; +import org.aspectj.apache.bcel.classfile.ConstantUtf8; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Utility; + +/** + *

Drop in replacement for the standard class loader of the JVM. You can use it + * in conjunction with the JavaWrapper to dynamically modify/create classes + * as they're requested.

+ * + *

This class loader recognizes special requests in a distinct + * format, i.e., when the name of the requested class contains with + * "$$BCEL$$" it calls the createClass() method with that name + * (everything bevor the $$BCEL$$ is considered to be the package + * name. You can subclass the class loader and override that + * method. "Normal" classes class can be modified by overriding the + * modifyClass() method which is called just before defineClass().

+ * + *

There may be a number of packages where you have to use the default + * class loader (which may also be faster). You can define the set of packages + * where to use the system class loader in the constructor. The default value contains + * "java.", "sun.", "javax."

+ * + * @version $Id: ClassLoader.java,v 1.5 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + * @see JavaWrapper + * @see ClassPath + */ +public class ClassLoader extends java.lang.ClassLoader { + private Hashtable classes = new Hashtable(); // Hashtable is synchronized thus thread-safe + private String[] ignored_packages = { + "java.", "javax.", "sun." + }; + private Repository repository = SyntheticRepository.getInstance(); + private java.lang.ClassLoader deferTo = ClassLoader.getSystemClassLoader(); + + public ClassLoader() { + } + + public ClassLoader(java.lang.ClassLoader deferTo) { + this.deferTo = deferTo; + this.repository = new ClassLoaderRepository(deferTo); + } + + /** @param ignored_packages classes contained in these packages will be loaded + * with the system class loader + */ + public ClassLoader(String[] ignored_packages) { + addIgnoredPkgs(ignored_packages); + } + + public ClassLoader(java.lang.ClassLoader deferTo, String [] ignored_packages) { + this.deferTo = deferTo; + this.repository = new ClassLoaderRepository(deferTo); + + addIgnoredPkgs(ignored_packages); + } + + private void addIgnoredPkgs(String[] ignored_packages) { + String[] new_p = new String[ignored_packages.length + this.ignored_packages.length]; + + System.arraycopy(this.ignored_packages, 0, new_p, 0, this.ignored_packages.length); + System.arraycopy(ignored_packages, 0, new_p, this.ignored_packages.length, + ignored_packages.length); + + this.ignored_packages = new_p; + } + + protected Class loadClass(String class_name, boolean resolve) + throws ClassNotFoundException + { + Class cl = null; + + /* First try: lookup hash table. + */ + if((cl=(Class)classes.get(class_name)) == null) { + /* Second try: Load system class using system class loader. You better + * don't mess around with them. + */ + for(int i=0; i < ignored_packages.length; i++) { + if(class_name.startsWith(ignored_packages[i])) { + cl = deferTo.loadClass(class_name); + break; + } + } + + if(cl == null) { + JavaClass clazz = null; + + /* Third try: Special request? + */ + if(class_name.indexOf("$$BCEL$$") >= 0) + clazz = createClass(class_name); + else { // Fourth try: Load classes via repository + if ((clazz = repository.loadClass(class_name)) != null) { + clazz = modifyClass(clazz); + } + else + throw new ClassNotFoundException(class_name); + } + + if(clazz != null) { + byte[] bytes = clazz.getBytes(); + cl = defineClass(class_name, bytes, 0, bytes.length); + } else // Fourth try: Use default class loader + cl = Class.forName(class_name); + } + + if(resolve) + resolveClass(cl); + } + + classes.put(class_name, cl); + + return cl; + } + + /** Override this method if you want to alter a class before it gets actually + * loaded. Does nothing by default. + */ + protected JavaClass modifyClass(JavaClass clazz) { + return clazz; + } + + /** + * Override this method to create you own classes on the fly. The + * name contains the special token $$BCEL$$. Everything before that + * token is consddered to be a package name. You can encode you own + * arguments into the subsequent string. You must regard however not + * to use any "illegal" characters, i.e., characters that may not + * appear in a Java class name too
+ * + * The default implementation interprets the string as a encoded compressed + * Java class, unpacks and decodes it with the Utility.decode() method, and + * parses the resulting byte array and returns the resulting JavaClass object. + * + * @param class_name compressed byte code with "$$BCEL$$" in it + */ + protected JavaClass createClass(String class_name) { + int index = class_name.indexOf("$$BCEL$$"); + String real_name = class_name.substring(index + 8); + + JavaClass clazz = null; + try { + byte[] bytes = Utility.decode(real_name, true); + ClassParser parser = new ClassParser(new ByteArrayInputStream(bytes), "foo"); + + clazz = parser.parse(); + } catch(Throwable e) { + e.printStackTrace(); + return null; + } + + // Adapt the class name to the passed value + ConstantPool cp = clazz.getConstantPool(); + + ConstantClass cl = (ConstantClass)cp.getConstant(clazz.getClassNameIndex(), + Constants.CONSTANT_Class); + ConstantUtf8 name = (ConstantUtf8)cp.getConstant(cl.getNameIndex(), + Constants.CONSTANT_Utf8); + name.setBytes(class_name.replace('.', '/')); + + return clazz; + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/ClassSet.java b/bcel-builder/src/org/aspectj/apache/bcel/util/ClassSet.java new file mode 100644 index 000000000..3f7b32aa3 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/ClassSet.java @@ -0,0 +1,96 @@ +package org.aspectj.apache.bcel.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 (http://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.HashMap; +import java.util.Collection; +import org.aspectj.apache.bcel.classfile.JavaClass; + +/** + * Utility class implementing a (typesafe) set of JavaClass objects. + * Since JavaClass has no equals() method, the name of the class is + * used for comparison. + * + * @version $Id: ClassSet.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + * @see ClassStack +*/ +public class ClassSet implements java.io.Serializable { + private HashMap _map = new HashMap(); + + public boolean add(JavaClass clazz) { + boolean result = false; + + if(!_map.containsKey(clazz.getClassName())) { + result = true; + _map.put(clazz.getClassName(), clazz); + } + + return result; + } + + public void remove(JavaClass clazz) { _map.remove(clazz.getClassName()); } + public boolean empty() { return _map.isEmpty(); } + + public JavaClass[] toArray() { + Collection values = _map.values(); + JavaClass[] classes = new JavaClass[values.size()]; + values.toArray(classes); + return classes; + } + + public String[] getClassNames() { + return (String[])_map.keySet().toArray(new String[_map.keySet().size()]); + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/ClassStack.java b/bcel-builder/src/org/aspectj/apache/bcel/util/ClassStack.java new file mode 100644 index 000000000..9d4092e37 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/ClassStack.java @@ -0,0 +1,73 @@ +package org.aspectj.apache.bcel.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 (http://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.JavaClass; + +/** + * Utility class implementing a (typesafe) stack of JavaClass objects. + * + * @version $Id: ClassStack.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + * @see Stack +*/ +public class ClassStack implements java.io.Serializable { + private Stack stack = new Stack(); + + public void push(JavaClass clazz) { stack.push(clazz); } + public JavaClass pop() { return (JavaClass)stack.pop(); } + public JavaClass top() { return (JavaClass)stack.peek(); } + public boolean empty() { return stack.empty(); } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/CodeHTML.java b/bcel-builder/src/org/aspectj/apache/bcel/util/CodeHTML.java new file mode 100644 index 000000000..9f51210ca --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/CodeHTML.java @@ -0,0 +1,632 @@ +package org.aspectj.apache.bcel.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 (http://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.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.BitSet; + +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.Code; +import org.aspectj.apache.bcel.classfile.CodeException; +import org.aspectj.apache.bcel.classfile.ConstantFieldref; +import org.aspectj.apache.bcel.classfile.ConstantInterfaceMethodref; +import org.aspectj.apache.bcel.classfile.ConstantMethodref; +import org.aspectj.apache.bcel.classfile.ConstantNameAndType; +import org.aspectj.apache.bcel.classfile.ConstantPool; +import org.aspectj.apache.bcel.classfile.LocalVariable; +import org.aspectj.apache.bcel.classfile.LocalVariableTable; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.Utility; + +/** + * Convert code into HTML file. + * + * @version $Id: CodeHTML.java,v 1.5 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + * + */ +final class CodeHTML implements org.aspectj.apache.bcel.Constants { + private String class_name; // name of current class + private Method[] methods; // Methods to print + private PrintWriter file; // file to write to + private BitSet goto_set; + private ConstantPool constant_pool; + private ConstantHTML constant_html; + private static boolean wide=false; + + CodeHTML(String dir, String class_name, + Method[] methods, ConstantPool constant_pool, + ConstantHTML constant_html) throws IOException + { + this.class_name = class_name; + this.methods = methods; + this.constant_pool = constant_pool; + this.constant_html = constant_html; + + file = new PrintWriter(new FileOutputStream(dir + class_name + "_code.html")); + file.println(""); + + for(int i=0; i < methods.length; i++) + writeMethod(methods[i], i); + + file.println(""); + file.close(); + } + + /** + * Disassemble a stream of byte codes and return the + * string representation. + * + * @param stream data input stream + * @return String representation of byte code + */ + private final String codeToHTML(ByteSequence bytes, int method_number) + throws IOException + { + short opcode = (short)bytes.readUnsignedByte(); + StringBuffer buf; + String name, signature; + int default_offset=0, low, high; + int index, class_index, vindex, constant; + int[] jump_table; + int no_pad_bytes=0, offset; + + buf = new StringBuffer("" + OPCODE_NAMES[opcode] + ""); + + /* Special case: Skip (0-3) padding bytes, i.e., the + * following bytes are 4-byte-aligned + */ + if((opcode == TABLESWITCH) || (opcode == LOOKUPSWITCH)) { + int remainder = bytes.getIndex() % 4; + no_pad_bytes = (remainder == 0)? 0 : 4 - remainder; + + for(int i=0; i < no_pad_bytes; i++) + bytes.readByte(); + + // Both cases have a field default_offset in common + default_offset = bytes.readInt(); + } + + switch(opcode) { + case TABLESWITCH: + low = bytes.readInt(); + high = bytes.readInt(); + + offset = bytes.getIndex() - 12 - no_pad_bytes - 1; + default_offset += offset; + + buf.append(""); + + // Print switch indices in first row (and default) + jump_table = new int[high - low + 1]; + for(int i=0; i < jump_table.length; i++) { + jump_table[i] = offset + bytes.readInt(); + + buf.append(""); + } + buf.append("\n"); + + // Print target and default indices in second row + for(int i=0; i < jump_table.length; i++) + buf.append(""); + buf.append("\n
" + (low + i) + "default
" + jump_table[i] + "" + default_offset + "
\n"); + + break; + + /* Lookup switch has variable length arguments. + */ + case LOOKUPSWITCH: + int npairs = bytes.readInt(); + offset = bytes.getIndex() - 8 - no_pad_bytes - 1; + jump_table = new int[npairs]; + default_offset += offset; + + buf.append(""); + + // Print switch indices in first row (and default) + for(int i=0; i < npairs; i++) { + int match = bytes.readInt(); + + jump_table[i] = offset + bytes.readInt(); + buf.append(""); + } + buf.append("\n"); + + // Print target and default indices in second row + for(int i=0; i < npairs; i++) + buf.append(""); + buf.append("\n
" + match + "default
" + jump_table[i] + "" + default_offset + "
\n"); + break; + + /* Two address bytes + offset from start of byte stream form the + * jump target. + */ + case GOTO: case IFEQ: case IFGE: case IFGT: + case IFLE: case IFLT: + case IFNE: case IFNONNULL: case IFNULL: case IF_ACMPEQ: + case IF_ACMPNE: case IF_ICMPEQ: case IF_ICMPGE: case IF_ICMPGT: + case IF_ICMPLE: case IF_ICMPLT: case IF_ICMPNE: case JSR: + + index = (int)(bytes.getIndex() + bytes.readShort() - 1); + + buf.append("" + index + ""); + break; + + /* Same for 32-bit wide jumps + */ + case GOTO_W: case JSR_W: + int windex = bytes.getIndex() + bytes.readInt() - 1; + buf.append("" + + windex + ""); + break; + + /* Index byte references local variable (register) + */ + case ALOAD: case ASTORE: case DLOAD: case DSTORE: case FLOAD: + case FSTORE: case ILOAD: case ISTORE: case LLOAD: case LSTORE: + case RET: + if(wide) { + vindex = bytes.readShort(); + wide=false; // Clear flag + } + else + vindex = bytes.readUnsignedByte(); + + buf.append("%" + vindex); + break; + + /* + * Remember wide byte which is used to form a 16-bit address in the + * following instruction. Relies on that the method is called again with + * the following opcode. + */ + case WIDE: + wide = true; + buf.append("(wide)"); + break; + + /* Array of basic type. + */ + case NEWARRAY: + buf.append("" + TYPE_NAMES[bytes.readByte()] + ""); + break; + + /* Access object/class fields. + */ + case GETFIELD: case GETSTATIC: case PUTFIELD: case PUTSTATIC: + index = bytes.readShort(); + ConstantFieldref c1 = (ConstantFieldref)constant_pool.getConstant(index, CONSTANT_Fieldref); + + class_index = c1.getClassIndex(); + name = constant_pool.getConstantString(class_index, CONSTANT_Class); + name = Utility.compactClassName(name, false); + + index = c1.getNameAndTypeIndex(); + String field_name = constant_pool.constantToString(index, CONSTANT_NameAndType); + + if(name.equals(class_name)) { // Local field + buf.append("" + field_name + "\n"); + } + else + buf.append(constant_html.referenceConstant(class_index) + "." + field_name); + + break; + + /* Operands are references to classes in constant pool + */ + case CHECKCAST: case INSTANCEOF: case NEW: + index = bytes.readShort(); + buf.append(constant_html.referenceConstant(index)); + break; + + /* Operands are references to methods in constant pool + */ + case INVOKESPECIAL: case INVOKESTATIC: case INVOKEVIRTUAL: case INVOKEINTERFACE: + int m_index = bytes.readShort(); + String str; + + if(opcode == INVOKEINTERFACE) { // Special treatment needed + int nargs = bytes.readUnsignedByte(); // Redundant + int reserved = bytes.readUnsignedByte(); // Reserved + + ConstantInterfaceMethodref c=(ConstantInterfaceMethodref)constant_pool.getConstant(m_index, CONSTANT_InterfaceMethodref); + + class_index = c.getClassIndex(); + str = constant_pool.constantToString(c); + index = c.getNameAndTypeIndex(); + } + else { + ConstantMethodref c = (ConstantMethodref)constant_pool.getConstant(m_index, CONSTANT_Methodref); + class_index = c.getClassIndex(); + + str = constant_pool.constantToString(c); + index = c.getNameAndTypeIndex(); + } + + name = Class2HTML.referenceClass(class_index); + str = Class2HTML.toHTML(constant_pool.constantToString(constant_pool.getConstant(index, CONSTANT_NameAndType))); + + // Get signature, i.e., types + ConstantNameAndType c2 = (ConstantNameAndType)constant_pool. + getConstant(index, CONSTANT_NameAndType); + signature = constant_pool.constantToString(c2.getSignatureIndex(), + CONSTANT_Utf8); + String[] args = Utility.methodSignatureArgumentTypes(signature, false); + String type = Utility.methodSignatureReturnType(signature, false); + + buf.append(name + "." + str + "" + "("); + + // List arguments + for(int i=0; i < args.length; i++) { + buf.append(Class2HTML.referenceType(args[i])); + + if(i < args.length - 1) + buf.append(", "); + } + // Attach return type + buf.append("):" + Class2HTML.referenceType(type)); + + break; + + /* Operands are references to items in constant pool + */ + case LDC_W: case LDC2_W: + index = bytes.readShort(); + + buf.append("" + + Class2HTML.toHTML(constant_pool.constantToString(index, + constant_pool. + getConstant(index).getTag()))+ + ""); + break; + + case LDC: + index = bytes.readUnsignedByte(); + buf.append("" + + Class2HTML.toHTML(constant_pool.constantToString(index, + constant_pool. + getConstant(index).getTag()))+ + ""); + break; + + /* Array of references. + */ + case ANEWARRAY: + index = bytes.readShort(); + + buf.append(constant_html.referenceConstant(index)); + break; + + /* Multidimensional array of references. + */ + case MULTIANEWARRAY: + index = bytes.readShort(); + int dimensions = bytes.readByte(); + buf.append(constant_html.referenceConstant(index) + ":" + dimensions + "-dimensional"); + break; + + /* Increment local variable. + */ + case IINC: + if(wide) { + vindex = bytes.readShort(); + constant = bytes.readShort(); + wide = false; + } + else { + vindex = bytes.readUnsignedByte(); + constant = bytes.readByte(); + } + buf.append("%" + vindex + " " + constant); + break; + + default: + if(NO_OF_OPERANDS[opcode] > 0) { + for(int i=0; i < TYPE_OF_OPERANDS[opcode].length; i++) { + switch(TYPE_OF_OPERANDS[opcode][i]) { + case T_BYTE: + buf.append(bytes.readUnsignedByte()); + break; + + case T_SHORT: // Either branch or index + buf.append(bytes.readShort()); + break; + + case T_INT: + buf.append(bytes.readInt()); + break; + + default: // Never reached + System.err.println("Unreachable default case reached!"); + System.exit(-1); + } + buf.append(" "); + } + } + } + + buf.append(""); + return buf.toString(); + } + + /** + * Find all target addresses in code, so that they can be marked + * with <A NAME = ...>. Target addresses are kept in an BitSet object. + */ + private final void findGotos(ByteSequence bytes, Method method, Code code) + throws IOException + { + int index; + goto_set = new BitSet(bytes.available()); + int opcode; + + /* First get Code attribute from method and the exceptions handled + * (try .. catch) in this method. We only need the line number here. + */ + + if(code != null) { + CodeException[] ce = code.getExceptionTable(); + int len = ce.length; + + for(int i=0; i < len; i++) { + goto_set.set(ce[i].getStartPC()); + goto_set.set(ce[i].getEndPC()); + goto_set.set(ce[i].getHandlerPC()); + } + + // Look for local variables and their range + Attribute[] attributes = code.getAttributes(); + for(int i=0; i < attributes.length; i++) { + if(attributes[i].getTag() == ATTR_LOCAL_VARIABLE_TABLE) { + LocalVariable[] vars = ((LocalVariableTable)attributes[i]).getLocalVariableTable(); + + for(int j=0; j < vars.length; j++) { + int start = vars[j].getStartPC(); + int end = (int)(start + vars[j].getLength()); + goto_set.set(start); + goto_set.set(end); + } + break; + } + } + } + + // Get target addresses from GOTO, JSR, TABLESWITCH, etc. + for(int i=0; bytes.available() > 0; i++) { + opcode = bytes.readUnsignedByte(); + //System.out.println(OPCODE_NAMES[opcode]); + switch(opcode) { + case TABLESWITCH: case LOOKUPSWITCH: + //bytes.readByte(); // Skip already read byte + + int remainder = bytes.getIndex() % 4; + int no_pad_bytes = (remainder == 0)? 0 : 4 - remainder; + int default_offset, offset; + + for(int j=0; j < no_pad_bytes; j++) + bytes.readByte(); + + // Both cases have a field default_offset in common + default_offset = bytes.readInt(); + + if(opcode == TABLESWITCH) { + int low = bytes.readInt(); + int high = bytes.readInt(); + + offset = bytes.getIndex() - 12 - no_pad_bytes - 1; + default_offset += offset; + goto_set.set(default_offset); + + for(int j=0; j < (high - low + 1); j++) { + index = offset + bytes.readInt(); + goto_set.set(index); + } + } + else { // LOOKUPSWITCH + int npairs = bytes.readInt(); + + offset = bytes.getIndex() - 8 - no_pad_bytes - 1; + default_offset += offset; + goto_set.set(default_offset); + + for(int j=0; j < npairs; j++) { + int match = bytes.readInt(); + + index = offset + bytes.readInt(); + goto_set.set(index); + } + } + break; + + case GOTO: case IFEQ: case IFGE: case IFGT: + case IFLE: case IFLT: + case IFNE: case IFNONNULL: case IFNULL: case IF_ACMPEQ: + case IF_ACMPNE: case IF_ICMPEQ: case IF_ICMPGE: case IF_ICMPGT: + case IF_ICMPLE: case IF_ICMPLT: case IF_ICMPNE: case JSR: + //bytes.readByte(); // Skip already read byte + index = bytes.getIndex() + bytes.readShort() - 1; + + goto_set.set(index); + break; + + case GOTO_W: case JSR_W: + //bytes.readByte(); // Skip already read byte + index = bytes.getIndex() + bytes.readInt() - 1; + goto_set.set(index); + break; + + default: + bytes.unreadByte(); + codeToHTML(bytes, 0); // Ignore output + } + } + } + + /** + * Write a single method with the byte code associated with it. + */ + private void writeMethod(Method method, int method_number) + throws IOException + { + // Get raw signature + String signature = method.getSignature(); + // Get array of strings containing the argument types + String[] args = Utility.methodSignatureArgumentTypes(signature, false); + // Get return type string + String type = Utility.methodSignatureReturnType(signature, false); + // Get method name + String name = method.getName(); + String html_name = Class2HTML.toHTML(name); + // Get method's access flags + String access = Utility.accessToString(method.getAccessFlags()); + access = Utility.replace(access, " ", " "); + // Get the method's attributes, the Code Attribute in particular + Attribute[] attributes= method.getAttributes(); + + file.print("

" + access + " " + + "" + Class2HTML.referenceType(type) + + " " + html_name + "("); + + for(int i=0; i < args.length; i++) { + file.print(Class2HTML.referenceType(args[i])); + if(i < args.length - 1) + file.print(", "); + } + + file.println(")

"); + + Code c=null; + byte[] code=null; + + if(attributes.length > 0) { + file.print("

Attributes

    \n"); + for(int i=0; i < attributes.length; i++) { + byte tag = attributes[i].getTag(); + + if(tag != ATTR_UNKNOWN) + file.print("
  • " + ATTRIBUTE_NAMES[tag] + "
  • \n"); + else + file.print("
  • " + attributes[i] + "
  • "); + + if(tag == ATTR_CODE) { + c = (Code)attributes[i]; + Attribute[] attributes2 = c.getAttributes(); + code = c.getCode(); + + file.print("
      "); + for(int j=0; j < attributes2.length; j++) { + tag = attributes2[j].getTag(); + file.print("
    • " + + ATTRIBUTE_NAMES[tag] + "
    • \n"); + + } + file.print("
    "); + } + } + file.println("
"); + } + + if(code != null) { // No code, an abstract method, e.g. + //System.out.println(name + "\n" + Utility.codeToString(code, constant_pool, 0, -1)); + + // Print the byte code + ByteSequence stream = new ByteSequence(code); + stream.mark(stream.available()); + findGotos(stream, method, c); + stream.reset(); + + file.println("" + + ""); + + for(int i=0; stream.available() > 0; i++) { + int offset = stream.getIndex(); + String str = codeToHTML(stream, method_number); + String anchor = ""; + + /* Set an anchor mark if this line is targetted by a goto, jsr, etc. + * Defining an anchor for every line is very inefficient! + */ + if(goto_set.get(offset)) + anchor = ""; + + String anchor2; + if(stream.getIndex() == code.length) // last loop + anchor2 = "" + offset + ""; + else + anchor2 = "" + offset; + + file.println(""); + } + + // Mark last line, may be targetted from Attributes window + file.println(""); + file.println("
Byte
offset
InstructionArgument
" + anchor2 + "" + anchor + str + "
"); + } + + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/ConstantHTML.java b/bcel-builder/src/org/aspectj/apache/bcel/util/ConstantHTML.java new file mode 100644 index 000000000..e7b5eec7d --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/ConstantHTML.java @@ -0,0 +1,274 @@ + +package org.aspectj.apache.bcel.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 (http://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.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; + +import org.aspectj.apache.bcel.classfile.Constant; +import org.aspectj.apache.bcel.classfile.ConstantClass; +import org.aspectj.apache.bcel.classfile.ConstantFieldref; +import org.aspectj.apache.bcel.classfile.ConstantInterfaceMethodref; +import org.aspectj.apache.bcel.classfile.ConstantMethodref; +import org.aspectj.apache.bcel.classfile.ConstantNameAndType; +import org.aspectj.apache.bcel.classfile.ConstantPool; +import org.aspectj.apache.bcel.classfile.ConstantString; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.Utility; + +/** + * Convert constant pool into HTML file. + * + * @version $Id: ConstantHTML.java,v 1.5 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + * + */ +final class ConstantHTML implements org.aspectj.apache.bcel.Constants { + private String class_name; // name of current class + private String class_package; // name of package + private ConstantPool constant_pool; // reference to constant pool + private PrintWriter file; // file to write to + private String[] constant_ref; // String to return for cp[i] + private Constant[] constants; // The constants in the cp + private Method[] methods; + + ConstantHTML(String dir, String class_name, String class_package, Method[] methods, + ConstantPool constant_pool) throws IOException + { + this.class_name = class_name; + this.class_package = class_package; + this.constant_pool = constant_pool; + this.methods = methods; + constants = constant_pool.getConstantPool(); + file = new PrintWriter(new FileOutputStream(dir + class_name + "_cp.html")); + constant_ref = new String[constants.length]; + constant_ref[0] = "<unknown>"; + + file.println(""); + + // Loop through constants, constants[0] is reserved + for(int i=1; i < constants.length; i++) { + if(i % 2 == 0) + file.print("\n"); + } + + file.println("
"); + else + file.print("
"); + + if(constants[i] != null) + writeConstant(i); + + file.print("
"); + file.close(); + } + + String referenceConstant(int index) { + return constant_ref[index]; + } + + private void writeConstant(int index) { + byte tag = constants[index].getTag(); + int class_index, name_index; + String ref; + + // The header is always the same + file.println("

" + index + " " + CONSTANT_NAMES[tag] + "

"); + + /* For every constant type get the needed parameters and print them appropiately + */ + switch(tag) { + case CONSTANT_InterfaceMethodref: + case CONSTANT_Methodref: + // Get class_index and name_and_type_index, depending on type + if(tag == CONSTANT_Methodref) { + ConstantMethodref c = (ConstantMethodref)constant_pool.getConstant(index, CONSTANT_Methodref); + class_index = c.getClassIndex(); + name_index = c.getNameAndTypeIndex(); + } + else { + ConstantInterfaceMethodref c1 = (ConstantInterfaceMethodref)constant_pool.getConstant(index, CONSTANT_InterfaceMethodref); + class_index = c1.getClassIndex(); + name_index = c1.getNameAndTypeIndex(); + } + + // Get method name and its class + String method_name = constant_pool.constantToString(name_index, CONSTANT_NameAndType); + String html_method_name = Class2HTML.toHTML(method_name); + + // Partially compacted class name, i.e., / -> . + String method_class = constant_pool.constantToString(class_index, CONSTANT_Class); + String short_method_class = Utility.compactClassName(method_class); // I.e., remove java.lang. + short_method_class = Utility.compactClassName(method_class); // I.e., remove java.lang. + short_method_class = Utility.compactClassName(short_method_class, class_package + ".", true); // Remove class package prefix + + // Get method signature + ConstantNameAndType c2 = (ConstantNameAndType)constant_pool.getConstant(name_index, CONSTANT_NameAndType); + String signature = constant_pool.constantToString(c2.getSignatureIndex(), CONSTANT_Utf8); + // Get array of strings containing the argument types + String[] args = Utility.methodSignatureArgumentTypes(signature, false); + + // Get return type string + String type = Utility.methodSignatureReturnType(signature, false); + String ret_type = Class2HTML.referenceType(type); + + StringBuffer buf = new StringBuffer("("); + for(int i=0; i < args.length; i++) { + buf.append(Class2HTML.referenceType(args[i])); + if(i < args.length - 1) + buf.append(", "); + } + buf.append(")"); + + String arg_types = buf.toString(); + + if(method_class.equals(class_name)) // Method is local to class + ref = "" + html_method_name + ""; + else + ref = "" + short_method_class + + "." + html_method_name; + + constant_ref[index] = ret_type + " " + + short_method_class + "." + html_method_name + " " + arg_types; + + file.println("

" + ret_type + " " + ref + arg_types + " \n

"); + break; + + case CONSTANT_Fieldref: + // Get class_index and name_and_type_index + ConstantFieldref c3 = (ConstantFieldref)constant_pool.getConstant(index, CONSTANT_Fieldref); + class_index = c3.getClassIndex(); + name_index = c3.getNameAndTypeIndex(); + + // Get method name and its class (compacted) + String field_class = constant_pool.constantToString(class_index, CONSTANT_Class); + String short_field_class = Utility.compactClassName(field_class); // I.e., remove java.lang. + short_field_class = Utility.compactClassName(short_field_class, class_package + ".", true); // Remove class package prefix + + String field_name = constant_pool.constantToString(name_index, CONSTANT_NameAndType); + + if(field_class.equals(class_name)) // Field is local to class + ref = "" + field_name + ""; + else + ref = "" + + short_field_class + "." + field_name + "\n"; + + constant_ref[index] = "" + + short_field_class + "." + field_name + ""; + + file.println("

" + ref + "
\n" + "

"); + break; + + case CONSTANT_Class: + ConstantClass c4 = (ConstantClass)constant_pool.getConstant(index, CONSTANT_Class); + name_index = c4.getNameIndex(); + String class_name2 = constant_pool.constantToString(index, tag); // / -> . + String short_class_name = Utility.compactClassName(class_name2); // I.e., remove java.lang. + short_class_name = Utility.compactClassName(short_class_name, class_package + ".", true); // Remove class package prefix + + ref = "" + short_class_name + ""; + constant_ref[index] = "" + short_class_name + ""; + + file.println("

" + ref + "

\n"); + break; + + case CONSTANT_String: + ConstantString c5 = (ConstantString)constant_pool.getConstant(index, CONSTANT_String); + name_index = c5.getStringIndex(); + + String str = Class2HTML.toHTML(constant_pool.constantToString(index, tag)); + + file.println("

" + str + "

\n"); + break; + + case CONSTANT_NameAndType: + ConstantNameAndType c6 = (ConstantNameAndType)constant_pool.getConstant(index, CONSTANT_NameAndType); + name_index = c6.getNameIndex(); + int signature_index = c6.getSignatureIndex(); + + file.println("

" + Class2HTML.toHTML(constant_pool.constantToString(index, tag)) + "

\n"); + break; + + default: + file.println("

" + Class2HTML.toHTML(constant_pool.constantToString(index, tag)) + "\n"); + } // switch + } + + private final int getMethodNumber(String str) { + for(int i=0; i < methods.length; i++) { + String cmp = methods[i].getName() + methods[i].getSignature(); + if(cmp.equals(str)) + return i; + } + return -1; + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/JavaWrapper.java b/bcel-builder/src/org/aspectj/apache/bcel/util/JavaWrapper.java new file mode 100644 index 000000000..fdbdf7ce8 --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/JavaWrapper.java @@ -0,0 +1,152 @@ +package org.aspectj.apache.bcel.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 (http://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.lang.reflect.*; + +/** + * Java interpreter replacement, i.e., wrapper that uses its own ClassLoader + * to modify/generate classes as they're requested. You can take this as a template + * for your own applications.
+ * Call this wrapper with + *

java org.aspectj.apache.bcel.util.JavaWrapper <real.class.name> [arguments]
+ *

+ * To use your own class loader you can set the "bcel.classloader" system property + * which defaults to "org.aspectj.apache.bcel.util.ClassLoader", e.g., with + *

java org.aspectj.apache.bcel.util.JavaWrapper -Dbcel.classloader=foo.MyLoader <real.class.name> [arguments]
+ *

+ * + * @version $Id: JavaWrapper.java,v 1.4 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + * @see ClassLoader + */ +public class JavaWrapper { + private java.lang.ClassLoader loader; + + private static java.lang.ClassLoader getClassLoader() { + String s = System.getProperty("bcel.classloader"); + + if((s == null) || "".equals(s)) + s = "org.aspectj.apache.bcel.util.ClassLoader"; + + try { + return (java.lang.ClassLoader)Class.forName(s).newInstance(); + } catch(Exception e) { + throw new RuntimeException(e.toString()); + } + } + + public JavaWrapper(java.lang.ClassLoader loader) { + this.loader = loader; + } + + public JavaWrapper() { + this(getClassLoader()); + } + + /** Runs the main method of the given class with the arguments passed in argv + * + * @param class_name the fully qualified class name + * @param argv the arguments just as you would pass them directly + */ + public void runMain(String class_name, String[] argv) throws ClassNotFoundException + { + Class cl = loader.loadClass(class_name); + Method method = null; + + try { + method = cl.getMethod("main", new Class[] { argv.getClass() }); + + /* Method main is sane ? + */ + int m = method.getModifiers(); + Class r = method.getReturnType(); + + if(!(Modifier.isPublic(m) && Modifier.isStatic(m)) || + Modifier.isAbstract(m) || (r != Void.TYPE)) + throw new NoSuchMethodException(); + } catch(NoSuchMethodException no) { + System.out.println("In class " + class_name + + ": public static void main(String[] argv) is not defined"); + return; + } + + try { + method.invoke(null, new Object[] { argv }); + } catch(Exception ex) { + ex.printStackTrace(); + } + } + + /** Default main method used as wrapper, expects the fully qualified class name + * of the real class as the first argument. + */ + public static void main(String[] argv) throws Exception { + /* Expects class name as first argument, other arguments are by-passed. + */ + if(argv.length == 0) { + System.out.println("Missing class name."); + return; + } + + String class_name = argv[0]; + String[] new_argv = new String[argv.length - 1]; + System.arraycopy(argv, 1, new_argv, 0, new_argv.length); + + JavaWrapper wrapper = new JavaWrapper(); + wrapper.runMain(class_name, new_argv); + } +} + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/MethodHTML.java b/bcel-builder/src/org/aspectj/apache/bcel/util/MethodHTML.java new file mode 100644 index 000000000..1c96dc52f --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/MethodHTML.java @@ -0,0 +1,208 @@ +package org.aspectj.apache.bcel.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 (http://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.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; + +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.Code; +import org.aspectj.apache.bcel.classfile.ConstantValue; +import org.aspectj.apache.bcel.classfile.ExceptionTable; +import org.aspectj.apache.bcel.classfile.Field; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.Utility; + +/** + * Convert methods and fields into HTML file. + * + * @version $Id: MethodHTML.java,v 1.5 2007/02/15 14:43:16 aclement Exp $ + * @author M. Dahm + * + */ +final class MethodHTML implements org.aspectj.apache.bcel.Constants { + private String class_name; // name of current class + private PrintWriter file; // file to write to + private ConstantHTML constant_html; + private AttributeHTML attribute_html; + + MethodHTML(String dir, String class_name, + Method[] methods, Field[] fields, + ConstantHTML constant_html, AttributeHTML attribute_html) throws IOException + { + this.class_name = class_name; + this.attribute_html = attribute_html; + this.constant_html = constant_html; + + file = new PrintWriter(new FileOutputStream(dir + class_name + "_methods.html")); + + file.println(""); + file.println("" + + ""); + for(int i=0; i < fields.length; i++) + writeField(fields[i]); + file.println("
Access flagsTypeField name
"); + + file.println("" + + "" + + ""); + for(int i=0; i < methods.length; i++) + writeMethod(methods[i], i); + + file.println("
Access flagsReturn typeMethod nameArguments
"); + file.close(); + } + + /** + * Print field of class. + * + * @param field field to print + * @exception java.io.IOException + */ + private void writeField(Field field) throws IOException { + String type = Utility.signatureToString(field.getSignature()); + String name = field.getName(); + String access = Utility.accessToString(field.getAccessFlags()); + Attribute[] attributes; + + access = Utility.replace(access, " ", " "); + + file.print("" + access + "\n" + + Class2HTML.referenceType(type) + "" + + name + ""); + + attributes = field.getAttributes(); + + // Write them to the Attributes.html file with anchor "[]" + for(int i=0; i < attributes.length; i++) + attribute_html.writeAttribute(attributes[i], name + "@" + i); + + for(int i=0; i < attributes.length; i++) { + if(attributes[i].getTag() == ATTR_CONSTANT_VALUE) { // Default value + String str = ((ConstantValue)attributes[i]).toString(); + + // Reference attribute in _attributes.html + file.print("= " + str + "\n"); + break; + } + } + + file.println(""); + } + + private final void writeMethod(Method method, int method_number) throws IOException { + // Get raw signature + String signature = method.getSignature(); + // Get array of strings containing the argument types + String[] args = Utility.methodSignatureArgumentTypes(signature, false); + // Get return type string + String type = Utility.methodSignatureReturnType(signature, false); + // Get method name + String name = method.getName(), html_name; + // Get method's access flags + String access = Utility.accessToString(method.getAccessFlags()); + // Get the method's attributes, the Code Attribute in particular + Attribute[] attributes = method.getAttributes(); + + /* HTML doesn't like names like and spaces are places to break + * lines. Both we don't want... + */ + access = Utility.replace(access, " ", " "); + html_name = Class2HTML.toHTML(name); + + file.print("" + + access + ""); + + file.print("" + Class2HTML.referenceType(type) + "" + + "" + html_name + "\n("); + + for(int i=0; i < args.length; i++) { + file.print(Class2HTML.referenceType(args[i])); + if(i < args.length - 1) + file.print(", "); + } + + file.print(")"); + + // Check for thrown exceptions + for(int i=0; i < attributes.length; i++) { + attribute_html.writeAttribute(attributes[i], "method" + method_number + "@" + i, + method_number); + + byte tag = attributes[i].getTag(); + if(tag == ATTR_EXCEPTIONS) { + file.print("throws"); + int[] exceptions = ((ExceptionTable)attributes[i]).getExceptionIndexTable(); + + for(int j=0; j < exceptions.length; j++) { + file.print(constant_html.referenceConstant(exceptions[j])); + + if(j < exceptions.length - 1) + file.print(", "); + } + file.println(""); + } else if(tag == ATTR_CODE) { + Attribute[] c_a = ((Code)attributes[i]).getAttributes(); + + for(int j=0; j < c_a.length; j++) + attribute_html.writeAttribute(c_a[j], "method" + method_number + "@" + i + "@" + j, + method_number); + } + } + } +} diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/package.html b/bcel-builder/src/org/aspectj/apache/bcel/util/package.html new file mode 100644 index 000000000..f8dc0211e --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/util/package.html @@ -0,0 +1,25 @@ + + + + + + +

+This package contains utility classes for the +Byte Code Engineering +Library, namely: +

+

+

    +
  • Collection classes for JavaClass objects
  • +
  • A converter for class files to HTML
  • +
  • A tool to find instructions patterns via regular expressions
  • +
  • A class to find classes as defined in the CLASSPATH
  • +
  • A class loader that allows to create clases at run time
  • +
+ +

+ + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/verifier/exc/package.html b/bcel-builder/src/org/aspectj/apache/bcel/verifier/exc/package.html new file mode 100644 index 000000000..a19fd3c5c --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/verifier/exc/package.html @@ -0,0 +1,24 @@ + + + + + + + +Exception classes used by JustIce, mostly used internally. You don't need to bother with them. + +

Package Specification

+ +Contained in this package are Exception classes for use with the JustIce verifier. + +

Related Documentation

+ +For a simple demonstration of JustIce working, please see: + + + + diff --git a/bcel-builder/src/org/aspectj/apache/bcel/verifier/structurals/package.html b/bcel-builder/src/org/aspectj/apache/bcel/verifier/structurals/package.html new file mode 100644 index 000000000..b21cb1fbb --- /dev/null +++ b/bcel-builder/src/org/aspectj/apache/bcel/verifier/structurals/package.html @@ -0,0 +1,27 @@ + + + + + + + +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: + + + + -- 2.39.5