Java Code Examples for org.objectweb.asm.Opcodes#FSTORE
The following examples show how to use
org.objectweb.asm.Opcodes#FSTORE .
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: BytecodeMethod.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void addVariableOperation(int opcode, int var) { VarOp op = new VarOp(opcode, var); LocalVariable lv = null; switch (opcode) { case Opcodes.ISTORE: lv = new LocalVariable("v"+var, "I", "I", null, null, var); break; case Opcodes.LSTORE: lv = new LocalVariable("v"+var, "J", "J", null, null, var); break; case Opcodes.FSTORE: lv = new LocalVariable("v"+var, "F", "F", null, null, var); break; case Opcodes.DSTORE: lv = new LocalVariable("v"+var, "D", "D", null, null, var); break; } if (lv != null && !localVariables.contains(lv)) { localVariables.add(lv); } addInstruction(op); }
Example 2
Source File: MemberSubstitution.java From byte-buddy with Apache License 2.0 | 6 votes |
@Override @SuppressFBWarnings(value = "SF_SWITCH_NO_DEFAULT", justification = "No action required on default option.") public void visitVarInsn(int opcode, int offset) { switch (opcode) { case Opcodes.ISTORE: case Opcodes.FSTORE: case Opcodes.ASTORE: localVariableExtension = Math.max(localVariableExtension, offset + 1); break; case Opcodes.LSTORE: case Opcodes.DSTORE: localVariableExtension = Math.max(localVariableExtension, offset + 2); break; } super.visitVarInsn(opcode, offset); }
Example 3
Source File: TypeUtils.java From maple-ir with GNU General Public License v3.0 | 6 votes |
public static int getVariableStoreOpcode(Type type) { if (type.getSort() >= Type.BOOLEAN && type.getSort() <= Type.INT) { return Opcodes.ISTORE; } else if (type == Type.LONG_TYPE) { return Opcodes.LSTORE; } else if (type == Type.FLOAT_TYPE) { return Opcodes.FSTORE; } else if (type == Type.DOUBLE_TYPE) { return Opcodes.DSTORE; } else if (type.getSort() >= Type.ARRAY && type.getSort() <= Type.OBJECT) { return Opcodes.ASTORE; } else { return getVariableStoreOpcode(asSimpleType(type)); // throw new IllegalArgumentException(type.toString()); } }
Example 4
Source File: ASMUtils.java From radon with GNU General Public License v3.0 | 6 votes |
public static int getVarOpcode(Type type, boolean store) { switch (type.getSort()) { case Type.BOOLEAN: case Type.CHAR: case Type.BYTE: case Type.SHORT: case Type.INT: return store ? Opcodes.ISTORE : Opcodes.ILOAD; case Type.FLOAT: return store ? Opcodes.FSTORE : Opcodes.FLOAD; case Type.LONG: return store ? Opcodes.LSTORE : Opcodes.LLOAD; case Type.DOUBLE: return store ? Opcodes.DSTORE : Opcodes.DLOAD; case Type.ARRAY: case Type.OBJECT: return store ? Opcodes.ASTORE : Opcodes.ALOAD; default: throw new AssertionError("Unknown type: " + type.getClassName()); } }
Example 5
Source File: LocalVariableAwareMethodVisitor.java From byte-buddy with Apache License 2.0 | 6 votes |
@Override @SuppressFBWarnings(value = "SF_SWITCH_NO_DEFAULT", justification = "No action required on default option.") public void visitVarInsn(int opcode, int offset) { switch (opcode) { case Opcodes.ISTORE: case Opcodes.FSTORE: case Opcodes.ASTORE: freeOffset = Math.max(freeOffset, offset + 1); break; case Opcodes.LSTORE: case Opcodes.DSTORE: freeOffset = Math.max(freeOffset, offset + 2); break; } super.visitVarInsn(opcode, offset); }
Example 6
Source File: LocalVariablesSorter.java From Concurnas with MIT License | 5 votes |
@Override public void visitVarInsn(final int opcode, final int var) { Type varType; switch (opcode) { case Opcodes.LLOAD: case Opcodes.LSTORE: varType = Type.LONG_TYPE; break; case Opcodes.DLOAD: case Opcodes.DSTORE: varType = Type.DOUBLE_TYPE; break; case Opcodes.FLOAD: case Opcodes.FSTORE: varType = Type.FLOAT_TYPE; break; case Opcodes.ILOAD: case Opcodes.ISTORE: varType = Type.INT_TYPE; break; case Opcodes.ALOAD: case Opcodes.ASTORE: case Opcodes.RET: varType = OBJECT_TYPE; break; default: throw new IllegalArgumentException("Invalid opcode " + opcode); } super.visitVarInsn(opcode, remap(var, varType)); }
Example 7
Source File: VarOp.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public boolean assignFrom(AssignableExpression ex, StringBuilder b) { b.append(" /* VarOp.assignFrom */ "); switch (opcode) { case Opcodes.ISTORE: return ex.assignTo("ilocals_"+var+"_", b); case Opcodes.LSTORE: return ex.assignTo("llocals_"+var+"_", b); case Opcodes.FSTORE: return ex.assignTo("flocals_"+var+"_", b); case Opcodes.DSTORE: return ex.assignTo("dlocals_"+var+"_", b); case Opcodes.ASTORE: { StringBuilder sb = new StringBuilder(); sb.append("locals[").append(var).append("].type=CN1_TYPE_INVALID;"); boolean res = ex.assignTo("locals["+var+"].data.o", sb); if (!res) { return false; } sb.append("locals[").append(var).append("].type=CN1_TYPE_OBJECT;"); b.append(sb); return true; } } b.append("\n"); return false; }
Example 8
Source File: TreeInstructions.java From instrumentation with Apache License 2.0 | 5 votes |
public static VarInsnNode getStoreInst(Type type, int position) { int opCode = -1; switch (type.getDescriptor().charAt(0)) { case 'B': opCode = Opcodes.ISTORE; break; case 'C': opCode = Opcodes.ISTORE; break; case 'D': opCode = Opcodes.DSTORE; break; case 'F': opCode = Opcodes.FSTORE; break; case 'I': opCode = Opcodes.ISTORE; break; case 'J': opCode = Opcodes.LSTORE; break; case 'L': opCode = Opcodes.ASTORE; break; case '[': opCode = Opcodes.ASTORE; break; case 'Z': opCode = Opcodes.ISTORE; break; case 'S': opCode = Opcodes.ISTORE; break; default: throw new ClassFormatError("Invalid method signature: " + type.getDescriptor()); } return new VarInsnNode(opCode, position); }
Example 9
Source File: InstructionAdapter.java From JReFrameworker with MIT License | 5 votes |
@Override public void visitVarInsn(final int opcode, final int var) { switch (opcode) { case Opcodes.ILOAD: load(var, Type.INT_TYPE); break; case Opcodes.LLOAD: load(var, Type.LONG_TYPE); break; case Opcodes.FLOAD: load(var, Type.FLOAT_TYPE); break; case Opcodes.DLOAD: load(var, Type.DOUBLE_TYPE); break; case Opcodes.ALOAD: load(var, OBJECT_TYPE); break; case Opcodes.ISTORE: store(var, Type.INT_TYPE); break; case Opcodes.LSTORE: store(var, Type.LONG_TYPE); break; case Opcodes.FSTORE: store(var, Type.FLOAT_TYPE); break; case Opcodes.DSTORE: store(var, Type.DOUBLE_TYPE); break; case Opcodes.ASTORE: store(var, OBJECT_TYPE); break; case Opcodes.RET: ret(var); break; default: throw new IllegalArgumentException(); } }
Example 10
Source File: LocalVariablesSorter.java From JReFrameworker with MIT License | 5 votes |
@Override public void visitVarInsn(final int opcode, final int var) { Type varType; switch (opcode) { case Opcodes.LLOAD: case Opcodes.LSTORE: varType = Type.LONG_TYPE; break; case Opcodes.DLOAD: case Opcodes.DSTORE: varType = Type.DOUBLE_TYPE; break; case Opcodes.FLOAD: case Opcodes.FSTORE: varType = Type.FLOAT_TYPE; break; case Opcodes.ILOAD: case Opcodes.ISTORE: varType = Type.INT_TYPE; break; case Opcodes.ALOAD: case Opcodes.ASTORE: case Opcodes.RET: varType = OBJECT_TYPE; break; default: throw new IllegalArgumentException("Invalid opcode " + opcode); } super.visitVarInsn(opcode, remap(var, varType)); }
Example 11
Source File: LocalVariablesSorter.java From JReFrameworker with MIT License | 5 votes |
@Override public void visitVarInsn(final int opcode, final int var) { Type varType; switch (opcode) { case Opcodes.LLOAD: case Opcodes.LSTORE: varType = Type.LONG_TYPE; break; case Opcodes.DLOAD: case Opcodes.DSTORE: varType = Type.DOUBLE_TYPE; break; case Opcodes.FLOAD: case Opcodes.FSTORE: varType = Type.FLOAT_TYPE; break; case Opcodes.ILOAD: case Opcodes.ISTORE: varType = Type.INT_TYPE; break; case Opcodes.ALOAD: case Opcodes.ASTORE: case Opcodes.RET: varType = OBJECT_TYPE; break; default: throw new IllegalArgumentException("Invalid opcode " + opcode); } super.visitVarInsn(opcode, remap(var, varType)); }
Example 12
Source File: InstructionAdapter.java From JByteMod-Beta with GNU General Public License v2.0 | 5 votes |
@Override public void visitVarInsn(final int opcode, final int var) { switch (opcode) { case Opcodes.ILOAD: load(var, Type.INT_TYPE); break; case Opcodes.LLOAD: load(var, Type.LONG_TYPE); break; case Opcodes.FLOAD: load(var, Type.FLOAT_TYPE); break; case Opcodes.DLOAD: load(var, Type.DOUBLE_TYPE); break; case Opcodes.ALOAD: load(var, OBJECT_TYPE); break; case Opcodes.ISTORE: store(var, Type.INT_TYPE); break; case Opcodes.LSTORE: store(var, Type.LONG_TYPE); break; case Opcodes.FSTORE: store(var, Type.FLOAT_TYPE); break; case Opcodes.DSTORE: store(var, Type.DOUBLE_TYPE); break; case Opcodes.ASTORE: store(var, OBJECT_TYPE); break; case Opcodes.RET: ret(var); break; default: throw new IllegalArgumentException(); } }
Example 13
Source File: LocalVariablesSorter.java From JByteMod-Beta with GNU General Public License v2.0 | 5 votes |
@Override public void visitVarInsn(final int opcode, final int var) { Type varType; switch (opcode) { case Opcodes.LLOAD: case Opcodes.LSTORE: varType = Type.LONG_TYPE; break; case Opcodes.DLOAD: case Opcodes.DSTORE: varType = Type.DOUBLE_TYPE; break; case Opcodes.FLOAD: case Opcodes.FSTORE: varType = Type.FLOAT_TYPE; break; case Opcodes.ILOAD: case Opcodes.ISTORE: varType = Type.INT_TYPE; break; case Opcodes.ALOAD: case Opcodes.ASTORE: case Opcodes.RET: varType = OBJECT_TYPE; break; default: throw new IllegalArgumentException("Invalid opcode " + opcode); } super.visitVarInsn(opcode, remap(var, varType)); }
Example 14
Source File: InstructionAdapter.java From Concurnas with MIT License | 5 votes |
@Override public void visitVarInsn(final int opcode, final int var) { switch (opcode) { case Opcodes.ILOAD: load(var, Type.INT_TYPE); break; case Opcodes.LLOAD: load(var, Type.LONG_TYPE); break; case Opcodes.FLOAD: load(var, Type.FLOAT_TYPE); break; case Opcodes.DLOAD: load(var, Type.DOUBLE_TYPE); break; case Opcodes.ALOAD: load(var, OBJECT_TYPE); break; case Opcodes.ISTORE: store(var, Type.INT_TYPE); break; case Opcodes.LSTORE: store(var, Type.LONG_TYPE); break; case Opcodes.FSTORE: store(var, Type.FLOAT_TYPE); break; case Opcodes.DSTORE: store(var, Type.DOUBLE_TYPE); break; case Opcodes.ASTORE: store(var, OBJECT_TYPE); break; case Opcodes.RET: ret(var); break; default: throw new IllegalArgumentException(); } }
Example 15
Source File: ANFTransform.java From Concurnas with MIT License | 5 votes |
public static int getStoreOp(char c){ switch(c){ case 'Z': return Opcodes.ISTORE ; case 'B': return Opcodes.ISTORE ; case 'S': return Opcodes.ISTORE; case 'I': return Opcodes.ISTORE ; case 'J': return Opcodes.LSTORE ; case 'F': return Opcodes.FSTORE ; case 'D': return Opcodes.DSTORE ; case 'C': return Opcodes.ISTORE ; default: return Opcodes.ASTORE; } }
Example 16
Source File: MethodVisitorBuilder.java From testability-explorer with Apache License 2.0 | 4 votes |
public void visitVarInsn(final int opcode, final int var) { switch (opcode) { case Opcodes.ILOAD : load(var, JavaType.INT); break; 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); } }
Example 17
Source File: MethodAnalyzer.java From deobfuscator with Apache License 2.0 | 4 votes |
public static AnalyzerResult analyze(ClassNode classNode, MethodNode method) { if (Modifier.isAbstract(method.access) || Modifier.isNative(method.access)) { return AnalyzerResult.EMPTY_RESULT; } AnalyzerResult result = new AnalyzerResult(); result.frames = new HashMap<>(); List<StackObject> stack = new ArrayList<>(); List<StackObject> locals = new ArrayList<>(); int counter = 0; if (!Modifier.isStatic(method.access)) { locals.add(new StackObject(new ArgumentFrame(Opcodes.ASTORE, 0), classNode.name)); counter++; } for (Type type : Type.getArgumentTypes(method.desc)) { Class<?> clazz = PrimitiveUtils.getPrimitiveByName(type.getClassName()); int opcode; if(clazz == int.class) opcode = Opcodes.ISTORE; else if(clazz == long.class) opcode = Opcodes.LSTORE; else if(clazz == double.class) opcode = Opcodes.DSTORE; else if(clazz == float.class) opcode = Opcodes.FSTORE; else opcode = Opcodes.ASTORE; ArgumentFrame frame = new ArgumentFrame(opcode, counter); counter++; if (clazz == null) { locals.add(new StackObject(Object.class, frame, type.getInternalName())); } else { locals.add(new StackObject(clazz, frame)); } if (clazz == double.class || clazz == long.class) { locals.add(new StackObject(clazz, frame)); } } Map<AbstractInsnNode, List<TryCatchBlockNode>> handlers = new HashMap<>(); if (method.tryCatchBlocks != null) { for (TryCatchBlockNode node : method.tryCatchBlocks) { AbstractInsnNode start = node.start; while (start != node.end) { handlers.computeIfAbsent(start, k -> new ArrayList<>()).add(node); start = start.getNext(); } } } try { execute(classNode, method, method.instructions.getFirst(), stack, locals, handlers, result, new HashSet<>()); } catch (StackOverflowError e) { if (Boolean.getBoolean("com.javadeobfuscator.MethodAnalyzer.debug") || DEBUG) { throw e; } throw new PreventableStackOverflowError("Ran out of stack space while analyzing a method"); } return result; }
Example 18
Source File: JVMImpl.java From serianalyzer with GNU General Public License v3.0 | 4 votes |
/** * @param opcode * @param var * @param s */ static void handleVarInsn ( int opcode, int var, JVMStackState s ) { Set<BaseType> v; switch ( opcode ) { case Opcodes.LLOAD: case Opcodes.ILOAD: case Opcodes.FLOAD: case Opcodes.DLOAD: case Opcodes.ALOAD: v = s.getVariable(var); if ( log.isTraceEnabled() ) { log.trace("LOAD " + opcode + "@" + var + ":" + v); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } if ( v == null || v.isEmpty() ) { s.push(new BasicVariable(toType(opcode), "unknown " + var, true)); //$NON-NLS-1$ } else if ( v.size() == 1 ) { s.push(v.iterator().next()); } else { Set<BaseType> alts = new HashSet<>(); for ( BaseType o : v ) { if ( o instanceof MultiAlternatives && ! ( (MultiAlternatives) o ).getAlternatives().isEmpty() ) { alts.addAll( ( (MultiAlternatives) o ).getAlternatives()); } else { alts.add(o); } } s.push(new MultiAlternatives(alts)); } break; case Opcodes.LSTORE: case Opcodes.ISTORE: case Opcodes.FSTORE: case Opcodes.DSTORE: case Opcodes.ASTORE: s.getVariable(var).add(s.pop()); break; case Opcodes.RET: break; default: log.warn("Unimplemented opcode " + opcode); //$NON-NLS-1$ } }
Example 19
Source File: VarOp.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
public boolean assignFrom(CustomInvoke ex, StringBuilder b) { b.append(" /* VarOp.assignFrom */ "); StringBuilder sb = new StringBuilder(); switch (opcode) { case Opcodes.ISTORE: if (ex.appendExpression(sb)) { b.append("ilocals_").append(var).append("_ = ").append(sb.toString().trim()).append(";\n"); return true; } break; case Opcodes.LSTORE: if (ex.appendExpression(sb)) { b.append("llocals_").append(var).append("_ = ").append(sb.toString().trim()).append(";\n"); return true; } break; case Opcodes.FSTORE: if (ex.appendExpression(sb)) { b.append("flocals_").append(var).append("_ = ").append(sb.toString().trim()).append(";\n"); return true; } break; case Opcodes.DSTORE: if (ex.appendExpression(sb)) { b.append("dlocals_").append(var).append("_ = ").append(sb.toString().trim()).append(";\n"); return true; } break; case Opcodes.ASTORE: { StringBuilder sb2 = new StringBuilder(); //sb2.append("locals[").append(var).append("].type=CN1_TYPE_INVALID; "); if (ex.appendExpression(sb)) { sb2.append("locals[").append(var).append("].data.o = ").append(sb.toString().trim()).append(";"); sb2.append("locals[").append(var).append("].type=CN1_TYPE_OBJECT;"); b.append(sb2); return true; } break; } } //b.append("\n"); return false; }
Example 20
Source File: VarOp.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
@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; 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"); }