Пример #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;
  }
Пример #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;
 }