List of usage examples for org.objectweb.asm Opcodes LLOAD
int LLOAD
To view the source code for org.objectweb.asm Opcodes LLOAD.
Click Source Link
From source file:com.offbynull.coroutines.instrumenter.asm.InstructionUtils.java
License:Open Source License
/** * Generates instructions to save the local variables table to an object array. * * @param arrayLocalsVar variable that the object array containing local variables table is stored * @param tempObjectVar variable to use for temporary objects * @param frame execution frame at the instruction where the local variables table is to be saved * @return instructions to save the local variables table in to an array * @throws NullPointerException if any argument is {@code null} * @throws IllegalArgumentException if variables have the same index, or if variables have been released, or if variables are of wrong * type/*w w w. j a va 2s .c om*/ */ public static InsnList saveLocalVariableTable(Variable arrayLocalsVar, Variable tempObjectVar, Frame<BasicValue> frame) { Validate.notNull(arrayLocalsVar); Validate.notNull(tempObjectVar); Validate.notNull(frame); Validate.isTrue(arrayLocalsVar.getType().equals(Type.getType(Object[].class))); Validate.isTrue(tempObjectVar.getType().equals(Type.getType(Object.class))); validateLocalIndicies(arrayLocalsVar.getIndex(), tempObjectVar.getIndex()); InsnList ret = new InsnList(); // Create array and save it in local vars table ret.add(new LdcInsnNode(frame.getLocals())); ret.add(new TypeInsnNode(Opcodes.ANEWARRAY, "java/lang/Object")); ret.add(new VarInsnNode(Opcodes.ASTORE, arrayLocalsVar.getIndex())); // Save the locals for (int i = 0; i < frame.getLocals(); i++) { BasicValue basicValue = frame.getLocal(i); Type type = basicValue.getType(); // If type == null, basicValue is pointing to uninitialized var -- basicValue.toString() will return '.'. This means that this // slot contains nothing to save. So, skip this slot if we encounter it. if (type == null) { continue; } // If type is 'Lnull;', this means that the slot has been assigned null and that "there has been no merge yet that would 'raise' // the type toward some class or interface type" (from ASM mailing list). We know this slot will always contain null at this // point in the code so we can avoid saving it. When we load it back up, we can simply push a null in to that slot, thereby // keeping the same 'Lnull;' type. if ("Lnull;".equals(type.getDescriptor())) { continue; } // Convert the item to an object (if not already an object) and stores it in array. switch (type.getSort()) { case Type.BOOLEAN: ret.add(new VarInsnNode(Opcodes.ILOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;")); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.BYTE: ret.add(new VarInsnNode(Opcodes.ILOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.SHORT: ret.add(new VarInsnNode(Opcodes.ILOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.CHAR: ret.add(new VarInsnNode(Opcodes.ILOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.INT: ret.add(new VarInsnNode(Opcodes.ILOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.FLOAT: ret.add(new VarInsnNode(Opcodes.FLOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.LONG: ret.add(new VarInsnNode(Opcodes.LLOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.DOUBLE: ret.add(new VarInsnNode(Opcodes.DLOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.ARRAY: case Type.OBJECT: ret.add(new VarInsnNode(Opcodes.ALOAD, i)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.METHOD: case Type.VOID: default: throw new IllegalStateException(); } // Store item in to locals storage array ret.add(new VarInsnNode(Opcodes.ALOAD, arrayLocalsVar.getIndex())); ret.add(new LdcInsnNode(i)); ret.add(new VarInsnNode(Opcodes.ALOAD, tempObjectVar.getIndex())); ret.add(new InsnNode(Opcodes.AASTORE)); } return ret; }
From source file:com.offbynull.coroutines.instrumenter.generators.GenericGenerators.java
License:Open Source License
/** * Copies a local variable on to the stack. * @param variable variable within the local variable table to load from * @return instructions to load a local variable on to the stack * @throws NullPointerException if any argument is {@code null} * @throws IllegalArgumentException if {@code variable} has been released *///from w w w . ja va2 s. c o m public static InsnList loadVar(Variable variable) { Validate.notNull(variable); InsnList ret = new InsnList(); switch (variable.getType().getSort()) { case Type.BOOLEAN: case Type.BYTE: case Type.CHAR: case Type.SHORT: case Type.INT: ret.add(new VarInsnNode(Opcodes.ILOAD, variable.getIndex())); break; case Type.LONG: ret.add(new VarInsnNode(Opcodes.LLOAD, variable.getIndex())); break; case Type.FLOAT: ret.add(new VarInsnNode(Opcodes.FLOAD, variable.getIndex())); break; case Type.DOUBLE: ret.add(new VarInsnNode(Opcodes.DLOAD, variable.getIndex())); break; case Type.OBJECT: case Type.ARRAY: ret.add(new VarInsnNode(Opcodes.ALOAD, variable.getIndex())); // If required, do it outside this method // ret.add(new TypeInsnNode(Opcodes.CHECKCAST, variable.getType().getInternalName())); break; default: throw new IllegalStateException(); // should never happen, there is code in Variable/VariableTable to make sure invalid // types aren't set } return ret; }
From source file:com.offbynull.coroutines.instrumenter.LocalsStateGenerators.java
License:Open Source License
/** * Generates instructions to save the local variables table. * @param markerType debug marker type/*from ww w. jav a 2 s. c om*/ * @param storageVars variables to store locals in to * @param frame execution frame at the instruction where the local variables table is to be saved * @return instructions to save the local variables table in to an array * @throws NullPointerException if any argument is {@code null} */ public static InsnList saveLocals(MarkerType markerType, StorageVariables storageVars, Frame<BasicValue> frame) { Validate.notNull(markerType); Validate.notNull(storageVars); Validate.notNull(frame); Variable intsVar = storageVars.getIntStorageVar(); Variable floatsVar = storageVars.getFloatStorageVar(); Variable longsVar = storageVars.getLongStorageVar(); Variable doublesVar = storageVars.getDoubleStorageVar(); Variable objectsVar = storageVars.getObjectStorageVar(); int intsCounter = 0; int floatsCounter = 0; int longsCounter = 0; int doublesCounter = 0; int objectsCounter = 0; StorageSizes storageSizes = computeSizes(frame); InsnList ret = new InsnList(); // Create storage arrays and save them in respective storage vars ret.add(merge(debugMarker(markerType, "Saving locals"), mergeIf(intsVar != null, () -> new Object[] { debugMarker(markerType, "Generating ints container (" + storageSizes.getIntsSize() + ")"), new LdcInsnNode(storageSizes.getIntsSize()), new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_INT), new VarInsnNode(Opcodes.ASTORE, intsVar.getIndex()) }), mergeIf(floatsVar != null, () -> new Object[] { debugMarker(markerType, "Generating floats container (" + storageSizes.getFloatsSize() + ")"), new LdcInsnNode(storageSizes.getFloatsSize()), new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_FLOAT), new VarInsnNode(Opcodes.ASTORE, floatsVar.getIndex()) }), mergeIf(longsVar != null, () -> new Object[] { debugMarker(markerType, "Generating longs container (" + storageSizes.getLongsSize() + ")"), new LdcInsnNode(storageSizes.getLongsSize()), new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_LONG), new VarInsnNode(Opcodes.ASTORE, longsVar.getIndex()) }), mergeIf(doublesVar != null, () -> new Object[] { debugMarker(markerType, "Generating doubles container (" + storageSizes.getDoublesSize() + ")"), new LdcInsnNode(storageSizes.getDoublesSize()), new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_DOUBLE), new VarInsnNode(Opcodes.ASTORE, doublesVar.getIndex()) }), mergeIf(objectsVar != null, () -> new Object[] { debugMarker(markerType, "Generating objects container (" + storageSizes.getObjectsSize() + ")"), new LdcInsnNode(storageSizes.getObjectsSize()), new TypeInsnNode(Opcodes.ANEWARRAY, "java/lang/Object"), new VarInsnNode(Opcodes.ASTORE, objectsVar.getIndex()) }))); // Save the locals for (int i = 0; i < frame.getLocals(); i++) { BasicValue basicValue = frame.getLocal(i); Type type = basicValue.getType(); // If type == null, basicValue is pointing to uninitialized var -- basicValue.toString() will return '.'. This means that this // slot contains nothing to save. So, skip this slot if we encounter it. if (type == null) { ret.add(debugMarker(markerType, "Skipping uninitialized value at " + i)); continue; } // If type is 'Lnull;', this means that the slot has been assigned null and that "there has been no merge yet that would 'raise' // the type toward some class or interface type" (from ASM mailing list). We know this slot will always contain null at this // point in the code so we can avoid saving it. When we load it back up, we can simply push a null in to that slot, thereby // keeping the same 'Lnull;' type. if ("Lnull;".equals(type.getDescriptor())) { ret.add(debugMarker(markerType, "Skipping null value at " + i)); continue; } // Place item in to appropriate storage array switch (type.getSort()) { case Type.BOOLEAN: case Type.BYTE: case Type.SHORT: case Type.CHAR: case Type.INT: ret.add(debugMarker(markerType, "Inserting int at LVT index " + i + " to storage index " + intsCounter)); ret.add(new VarInsnNode(Opcodes.ALOAD, intsVar.getIndex())); // [int[]] ret.add(new LdcInsnNode(intsCounter)); // [int[], idx] ret.add(new VarInsnNode(Opcodes.ILOAD, i)); // [int[], idx, val] ret.add(new InsnNode(Opcodes.IASTORE)); // [] intsCounter++; break; case Type.FLOAT: ret.add(debugMarker(markerType, "Inserting float at LVT index " + i + " to storage index " + floatsCounter)); ret.add(new VarInsnNode(Opcodes.ALOAD, floatsVar.getIndex())); // [float[]] ret.add(new LdcInsnNode(floatsCounter)); // [float[], idx] ret.add(new VarInsnNode(Opcodes.FLOAD, i)); // [float[], idx, val] ret.add(new InsnNode(Opcodes.FASTORE)); // [] floatsCounter++; break; case Type.LONG: ret.add(debugMarker(markerType, "Inserting long at LVT index " + i + " to storage index " + longsCounter)); ret.add(new VarInsnNode(Opcodes.ALOAD, longsVar.getIndex())); // [long[]] ret.add(new LdcInsnNode(longsCounter)); // [long[], idx] ret.add(new VarInsnNode(Opcodes.LLOAD, i)); // [long[], idx, val] ret.add(new InsnNode(Opcodes.LASTORE)); // [] longsCounter++; break; case Type.DOUBLE: ret.add(debugMarker(markerType, "Inserting double at LVT index " + i + " to storage index " + doublesCounter)); ret.add(new VarInsnNode(Opcodes.ALOAD, doublesVar.getIndex())); // [double[]] ret.add(new LdcInsnNode(doublesCounter)); // [double[], idx] ret.add(new VarInsnNode(Opcodes.DLOAD, i)); // [double[], idx, val] ret.add(new InsnNode(Opcodes.DASTORE)); // [] doublesCounter++; break; case Type.ARRAY: case Type.OBJECT: ret.add(debugMarker(markerType, "Inserting object at LVT index " + i + " to storage index " + objectsCounter)); ret.add(new VarInsnNode(Opcodes.ALOAD, objectsVar.getIndex())); // [Object[]] ret.add(new LdcInsnNode(objectsCounter)); // [Object[], idx] ret.add(new VarInsnNode(Opcodes.ALOAD, i)); // [Object[], idx, val] ret.add(new InsnNode(Opcodes.AASTORE)); // [] objectsCounter++; break; case Type.METHOD: case Type.VOID: default: throw new IllegalStateException(); } } return ret; }
From source file:com.sun.fortress.compiler.asmbytecodeoptimizer.DefUseChains.java
License:Open Source License
private static void removeUnboxedValueInsns(AbstractInterpretationValue val, ByteCodeMethodVisitor bcmv) { for (Insn i : val.getDefs()) removeInsn(bcmv, i, val, "RemovingBoxedValueDefinition"); for (Insn i : val.getUses()) { if (i.isBoxingMethod()) { removeInsn(bcmv, i, val, "RemoveBoxingMethod"); } else if (i.isUnBoxingMethod()) { removeInsn(bcmv, i, val, "UnboxingMethod"); } else if (i.isCheckCast()) { removeInsn(bcmv, i, val, "CheckCast"); // FIXME CHF } else if (i instanceof VarInsn) { VarInsn vi = (VarInsn) i;//from ww w. j a va 2 s. co m if (vi.opcode == Opcodes.ASTORE) { int j = bcmv.insns.indexOf(i); removeInsn(bcmv, i, val, "astoreconversion" + val.getType()); if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FZZ32;")) bcmv.insns.add(j, new VarInsn("ISTORE", Opcodes.ISTORE, val.getValueNumber(), vi.index)); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FZZ64;")) bcmv.insns.add(j, new VarInsn("LSTORE", Opcodes.LSTORE, val.getValueNumber(), vi.index)); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FRR32;")) bcmv.insns.add(j, new VarInsn("FSTORE", Opcodes.FSTORE, val.getValueNumber(), vi.index)); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FRR64;")) bcmv.insns.add(j, new VarInsn("DSTORE", Opcodes.DSTORE, val.getValueNumber(), vi.index)); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FBoolean;")) bcmv.insns.add(j, new VarInsn("ISTORE", Opcodes.ISTORE, val.getValueNumber(), vi.index)); else bcmv.insns.add(j, new VarInsn("ASTORE", Opcodes.ASTORE, val.getValueNumber(), vi.index)); } else if (vi.opcode == Opcodes.ALOAD) { int j = bcmv.insns.indexOf(i); removeInsn(bcmv, i, val, "Aloadconversion" + val.getType()); if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FZZ32;")) bcmv.insns.add(j, new VarInsn("ILOAD", Opcodes.ILOAD, val.getValueNumber(), vi.index)); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FZZ64;")) bcmv.insns.add(j, new VarInsn("LLOAD", Opcodes.LLOAD, val.getValueNumber(), vi.index)); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FRR32;")) bcmv.insns.add(j, new VarInsn("FLOAD", Opcodes.FLOAD, val.getValueNumber(), vi.index)); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FRR64;")) bcmv.insns.add(j, new VarInsn("DLOAD", Opcodes.DLOAD, val.getValueNumber(), vi.index)); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FBoolean;")) bcmv.insns.add(j, new VarInsn("ILOAD", Opcodes.ILOAD, val.getValueNumber(), vi.index)); else bcmv.insns.add(j, new VarInsn("ALOAD", Opcodes.ALOAD, val.getValueNumber(), vi.index)); } } else if (i instanceof SingleInsn) { SingleInsn si = (SingleInsn) i; if (si.opcode == Opcodes.ARETURN) { int j = bcmv.insns.indexOf(i); if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FZZ32;")) bcmv.insns.add(j, new MethodInsn("INVOKESTATIC", Opcodes.INVOKESTATIC, "com/sun/fortress/compiler/runtimeValues/FZZ32", "make", "(I)Lcom/sun/fortress/compiler/runtimeValues/FZZ32;", "ReboxingReturnValue")); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FZZ64;")) bcmv.insns.add(j, new MethodInsn("INVOKESTATIC", Opcodes.INVOKESTATIC, "com/sun/fortress/compiler/runtimeValues/FZZ64", "make", "(J)Lcom/sun/fortress/compiler/runtimeValues/FZZ64;", "ReboxingReturnValue")); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FRR32;")) bcmv.insns.add(j, new MethodInsn("INVOKESTATIC", Opcodes.INVOKESTATIC, "com/sun/fortress/compiler/runtimeValues/FRR32", "make", "(F)Lcom/sun/fortress/compiler/runtimeValues/FRR32;", "ReboxingReturnValue")); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FRR64;")) bcmv.insns.add(j, new MethodInsn("INVOKESTATIC", Opcodes.INVOKESTATIC, "com/sun/fortress/compiler/runtimeValues/FRR64", "make", "(D)Lcom/sun/fortress/compiler/runtimeValues/FRR64;", "ReboxingReturnValue")); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FVoid;")) bcmv.insns.add(j, new MethodInsn("INVOKESTATIC", Opcodes.INVOKESTATIC, "com/sun/fortress/compiler/runtimeValues/FVoid", "make", "()Lcom/sun/fortress/compiler/runtimeValues/FVoid;", "ReboxingReturnValue")); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FBoolean;")) bcmv.insns.add(j, new MethodInsn("INVOKESTATIC", Opcodes.INVOKESTATIC, "com/sun/fortress/compiler/runtimeValues/FBoolean", "make", "(Z)Lcom/sun/fortress/compiler/runtimeValues/FBoolean;", "ReboxingReturnValue")); else if (val.getType().equals("Lcom/sun/fortress/compiler/runtimeValues/FJavaString;")) bcmv.insns.add(j, new MethodInsn("INVOKESTATIC", Opcodes.INVOKESTATIC, "com/sun/fortress/compiler/runtimeValues/FJavaString", "make", "(java.lang.String)Lcom/sun/fortress/compiler/runtimeValues/FJavaString;", "ReboxingReturnValue")); else throw new RuntimeException("Don't recognize var type " + val.getType()); } } } }
From source file:com.sun.fortress.compiler.asmbytecodeoptimizer.Inlining.java
License:Open Source License
public static List<Insn> convertInsns(MethodInsn mi, List<Insn> insns, int[] args, int _index, Label end) { List<Insn> result = new ArrayList<Insn>(); HashMap labels = new HashMap(); int index = _index; for (Insn i : insns) { if (i.isExpanded()) { MethodInsn expanded = (MethodInsn) i; // This use of end should be OK because all returns should have been removed when inlined before. // What could go wrong? result.addAll(convertInsns(expanded, expanded.inlineExpansionInsns, args, _index, end)); } else if (i instanceof SingleInsn) { SingleInsn si = (SingleInsn) i; switch (si.opcode) { case Opcodes.IRETURN: case Opcodes.LRETURN: case Opcodes.FRETURN: case Opcodes.DRETURN: case Opcodes.ARETURN: case Opcodes.RETURN: result.add(new JumpInsn("RETURN->GOTO", Opcodes.GOTO, end, newIndex(mi, index++))); break; default: result.add(i.copy(newIndex(mi, index++))); }//from ww w . j a va 2 s . c o m } else if (i instanceof VarInsn) { VarInsn vi = (VarInsn) i; switch (vi.opcode) { case Opcodes.ILOAD: case Opcodes.LLOAD: case Opcodes.FLOAD: case Opcodes.DLOAD: case Opcodes.ALOAD: case Opcodes.ISTORE: case Opcodes.LSTORE: case Opcodes.FSTORE: case Opcodes.DSTORE: case Opcodes.ASTORE: VarInsn newVarInsn = new VarInsn(vi.name, vi.opcode, args[vi.var], newIndex(mi, index++)); result.add(newVarInsn); break; default: result.add(i.copy(newIndex(mi, index++))); } } else if (i instanceof VisitMaxs) { } else if (i instanceof VisitEnd) { } else if (i instanceof VisitCode) { } else if (i instanceof VisitFrame) { } else if (i instanceof LabelInsn) { LabelInsn li = (LabelInsn) i; if (labels.containsKey(li.label)) result.add(new LabelInsn(li.name, (Label) labels.get(li.label), newIndex(mi, index++))); else { Label l = new Label(); labels.put(li.label, l); result.add(new LabelInsn(li.name, l, newIndex(mi, index++))); } } else if (i instanceof JumpInsn) { JumpInsn ji = (JumpInsn) i; if (labels.containsKey(ji.label)) result.add( new JumpInsn(ji.name, ji.opcode, (Label) labels.get(ji.label), newIndex(mi, index++))); else { Label l = new Label(); labels.put(ji.label, l); result.add(new JumpInsn(ji.name, ji.opcode, l, newIndex(mi, index++))); } } else if (i instanceof VisitLineNumberInsn) { VisitLineNumberInsn vlni = (VisitLineNumberInsn) i; if (labels.containsKey(vlni.start)) result.add(new VisitLineNumberInsn(vlni.name, vlni.line, (Label) labels.get(vlni.start), newIndex(mi, index++))); else { Label l = new Label(); labels.put(vlni.start, l); result.add(new VisitLineNumberInsn(vlni.name, vlni.line, l, newIndex(mi, index++))); } } else if (i instanceof LocalVariableInsn) { LocalVariableInsn lvi = (LocalVariableInsn) i; if (labels.containsKey(lvi.start) && labels.containsKey(lvi.end)) { result.add(new LocalVariableInsn(lvi.name, lvi._name, lvi.desc, lvi.sig, (Label) labels.get(lvi.start), (Label) labels.get(lvi.end), args[lvi._index], newIndex(mi, index++))); } else throw new RuntimeException("NYI"); } else if (i instanceof TryCatchBlock) { TryCatchBlock tcb = (TryCatchBlock) i; if (labels.containsKey(tcb.start) && labels.containsKey(tcb.end) && labels.containsKey(tcb.handler)) { result.add( new TryCatchBlock(tcb.name, (Label) labels.get(tcb.start), (Label) labels.get(tcb.end), (Label) labels.get(tcb.handler), tcb.type, newIndex(mi, index++))); } else if (!labels.containsKey(tcb.start) && !labels.containsKey(tcb.end) && !labels.containsKey(tcb.handler)) { Label s = new Label(); Label e = new Label(); Label h = new Label(); labels.put(tcb.start, s); labels.put(tcb.end, e); labels.put(tcb.handler, h); result.add(new TryCatchBlock(tcb.name, s, e, h, tcb.type, newIndex(mi, index++))); } else throw new RuntimeException("NYI"); // Need to add TableSwitch, LookupSwitch } else { result.add(i.copy(newIndex(mi, index++))); } } return result; }
From source file:com.trigersoft.jaque.expression.ExpressionMethodVisitor.java
License:Apache License
@Override public void visitVarInsn(int opcode, int var) { if (_me != null) { if (var == 0) { _exprStack.push(_me);// w w w . jav a 2 s. c o m return; } var--; } Class<?> type; switch (opcode) { case Opcodes.ISTORE: case Opcodes.LSTORE: case Opcodes.FSTORE: case Opcodes.DSTORE: case Opcodes.ASTORE: case Opcodes.RET: default: throw notLambda(opcode); case Opcodes.ILOAD: type = Integer.TYPE; break; case Opcodes.LLOAD: type = Long.TYPE; break; case Opcodes.FLOAD: type = Float.TYPE; break; case Opcodes.DLOAD: type = Double.TYPE; break; case Opcodes.ALOAD: type = _argTypes[var]; break; } _exprStack.push(Expression.parameter(type, var)); }
From source file:de.tuberlin.uebb.jbop.optimizer.methodsplitter.Block.java
License:Open Source License
private int getOpcode(final Type type) { if (Type.BOOLEAN_TYPE.equals(type)) { return Opcodes.ILOAD; }//w ww . j a v a2 s. co m if (Type.INT_TYPE.equals(type)) { return Opcodes.ILOAD; } if (Type.FLOAT_TYPE.equals(type)) { return Opcodes.FLOAD; } if (Type.LONG_TYPE.equals(type)) { return Opcodes.LLOAD; } if (Type.DOUBLE_TYPE.equals(type)) { return Opcodes.DLOAD; } if (Type.CHAR_TYPE.equals(type)) { return Opcodes.ILOAD; } return Opcodes.ALOAD; }
From source file:de.tuberlin.uebb.jbop.optimizer.methodsplitter.Block.java
License:Open Source License
private Type getTypeIfSimpleType(final AbstractInsnNode node) { final int opcode = node.getOpcode(); if ((opcode == Opcodes.ILOAD) || (opcode == Opcodes.ISTORE) || (opcode == Opcodes.IRETURN)) { return Type.INT_TYPE; }/*from w w w. j a v a 2 s . c o m*/ if ((opcode == Opcodes.FLOAD) || (opcode == Opcodes.FSTORE) || (opcode == Opcodes.FRETURN)) { return Type.FLOAT_TYPE; } if ((opcode == Opcodes.LLOAD) || (opcode == Opcodes.LSTORE) || (opcode == Opcodes.LRETURN)) { return Type.LONG_TYPE; } if ((opcode == Opcodes.DLOAD) || (opcode == Opcodes.DSTORE) || (opcode == Opcodes.DRETURN)) { return Type.DOUBLE_TYPE; } return null; }
From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.VarInstruction.java
License:Open Source License
public VarInstruction(final ReadMethod readMethod, final int opcode, final int lineNumber, final int localVarIndex) { super(readMethod, opcode, lineNumber); assert opcode == Opcodes.ILOAD || opcode == Opcodes.LLOAD || opcode == Opcodes.FLOAD || opcode == Opcodes.DLOAD || opcode == Opcodes.ALOAD || opcode == Opcodes.ISTORE || opcode == Opcodes.LSTORE || opcode == Opcodes.FSTORE || opcode == Opcodes.DSTORE || opcode == Opcodes.ASTORE || opcode == Opcodes.RET; this.localVarIndex = localVarIndex; }
From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.VarInstruction.java
License:Open Source License
private VarInstruction(final ReadMethod readMethod, final int lineNumber, final int opcode, final int localVarIndex, final int index) { super(readMethod, opcode, lineNumber, index); assert opcode == Opcodes.ILOAD || opcode == Opcodes.LLOAD || opcode == Opcodes.FLOAD || opcode == Opcodes.DLOAD || opcode == Opcodes.ALOAD || opcode == Opcodes.ISTORE || opcode == Opcodes.LSTORE || opcode == Opcodes.FSTORE || opcode == Opcodes.DSTORE || opcode == Opcodes.ASTORE || opcode == Opcodes.RET; this.localVarIndex = localVarIndex; }