public class StandardASMCompiler extends Object implements ScriptCompiler, org.objectweb.asm.Opcodes
Modifier and Type | Class and Description |
---|---|
static class |
StandardASMCompiler.InvokerDescriptor |
Modifier and Type | Field and Description |
---|---|
static int |
ARGS_INDEX |
static int |
CLOSURE_OFFSET |
static int |
DYNAMIC_SCOPE_OFFSET |
static int |
EXCEPTION_OFFSET |
static int |
FIRST_TEMP_OFFSET |
static String |
IRUBYOBJECT |
static int |
PREVIOUS_EXCEPTION_OFFSET |
static String |
RUBY |
static int |
SELF_INDEX |
static int |
STARTING_DSTR_FACTOR |
static int |
THIS |
static String |
THREADCONTEXT |
static int |
THREADCONTEXT_INDEX |
static int |
VARS_ARRAY_OFFSET |
static boolean |
VERIFY_CLASSFILES |
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_MANDATED, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASM4, ASM5, 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, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, TOP, UNINITIALIZED_THIS, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8
Constructor and Description |
---|
StandardASMCompiler(String classname,
String sourcename)
Creates a new instance of StandardCompilerContext
|
Modifier and Type | Method and Description |
---|---|
void |
addBlockCallback19Descriptor(String method,
String file,
int line) |
void |
addBlockCallbackDescriptor(String method,
String file,
int line) |
void |
addInvokerDescriptor(String rubyName,
String newMethodName,
int methodArity,
StaticScope scope,
CallConfiguration callConfig,
String filename,
int line) |
static String |
buildStaticScopeNames(StaticScope scope) |
void |
dumpClass(PrintStream out) |
void |
endScript(boolean generateLoad,
boolean generateMain)
End compilation for the current script, closing all context and structures
used for the compilation.
|
int |
getAndIncrementEnsureNumber() |
int |
getAndIncrementInnerIndex() |
int |
getAndIncrementMethodIndex() |
int |
getAndIncrementRescueNumber() |
CacheCompiler |
getCacheCompiler() |
byte[] |
getClassByteArray() |
SkinnyMethodAdapter |
getClassInitMethod() |
String |
getClassname() |
org.objectweb.asm.ClassVisitor |
getClassVisitor() |
static String |
getClosure19Signature() |
static String |
getClosureSignature() |
int |
getEnsureNumber() |
SkinnyMethodAdapter |
getInitMethod() |
int |
getInnerIndex() |
int |
getMethodIndex() |
static String |
getMethodSignature(int args) |
String |
getNewConstant(String type,
String name_prefix) |
String |
getNewConstant(String type,
String name_prefix,
Object init) |
String |
getNewConstantName() |
String |
getNewField(String type,
String name,
Object init) |
String |
getNewStaticConstant(String type,
String name_prefix) |
int |
getRescueNumber() |
String |
getSourcename() |
static String |
getStaticClosure19Signature(String classdesc) |
static String |
getStaticClosureSignature(String classdesc) |
static Class[] |
getStaticMethodParams(Class target,
int args) |
static String |
getStaticMethodSignature(String classname,
int args) |
Class<?> |
loadClass(JRubyClassLoader classLoader) |
void |
setJavaVersion(Integer javaVersion) |
BodyCompiler |
startFileMethod(CompilerCallback args,
StaticScope scope,
ASTInspector inspector)
Begin compilation for the root of a script named __file__.
|
BodyCompiler |
startMethod(String rubyName,
String javaName,
CompilerCallback args,
StaticScope scope,
ASTInspector inspector,
int scopeIndex)
Begin compilation for a method that has the specified number of local variables.
|
void |
startScript(StaticScope scope)
Begin compilation for a script, preparing all necessary context and code
to support this script's compiled representation.
|
void |
writeClass(File destination) |
void |
writeInvokers(File destination) |
void |
writeInvokers(String destination) |
public static final String THREADCONTEXT
public static final String RUBY
public static final String IRUBYOBJECT
public static final boolean VERIFY_CLASSFILES
public static final int THIS
public static final int THREADCONTEXT_INDEX
public static final int SELF_INDEX
public static final int ARGS_INDEX
public static final int CLOSURE_OFFSET
public static final int DYNAMIC_SCOPE_OFFSET
public static final int VARS_ARRAY_OFFSET
public static final int EXCEPTION_OFFSET
public static final int PREVIOUS_EXCEPTION_OFFSET
public static final int FIRST_TEMP_OFFSET
public static final int STARTING_DSTR_FACTOR
public static String getMethodSignature(int args)
public static String getClosureSignature()
public static String getClosure19Signature()
public void setJavaVersion(Integer javaVersion)
public byte[] getClassByteArray()
public Class<?> loadClass(JRubyClassLoader classLoader) throws ClassNotFoundException
ClassNotFoundException
public void dumpClass(PrintStream out)
public void writeClass(File destination) throws IOException
IOException
public void writeInvokers(String destination) throws IOException
IOException
public void writeInvokers(File destination) throws IOException
IOException
public void addInvokerDescriptor(String rubyName, String newMethodName, int methodArity, StaticScope scope, CallConfiguration callConfig, String filename, int line)
public void addBlockCallbackDescriptor(String method, String file, int line)
public void addBlockCallback19Descriptor(String method, String file, int line)
public String getClassname()
public String getSourcename()
public org.objectweb.asm.ClassVisitor getClassVisitor()
public void startScript(StaticScope scope)
ScriptCompiler
startScript
in interface ScriptCompiler
public void endScript(boolean generateLoad, boolean generateMain)
ScriptCompiler
endScript
in interface ScriptCompiler
public static String buildStaticScopeNames(StaticScope scope)
public SkinnyMethodAdapter getInitMethod()
public SkinnyMethodAdapter getClassInitMethod()
public CacheCompiler getCacheCompiler()
public BodyCompiler startMethod(String rubyName, String javaName, CompilerCallback args, StaticScope scope, ASTInspector inspector, int scopeIndex)
ScriptCompiler
startMethod
in interface ScriptCompiler
public BodyCompiler startFileMethod(CompilerCallback args, StaticScope scope, ASTInspector inspector)
ScriptCompiler
startFileMethod
in interface ScriptCompiler
args
- Arguments to the script, as passed via jitted wrappersscope
- The StaticScope for the scriptinspector
- The ASTInspector for the nodes for the scriptpublic int getMethodIndex()
public int getAndIncrementMethodIndex()
public int getInnerIndex()
public int getAndIncrementInnerIndex()
public int getRescueNumber()
public int getAndIncrementRescueNumber()
public int getEnsureNumber()
public int getAndIncrementEnsureNumber()
public String getNewConstantName()
Copyright © 2001-2015 JRuby. All Rights Reserved.