Skip to content

Commit 21ccb97

Browse files
committed
[Truffle] Workaround for bug in 0.5 Truffle splitter/inliner.
1 parent e5cf31f commit 21ccb97

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

core/src/main/java/org/jruby/truffle/nodes/dispatch/CachedBoxedMethodMissingDispatchNode.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.jruby.truffle.runtime.core.RubySymbol;
2626
import org.jruby.truffle.runtime.lookup.LookupNode;
2727
import org.jruby.truffle.runtime.methods.RubyMethod;
28+
import org.jruby.util.cli.Options;
2829

2930
public abstract class CachedBoxedMethodMissingDispatchNode extends CachedDispatchNode {
3031

@@ -43,6 +44,18 @@ public CachedBoxedMethodMissingDispatchNode(RubyContext context, Object cachedNa
4344
this.method = method;
4445

4546
callNode = Truffle.getRuntime().createDirectCallNode(method.getCallTarget());
47+
48+
/*
49+
* The splitter/inliner since Truffle 0.5 has a bug where it isn't splitting/inlining this call site - it should
50+
* be fixed in 0.6, but until then we'll force it. Turn off (to test) with
51+
* -Xtruffle.call.force_split_inline_missing = false.
52+
*/
53+
54+
if (Options.TRUFFLE_CALL_FORCE_SPLIT_INLINE_MISSING.load()) {
55+
insert(callNode);
56+
callNode.split();
57+
callNode.forceInlining();
58+
}
4659
}
4760

4861
public CachedBoxedMethodMissingDispatchNode(CachedBoxedMethodMissingDispatchNode prev) {

core/src/main/java/org/jruby/util/cli/Options.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public class Options {
148148
public static final Option<Integer> TRUFFLE_DISPATCH_MEGAMORPHIC_MAX = integer(TRUFFLE, "truffle.dispatch.megamorphic.max", 255, "Maximum size of a megamorphic call site cache.");
149149
public static final Option<Boolean> TRUFFLE_LOAD_PRINT = bool(TRUFFLE, "truffle.load.print", false, "Print the name of files as they're loaded.");
150150
public static final Option<Boolean> TRUFFLE_DEBUG_ENABLE_ASSERT_CONSTANT = bool(TRUFFLE, "truffle.debug.enable_assert_constant", false, "Enable special 'truffle_assert_constant' form.");
151+
public static final Option<Boolean> TRUFFLE_CALL_FORCE_SPLIT_INLINE_MISSING = bool(TRUFFLE, "truffle.call.force_split_inline_missing", true, "Force splitting/inlining of a method missing call.");
151152

152153
public static final Option<Boolean> NATIVE_ENABLED = bool(NATIVE, "native.enabled", true, "Enable/disable native code, including POSIX features and C exts.");
153154
public static final Option<Boolean> NATIVE_VERBOSE = bool(NATIVE, "native.verbose", false, "Enable verbose logging of native extension loading.");

0 commit comments

Comments
 (0)