jdk.internal.org.objectweb.asm.tree.AbstractInsnNode Java Examples
The following examples show how to use
jdk.internal.org.objectweb.asm.tree.AbstractInsnNode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SourceInterpreter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public SourceValue newOperation(final AbstractInsnNode insn) { int size; switch (insn.getOpcode()) { case LCONST_0: case LCONST_1: case DCONST_0: case DCONST_1: size = 2; break; case LDC: Object cst = ((LdcInsnNode) insn).cst; size = cst instanceof Long || cst instanceof Double ? 2 : 1; break; case GETSTATIC: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; } return new SourceValue(size, insn); }
Example #2
Source File: SourceInterpreter.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public SourceValue newOperation(final AbstractInsnNode insn) { int size; switch (insn.getOpcode()) { case LCONST_0: case LCONST_1: case DCONST_0: case DCONST_1: size = 2; break; case LDC: Object cst = ((LdcInsnNode) insn).cst; size = cst instanceof Long || cst instanceof Double ? 2 : 1; break; case GETSTATIC: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; } return new SourceValue(size, insn); }
Example #3
Source File: SourceInterpreter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public SourceValue unaryOperation(final AbstractInsnNode insn, final SourceValue value) { int size; switch (insn.getOpcode()) { case LNEG: case DNEG: case I2L: case I2D: case L2D: case F2L: case F2D: case D2L: size = 2; break; case GETFIELD: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; } return new SourceValue(size, insn); }
Example #4
Source File: SourceInterpreter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public SourceValue newOperation(final AbstractInsnNode insn) { int size; switch (insn.getOpcode()) { case LCONST_0: case LCONST_1: case DCONST_0: case DCONST_1: size = 2; break; case LDC: Object cst = ((LdcInsnNode) insn).cst; size = cst instanceof Long || cst instanceof Double ? 2 : 1; break; case GETSTATIC: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; } return new SourceValue(size, insn); }
Example #5
Source File: SourceInterpreter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public SourceValue unaryOperation(final AbstractInsnNode insn, final SourceValue value) { int size; switch (insn.getOpcode()) { case LNEG: case DNEG: case I2L: case I2D: case L2D: case F2L: case F2D: case D2L: size = 2; break; case GETFIELD: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; } return new SourceValue(size, insn); }
Example #6
Source File: SourceInterpreter.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override public SourceValue newOperation(final AbstractInsnNode insn) { int size; switch (insn.getOpcode()) { case LCONST_0: case LCONST_1: case DCONST_0: case DCONST_1: size = 2; break; case LDC: Object cst = ((LdcInsnNode) insn).cst; size = cst instanceof Long || cst instanceof Double ? 2 : 1; break; case GETSTATIC: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; } return new SourceValue(size, insn); }
Example #7
Source File: SourceInterpreter.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override public SourceValue unaryOperation(final AbstractInsnNode insn, final SourceValue value) { int size; switch (insn.getOpcode()) { case LNEG: case DNEG: case I2L: case I2D: case L2D: case F2L: case F2D: case D2L: size = 2; break; case GETFIELD: size = Type.getType(((FieldInsnNode) insn).desc).getSize(); break; default: size = 1; } return new SourceValue(size, insn); }
Example #8
Source File: SourceInterpreter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public SourceValue binaryOperation(final AbstractInsnNode insn, final SourceValue value1, final SourceValue value2) { int size; switch (insn.getOpcode()) { case LALOAD: case DALOAD: case LADD: case DADD: case LSUB: case DSUB: case LMUL: case DMUL: case LDIV: case DDIV: case LREM: case DREM: case LSHL: case LSHR: case LUSHR: case LAND: case LOR: case LXOR: size = 2; break; default: size = 1; } return new SourceValue(size, insn); }
Example #9
Source File: SourceInterpreter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public SourceValue binaryOperation(final AbstractInsnNode insn, final SourceValue value1, final SourceValue value2) { int size; switch (insn.getOpcode()) { case LALOAD: case DALOAD: case LADD: case DADD: case LSUB: case DSUB: case LMUL: case DMUL: case LDIV: case DDIV: case LREM: case DREM: case LSHL: case LSHR: case LUSHR: case LAND: case LOR: case LXOR: size = 2; break; default: size = 1; } return new SourceValue(size, insn); }
Example #10
Source File: SourceInterpreter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public SourceValue binaryOperation(final AbstractInsnNode insn, final SourceValue value1, final SourceValue value2) { int size; switch (insn.getOpcode()) { case LALOAD: case DALOAD: case LADD: case DADD: case LSUB: case DSUB: case LMUL: case DMUL: case LDIV: case DDIV: case LREM: case DREM: case LSHL: case LSHR: case LUSHR: case LAND: case LOR: case LXOR: size = 2; break; default: size = 1; } return new SourceValue(size, insn); }
Example #11
Source File: BasicVerifier.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public void returnOperation(final AbstractInsnNode insn, final BasicValue value, final BasicValue expected) throws AnalyzerException { if (!isSubTypeOf(value, expected)) { throw new AnalyzerException(insn, "Incompatible return type", expected, value); } }
Example #12
Source File: BasicVerifier.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public void returnOperation(final AbstractInsnNode insn, final BasicValue value, final BasicValue expected) throws AnalyzerException { if (!isSubTypeOf(value, expected)) { throw new AnalyzerException(insn, "Incompatible return type", expected, value); } }
Example #13
Source File: SourceInterpreter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public SourceValue naryOperation(final AbstractInsnNode insn, final List<? extends SourceValue> values) { int size; int opcode = insn.getOpcode(); if (opcode == MULTIANEWARRAY) { size = 1; } else { String desc = (opcode == INVOKEDYNAMIC) ? ((InvokeDynamicInsnNode) insn).desc : ((MethodInsnNode) insn).desc; size = Type.getReturnType(desc).getSize(); } return new SourceValue(size, insn); }
Example #14
Source File: SourceInterpreter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public SourceValue binaryOperation(final AbstractInsnNode insn, final SourceValue value1, final SourceValue value2) { int size; switch (insn.getOpcode()) { case LALOAD: case DALOAD: case LADD: case DADD: case LSUB: case DSUB: case LMUL: case DMUL: case LDIV: case DDIV: case LREM: case DREM: case LSHL: case LSHR: case LUSHR: case LAND: case LOR: case LXOR: size = 2; break; default: size = 1; } return new SourceValue(size, insn); }
Example #15
Source File: BasicVerifier.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void returnOperation(final AbstractInsnNode insn, final BasicValue value, final BasicValue expected) throws AnalyzerException { if (!isSubTypeOf(value, expected)) { throw new AnalyzerException(insn, "Incompatible return type", expected, value); } }
Example #16
Source File: BasicInterpreter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public BasicValue naryOperation(final AbstractInsnNode insn, final List<? extends BasicValue> values) throws AnalyzerException { int opcode = insn.getOpcode(); if (opcode == MULTIANEWARRAY) { return newValue(Type.getType(((MultiANewArrayInsnNode) insn).desc)); } else if (opcode == INVOKEDYNAMIC) { return newValue(Type .getReturnType(((InvokeDynamicInsnNode) insn).desc)); } else { return newValue(Type.getReturnType(((MethodInsnNode) insn).desc)); } }
Example #17
Source File: SourceInterpreter.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public void returnOperation(final AbstractInsnNode insn, final SourceValue value, final SourceValue expected) { }
Example #18
Source File: BasicInterpreter.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Override public BasicValue copyOperation(final AbstractInsnNode insn, final BasicValue value) throws AnalyzerException { return value; }
Example #19
Source File: BasicInterpreter.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public BasicValue newOperation(final AbstractInsnNode insn) throws AnalyzerException { switch (insn.getOpcode()) { case ACONST_NULL: return newValue(Type.getObjectType("null")); case ICONST_M1: case ICONST_0: case ICONST_1: case ICONST_2: case ICONST_3: case ICONST_4: case ICONST_5: return BasicValue.INT_VALUE; case LCONST_0: case LCONST_1: return BasicValue.LONG_VALUE; case FCONST_0: case FCONST_1: case FCONST_2: return BasicValue.FLOAT_VALUE; case DCONST_0: case DCONST_1: return BasicValue.DOUBLE_VALUE; case BIPUSH: case SIPUSH: return BasicValue.INT_VALUE; case LDC: Object cst = ((LdcInsnNode) insn).cst; if (cst instanceof Integer) { return BasicValue.INT_VALUE; } else if (cst instanceof Float) { return BasicValue.FLOAT_VALUE; } else if (cst instanceof Long) { return BasicValue.LONG_VALUE; } else if (cst instanceof Double) { return BasicValue.DOUBLE_VALUE; } else if (cst instanceof String) { return newValue(Type.getObjectType("java/lang/String")); } else if (cst instanceof Type) { int sort = ((Type) cst).getSort(); if (sort == Type.OBJECT || sort == Type.ARRAY) { return newValue(Type.getObjectType("java/lang/Class")); } else if (sort == Type.METHOD) { return newValue(Type .getObjectType("java/lang/invoke/MethodType")); } else { throw new IllegalArgumentException("Illegal LDC constant " + cst); } } else if (cst instanceof Handle) { return newValue(Type .getObjectType("java/lang/invoke/MethodHandle")); } else { throw new IllegalArgumentException("Illegal LDC constant " + cst); } case JSR: return BasicValue.RETURNADDRESS_VALUE; case GETSTATIC: return newValue(Type.getType(((FieldInsnNode) insn).desc)); case NEW: return newValue(Type.getObjectType(((TypeInsnNode) insn).desc)); default: throw new Error("Internal error."); } }
Example #20
Source File: BasicVerifier.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public BasicValue unaryOperation(final AbstractInsnNode insn, final BasicValue value) throws AnalyzerException { BasicValue expected; switch (insn.getOpcode()) { case INEG: case IINC: case I2F: case I2L: case I2D: case I2B: case I2C: case I2S: case IFEQ: case IFNE: case IFLT: case IFGE: case IFGT: case IFLE: case TABLESWITCH: case LOOKUPSWITCH: case IRETURN: case NEWARRAY: case ANEWARRAY: expected = BasicValue.INT_VALUE; break; case FNEG: case F2I: case F2L: case F2D: case FRETURN: expected = BasicValue.FLOAT_VALUE; break; case LNEG: case L2I: case L2F: case L2D: case LRETURN: expected = BasicValue.LONG_VALUE; break; case DNEG: case D2I: case D2F: case D2L: case DRETURN: expected = BasicValue.DOUBLE_VALUE; break; case GETFIELD: expected = newValue(Type .getObjectType(((FieldInsnNode) insn).owner)); break; case CHECKCAST: if (!value.isReference()) { throw new AnalyzerException(insn, null, "an object reference", value); } return super.unaryOperation(insn, value); case ARRAYLENGTH: if (!isArrayValue(value)) { throw new AnalyzerException(insn, null, "an array reference", value); } return super.unaryOperation(insn, value); case ARETURN: case ATHROW: case INSTANCEOF: case MONITORENTER: case MONITOREXIT: case IFNULL: case IFNONNULL: if (!value.isReference()) { throw new AnalyzerException(insn, null, "an object reference", value); } return super.unaryOperation(insn, value); case PUTSTATIC: expected = newValue(Type.getType(((FieldInsnNode) insn).desc)); break; default: throw new Error("Internal error."); } if (!isSubTypeOf(value, expected)) { throw new AnalyzerException(insn, null, expected, value); } return super.unaryOperation(insn, value); }
Example #21
Source File: AnalyzerException.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public AnalyzerException(final AbstractInsnNode node, final String msg) { super(msg); this.node = node; }
Example #22
Source File: AnalyzerException.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public AnalyzerException(final AbstractInsnNode node, final String msg, final Throwable exception) { super(msg, exception); this.node = node; }
Example #23
Source File: AnalyzerException.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public AnalyzerException(final AbstractInsnNode node, final String msg, final Object expected, final Value encountered) { super((msg == null ? "Expected " : msg + ": expected ") + expected + ", but found " + encountered); this.node = node; }
Example #24
Source File: BasicVerifier.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public BasicValue ternaryOperation(final AbstractInsnNode insn, final BasicValue value1, final BasicValue value2, final BasicValue value3) throws AnalyzerException { BasicValue expected1; BasicValue expected3; switch (insn.getOpcode()) { case IASTORE: expected1 = newValue(Type.getType("[I")); expected3 = BasicValue.INT_VALUE; break; case BASTORE: if (isSubTypeOf(value1, newValue(Type.getType("[Z")))) { expected1 = newValue(Type.getType("[Z")); } else { expected1 = newValue(Type.getType("[B")); } expected3 = BasicValue.INT_VALUE; break; case CASTORE: expected1 = newValue(Type.getType("[C")); expected3 = BasicValue.INT_VALUE; break; case SASTORE: expected1 = newValue(Type.getType("[S")); expected3 = BasicValue.INT_VALUE; break; case LASTORE: expected1 = newValue(Type.getType("[J")); expected3 = BasicValue.LONG_VALUE; break; case FASTORE: expected1 = newValue(Type.getType("[F")); expected3 = BasicValue.FLOAT_VALUE; break; case DASTORE: expected1 = newValue(Type.getType("[D")); expected3 = BasicValue.DOUBLE_VALUE; break; case AASTORE: expected1 = value1; expected3 = BasicValue.REFERENCE_VALUE; break; default: throw new Error("Internal error."); } if (!isSubTypeOf(value1, expected1)) { throw new AnalyzerException(insn, "First argument", "a " + expected1 + " array reference", value1); } else if (!BasicValue.INT_VALUE.equals(value2)) { throw new AnalyzerException(insn, "Second argument", BasicValue.INT_VALUE, value2); } else if (!isSubTypeOf(value3, expected3)) { throw new AnalyzerException(insn, "Third argument", expected3, value3); } return null; }
Example #25
Source File: SourceValue.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public SourceValue(final int size, final AbstractInsnNode insn) { this.size = size; this.insns = new SmallSet<AbstractInsnNode>(insn, null); }
Example #26
Source File: BasicInterpreter.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public BasicValue newOperation(final AbstractInsnNode insn) throws AnalyzerException { switch (insn.getOpcode()) { case ACONST_NULL: return newValue(Type.getObjectType("null")); case ICONST_M1: case ICONST_0: case ICONST_1: case ICONST_2: case ICONST_3: case ICONST_4: case ICONST_5: return BasicValue.INT_VALUE; case LCONST_0: case LCONST_1: return BasicValue.LONG_VALUE; case FCONST_0: case FCONST_1: case FCONST_2: return BasicValue.FLOAT_VALUE; case DCONST_0: case DCONST_1: return BasicValue.DOUBLE_VALUE; case BIPUSH: case SIPUSH: return BasicValue.INT_VALUE; case LDC: Object cst = ((LdcInsnNode) insn).cst; if (cst instanceof Integer) { return BasicValue.INT_VALUE; } else if (cst instanceof Float) { return BasicValue.FLOAT_VALUE; } else if (cst instanceof Long) { return BasicValue.LONG_VALUE; } else if (cst instanceof Double) { return BasicValue.DOUBLE_VALUE; } else if (cst instanceof String) { return newValue(Type.getObjectType("java/lang/String")); } else if (cst instanceof Type) { int sort = ((Type) cst).getSort(); if (sort == Type.OBJECT || sort == Type.ARRAY) { return newValue(Type.getObjectType("java/lang/Class")); } else if (sort == Type.METHOD) { return newValue(Type .getObjectType("java/lang/invoke/MethodType")); } else { throw new IllegalArgumentException("Illegal LDC constant " + cst); } } else if (cst instanceof Handle) { return newValue(Type .getObjectType("java/lang/invoke/MethodHandle")); } else { throw new IllegalArgumentException("Illegal LDC constant " + cst); } case JSR: return BasicValue.RETURNADDRESS_VALUE; case GETSTATIC: return newValue(Type.getType(((FieldInsnNode) insn).desc)); case NEW: return newValue(Type.getObjectType(((TypeInsnNode) insn).desc)); default: throw new Error("Internal error."); } }
Example #27
Source File: AnalyzerException.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public AnalyzerException(final AbstractInsnNode node, final String msg, final Throwable exception) { super(msg, exception); this.node = node; }
Example #28
Source File: SourceValue.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public SourceValue(final int size, final AbstractInsnNode insn) { this.size = size; this.insns = new SmallSet<AbstractInsnNode>(insn, null); }
Example #29
Source File: BasicInterpreter.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public void returnOperation(final AbstractInsnNode insn, final BasicValue value, final BasicValue expected) throws AnalyzerException { }
Example #30
Source File: SourceInterpreter.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public SourceValue ternaryOperation(final AbstractInsnNode insn, final SourceValue value1, final SourceValue value2, final SourceValue value3) { return new SourceValue(1, insn); }