|
|
|
@ -15,7 +15,6 @@
|
|
|
|
|
*/ |
|
|
|
|
package com.fr.third.net.sf.cglib.core; |
|
|
|
|
|
|
|
|
|
import java.io.*; |
|
|
|
|
import java.util.*; |
|
|
|
|
import com.fr.third.org.objectweb.asm.*; |
|
|
|
|
|
|
|
|
@ -40,23 +39,23 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
private static final Signature CSTRUCT_STRING = |
|
|
|
|
TypeUtils.parseConstructor("String"); |
|
|
|
|
|
|
|
|
|
public static final int ADD = Constants.IADD; |
|
|
|
|
public static final int MUL = Constants.IMUL; |
|
|
|
|
public static final int XOR = Constants.IXOR; |
|
|
|
|
public static final int USHR = Constants.IUSHR; |
|
|
|
|
public static final int SUB = Constants.ISUB; |
|
|
|
|
public static final int DIV = Constants.IDIV; |
|
|
|
|
public static final int NEG = Constants.INEG; |
|
|
|
|
public static final int REM = Constants.IREM; |
|
|
|
|
public static final int AND = Constants.IAND; |
|
|
|
|
public static final int OR = Constants.IOR; |
|
|
|
|
|
|
|
|
|
public static final int GT = Constants.IFGT; |
|
|
|
|
public static final int LT = Constants.IFLT; |
|
|
|
|
public static final int GE = Constants.IFGE; |
|
|
|
|
public static final int LE = Constants.IFLE; |
|
|
|
|
public static final int NE = Constants.IFNE; |
|
|
|
|
public static final int EQ = Constants.IFEQ; |
|
|
|
|
public static final int ADD = com.fr.third.net.sf.cglib.core.Constants.IADD; |
|
|
|
|
public static final int MUL = com.fr.third.net.sf.cglib.core.Constants.IMUL; |
|
|
|
|
public static final int XOR = com.fr.third.net.sf.cglib.core.Constants.IXOR; |
|
|
|
|
public static final int USHR = com.fr.third.net.sf.cglib.core.Constants.IUSHR; |
|
|
|
|
public static final int SUB = com.fr.third.net.sf.cglib.core.Constants.ISUB; |
|
|
|
|
public static final int DIV = com.fr.third.net.sf.cglib.core.Constants.IDIV; |
|
|
|
|
public static final int NEG = com.fr.third.net.sf.cglib.core.Constants.INEG; |
|
|
|
|
public static final int REM = com.fr.third.net.sf.cglib.core.Constants.IREM; |
|
|
|
|
public static final int AND = com.fr.third.net.sf.cglib.core.Constants.IAND; |
|
|
|
|
public static final int OR = com.fr.third.net.sf.cglib.core.Constants.IOR; |
|
|
|
|
|
|
|
|
|
public static final int GT = com.fr.third.net.sf.cglib.core.Constants.IFGT; |
|
|
|
|
public static final int LT = com.fr.third.net.sf.cglib.core.Constants.IFLT; |
|
|
|
|
public static final int GE = com.fr.third.net.sf.cglib.core.Constants.IFGE; |
|
|
|
|
public static final int LE = com.fr.third.net.sf.cglib.core.Constants.IFLE; |
|
|
|
|
public static final int NE = com.fr.third.net.sf.cglib.core.Constants.IFNE; |
|
|
|
|
public static final int EQ = com.fr.third.net.sf.cglib.core.Constants.IFEQ; |
|
|
|
|
|
|
|
|
|
private ClassEmitter ce; |
|
|
|
|
private State state; |
|
|
|
@ -152,9 +151,9 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
exception.getInternalName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void goTo(Label label) { mv.visitJumpInsn(Constants.GOTO, label); } |
|
|
|
|
public void ifnull(Label label) { mv.visitJumpInsn(Constants.IFNULL, label); } |
|
|
|
|
public void ifnonnull(Label label) { mv.visitJumpInsn(Constants.IFNONNULL, label); } |
|
|
|
|
public void goTo(Label label) { mv.visitJumpInsn(com.fr.third.net.sf.cglib.core.Constants.GOTO, label); } |
|
|
|
|
public void ifnull(Label label) { mv.visitJumpInsn(com.fr.third.net.sf.cglib.core.Constants.IFNULL, label); } |
|
|
|
|
public void ifnonnull(Label label) { mv.visitJumpInsn(com.fr.third.net.sf.cglib.core.Constants.IFNONNULL, label); } |
|
|
|
|
|
|
|
|
|
public void if_jump(int mode, Label label) { |
|
|
|
|
mv.visitJumpInsn(mode, label); |
|
|
|
@ -173,33 +172,33 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} |
|
|
|
|
switch (type.getSort()) { |
|
|
|
|
case Type.LONG: |
|
|
|
|
mv.visitInsn(Constants.LCMP); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.LCMP); |
|
|
|
|
break; |
|
|
|
|
case Type.DOUBLE: |
|
|
|
|
mv.visitInsn(Constants.DCMPG); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DCMPG); |
|
|
|
|
break; |
|
|
|
|
case Type.FLOAT: |
|
|
|
|
mv.visitInsn(Constants.FCMPG); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.FCMPG); |
|
|
|
|
break; |
|
|
|
|
case Type.ARRAY: |
|
|
|
|
case Type.OBJECT: |
|
|
|
|
switch (mode) { |
|
|
|
|
case EQ: |
|
|
|
|
mv.visitJumpInsn(Constants.IF_ACMPEQ, label); |
|
|
|
|
mv.visitJumpInsn(com.fr.third.net.sf.cglib.core.Constants.IF_ACMPEQ, label); |
|
|
|
|
return; |
|
|
|
|
case NE: |
|
|
|
|
mv.visitJumpInsn(Constants.IF_ACMPNE, label); |
|
|
|
|
mv.visitJumpInsn(com.fr.third.net.sf.cglib.core.Constants.IF_ACMPNE, label); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
throw new IllegalArgumentException("Bad comparison for type " + type); |
|
|
|
|
default: |
|
|
|
|
switch (mode) { |
|
|
|
|
case EQ: intOp = Constants.IF_ICMPEQ; break; |
|
|
|
|
case NE: intOp = Constants.IF_ICMPNE; break; |
|
|
|
|
case EQ: intOp = com.fr.third.net.sf.cglib.core.Constants.IF_ICMPEQ; break; |
|
|
|
|
case NE: intOp = com.fr.third.net.sf.cglib.core.Constants.IF_ICMPNE; break; |
|
|
|
|
case GE: swap(); /* fall through */ |
|
|
|
|
case LT: intOp = Constants.IF_ICMPLT; break; |
|
|
|
|
case LT: intOp = com.fr.third.net.sf.cglib.core.Constants.IF_ICMPLT; break; |
|
|
|
|
case LE: swap(); /* fall through */ |
|
|
|
|
case GT: intOp = Constants.IF_ICMPGT; break; |
|
|
|
|
case GT: intOp = com.fr.third.net.sf.cglib.core.Constants.IF_ICMPGT; break; |
|
|
|
|
} |
|
|
|
|
mv.visitJumpInsn(intOp, label); |
|
|
|
|
return; |
|
|
|
@ -207,16 +206,16 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
if_jump(jumpmode, label); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void pop() { mv.visitInsn(Constants.POP); } |
|
|
|
|
public void pop2() { mv.visitInsn(Constants.POP2); } |
|
|
|
|
public void dup() { mv.visitInsn(Constants.DUP); } |
|
|
|
|
public void dup2() { mv.visitInsn(Constants.DUP2); } |
|
|
|
|
public void dup_x1() { mv.visitInsn(Constants.DUP_X1); } |
|
|
|
|
public void dup_x2() { mv.visitInsn(Constants.DUP_X2); } |
|
|
|
|
public void dup2_x1() { mv.visitInsn(Constants.DUP2_X1); } |
|
|
|
|
public void dup2_x2() { mv.visitInsn(Constants.DUP2_X2); } |
|
|
|
|
public void swap() { mv.visitInsn(Constants.SWAP); } |
|
|
|
|
public void aconst_null() { mv.visitInsn(Constants.ACONST_NULL); } |
|
|
|
|
public void pop() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.POP); } |
|
|
|
|
public void pop2() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.POP2); } |
|
|
|
|
public void dup() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP); } |
|
|
|
|
public void dup2() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP2); } |
|
|
|
|
public void dup_x1() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP_X1); } |
|
|
|
|
public void dup_x2() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP_X2); } |
|
|
|
|
public void dup2_x1() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP2_X1); } |
|
|
|
|
public void dup2_x2() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.DUP2_X2); } |
|
|
|
|
public void swap() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.SWAP); } |
|
|
|
|
public void aconst_null() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.ACONST_NULL); } |
|
|
|
|
|
|
|
|
|
public void swap(Type prev, Type type) { |
|
|
|
|
if (type.getSize() == 1) { |
|
|
|
@ -237,13 +236,13 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void monitorenter() { mv.visitInsn(Constants.MONITORENTER); } |
|
|
|
|
public void monitorexit() { mv.visitInsn(Constants.MONITOREXIT); } |
|
|
|
|
public void monitorenter() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.MONITORENTER); } |
|
|
|
|
public void monitorexit() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.MONITOREXIT); } |
|
|
|
|
|
|
|
|
|
public void math(int op, Type type) { mv.visitInsn(type.getOpcode(op)); } |
|
|
|
|
|
|
|
|
|
public void array_load(Type type) { mv.visitInsn(type.getOpcode(Constants.IALOAD)); } |
|
|
|
|
public void array_store(Type type) { mv.visitInsn(type.getOpcode(Constants.IASTORE)); } |
|
|
|
|
public void array_load(Type type) { mv.visitInsn(type.getOpcode(com.fr.third.net.sf.cglib.core.Constants.IALOAD)); } |
|
|
|
|
public void array_store(Type type) { mv.visitInsn(type.getOpcode(com.fr.third.net.sf.cglib.core.Constants.IASTORE)); } |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Casts from one primitive numeric type to another |
|
|
|
@ -252,44 +251,44 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
if (from != to) { |
|
|
|
|
if (from == Type.DOUBLE_TYPE) { |
|
|
|
|
if (to == Type.FLOAT_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.D2F); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.D2F); |
|
|
|
|
} else if (to == Type.LONG_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.D2L); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.D2L); |
|
|
|
|
} else { |
|
|
|
|
mv.visitInsn(Constants.D2I); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.D2I); |
|
|
|
|
cast_numeric(Type.INT_TYPE, to); |
|
|
|
|
} |
|
|
|
|
} else if (from == Type.FLOAT_TYPE) { |
|
|
|
|
if (to == Type.DOUBLE_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.F2D); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.F2D); |
|
|
|
|
} else if (to == Type.LONG_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.F2L); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.F2L); |
|
|
|
|
} else { |
|
|
|
|
mv.visitInsn(Constants.F2I); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.F2I); |
|
|
|
|
cast_numeric(Type.INT_TYPE, to); |
|
|
|
|
} |
|
|
|
|
} else if (from == Type.LONG_TYPE) { |
|
|
|
|
if (to == Type.DOUBLE_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.L2D); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.L2D); |
|
|
|
|
} else if (to == Type.FLOAT_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.L2F); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.L2F); |
|
|
|
|
} else { |
|
|
|
|
mv.visitInsn(Constants.L2I); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.L2I); |
|
|
|
|
cast_numeric(Type.INT_TYPE, to); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (to == Type.BYTE_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.I2B); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2B); |
|
|
|
|
} else if (to == Type.CHAR_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.I2C); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2C); |
|
|
|
|
} else if (to == Type.DOUBLE_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.I2D); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2D); |
|
|
|
|
} else if (to == Type.FLOAT_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.I2F); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2F); |
|
|
|
|
} else if (to == Type.LONG_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.I2L); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2L); |
|
|
|
|
} else if (to == Type.SHORT_TYPE) { |
|
|
|
|
mv.visitInsn(Constants.I2S); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.I2S); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -301,9 +300,9 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} else if (i <= 5) { |
|
|
|
|
mv.visitInsn(TypeUtils.ICONST(i)); |
|
|
|
|
} else if (i <= Byte.MAX_VALUE) { |
|
|
|
|
mv.visitIntInsn(Constants.BIPUSH, i); |
|
|
|
|
mv.visitIntInsn(com.fr.third.net.sf.cglib.core.Constants.BIPUSH, i); |
|
|
|
|
} else if (i <= Short.MAX_VALUE) { |
|
|
|
|
mv.visitIntInsn(Constants.SIPUSH, i); |
|
|
|
|
mv.visitIntInsn(com.fr.third.net.sf.cglib.core.Constants.SIPUSH, i); |
|
|
|
|
} else { |
|
|
|
|
mv.visitLdcInsn(new Integer(i)); |
|
|
|
|
} |
|
|
|
@ -337,26 +336,26 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void newarray() { |
|
|
|
|
newarray(Constants.TYPE_OBJECT); |
|
|
|
|
newarray(com.fr.third.net.sf.cglib.core.Constants.TYPE_OBJECT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void newarray(Type type) { |
|
|
|
|
if (TypeUtils.isPrimitive(type)) { |
|
|
|
|
mv.visitIntInsn(Constants.NEWARRAY, TypeUtils.NEWARRAY(type)); |
|
|
|
|
mv.visitIntInsn(com.fr.third.net.sf.cglib.core.Constants.NEWARRAY, TypeUtils.NEWARRAY(type)); |
|
|
|
|
} else { |
|
|
|
|
emit_type(Constants.ANEWARRAY, type); |
|
|
|
|
emit_type(com.fr.third.net.sf.cglib.core.Constants.ANEWARRAY, type); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void arraylength() { |
|
|
|
|
mv.visitInsn(Constants.ARRAYLENGTH); |
|
|
|
|
mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.ARRAYLENGTH); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void load_this() { |
|
|
|
|
if (TypeUtils.isStatic(state.access)) { |
|
|
|
|
throw new IllegalStateException("no 'this' pointer within static method"); |
|
|
|
|
} |
|
|
|
|
mv.visitVarInsn(Constants.ALOAD, 0); |
|
|
|
|
mv.visitVarInsn(com.fr.third.net.sf.cglib.core.Constants.ALOAD, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -395,12 +394,12 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
|
|
|
|
|
private void load_local(Type t, int pos) { |
|
|
|
|
// TODO: make t == null ok?
|
|
|
|
|
mv.visitVarInsn(t.getOpcode(Constants.ILOAD), pos); |
|
|
|
|
mv.visitVarInsn(t.getOpcode(com.fr.third.net.sf.cglib.core.Constants.ILOAD), pos); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void store_local(Type t, int pos) { |
|
|
|
|
// TODO: make t == null ok?
|
|
|
|
|
mv.visitVarInsn(t.getOpcode(Constants.ISTORE), pos); |
|
|
|
|
mv.visitVarInsn(t.getOpcode(com.fr.third.net.sf.cglib.core.Constants.ISTORE), pos); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void iinc(Local local, int amount) { |
|
|
|
@ -416,51 +415,51 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void return_value() { |
|
|
|
|
mv.visitInsn(state.sig.getReturnType().getOpcode(Constants.IRETURN)); |
|
|
|
|
mv.visitInsn(state.sig.getReturnType().getOpcode(com.fr.third.net.sf.cglib.core.Constants.IRETURN)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void getfield(String name) { |
|
|
|
|
ClassEmitter.FieldInfo info = ce.getFieldInfo(name); |
|
|
|
|
int opcode = TypeUtils.isStatic(info.access) ? Constants.GETSTATIC : Constants.GETFIELD; |
|
|
|
|
int opcode = TypeUtils.isStatic(info.access) ? com.fr.third.net.sf.cglib.core.Constants.GETSTATIC : com.fr.third.net.sf.cglib.core.Constants.GETFIELD; |
|
|
|
|
emit_field(opcode, ce.getClassType(), name, info.type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void putfield(String name) { |
|
|
|
|
ClassEmitter.FieldInfo info = ce.getFieldInfo(name); |
|
|
|
|
int opcode = TypeUtils.isStatic(info.access) ? Constants.PUTSTATIC : Constants.PUTFIELD; |
|
|
|
|
int opcode = TypeUtils.isStatic(info.access) ? com.fr.third.net.sf.cglib.core.Constants.PUTSTATIC : com.fr.third.net.sf.cglib.core.Constants.PUTFIELD; |
|
|
|
|
emit_field(opcode, ce.getClassType(), name, info.type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void super_getfield(String name, Type type) { |
|
|
|
|
emit_field(Constants.GETFIELD, ce.getSuperType(), name, type); |
|
|
|
|
emit_field(com.fr.third.net.sf.cglib.core.Constants.GETFIELD, ce.getSuperType(), name, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void super_putfield(String name, Type type) { |
|
|
|
|
emit_field(Constants.PUTFIELD, ce.getSuperType(), name, type); |
|
|
|
|
emit_field(com.fr.third.net.sf.cglib.core.Constants.PUTFIELD, ce.getSuperType(), name, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void super_getstatic(String name, Type type) { |
|
|
|
|
emit_field(Constants.GETSTATIC, ce.getSuperType(), name, type); |
|
|
|
|
emit_field(com.fr.third.net.sf.cglib.core.Constants.GETSTATIC, ce.getSuperType(), name, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void super_putstatic(String name, Type type) { |
|
|
|
|
emit_field(Constants.PUTSTATIC, ce.getSuperType(), name, type); |
|
|
|
|
emit_field(com.fr.third.net.sf.cglib.core.Constants.PUTSTATIC, ce.getSuperType(), name, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void getfield(Type owner, String name, Type type) { |
|
|
|
|
emit_field(Constants.GETFIELD, owner, name, type); |
|
|
|
|
emit_field(com.fr.third.net.sf.cglib.core.Constants.GETFIELD, owner, name, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void putfield(Type owner, String name, Type type) { |
|
|
|
|
emit_field(Constants.PUTFIELD, owner, name, type); |
|
|
|
|
emit_field(com.fr.third.net.sf.cglib.core.Constants.PUTFIELD, owner, name, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void getstatic(Type owner, String name, Type type) { |
|
|
|
|
emit_field(Constants.GETSTATIC, owner, name, type); |
|
|
|
|
emit_field(com.fr.third.net.sf.cglib.core.Constants.GETSTATIC, owner, name, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void putstatic(Type owner, String name, Type type) { |
|
|
|
|
emit_field(Constants.PUTSTATIC, owner, name, type); |
|
|
|
|
emit_field(com.fr.third.net.sf.cglib.core.Constants.PUTSTATIC, owner, name, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// package-protected for EmitUtils, try to fix
|
|
|
|
@ -476,7 +475,7 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void super_invoke(Signature sig) { |
|
|
|
|
emit_invoke(Constants.INVOKESPECIAL, ce.getSuperType(), sig); |
|
|
|
|
emit_invoke(com.fr.third.net.sf.cglib.core.Constants.INVOKESPECIAL, ce.getSuperType(), sig); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void invoke_constructor(Type type) { |
|
|
|
@ -492,9 +491,9 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void emit_invoke(int opcode, Type type, Signature sig) { |
|
|
|
|
if (sig.getName().equals(Constants.CONSTRUCTOR_NAME) && |
|
|
|
|
((opcode == Constants.INVOKEVIRTUAL) || |
|
|
|
|
(opcode == Constants.INVOKESTATIC))) { |
|
|
|
|
if (sig.getName().equals(com.fr.third.net.sf.cglib.core.Constants.CONSTRUCTOR_NAME) && |
|
|
|
|
((opcode == com.fr.third.net.sf.cglib.core.Constants.INVOKEVIRTUAL) || |
|
|
|
|
(opcode == com.fr.third.net.sf.cglib.core.Constants.INVOKESTATIC))) { |
|
|
|
|
// TODO: error
|
|
|
|
|
} |
|
|
|
|
mv.visitMethodInsn(opcode, |
|
|
|
@ -505,15 +504,15 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void invoke_interface(Type owner, Signature sig) { |
|
|
|
|
emit_invoke(Constants.INVOKEINTERFACE, owner, sig); |
|
|
|
|
emit_invoke(com.fr.third.net.sf.cglib.core.Constants.INVOKEINTERFACE, owner, sig); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void invoke_virtual(Type owner, Signature sig) { |
|
|
|
|
emit_invoke(Constants.INVOKEVIRTUAL, owner, sig); |
|
|
|
|
emit_invoke(com.fr.third.net.sf.cglib.core.Constants.INVOKEVIRTUAL, owner, sig); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void invoke_static(Type owner, Signature sig) { |
|
|
|
|
emit_invoke(Constants.INVOKESTATIC, owner, sig); |
|
|
|
|
emit_invoke(com.fr.third.net.sf.cglib.core.Constants.INVOKESTATIC, owner, sig); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void invoke_virtual_this(Signature sig) { |
|
|
|
@ -525,7 +524,7 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void invoke_constructor(Type type, Signature sig) { |
|
|
|
|
emit_invoke(Constants.INVOKESPECIAL, type, sig); |
|
|
|
|
emit_invoke(com.fr.third.net.sf.cglib.core.Constants.INVOKESPECIAL, type, sig); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void invoke_constructor_this(Signature sig) { |
|
|
|
@ -541,7 +540,7 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void new_instance(Type type) { |
|
|
|
|
emit_type(Constants.NEW, type); |
|
|
|
|
emit_type(com.fr.third.net.sf.cglib.core.Constants.NEW, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void emit_type(int opcode, Type type) { |
|
|
|
@ -559,16 +558,16 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
aaload(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void aaload() { mv.visitInsn(Constants.AALOAD); } |
|
|
|
|
public void aastore() { mv.visitInsn(Constants.AASTORE); } |
|
|
|
|
public void athrow() { mv.visitInsn(Constants.ATHROW); } |
|
|
|
|
public void aaload() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.AALOAD); } |
|
|
|
|
public void aastore() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.AASTORE); } |
|
|
|
|
public void athrow() { mv.visitInsn(com.fr.third.net.sf.cglib.core.Constants.ATHROW); } |
|
|
|
|
|
|
|
|
|
public Label make_label() { |
|
|
|
|
return new Label(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Local make_local() { |
|
|
|
|
return make_local(Constants.TYPE_OBJECT); |
|
|
|
|
return make_local(com.fr.third.net.sf.cglib.core.Constants.TYPE_OBJECT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Local make_local(Type type) { |
|
|
|
@ -580,13 +579,13 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void checkcast(Type type) { |
|
|
|
|
if (!type.equals(Constants.TYPE_OBJECT)) { |
|
|
|
|
emit_type(Constants.CHECKCAST, type); |
|
|
|
|
if (!type.equals(com.fr.third.net.sf.cglib.core.Constants.TYPE_OBJECT)) { |
|
|
|
|
emit_type(com.fr.third.net.sf.cglib.core.Constants.CHECKCAST, type); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void instance_of(Type type) { |
|
|
|
|
emit_type(Constants.INSTANCEOF, type); |
|
|
|
|
emit_type(com.fr.third.net.sf.cglib.core.Constants.INSTANCEOF, type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void instance_of_this() { |
|
|
|
@ -718,7 +717,7 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
dup_x1(); |
|
|
|
|
swap(); |
|
|
|
|
} |
|
|
|
|
invoke_constructor(boxed, new Signature(Constants.CONSTRUCTOR_NAME, Type.VOID_TYPE, new Type[]{ type })); |
|
|
|
|
invoke_constructor(boxed, new Signature(com.fr.third.net.sf.cglib.core.Constants.CONSTRUCTOR_NAME, Type.VOID_TYPE, new Type[]{ type })); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -731,17 +730,17 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
* @return true if the value was unboxed |
|
|
|
|
*/ |
|
|
|
|
public void unbox(Type type) { |
|
|
|
|
Type t = Constants.TYPE_NUMBER; |
|
|
|
|
Type t = com.fr.third.net.sf.cglib.core.Constants.TYPE_NUMBER; |
|
|
|
|
Signature sig = null; |
|
|
|
|
switch (type.getSort()) { |
|
|
|
|
case Type.VOID: |
|
|
|
|
return; |
|
|
|
|
case Type.CHAR: |
|
|
|
|
t = Constants.TYPE_CHARACTER; |
|
|
|
|
t = com.fr.third.net.sf.cglib.core.Constants.TYPE_CHARACTER; |
|
|
|
|
sig = CHAR_VALUE; |
|
|
|
|
break; |
|
|
|
|
case Type.BOOLEAN: |
|
|
|
|
t = Constants.TYPE_BOOLEAN; |
|
|
|
|
t = com.fr.third.net.sf.cglib.core.Constants.TYPE_BOOLEAN; |
|
|
|
|
sig = BOOLEAN_VALUE; |
|
|
|
|
break; |
|
|
|
|
case Type.DOUBLE: |
|
|
|
@ -847,7 +846,7 @@ public class CodeEmitter extends LocalVariablesSorter {
|
|
|
|
|
ClassInfo classInfo = method.getClassInfo(); |
|
|
|
|
Type type = classInfo.getType(); |
|
|
|
|
Signature sig = method.getSignature(); |
|
|
|
|
if (sig.getName().equals(Constants.CONSTRUCTOR_NAME)) { |
|
|
|
|
if (sig.getName().equals(com.fr.third.net.sf.cglib.core.Constants.CONSTRUCTOR_NAME)) { |
|
|
|
|
invoke_constructor(type, sig); |
|
|
|
|
} else if (TypeUtils.isInterface(classInfo.getModifiers())) { |
|
|
|
|
invoke_interface(type, sig); |
|
|
|
|