public abstract class Exposer extends java.lang.Object implements org.objectweb.asm.Opcodes, PyTypes
Modifier and Type | Field and Description |
---|---|
protected org.objectweb.asm.ClassVisitor |
cv
The current class under construction.
|
protected org.objectweb.asm.Type[] |
interfacesImplemented |
protected org.objectweb.asm.MethodVisitor |
mv
The current method under construction or null.
|
protected static java.util.Map<org.objectweb.asm.Type,org.objectweb.asm.Type> |
PRIMITIVES
Maps from a primitive type to its wrapper
|
protected org.objectweb.asm.Type |
thisType
The type that will be generated.
|
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_MANDATED, ACC_MODULE, ACC_NATIVE, ACC_OPEN, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_RECORD, ACC_STATIC, ACC_STATIC_PHASE, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_TRANSITIVE, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASM10_EXPERIMENTAL, ASM4, ASM5, ASM6, ASM7, ASM8, ASM9, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DOUBLE, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F_APPEND, F_CHOP, F_FULL, F_NEW, F_SAME, F_SAME1, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAT, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, H_GETFIELD, H_GETSTATIC, H_INVOKEINTERFACE, H_INVOKESPECIAL, H_INVOKESTATIC, H_INVOKEVIRTUAL, H_NEWINVOKESPECIAL, H_PUTFIELD, H_PUTSTATIC, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, IMUL, INEG, INSTANCEOF, INTEGER, INVOKEDYNAMIC, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LONG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SOURCE_DEPRECATED, SOURCE_MASK, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, TOP, UNINITIALIZED_THIS, V_PREVIEW, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19, V9
ABUILTIN_FUNCTION, ABUILTIN_METHOD, ADATA_DESCR, APYOBJ, ASSUPER, ASTRING, BOOLEAN, BUILTIN_FUNCTION, BUILTIN_INFO, BUILTIN_METHOD, BUILTIN_METHOD_NARROW, BYTE, CHAR, CLASS, DATA_DESCR, EXPOSED_CLASS_METHOD, EXPOSED_DELETE, EXPOSED_GET, EXPOSED_METHOD, EXPOSED_NEW, EXPOSED_SET, EXPOSED_TYPE, INT, OBJECT, PY, PYBOOLEAN, PYEXCEPTION, PYFLOAT, PYINTEGER, PYLONG, PYNEWWRAPPER, PYOBJ, PYSTR, PYTYPE, SHORT, STRING, STRING_BUILDER, THREAD_STATE, TYPEBUILDER, VOID
Constructor and Description |
---|
Exposer(java.lang.Class<?> superClass,
java.lang.String generatedName,
org.objectweb.asm.Type... interfacesImplemented) |
Modifier and Type | Method and Description |
---|---|
protected void |
call(org.objectweb.asm.Type onType,
java.lang.String methodName,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... args)
Calls the method on onType with the given return type and argument types.
|
protected void |
callConstructor(org.objectweb.asm.Type onType,
org.objectweb.asm.Type... args)
Calls the constructor on onType with the given args.
|
protected void |
callStatic(org.objectweb.asm.Type onType,
java.lang.String methodName,
org.objectweb.asm.Type returnType,
org.objectweb.asm.Type... args)
Calls the static method on onType with the given return type and argument types.
|
protected void |
endConstructor()
Closes the constructor begun by startConstructor.
|
protected void |
endMethod(int returnCode)
Closes the method under construction.
|
protected abstract void |
generate()
Implemented by subclasses to fill in the actual implementation of the class.
|
void |
generate(org.objectweb.asm.ClassVisitor visitor)
Will call the methods on visitor to generate this class.
|
protected void |
get(java.lang.String fieldName,
org.objectweb.asm.Type ofType)
Loads a field on the instance under construction of ofType onto the stack
|
java.lang.String |
getClassName() |
protected org.objectweb.asm.Type |
getGeneratedType() |
java.lang.String |
getInternalName() |
protected void |
getStatic(org.objectweb.asm.Type onType,
java.lang.String fieldName,
org.objectweb.asm.Type ofType)
Gets a static field from onType of the given type.
|
protected void |
instantiate(org.objectweb.asm.Type ofType)
Instantiates ofType using its no-arg constructor
|
protected void |
instantiate(org.objectweb.asm.Type ofType,
org.python.expose.generate.Exposer.Instantiator inst)
Instantiates ofType with its constructor that takes the types returned by inst.getTypes().
|
protected java.lang.Class<?> |
load(BytecodeLoader.Loader l)
Generates this Exposer and loads it into the given Loader.
|
protected java.lang.String |
methodDesc(org.objectweb.asm.Type ret,
org.objectweb.asm.Type... args)
Produces a method descriptor with ret as its return type that takes args.
|
protected void |
startConstructor(org.objectweb.asm.Type... args)
Starts building a constructor in the class.
|
protected void |
startMethod(java.lang.String name,
org.objectweb.asm.Type ret,
org.objectweb.asm.Type... args)
Starts building a method in the class being generated.
|
protected void |
superConstructor(org.objectweb.asm.Type... args)
Calls the constructor on the super class with the given args.
|
protected void |
toPy(org.objectweb.asm.Type inputType)
Turns an object of inputType on the top of the stack into an equivalent Py type.
|
protected org.objectweb.asm.MethodVisitor mv
protected org.objectweb.asm.ClassVisitor cv
protected org.objectweb.asm.Type thisType
protected org.objectweb.asm.Type[] interfacesImplemented
protected static final java.util.Map<org.objectweb.asm.Type,org.objectweb.asm.Type> PRIMITIVES
public Exposer(java.lang.Class<?> superClass, java.lang.String generatedName, org.objectweb.asm.Type... interfacesImplemented)
superClass
- -
the super class of the generated classgeneratedName
- -
the name of the class to generateprotected abstract void generate()
protected java.lang.Class<?> load(BytecodeLoader.Loader l)
protected org.objectweb.asm.Type getGeneratedType()
public java.lang.String getClassName()
public java.lang.String getInternalName()
public void generate(org.objectweb.asm.ClassVisitor visitor)
protected void superConstructor(org.objectweb.asm.Type... args)
protected void instantiate(org.objectweb.asm.Type ofType)
protected void instantiate(org.objectweb.asm.Type ofType, org.python.expose.generate.Exposer.Instantiator inst)
protected void callConstructor(org.objectweb.asm.Type onType, org.objectweb.asm.Type... args)
protected void call(org.objectweb.asm.Type onType, java.lang.String methodName, org.objectweb.asm.Type returnType, org.objectweb.asm.Type... args)
protected void callStatic(org.objectweb.asm.Type onType, java.lang.String methodName, org.objectweb.asm.Type returnType, org.objectweb.asm.Type... args)
protected java.lang.String methodDesc(org.objectweb.asm.Type ret, org.objectweb.asm.Type... args)
protected void startConstructor(org.objectweb.asm.Type... args)
protected void endConstructor()
protected void startMethod(java.lang.String name, org.objectweb.asm.Type ret, org.objectweb.asm.Type... args)
protected void endMethod(int returnCode)
protected void get(java.lang.String fieldName, org.objectweb.asm.Type ofType)
protected void toPy(org.objectweb.asm.Type inputType)
protected void getStatic(org.objectweb.asm.Type onType, java.lang.String fieldName, org.objectweb.asm.Type ofType)