Skip to content

Instantly share code, notes, and snippets.

@headius
Created July 2, 2009 20:23
Show Gist options
  • Save headius/139695 to your computer and use it in GitHub Desktop.
Save headius/139695 to your computer and use it in GitHub Desktop.
private static final MethodHandle PGC_1 = dropNameAndArgs(PGC, 4, 1, false);
private static final MethodHandle GETMETHOD_1 = dropNameAndArgs(GETMETHOD, 5, 1, false);
private static final MethodHandle TEST_1 = dropNameAndArgs(TEST, 4, 1, false);
private static final MethodHandle TARGET_1;
static {
MethodHandle target = MethodHandles.lookup().findVirtual(DynamicMethod.class, "call",
MethodType.make(IRubyObject.class, ThreadContext.class, IRubyObject.class, RubyModule.class, String.class, IRubyObject.class));
// IRubyObject, DynamicMethod, ThreadContext, IRubyObject, RubyModule, String, IRubyObject
target = MethodHandles.convertArguments(target, MethodType.make(IRubyObject.class, DynamicMethod.class, ThreadContext.class, IRubyObject.class, RubyClass.class, String.class, IRubyObject.class));
// IRubyObject, DynamicMethod, ThreadContext, IRubyObject, RubyClass, String, IRubyObject
target = MethodHandles.permuteArguments(
target,
MethodType.make(IRubyObject.class, DynamicMethod.class, RubyClass.class, ThreadContext.class, IRubyObject.class, String.class, IRubyObject.class),
new int[] {0,2,3,1,4,5});
// IRubyObject, DynamicMethod, RubyClass, ThreadContext, IRubyObject, String, IRubyObject
target = MethodHandles.dropArguments(target, 3, IRubyObject.class);
// IRubyObject, DynamicMethod, RubyClass, ThreadContext, IRubyObject, IRubyObject, String, IRubyObject
target = MethodHandles.dropArguments(target, 2, CacheEntry.class);
// IRubyObject, DynamicMethod, RubyClass, CacheEntry, ThreadContext, IRubyObject, IRubyObject, String, IRubyObject
target = MethodHandles.foldArguments(target, GETMETHOD_1);
// IRubyObject, RubyClass, CacheEntry, ThreadContext, IRubyObject, IRubyObject, String, IRubyObject
target = MethodHandles.foldArguments(target, PGC_1);
// IRubyObject, CacheEntry, ThreadContext, IRubyObject, IRubyObject, String, IRubyObject
TARGET_1 = target;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment