Skip to content

Commit

Permalink
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -150,6 +150,8 @@ public class Options {
public static final Option<Boolean> TRUFFLE_DISPATCH_METHODMISSING_ALWAYS_CLONED = bool(TRUFFLE, "truffle.call.method_missing_always_cloned", true, "Always clone #method_missing call targets.");
public static final Option<Boolean> TRUFFLE_DISPATCH_METHODMISSING_ALWAYS_INLINED = bool(TRUFFLE, "truffle.call.method_missing_always_inlined", true, "Always inline #method_missing call targets.");

public static final Option<Integer> TRUFFLE_PACK_UNROLL_LIMIT = integer(TRUFFLE, "truffle.pack.unroll", 4, "If a pack expression has a loop less than this many iterations, unroll it.");

public static final Option<Boolean> TRUFFLE_METRICS_TIME = bool(TRUFFLE, "truffle.metrics.time", false, "Print the time at various stages of VM operation.");
public static final Option<Boolean> TRUFFLE_METRICS_MEMORY_USED_ON_EXIT = bool(TRUFFLE, "truffle.metrics.memory_used_on_exit", false, "Print the size of heap memory in use on exit.");

Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
import com.oracle.truffle.api.nodes.ExplodeLoop;
import org.jruby.truffle.pack.nodes.PackNode;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.util.cli.Options;

/**
* Repeats a child node N times.
@@ -28,6 +29,8 @@
*/
public class NNode extends PackNode {

private static final int PACK_UNROLL_LIMIT = Options.TRUFFLE_PACK_UNROLL_LIMIT.load();

private final int repeats;
@Child private PackNode child;

@@ -41,7 +44,7 @@ public NNode(RubyContext context, int repeats, PackNode child) {
public Object execute(VirtualFrame frame) {
if (CompilerDirectives.inCompiledCode()
&& CompilerDirectives.isCompilationConstant(repeats)
&& repeats <= 4) {
&& repeats <= PACK_UNROLL_LIMIT) {
return executeExploded(frame);
}

0 comments on commit bba59d1

Please sign in to comment.