Class InvocationMethodFactory

java.lang.Object
org.jruby.runtime.MethodFactory
org.jruby.internal.runtime.methods.InvocationMethodFactory
All Implemented Interfaces:
org.objectweb.asm.Opcodes
Direct Known Subclasses:
DumpingInvocationMethodFactory, InvokeDynamicMethodFactory

public class InvocationMethodFactory extends MethodFactory implements org.objectweb.asm.Opcodes
In order to avoid the overhead with reflection-based method handles, this MethodFactory uses ASM to generate tiny invoker classes. This allows for better performance and more specialization per-handle than can be supported via reflection. It also allows optimizing away many conditionals that can be determined once ahead of time. When running in secured environments, this factory may not function. When this can be detected, MethodFactory will fall back on the reflection-based factory instead.
See Also:
  • Field Details

    • LOG

      private static final Logger LOG
    • DEBUG

      private static final boolean DEBUG
      See Also:
    • COMPILED_CALL_SIG

      private static final String COMPILED_CALL_SIG
      The outward call signature for compiled Ruby method handles.
    • COMPILED_CALL_SIG_BLOCK

      private static final String COMPILED_CALL_SIG_BLOCK
      The outward call signature for compiled Ruby method handles.
    • COMPILED_CALL_SIG_ZERO_BLOCK

      private static final String COMPILED_CALL_SIG_ZERO_BLOCK
      The outward arity-zero call-with-block signature for compiled Ruby method handles.
    • COMPILED_CALL_SIG_ZERO

      private static final String COMPILED_CALL_SIG_ZERO
      The outward arity-zero call-without-block signature for compiled Ruby method handles.
    • COMPILED_CALL_SIG_ONE_BLOCK

      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_ONE

      private static final String COMPILED_CALL_SIG_ONE
      The outward arity-one call-without-block signature for compiled Ruby method handles.
    • COMPILED_CALL_SIG_TWO_BLOCK

      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_TWO

      private static final String COMPILED_CALL_SIG_TWO
      The outward arity-two call-without-block signature for compiled Ruby method handles.
    • COMPILED_CALL_SIG_THREE_BLOCK

      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_THREE

      private static final String COMPILED_CALL_SIG_THREE
      The outward arity-three call-without-block signature for compiled Ruby method handles.
    • JAVA_SUPER_SIG

      private static final String JAVA_SUPER_SIG
      The super constructor signature for Java-based method handles.
    • THIS_INDEX

      public static final int THIS_INDEX
      The lvar index of "this"
      See Also:
    • THREADCONTEXT_INDEX

      public static final int THREADCONTEXT_INDEX
      The lvar index of the passed-in ThreadContext
      See Also:
    • RECEIVER_INDEX

      public static final int RECEIVER_INDEX
      The lvar index of the method-receiving object
      See Also:
    • CLASS_INDEX

      public static final int CLASS_INDEX
      The lvar index of the RubyClass being invoked against
      See Also:
    • NAME_INDEX

      public static final int NAME_INDEX
      The lvar index method name being invoked
      See Also:
    • ARGS_INDEX

      public static final int ARGS_INDEX
      The lvar index of the method args on the call
      See Also:
    • BLOCK_INDEX

      public static final int BLOCK_INDEX
      The lvar index of the passed-in Block on the call
      See Also:
    • classLoader

      protected final ClassDefiningJRubyClassLoader classLoader
      The classloader to use for code loading
    • syncObject

      protected final Object syncObject
      An object to sync against when loading classes, to avoid dups
    • seenUndefinedClasses

      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.
    • haveWarnedUser

      private boolean haveWarnedUser
      Whether we've informed the user that we've seen undefined methods; this is to avoid a flood of repetitive information.
    • RubyModule_and_Visibility_and_Name

      private static final Class[] RubyModule_and_Visibility_and_Name
    • RubyModule_and_Visibility

      @Deprecated private static final Class[] RubyModule_and_Visibility
      Deprecated.
  • Constructor Details

    • InvocationMethodFactory

      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.
      Parameters:
      classLoader - The classloader to use, or to wrap if it is not a JRubyClassLoader instance.
  • Method Details