org.jruby.runtime.MethodFactory
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ARGS_INDEX
The lvar index of the method args on the call |
| public static final int | BLOCK_INDEX
The lvar index of the passed-in Block on the call |
| public static final int | CLASS_INDEX
The lvar index of the RubyClass being invoked against |
| protected final ClassDefiningJRubyClassLoader | classLoader
The classloader to use for code loading |
| private static final String | COMPILED_CALL_SIG
The outward call signature for compiled Ruby method handles. |
| private static final String | COMPILED_CALL_SIG_BLOCK
The outward call signature for compiled Ruby method handles. |
| private static final String | COMPILED_CALL_SIG_ONE
The outward arity-one call-without-block signature for compiled Ruby method handles. |
| private static final String | COMPILED_CALL_SIG_ONE_BLOCK
The outward arity-one call-with-block signature for compiled Ruby method handles. |
| private static final String | COMPILED_CALL_SIG_THREE
The outward arity-three call-without-block signature for compiled Ruby method handles. |
| private static final String | COMPILED_CALL_SIG_THREE_BLOCK
The outward arity-three call-with-block signature for compiled Ruby method handles. |
| private static final String | COMPILED_CALL_SIG_TWO
The outward arity-two call-without-block signature for compiled Ruby method handles. |
| private static final String | COMPILED_CALL_SIG_TWO_BLOCK
The outward arity-two call-with-block signature for compiled Ruby method handles. |
| private static final String | COMPILED_CALL_SIG_ZERO
The outward arity-zero call-without-block signature for compiled Ruby method handles. |
| private static final String | COMPILED_CALL_SIG_ZERO_BLOCK
The outward arity-zero call-with-block signature for compiled Ruby method handles. |
| private static final boolean | |
| private boolean | haveWarnedUser
Whether we've informed the user that we've seen undefined methods; this is to avoid a flood of repetitive information. |
| private static final String | JAVA_SUPER_SIG
The super constructor signature for Java-based method handles. |
| private static final Logger | |
| public static final int | NAME_INDEX
The lvar index method name being invoked |
| public static final int | RECEIVER_INDEX
The lvar index of the method-receiving object |
| private static final Class | RubyModule_and_Visibility
Deprecated
|
| private static final Class | |
| private boolean | seenUndefinedClasses
Whether this factory has seen undefined methods already. |
| protected final Object | syncObject
An object to sync against when loading classes, to avoid dups |
| public static final int | THIS_INDEX
The lvar index of "this" |
| public static final int | THREADCONTEXT_INDEX
The lvar index of the passed-in ThreadContext |
| Access | Constructor and Description |
|---|---|
| public | InvocationMethodFactory(ClassLoader
The classloader to use, or to wrap if it is not a
JRubyClassLoader instance. classLoader)Construct a new InvocationMethodFactory using the specified classloader to load code. |
| Modifier and Type | Method and Description |
|---|---|
| private void | addAnnotatedMethodInvoker(ClassWriter cw, String superClass, List<JavaMethodDescriptor> descs, boolean acceptsKeywords)
|
| private SkinnyMethodAdapter | |
| private static void | checkArity(JRubyMethod
The annotation of the called method jrubyMethod, SkinnyMethodAdapter The code generator for the handle being created method, int specificArity)Emit code to check the arity of a call to a Java-based method. |
| public JavaMethod | constructJavaMethod(RubyModule implementationClass, JavaMethodDescriptor desc, String name, Class<T> c)
|
| private void | createAnnotatedMethodInvocation(JavaMethodDescriptor desc, SkinnyMethodAdapter method, String superClass, int specificArity, boolean block, boolean acceptsKeywords)
|
| private static ClassWriter | |
| private static Class | |
| protected Class | |
| public DynamicMethod | getAnnotatedMethod(RubyModule
The target class or module on which the method
will be bound. implementationClass, List<JavaMethodDescriptor> descs, String name)Implements abstract org. Use code generation to provide a method handle based on an annotated Java method. |
| public DynamicMethod | getAnnotatedMethod(RubyModule
The target class or module on which the method
will be bound. implementationClass, JavaMethodDescriptor A JavaMethodDescriptor describing the target method desc, String name)Implements abstract org. Use code generation to provide a method handle based on an annotated Java method. |
| public Class | getAnnotatedMethodClass(List<JavaMethodDescriptor> descs)
Use code generation to provide a method handle based on an annotated Java method. |
| public static String | |
| private static String | |
| private static String | |
| private void | |
| private void | invokeCallConfigPre(SkinnyMethodAdapter mv, String superClass, int specificArity, boolean block, CallConfiguration callConfig)
|
| private static void | |
| private static void | |
| private static void | |
| private static void | |
| private static void | loadBlock(SkinnyMethodAdapter mv, int specificArity, boolean getsBlock)
load the block argument from the correct position. |
| private static void | loadBlockForPre(SkinnyMethodAdapter mv, int specificArity, boolean getsBlock)
load block argument for pre() call. |
| private static void | |
| private static void | prepareForPre(SkinnyMethodAdapter mv, int specificArity, boolean block, CallConfiguration callConfig)
|
| private Class |
| ARGS_INDEX | back to summary |
|---|---|
| public static final int ARGS_INDEX The lvar index of the method args on the call | |
| BLOCK_INDEX | back to summary |
|---|---|
| public static final int BLOCK_INDEX The lvar index of the passed-in Block on the call | |
| CLASS_INDEX | back to summary |
|---|---|
| public static final int CLASS_INDEX The lvar index of the RubyClass being invoked against | |
| classLoader | back to summary |
|---|---|
| protected final ClassDefiningJRubyClassLoader classLoader The classloader to use for code loading | |
| COMPILED_CALL_SIG | back to summary |
|---|---|
| private static final String COMPILED_CALL_SIG The outward call signature for compiled Ruby method handles. | |
| COMPILED_CALL_SIG_BLOCK | back to summary |
|---|---|
| private static final String COMPILED_CALL_SIG_BLOCK The outward call signature for compiled Ruby method handles. | |
| COMPILED_CALL_SIG_ONE | back to summary |
|---|---|
| private static final String COMPILED_CALL_SIG_ONE The outward arity-one call-without-block signature for compiled Ruby method handles. | |
| COMPILED_CALL_SIG_ONE_BLOCK | back to summary |
|---|---|
| private static final String COMPILED_CALL_SIG_ONE_BLOCK The outward arity-one call-with-block signature for compiled Ruby method handles. | |
| COMPILED_CALL_SIG_THREE | back to summary |
|---|---|
| private static final String COMPILED_CALL_SIG_THREE The outward arity-three call-without-block signature for compiled Ruby method handles. | |
| COMPILED_CALL_SIG_THREE_BLOCK | back to summary |
|---|---|
| private static final String COMPILED_CALL_SIG_THREE_BLOCK The outward arity-three call-with-block signature for compiled Ruby method handles. | |
| COMPILED_CALL_SIG_TWO | back to summary |
|---|---|
| private static final String COMPILED_CALL_SIG_TWO The outward arity-two call-without-block signature for compiled Ruby method handles. | |
| COMPILED_CALL_SIG_TWO_BLOCK | back to summary |
|---|---|
| private static final String COMPILED_CALL_SIG_TWO_BLOCK The outward arity-two call-with-block signature for compiled Ruby method handles. | |
| COMPILED_CALL_SIG_ZERO | back to summary |
|---|---|
| private static final String COMPILED_CALL_SIG_ZERO The outward arity-zero call-without-block signature for compiled Ruby method handles. | |
| COMPILED_CALL_SIG_ZERO_BLOCK | back to summary |
|---|---|
| private static final String COMPILED_CALL_SIG_ZERO_BLOCK The outward arity-zero call-with-block signature for compiled Ruby method handles. | |
| DEBUG | back to summary |
|---|---|
| private static final boolean DEBUG | |
| haveWarnedUser | back to summary |
|---|---|
| private boolean haveWarnedUser Whether we've informed the user that we've seen undefined methods; this is to avoid a flood of repetitive information. | |
| JAVA_SUPER_SIG | back to summary |
|---|---|
| private static final String JAVA_SUPER_SIG The super constructor signature for Java-based method handles. | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| NAME_INDEX | back to summary |
|---|---|
| public static final int NAME_INDEX The lvar index method name being invoked | |
| RECEIVER_INDEX | back to summary |
|---|---|
| public static final int RECEIVER_INDEX The lvar index of the method-receiving object | |
| RubyModule_and_Visibility | back to summary |
|---|---|
| private static final Class<T>[] RubyModule_and_Visibility
Deprecated
| |
| RubyModule_and_Visibility_and_Name | back to summary |
|---|---|
| private static final Class<T>[] RubyModule_and_Visibility_and_Name | |
| seenUndefinedClasses | back to summary |
|---|---|
| private boolean seenUndefinedClasses Whether this factory has seen undefined methods already. This is used to detect likely method handle collisions when we expect to create a new handle for each call. | |
| syncObject | back to summary |
|---|---|
| protected final Object syncObject An object to sync against when loading classes, to avoid dups | |
| THIS_INDEX | back to summary |
|---|---|
| public static final int THIS_INDEX The lvar index of "this" | |
| THREADCONTEXT_INDEX | back to summary |
|---|---|
| public static final int THREADCONTEXT_INDEX The lvar index of the passed-in ThreadContext | |
| InvocationMethodFactory | back to summary |
|---|---|
| public InvocationMethodFactory(ClassLoader classLoader) Construct a new InvocationMethodFactory using the specified classloader to load code. If the target classloader is not an instance of JRubyClassLoader, it will be wrapped with one.
| |
| addAnnotatedMethodInvoker | back to summary |
|---|---|
| private void addAnnotatedMethodInvoker(ClassWriter cw, String superClass, List<JavaMethodDescriptor> descs, boolean acceptsKeywords) | |
| beginMethod | back to summary |
|---|---|
| private SkinnyMethodAdapter beginMethod(ClassWriter cw, String methodName, int specificArity, boolean block) | |
| checkArity | back to summary |
|---|---|
| private static void checkArity(JRubyMethod jrubyMethod, SkinnyMethodAdapter method, int specificArity) Emit code to check the arity of a call to a Java-based method.
| |
| constructJavaMethod | back to summary |
|---|---|
public JavaMethod constructJavaMethod(RubyModule implementationClass, JavaMethodDescriptor desc, String name, Class<T> c) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
| |
| createAnnotatedMethodInvocation | back to summary |
|---|---|
| private void createAnnotatedMethodInvocation(JavaMethodDescriptor desc, SkinnyMethodAdapter method, String superClass, int specificArity, boolean block, boolean acceptsKeywords) | |
| createJavaMethodCtor | back to summary |
|---|---|
| private static ClassWriter createJavaMethodCtor(String namePath, String sup, String parameterDesc) | |
| determineSuperclass | back to summary |
|---|---|
| private static Class | |
| endClass | back to summary |
|---|---|
| protected Class | |
| getAnnotatedMethod | back to summary |
|---|---|
| public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, List<JavaMethodDescriptor> descs, String name) Implements abstract org. Use code generation to provide a method handle based on an annotated Java method.
| |
| getAnnotatedMethod | back to summary |
|---|---|
| public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, JavaMethodDescriptor desc, String name) Implements abstract org. Use code generation to provide a method handle based on an annotated Java method.
| |
| getAnnotatedMethodClass | back to summary |
|---|---|
| public Class Use code generation to provide a method handle based on an annotated Java method. Return the resulting generated or loaded class. | |
| getPostMethod | back to summary |
|---|---|
| public static String getPostMethod(CallConfiguration callConfig) | |
| getPreMethod | back to summary |
|---|---|
| private static String getPreMethod(CallConfiguration callConfig) | |
| getPreSignature | back to summary |
|---|---|
| private static String getPreSignature(CallConfiguration callConfig) | |
| invokeCallConfigPost | back to summary |
|---|---|
| private void invokeCallConfigPost(SkinnyMethodAdapter mv, String superClass, CallConfiguration callConfig) | |
| invokeCallConfigPre | back to summary |
|---|---|
| private void invokeCallConfigPre(SkinnyMethodAdapter mv, String superClass, int specificArity, boolean block, CallConfiguration callConfig) | |
| invokeCCallTrace | back to summary |
|---|---|
| private static void invokeCCallTrace(SkinnyMethodAdapter method, int traceBoolIndex) | |
| invokeCReturnTrace | back to summary |
|---|---|
| private static void invokeCReturnTrace(SkinnyMethodAdapter method, int traceBoolIndex) | |
| loadArguments | back to summary |
|---|---|
| private static void loadArguments(SkinnyMethodAdapter mv, JavaMethodDescriptor desc, int specificArity) | |
| loadArgumentWithCast | back to summary |
|---|---|
| private static void loadArgumentWithCast(SkinnyMethodAdapter mv, int argNumber, Class<T> coerceType) | |
| loadBlock | back to summary |
|---|---|
| private static void loadBlock(SkinnyMethodAdapter mv, int specificArity, boolean getsBlock) load the block argument from the correct position. Since we have fixed- arity call paths we need to calculate where the last var holding the block is. If we don't have a block then this does nothing. | |
| loadBlockForPre | back to summary |
|---|---|
| private static void loadBlockForPre(SkinnyMethodAdapter mv, int specificArity, boolean getsBlock) load block argument for pre() call. Since we have fixed-arity call paths we need calculate where the last var holding the block is. is we don't have a block we setup NULL_BLOCK as part of our null pattern strategy (we do not allow null in any field which accepts block). | |
| loadReceiver | back to summary |
|---|---|
| private static void loadReceiver(String typePath, JavaMethodDescriptor desc, SkinnyMethodAdapter mv) | |
| prepareForPre | back to summary |
|---|---|
| private static void prepareForPre(SkinnyMethodAdapter mv, int specificArity, boolean block, CallConfiguration callConfig) | |
| tryClass | back to summary |
|---|---|
| private Class | |