Skip to content

Commit

Permalink
Showing 2 changed files with 6 additions and 18 deletions.
8 changes: 5 additions & 3 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -472,7 +472,7 @@ public IRubyObject evalScriptlet(String script, DynamicScope scope) {
context.preEvalScriptlet(scope);

try {
return Interpreter.getInstance().execute(this, rootNode, context.getFrameSelf());
return interpreter.execute(this, rootNode, context.getFrameSelf());
} finally {
context.postEvalScriptlet();
}
@@ -835,7 +835,7 @@ public IRubyObject runInterpreter(ThreadContext context, ParseResult parseResult
throw new UnsupportedOperationException();
}

return Interpreter.getInstance().execute(this, parseResult, self);
return interpreter.execute(this, parseResult, self);
}

public IRubyObject runInterpreter(ThreadContext context, Node rootNode, IRubyObject self) {
@@ -849,7 +849,7 @@ public IRubyObject runInterpreter(ThreadContext context, Node rootNode, IRubyObj
Main.printTruffleTimeMetric("after-run");
return getNil();
} else {
return Interpreter.getInstance().execute(this, rootNode, self);
return interpreter.execute(this, rootNode, self);
}
}

@@ -5137,6 +5137,8 @@ public void addToObjectSpace(boolean useObjectSpace, IRubyObject object) {

private final FilenoUtil filenoUtil = new FilenoUtil();

private Interpreter interpreter = new Interpreter();

/**
* A representation of this runtime as a JIT-optimizable constant. Used for e.g. invokedynamic binding of runtime
* accesses.
16 changes: 1 addition & 15 deletions core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
Original file line number Diff line number Diff line change
@@ -31,23 +31,9 @@

public class Interpreter extends IRTranslator<IRubyObject, IRubyObject> {
public static final Logger LOG = LoggerFactory.getLogger("Interpreter");
private static final IRubyObject[] EMPTY_ARGS = new IRubyObject[]{};
public static final String ROOT = "(root)";
static int interpInstrsCount = 0;

// we do not need instances of Interpreter
// FIXME: Should we make it real singleton and get rid of static methods?
private Interpreter() { }

private static class InterpreterHolder {
// FIXME: Remove static reference unless lifus does later
public static final Interpreter instance = new Interpreter();
}

public static Interpreter getInstance() {
return InterpreterHolder.instance;
}

public static void dumpStats() {
if ((IRRuntimeHelpers.isDebug() || IRRuntimeHelpers.inProfileMode()) && interpInstrsCount > 10000) {
LOG.info("-- Interpreted instructions: {}", interpInstrsCount);
@@ -178,7 +164,7 @@ private static IRubyObject evalCommon(ThreadContext context, DynamicScope evalSc

runBeginBlocks(ic.getBeginBlocks(), context, self, ss, null);

return Interpreter.INTERPRET_EVAL(context, self, ic, ic.getStaticScope().getModule(), EMPTY_ARGS, name, block, null);
return Interpreter.INTERPRET_EVAL(context, self, ic, ic.getStaticScope().getModule(), IRubyObject.NULL_ARRAY, name, block, null);
} finally {
evalScope.clearEvalType();
context.popScope();

0 comments on commit 11fad6e

Please sign in to comment.