Skip to content

Instantly share code, notes, and snippets.

@headius
Created May 4, 2010 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/389864 to your computer and use it in GitHub Desktop.
Save headius/389864 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 1d8f325..67ae557 100644
--- a/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java
+++ b/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java
@@ -24,8 +24,8 @@ public class InvokeDynamicSupport {
public static class JRubyCallSite extends CallSite {
private final CallType callType;
- public JRubyCallSite(Class caller, String name, MethodType type, CallType callType) {
- super(caller, name, type);
+ public JRubyCallSite(CallType callType) {
+ super(null);
this.callType = callType;
}
@@ -36,20 +36,22 @@ public class InvokeDynamicSupport {
public static CallSite bootstrap(Class caller, String name, MethodType type) {
JRubyCallSite site;
-
- if (name == "call") {
- site = new JRubyCallSite(caller, name, type, CallType.NORMAL);
+
+ if (name.equals("call")) {
+ site = new JRubyCallSite(CallType.NORMAL);
} else {
- site = new JRubyCallSite(caller, name, type, CallType.FUNCTIONAL);
+ site = new JRubyCallSite(CallType.FUNCTIONAL);
}
-
+
MethodType fallbackType = type.insertParameterType(0, JRubyCallSite.class);
MethodHandle myFallback = MethodHandles.insertArguments(
MethodHandles.lookup().findStatic(InvokeDynamicSupport.class, "fallback",
fallbackType),
0,
site);
+
site.setTarget(myFallback);
+
return site;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment