List of usage examples for org.objectweb.asm Type getType
public static Type getType(final Method method)
From source file:analysis.ReferenceGenerator.java
License:Open Source License
private void refFields(List<FieldNode> fields) { Type type;//from w w w .ja v a 2 s.c om for (FieldNode field : fields) { type = Type.getType(field.desc); addTypeClassRef(type); } }
From source file:analysis.ReferenceGenerator.java
License:Open Source License
private void refInstructions(InsnList insnList) { AbstractInsnNode insn;/*w ww . j a v a 2 s.co m*/ insn = insnList.getFirst(); Object cst; while (insn != null) { switch (insn.getType()) { case AbstractInsnNode.FIELD_INSN: //addTypeClassRef(Type.getType(((FieldInsnNode)insn).desc)); addFieldRef(((FieldInsnNode) insn).owner, ((FieldInsnNode) insn).name); break; /*case AbstractInsnNode.INVOKE_DYNAMIC_INSN: break;*/ /*case AbstractInsnNode.LDC_INSN: cst = ((LdcInsnNode)insn).cst; if(cst instanceof Type) { addTypeClassRef((Type)cst); } break;*/ case AbstractInsnNode.METHOD_INSN: addMethodRef(((MethodInsnNode) insn).owner, ((MethodInsnNode) insn).name, ((MethodInsnNode) insn).desc); break; case AbstractInsnNode.MULTIANEWARRAY_INSN: addTypeClassRef(Type.getType(((MultiANewArrayInsnNode) insn).desc)); break; case AbstractInsnNode.TYPE_INSN: addTypeClassRef(Type.getType(((TypeInsnNode) insn).desc)); break; } insn = insn.getNext(); } }
From source file:blue.origami.asm.OAsmUtils.java
License:Apache License
public static Type asmType(Class<?> c) { return Type.getType(c); }
From source file:blue.origami.asm.OAsmUtils.java
License:Apache License
public static Type[] asmTypes(Class<?>... c) { Type[] t = new Type[c.length]; for (int i = 0; i < t.length; i++) { t[i] = Type.getType(c[i]); }/*from w w w . j a v a 2s.c o m*/ return t; }
From source file:blue.origami.asm.OAsmUtils.java
License:Apache License
public static Type asmType(OType t) { return Type.getType(t.typeDesc(0)); }
From source file:blue.origami.asm.OClassWriter.java
License:Apache License
public Type getTypeDesc() { return Type.getType("L" + this.cname + ";"); }
From source file:blue.origami.asm.OGeneratorAdapter.java
License:Apache License
boolean tryInvokeBinary(OMethodHandle mh) { int op = -1;//from w w w . j a v a2s .c om Class<?> type = null; // ODebug.trace("binary %s", mh.getLocalName()); if (mh.getThisParamSize() == 2) { switch (mh.getLocalName()) { case "+": op = ADD; type = this.checkMath(mh); break; case "-": op = SUB; type = this.checkMath(mh); break; case "*": op = MUL; type = this.checkMath(mh); break; case "/": op = DIV; type = this.checkMath(mh); break; case "%": op = REM; type = this.checkMath(mh); break; case "||": op = OR; type = this.checkBitwise(mh); break; case "&&": op = AND; type = this.checkBitwise(mh); break; case "^": op = XOR; type = this.checkBitwise(mh); break; case "<<": op = SHL; type = this.checkBitwise(mh); break; case ">>": op = SHR; type = this.checkBitwise(mh); break; case ">>>": op = USHR; type = this.checkBitwise(mh); break; default: } if (type != null) { this.math(op, Type.getType(type)); return true; } } if (mh.getThisParamSize() == 1) { switch (mh.getLocalName()) { case "!": if (this.checkUnary(mh, boolean.class, boolean.class)) { this.not(); return true; } return false; case "-": type = this.checkMath1(mh); op = NEG; break; default: } if (type != null) { this.math(op, Type.getType(type)); return true; } } return false; }
From source file:blue.origami.asm.OGeneratorAdapter.java
License:Apache License
/** * create new local variable entry and store stack top value to created * entry//w w w.ja v a2s. c o m * * @param varName * @param t * @return */ public VarEntry createNewVarAndStore(String varName, OType t) { VarEntry entry = this.varScopes.peek().newVarEntry(varName, t); this.countLocalSlots(t); Type typeDesc = Type.getType(t.typeDesc(0)); this.visitVarInsn(typeDesc.getOpcode(Opcodes.ISTORE), entry.getVarIndex()); return entry; }
From source file:blue.origami.asm.OGeneratorAdapter.java
License:Apache License
/** * store stack top value to local variable. * * @param entry/*from ww w .j a va 2s . c o m*/ */ public void storeToVar(VarEntry entry) { Type typeDesc = Type.getType(entry.getVarClass().typeDesc(0)); this.visitVarInsn(typeDesc.getOpcode(Opcodes.ISTORE), entry.getVarIndex()); }
From source file:blue.origami.asm.OGeneratorAdapter.java
License:Apache License
/** * load value from local variable and put it at stack top. * * @param entry/* w w w . ja va 2 s . c om*/ */ public void loadFromVar(VarEntry entry) { Type typeDesc = Type.getType(entry.getVarClass().typeDesc(0)); this.visitVarInsn(typeDesc.getOpcode(Opcodes.ILOAD), entry.getVarIndex()); }