Example #1
0
  static {
    MethodHandle target =
        MethodHandles.lookup()
            .findVirtual(
                DynamicMethod.class,
                "call",
                MethodType.make(
                    IRubyObject.class,
                    ThreadContext.class,
                    IRubyObject.class,
                    RubyModule.class,
                    String.class,
                    IRubyObject.class,
                    IRubyObject.class,
                    Block.class));
    target =
        MethodHandles.convertArguments(
            target,
            MethodType.make(
                IRubyObject.class,
                DynamicMethod.class,
                ThreadContext.class,
                IRubyObject.class,
                RubyClass.class,
                String.class,
                IRubyObject.class,
                IRubyObject.class,
                Block.class));
    target =
        MethodHandles.permuteArguments(
            target,
            MethodType.make(
                IRubyObject.class,
                DynamicMethod.class,
                RubyClass.class,
                CacheEntry.class,
                ThreadContext.class,
                IRubyObject.class,
                IRubyObject.class,
                String.class,
                IRubyObject.class,
                IRubyObject.class,
                Block.class),
            new int[] {0, 3, 5, 1, 6, 7, 8, 9});
    // IRubyObject, DynamicMethod, RubyClass, CacheEntry, ThreadContext, IRubyObject, IRubyObject,
    // String, args
    target = MethodHandles.foldArguments(target, GETMETHOD_2_B);
    // IRubyObject, RubyClass, CacheEntry, ThreadContext, IRubyObject, IRubyObject, String, args
    target = MethodHandles.foldArguments(target, PGC_2_B);
    // IRubyObject, CacheEntry, ThreadContext, IRubyObject, IRubyObject, String, args

    MethodHandle breakJump = dropNameAndArgs(BREAKJUMP, 5, 2, true);
    MethodHandle retryJump = dropNameAndArgs(RETRYJUMP, 5, 2, true);
    target = MethodHandles.catchException(target, JumpException.BreakJump.class, breakJump);
    target = MethodHandles.catchException(target, JumpException.RetryJump.class, retryJump);

    TARGET_2_B = target;
  }
Example #2
0
 static {
   MethodHandle target =
       MethodHandles.lookup()
           .findVirtual(
               DynamicMethod.class,
               "call",
               MethodType.make(
                   IRubyObject.class,
                   ThreadContext.class,
                   IRubyObject.class,
                   RubyModule.class,
                   String.class,
                   IRubyObject.class,
                   IRubyObject.class,
                   IRubyObject.class));
   target =
       MethodHandles.convertArguments(
           target,
           MethodType.make(
               IRubyObject.class,
               DynamicMethod.class,
               ThreadContext.class,
               IRubyObject.class,
               RubyClass.class,
               String.class,
               IRubyObject.class,
               IRubyObject.class,
               IRubyObject.class));
   target =
       MethodHandles.permuteArguments(
           target,
           MethodType.make(
               IRubyObject.class,
               DynamicMethod.class,
               RubyClass.class,
               CacheEntry.class,
               ThreadContext.class,
               IRubyObject.class,
               IRubyObject.class,
               String.class,
               IRubyObject.class,
               IRubyObject.class,
               IRubyObject.class),
           new int[] {0, 3, 5, 1, 6, 7, 8, 9});
   // IRubyObject, DynamicMethod, RubyClass, CacheEntry, ThreadContext, IRubyObject, IRubyObject,
   // String, args
   target = MethodHandles.foldArguments(target, GETMETHOD_3);
   // IRubyObject, RubyClass, CacheEntry, ThreadContext, IRubyObject, IRubyObject, String, args
   target = MethodHandles.foldArguments(target, PGC_3);
   // IRubyObject, CacheEntry, ThreadContext, IRubyObject, IRubyObject, String, args
   TARGET_3 = target;
 }
Example #3
0
 static {
   MethodHandle retryJump =
       MethodHandles.lookup()
           .findStatic(
               InvokeDynamicSupport.class,
               "retryJumpError",
               MethodType.make(IRubyObject.class, ThreadContext.class));
   // ThreadContext
   retryJump =
       MethodHandles.permuteArguments(
           retryJump,
           MethodType.make(
               IRubyObject.class,
               JumpException.RetryJump.class,
               CacheEntry.class,
               ThreadContext.class,
               IRubyObject.class,
               IRubyObject.class),
           new int[] {2});
   // RetryJump, CacheEntry, ThreadContext, IRubyObject, IRubyObject
   RETRYJUMP = retryJump;
 }
Example #4
0
 static {
   MethodHandle breakJump =
       MethodHandles.lookup()
           .findStatic(
               InvokeDynamicSupport.class,
               "handleBreakJump",
               MethodType.make(
                   IRubyObject.class, JumpException.BreakJump.class, ThreadContext.class));
   // BreakJump, ThreadContext
   breakJump =
       MethodHandles.permuteArguments(
           breakJump,
           MethodType.make(
               IRubyObject.class,
               JumpException.BreakJump.class,
               CacheEntry.class,
               ThreadContext.class,
               IRubyObject.class,
               IRubyObject.class),
           new int[] {0, 2});
   // BreakJump, CacheEntry, ThreadContext, IRubyObject, IRubyObject
   BREAKJUMP = breakJump;
 }