Created
March 29, 2012 12:23
-
-
Save nahi/2236839 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java b/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java | |
index 17e442c..13de470 100644 | |
--- a/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java | |
+++ b/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java | |
@@ -426,8 +426,11 @@ public class InvokeDynamicSupport { | |
getValue = filterReturnValue(getValue, nullToNil); | |
// prepare fallback | |
- MethodHandle fallback = findStatic(InvokeDynamicSupport.class, "getVariableFallback", methodType(IRubyObject.class, VariableSite.class, IRubyObject.class)); | |
- fallback = fallback.bindTo(site); | |
+ MethodHandle fallback = site.getTarget(); | |
+ if (fallback == null) { | |
+ fallback = findStatic(InvokeDynamicSupport.class, "getVariableFallback", methodType(IRubyObject.class, VariableSite.class, IRubyObject.class)); | |
+ fallback = fallback.bindTo(site); | |
+ } | |
// prepare test | |
MethodHandle test = findStatic(InvocationLinker.class, "testRealClass", methodType(boolean.class, RubyClass.class, IRubyObject.class)); | |
@@ -455,8 +458,11 @@ public class InvokeDynamicSupport { | |
setValue = foldArguments(returnValue, setValue); | |
// prepare fallback | |
- MethodHandle fallback = findStatic(InvokeDynamicSupport.class, "setVariableFallback", methodType(IRubyObject.class, VariableSite.class, IRubyObject.class, IRubyObject.class)); | |
- fallback = fallback.bindTo(site); | |
+ MethodHandle fallback = site.getTarget(); | |
+ if (fallback == null) { | |
+ fallback = findStatic(InvokeDynamicSupport.class, "setVariableFallback", methodType(IRubyObject.class, VariableSite.class, IRubyObject.class, IRubyObject.class)); | |
+ fallback = fallback.bindTo(site); | |
+ } | |
// prepare test | |
MethodHandle test = findStatic(InvocationLinker.class, "testRealClass", methodType(boolean.class, RubyClass.class, IRubyObject.class)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment