Skip to content

Instantly share code, notes, and snippets.

@jruby
Created May 27, 2009 20:32
Show Gist options
  • Save jruby/118890 to your computer and use it in GitHub Desktop.
Save jruby/118890 to your computer and use it in GitHub Desktop.
diff --git a/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java b/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java
index 332d1c1..a83ebfe 100644
--- a/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java
+++ b/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java
@@ -72,7 +72,7 @@ public class InvokeDynamicSupport {
return MethodHandles.convertArguments(guardWithTest, site.type());
}
- public static boolean test(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name) {
+ public static boolean test(CacheEntry entry, IRubyObject self) {
return entry.typeOk(self.getMetaClass());
}
@@ -92,10 +92,6 @@ public class InvokeDynamicSupport {
return entry.method.call(context, self, selfClass, name);
}
- public static boolean test(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0) {
- return entry.typeOk(self.getMetaClass());
- }
-
public static IRubyObject target(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0) {
RubyClass selfClass = pollAndGetClass(context, self);
return entry.method.call(context, self, selfClass, name, arg0);
@@ -112,10 +108,6 @@ public class InvokeDynamicSupport {
return entry.method.call(context, self, selfClass, name, arg0);
}
- public static boolean test(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1) {
- return entry.typeOk(self.getMetaClass());
- }
-
public static IRubyObject target(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1) {
RubyClass selfClass = pollAndGetClass(context, self);
return entry.method.call(context, self, selfClass, name, arg0, arg1);
@@ -132,10 +124,6 @@ public class InvokeDynamicSupport {
return entry.method.call(context, self, selfClass, name, arg0, arg1);
}
- public static boolean test(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) {
- return entry.typeOk(self.getMetaClass());
- }
-
public static IRubyObject target(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) {
RubyClass selfClass = pollAndGetClass(context, self);
return entry.method.call(context, self, selfClass, name, arg0, arg1, arg2);
@@ -172,10 +160,6 @@ public class InvokeDynamicSupport {
return entry.method.call(context, self, selfClass, name, args);
}
- public static boolean test(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, Block block) {
- return entry.typeOk(self.getMetaClass());
- }
-
public static IRubyObject target(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, Block block) {
try {
RubyClass selfClass = pollAndGetClass(context, self);
@@ -208,10 +192,6 @@ public class InvokeDynamicSupport {
}
}
- public static boolean test(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0, Block block) {
- return entry.typeOk(self.getMetaClass());
- }
-
public static IRubyObject target(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0, Block block) {
try {
RubyClass selfClass = pollAndGetClass(context, self);
@@ -244,10 +224,6 @@ public class InvokeDynamicSupport {
}
}
- public static boolean test(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, Block block) {
- return entry.typeOk(self.getMetaClass());
- }
-
public static IRubyObject target(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, Block block) {
try {
RubyClass selfClass = pollAndGetClass(context, self);
@@ -280,10 +256,6 @@ public class InvokeDynamicSupport {
}
}
- public static boolean test(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) {
- return entry.typeOk(self.getMetaClass());
- }
-
public static IRubyObject target(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) {
try {
RubyClass selfClass = pollAndGetClass(context, self);
@@ -316,10 +288,6 @@ public class InvokeDynamicSupport {
}
}
- public static boolean test(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject[] args, Block block) {
- return entry.typeOk(self.getMetaClass());
- }
-
public static IRubyObject target(CacheEntry entry, ThreadContext context, IRubyObject caller, IRubyObject self, String name, IRubyObject[] args, Block block) {
try {
RubyClass selfClass = pollAndGetClass(context, self);
@@ -417,71 +385,67 @@ public class InvokeDynamicSupport {
private static final MethodType BOOTSTRAP_TYPE = MethodType.make(CallSite.class, Class.class, String.class, MethodType.class);
private static final MethodHandle BOOTSTRAP = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "bootstrap", BOOTSTRAP_TYPE);
- private static final MethodHandle TEST_0 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
- MethodType.make(boolean.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class));
+ private static final MethodHandle TEST = MethodHandles.dropArguments(
+ MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
+ MethodType.make(boolean.class, CacheEntry.class, IRubyObject.class)),
+ 1,
+ ThreadContext.class, IRubyObject.class);
+
+ private static final MethodHandle TEST_0 = MethodHandles.dropArguments(TEST, 2, String.class);
private static final MethodHandle TARGET_0 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "target",
MethodType.make(IRubyObject.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class));
private static final MethodHandle FALLBACK_0 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
MethodType.make(IRubyObject.class, JRubyCallSite.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class));
- private static final MethodHandle TEST_1 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
- MethodType.make(boolean.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class));
+ private static final MethodHandle TEST_1 = MethodHandles.dropArguments(TEST, 2, String.class, IRubyObject.class);
private static final MethodHandle TARGET_1 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "target",
MethodType.make(IRubyObject.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class));
private static final MethodHandle FALLBACK_1 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
MethodType.make(IRubyObject.class, JRubyCallSite.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class));
- private static final MethodHandle TEST_2 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
- MethodType.make(boolean.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class));
+ private static final MethodHandle TEST_2 = MethodHandles.dropArguments(TEST, 2, String.class, IRubyObject.class, IRubyObject.class);
private static final MethodHandle TARGET_2 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "target",
MethodType.make(IRubyObject.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class));
private static final MethodHandle FALLBACK_2 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
MethodType.make(IRubyObject.class, JRubyCallSite.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class));
- private static final MethodHandle TEST_3 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
- MethodType.make(boolean.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class, IRubyObject.class));
+ private static final MethodHandle TEST_3 = MethodHandles.dropArguments(TEST, 2, String.class, IRubyObject.class, IRubyObject.class, IRubyObject.class);
private static final MethodHandle TARGET_3 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "target",
MethodType.make(IRubyObject.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class, IRubyObject.class));
private static final MethodHandle FALLBACK_3 = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
MethodType.make(IRubyObject.class, JRubyCallSite.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class, IRubyObject.class));
- private static final MethodHandle TEST_N = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
- MethodType.make(boolean.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject[].class));
+ private static final MethodHandle TEST_N = MethodHandles.dropArguments(TEST, 2, String.class, IRubyObject[].class);
private static final MethodHandle TARGET_N = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "target",
MethodType.make(IRubyObject.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject[].class));
private static final MethodHandle FALLBACK_N = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
MethodType.make(IRubyObject.class, JRubyCallSite.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject[].class));
- private static final MethodHandle TEST_0_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
- MethodType.make(boolean.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, Block.class));
+ private static final MethodHandle TEST_0_B = MethodHandles.dropArguments(TEST, 2, String.class, Block.class);
private static final MethodHandle TARGET_0_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "target",
MethodType.make(IRubyObject.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, Block.class));
private static final MethodHandle FALLBACK_0_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
MethodType.make(IRubyObject.class, JRubyCallSite.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, Block.class));
- private static final MethodHandle TEST_1_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
- MethodType.make(boolean.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, Block.class));
+ private static final MethodHandle TEST_1_B = MethodHandles.dropArguments(TEST, 2, String.class, IRubyObject.class, Block.class);
private static final MethodHandle TARGET_1_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "target",
MethodType.make(IRubyObject.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, Block.class));
private static final MethodHandle FALLBACK_1_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
MethodType.make(IRubyObject.class, JRubyCallSite.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, Block.class));
- private static final MethodHandle TEST_2_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
- MethodType.make(boolean.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class, Block.class));
+ private static final MethodHandle TEST_2_B = MethodHandles.dropArguments(TEST, 2, String.class, IRubyObject.class, IRubyObject.class, Block.class);
private static final MethodHandle TARGET_2_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "target",
MethodType.make(IRubyObject.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class, Block.class));
private static final MethodHandle FALLBACK_2_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
MethodType.make(IRubyObject.class, JRubyCallSite.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class, Block.class));
- private static final MethodHandle TEST_3_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
- MethodType.make(boolean.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class, IRubyObject.class, Block.class));
+ private static final MethodHandle TEST_3_B = MethodHandles.dropArguments(TEST, 2, String.class, IRubyObject.class, IRubyObject.class, IRubyObject.class, Block.class);
private static final MethodHandle TARGET_3_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "target",
MethodType.make(IRubyObject.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class, IRubyObject.class, Block.class));
private static final MethodHandle FALLBACK_3_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
MethodType.make(IRubyObject.class, JRubyCallSite.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject.class, IRubyObject.class, IRubyObject.class, Block.class));
- private static final MethodHandle TEST_N_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "test",
- MethodType.make(boolean.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject[].class, Block.class));
+ private static final MethodHandle TEST_N_B = MethodHandles.dropArguments(TEST, 2, String.class, IRubyObject[].class, Block.class);
private static final MethodHandle TARGET_N_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "target",
MethodType.make(IRubyObject.class, CacheEntry.class, ThreadContext.class, IRubyObject.class, IRubyObject.class, String.class, IRubyObject[].class, Block.class));
private static final MethodHandle FALLBACK_N_B = MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment