List of usage examples for org.objectweb.asm Opcodes FLOAD
int FLOAD
To view the source code for org.objectweb.asm Opcodes FLOAD.
Click Source Link
From source file:com.codename1.tools.translator.bytecodes.VarOp.java
License:Open Source License
@Override public boolean assignTo(String varName, StringBuilder sb) { StringBuilder b = new StringBuilder(); /*// w ww . j ava2 s . com if (typeVarName != null) { switch (opcode) { case Opcodes.ALOAD: b.append("locals["); b.append(var); b.append("].type = CN1_TYPE_OBJECT; "); break; } }*/ if (varName != null) { b.append(" "); b.append(varName).append(" = "); } switch (opcode) { case Opcodes.ILOAD: b.append("ilocals_"); b.append(var); b.append("_"); break; case Opcodes.LLOAD: b.append("llocals_"); b.append(var); b.append("_"); break; case Opcodes.FLOAD: b.append("flocals_"); b.append(var); b.append("_"); break; case Opcodes.DLOAD: b.append("dlocals_"); b.append(var); b.append("_"); break; case Opcodes.ALOAD: if (getMethod() != null && !getMethod().isStatic() && var == 0) { b.append("__cn1ThisObject"); } else { b.append("locals["); b.append(var); b.append("].data.o"); } break; default: return false; } if (varName != null) { b.append(";\n"); } sb.append(b); return true; }
From source file:com.codename1.tools.translator.bytecodes.VarOp.java
License:Open Source License
@Override public void appendInstruction(StringBuilder b) { b.append(" "); switch (opcode) { case Opcodes.ILOAD: b.append("(*SP).type = CN1_TYPE_INT; /* ILOAD */ \n" + " (*SP).data.i = ilocals_"); b.append(var); b.append("_; \n SP++;\n"); return;//from www .ja v a 2s. com case Opcodes.LLOAD: b.append("BC_LLOAD("); break; case Opcodes.FLOAD: b.append("BC_FLOAD("); break; case Opcodes.DLOAD: b.append("BC_DLOAD("); break; case Opcodes.ALOAD: b.append("BC_ALOAD("); break; case Opcodes.ISTORE: b.append("BC_ISTORE("); break; case Opcodes.LSTORE: b.append("BC_LSTORE("); break; case Opcodes.FSTORE: b.append("BC_FSTORE("); break; case Opcodes.DSTORE: b.append("BC_DSTORE("); break; case Opcodes.ASTORE: b.append("BC_ASTORE("); break; case Opcodes.RET: b.append("/* RET TODO */"); //b.append("goto label_"); //b.append(var); //b.append("; /* RET */\n"); return; case Opcodes.SIPUSH: case Opcodes.BIPUSH: b.append("PUSH_INT("); break; case Opcodes.NEWARRAY: switch (var) { case 4: // boolean b.append( "PUSH_OBJ(allocArray(threadStateData, POP_INT(), &class_array1__JAVA_BOOLEAN, sizeof(JAVA_ARRAY_BOOLEAN), 1));\n"); break; case 5: // char b.append( "PUSH_OBJ(allocArray(threadStateData, POP_INT(), &class_array1__JAVA_CHAR, sizeof(JAVA_ARRAY_CHAR), 1));\n"); break; case 6: // float b.append( "PUSH_OBJ(allocArray(threadStateData, POP_INT(), &class_array1__JAVA_FLOAT, sizeof(JAVA_ARRAY_FLOAT), 1));\n"); break; case 7: // double b.append( "PUSH_OBJ(allocArray(threadStateData, POP_INT(), &class_array1__JAVA_DOUBLE, sizeof(JAVA_ARRAY_DOUBLE), 1));\n"); break; case 8: // byte b.append( "PUSH_OBJ(allocArray(threadStateData, POP_INT(), &class_array1__JAVA_BYTE, sizeof(JAVA_ARRAY_BYTE), 1));\n"); break; case 9: // short b.append( "PUSH_OBJ(allocArray(threadStateData, POP_INT(), &class_array1__JAVA_SHORT, sizeof(JAVA_ARRAY_SHORT), 1));\n"); break; case 10: // int b.append( "PUSH_OBJ(allocArray(threadStateData, POP_INT(), &class_array1__JAVA_INT, sizeof(JAVA_ARRAY_INT), 1));\n"); break; case 11: // long b.append( "PUSH_OBJ(allocArray(threadStateData, POP_INT(), &class_array1__JAVA_LONG, sizeof(JAVA_ARRAY_LONG), 1));\n"); break; } return; default: throw new RuntimeException("Missing opcode: " + opcode); } b.append(var); b.append(");\n"); }
From source file:com.geeksaga.light.profiler.util.ASMUtil.java
License:Apache License
public static VarInsnNode createFLOAD(int index) { return new VarInsnNode(Opcodes.FLOAD, index); }
From source file:com.github.anba.es6draft.compiler.assembler.InstructionAssembler.java
License:Open Source License
private void load(int var, Type type) { assert var >= 0 && variables.isActive(var) : "variable is not initialized"; switch (type.getOpcode(Opcodes.ILOAD)) { case Opcodes.ILOAD: iload(var); return;//from ww w . j av a2 s. co m case Opcodes.LLOAD: lload(var); return; case Opcodes.FLOAD: fload(var); return; case Opcodes.DLOAD: dload(var); return; case Opcodes.ALOAD: aload(var); return; default: throw new IllegalArgumentException(); } }
From source file:com.github.anba.es6draft.compiler.assembler.InstructionAssembler.java
License:Open Source License
private void fload(int var) { methodVisitor.visitVarInsn(Opcodes.FLOAD, var); stack.fload(var); }
From source file:com.google.devtools.build.android.desugar.BytecodeTypeInference.java
License:Open Source License
@Override public void visitVarInsn(int opcode, int var) { switch (opcode) { case Opcodes.ILOAD: push(InferredType.INT);// w w w.ja va2 s .c o m break; case Opcodes.LLOAD: push(InferredType.LONG); push(InferredType.TOP); break; case Opcodes.FLOAD: push(InferredType.FLOAT); break; case Opcodes.DLOAD: push(InferredType.DOUBLE); push(InferredType.TOP); break; case Opcodes.ALOAD: push(getLocalVariableType(var)); break; case Opcodes.ISTORE: case Opcodes.FSTORE: case Opcodes.ASTORE: { InferredType type = pop(); setLocalVariableTypes(var, type); break; } case Opcodes.LSTORE: case Opcodes.DSTORE: { InferredType type = pop(2); setLocalVariableTypes(var, type); setLocalVariableTypes(var + 1, InferredType.TOP); break; } case Opcodes.RET: throw new RuntimeException("The instruction RET is not supported"); default: throw new RuntimeException("Unhandled opcode " + opcode); } super.visitVarInsn(opcode, var); }
From source file:com.google.devtools.build.wireless.testing.java.injector.TypeDescriptorTest.java
License:Apache License
/** * Test method for {@link TypeDescriptor#getLoadOpcode()}. *//*from w w w . j a v a 2 s.c o m*/ public void testGetLoadOpcode() { try { TypeDescriptor.VOID.getLoadOpcode(); fail("Void should have thrown an exception!"); } catch (IllegalStateException e) { // OK! } assertEquals("Wrong LOAD instruction", Opcodes.ILOAD, TypeDescriptor.BOOLEAN.getLoadOpcode()); assertEquals("Wrong STORE instruction", Opcodes.ILOAD, TypeDescriptor.BYTE.getLoadOpcode()); assertEquals("Wrong STORE instruction", Opcodes.ILOAD, TypeDescriptor.CHAR.getLoadOpcode()); assertEquals("Wrong STORE instruction", Opcodes.ILOAD, TypeDescriptor.SHORT.getLoadOpcode()); assertEquals("Wrong STORE instruction", Opcodes.ILOAD, TypeDescriptor.INTEGER.getLoadOpcode()); assertEquals("Wrong STORE instruction", Opcodes.LLOAD, TypeDescriptor.LONG.getLoadOpcode()); assertEquals("Wrong STORE instruction", Opcodes.FLOAD, TypeDescriptor.FLOAT.getLoadOpcode()); assertEquals("Wrong STORE instruction", Opcodes.DLOAD, TypeDescriptor.DOUBLE.getLoadOpcode()); assertEquals("Wrong STORE instruction", Opcodes.ALOAD, TypeDescriptor.CLASS.getLoadOpcode()); assertEquals("Wrong STORE instruction", Opcodes.ALOAD, TypeDescriptor.ARRAY.getLoadOpcode()); }
From source file:com.google.gwt.jvm.asm.NativeMethodDelegatingVisitor.java
License:Apache License
private int nativeDelegate_addArgument(String parameter, int index) { int size = 1; delegate.visitInsn(Opcodes.DUP);/*from w w w . j a va 2s . c o m*/ switch (parameter.charAt(0)) { case 'L': case '[': parameter = "Ljava/lang/Object;"; delegate.visitVarInsn(Opcodes.ALOAD, index); break; case 'Z': case 'B': case 'C': case 'S': case 'I': delegate.visitVarInsn(Opcodes.ILOAD, index); break; case 'J': delegate.visitVarInsn(Opcodes.LLOAD, index); size = 2; break; case 'F': delegate.visitVarInsn(Opcodes.FLOAD, index); break; case 'D': delegate.visitVarInsn(Opcodes.DLOAD, index); size = 2; break; default: throw new IllegalStateException(parameter); } delegate.visitMethodInsn(Opcodes.INVOKEVIRTUAL, InvocationDelegate, "addArg", "(" + parameter + ")V"); return size; }
From source file:com.google.test.metric.asm.MethodVisitorBuilder.java
License:Apache License
public void visitVarInsn(final int opcode, final int var) { switch (opcode) { case Opcodes.ILOAD: load(var, JavaType.INT); break;/* w w w . jav a 2s. c o m*/ case Opcodes.LLOAD: load(var, JavaType.LONG); break; case Opcodes.FLOAD: load(var, JavaType.FLOAT); break; case Opcodes.DLOAD: load(var, JavaType.DOUBLE); break; case Opcodes.ALOAD: load(var, JavaType.OBJECT); break; case Opcodes.ISTORE: store(var, JavaType.INT); break; case Opcodes.LSTORE: store(var, JavaType.LONG); break; case Opcodes.FSTORE: store(var, JavaType.FLOAT); break; case Opcodes.DSTORE: store(var, JavaType.DOUBLE); break; case Opcodes.ASTORE: store(var, JavaType.OBJECT); break; case Opcodes.RET: recorder.add(new Runnable() { public void run() { block.addOp(new RetSub(lineNumber)); } }); break; default: throw new UnsupportedOperationException("opcode: " + opcode); } }
From source file:com.hea3ven.hardmodetweaks.core.ClassTransformerHardModeTweaks.java
License:Open Source License
private MethodNode createNewCalcCelAngleMethod(String methodName, boolean obfuscated) { // > float calculateCelestialAngle(long time, float off) { // > return TimeTweaksManager.calculateCelestialAngle(time, off); // > }//from ww w.ja va 2s.c om MethodNode getWorldTimeMethod = new MethodNode(Opcodes.ASM4, Opcodes.ACC_PUBLIC, methodName, "(JF)F", null, null); getWorldTimeMethod.instructions.add(new VarInsnNode(Opcodes.LLOAD, 1)); getWorldTimeMethod.instructions.add(new VarInsnNode(Opcodes.FLOAD, 3)); getWorldTimeMethod.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/hea3ven/hardmodetweaks/TimeTweaksManager", "calculateCelestialAngle", "(JF)F")); getWorldTimeMethod.instructions.add(new InsnNode(Opcodes.FRETURN)); return getWorldTimeMethod; }