Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ef5da87d17b3
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 713f6b251ad6
Choose a head ref
  • 3 commits
  • 14 files changed
  • 1 contributor

Commits on May 3, 2015

  1. Copy the full SHA
    75258eb View commit details
  2. Copy the full SHA
    ea856f7 View commit details
  3. Copy the full SHA
    713f6b2 View commit details
3 changes: 0 additions & 3 deletions core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -127,7 +127,6 @@ public class Options {
public static final Option<Boolean> IR_WRITING_DEBUG = bool(IR, "ir.writing.debug", false, "Debug writing JRuby IR file.");
public static final Option<String> IR_INLINE_COMPILER_PASSES = string(IR, "ir.inline_passes", "Specify comma delimeted list of passes to run after inlining a method.");

public static final Option<Boolean> TRUFFLE_PRINT_RUNTIME = bool(TRUFFLE, "truffle.printRuntime", false, "Print the name of the Truffle runtime on startup.");
public static final Option<Boolean> TRUFFLE_RUNTIME_VERSION_CHECK = bool(TRUFFLE, "truffle.runtime.version_check", true, "Check the version of Truffle supplied by the JVM before starting.");

public static final Option<Integer> TRUFFLE_DISPATCH_POLYMORPHIC_MAX = integer(TRUFFLE, "truffle.dispatch.polymorphic.max", 8, "Maximum size of a polymorphic call site cache.");
@@ -136,8 +135,6 @@ public class Options {
public static final Option<Integer> TRUFFLE_ARRAYS_SMALL = integer(TRUFFLE, "truffle.arrays.small", 3, "Maximum size of an Array to consider small for optimisations.");
public static final Option<Integer> TRUFFLE_HASH_PACKED_ARRAY_MAX = integer(TRUFFLE, "truffle.hash.packed_array_max", 3, "Maximum size of a Hash to use with the packed array storage strategy.");

public static final Option<Boolean> TRUFFLE_LOAD_CORE = bool(TRUFFLE, "truffle.load_core", true, "Load the Truffle core library.");

public static final Option<Integer> TRUFFLE_PASSALOT = integer(TRUFFLE, "truffle.passalot", 0, "Probabilty between 0 and 100 to randomly insert Thread.pass at a given line.");
public static final Option<Integer> TRUFFLE_INSTRUMENTATION_SERVER_PORT = integer(TRUFFLE, "truffle.instrumentation_server_port", 0, "Port number to run an HTTP server on that provides instrumentation services");
public static final Option<String> TRUFFLE_TRANSLATOR_PRINT_AST = string(TRUFFLE, "truffle.translator.print_asts", "", "Comma delimited list of method names to print the AST of after translation.");
10 changes: 1 addition & 9 deletions truffle/src/main/java/org/jruby/truffle/TruffleBridgeImpl.java
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@
*/
package org.jruby.truffle;

import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.source.BytesDecoder;
import com.oracle.truffle.api.source.Source;
@@ -31,7 +30,6 @@
import org.jruby.truffle.runtime.core.RubyException;
import org.jruby.truffle.translator.NodeWrapper;
import org.jruby.truffle.translator.TranslatorDriver;
import org.jruby.util.cli.Options;

import java.io.File;
import java.io.IOException;
@@ -41,8 +39,6 @@

public class TruffleBridgeImpl implements TruffleBridge {

private static final boolean PRINT_RUNTIME = Options.TRUFFLE_PRINT_RUNTIME.load();

private final org.jruby.Ruby runtime;
private final RubyContext truffleContext;

@@ -58,10 +54,6 @@ public TruffleBridgeImpl(org.jruby.Ruby runtime) {

@Override
public void init() {
if (PRINT_RUNTIME) {
runtime.getInstanceConfig().getError().println("jruby: using " + Truffle.getRuntime().getName());
}

// Bring in core method nodes

RubyClass rubyObjectClass = truffleContext.getCoreLibrary().getObjectClass();
@@ -176,7 +168,7 @@ public Object execute(final Object self, final org.jruby.ast.RootNode rootNode)
}

public Object execute(final TranslatorDriver.ParserContext parserContext, final Object self, final MaterializedFrame parentFrame, final org.jruby.ast.RootNode rootNode) {
truffleContext.getCoreLibrary().getGlobalVariablesObject().getOperations().setInstanceVariable(
truffleContext.getCoreLibrary().getGlobalVariablesObject().getObjectType().setInstanceVariable(
truffleContext.getCoreLibrary().getGlobalVariablesObject(), "$0",
truffleContext.toTruffle(runtime.getGlobalVariables().get("$0")));

Original file line number Diff line number Diff line change
@@ -9,11 +9,9 @@
*/
package org.jruby.truffle.nodes.control;

import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ControlFlowException;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.BranchProfile;
import org.jruby.truffle.nodes.RubyNode;
@@ -85,7 +83,7 @@ private Object handleException(VirtualFrame frame, RaiseException exception) {
CompilerDirectives.transferToInterpreter();

final RubyBasicObject threadLocals = getContext().getThreadManager().getCurrentThread().getThreadLocals();
threadLocals.getOperations().setInstanceVariable(threadLocals, "$!", exception.getRubyException());
threadLocals.getObjectType().setInstanceVariable(threadLocals, "$!", exception.getRubyException());

for (RescueNode rescue : rescueParts) {
if (rescue.canHandle(frame, exception.getRubyException())) {
Original file line number Diff line number Diff line change
@@ -37,9 +37,7 @@
import org.jruby.truffle.nodes.rubinius.ObjectPrimitiveNodes;
import org.jruby.truffle.nodes.rubinius.ObjectPrimitiveNodesFactory;
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.backtrace.Activation;
import org.jruby.truffle.runtime.backtrace.Backtrace;
import org.jruby.truffle.runtime.backtrace.MRIBacktraceFormatter;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.hash.HashOperations;
@@ -373,7 +371,7 @@ public RubyBasicObject copy(VirtualFrame frame, RubyBasicObject self) {

final RubyBasicObject newObject = self.getLogicalClass().allocate(this);

newObject.getOperations().setInstanceVariables(newObject, self.getOperations().getInstanceVariables(self));
newObject.getObjectType().setInstanceVariables(newObject, self.getObjectType().getInstanceVariables(self));

return newObject;
}
@@ -885,14 +883,14 @@ public InstanceVariableSetNode(RubyContext context, SourceSection sourceSection)
@TruffleBoundary
@Specialization
public Object instanceVariableSet(RubyBasicObject object, RubyString name, Object value) {
object.getOperations().setInstanceVariable(object, RubyContext.checkInstanceVariableName(getContext(), name.toString(), this), value);
object.getObjectType().setInstanceVariable(object, RubyContext.checkInstanceVariableName(getContext(), name.toString(), this), value);
return value;
}

@TruffleBoundary
@Specialization
public Object instanceVariableSet(RubyBasicObject object, RubySymbol name, Object value) {
object.getOperations().setInstanceVariable(object, RubyContext.checkInstanceVariableName(getContext(), name.toString(), this), value);
object.getObjectType().setInstanceVariable(object, RubyContext.checkInstanceVariableName(getContext(), name.toString(), this), value);
return value;
}

@@ -909,7 +907,7 @@ public InstanceVariablesNode(RubyContext context, SourceSection sourceSection) {
public RubyArray instanceVariables(RubyBasicObject self) {
notDesignedForCompilation();

final Object[] instanceVariableNames = self.getOperations().getFieldNames(self);
final Object[] instanceVariableNames = self.getObjectType().getFieldNames(self);

Arrays.sort(instanceVariableNames);

Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.runtime.ModuleOperations;
import org.jruby.truffle.runtime.ObjectIDOperations;
import org.jruby.truffle.runtime.object.ObjectIDOperations;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.core.*;
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ public void execute(RubyBasicObject object, Object value) {
newProperty = currentProperty;
newProperty.setSafe(object.getDynamicObject(), value, null);
} else {
object.getOperations().setInstanceVariable(object, name, value);
object.getObjectType().setInstanceVariable(object, name, value);
newShape = object.getDynamicObject().getShape();
newProperty = newShape.getProperty(name);

Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
import org.jruby.truffle.nodes.objects.IsTaintedNodeGen;
import org.jruby.truffle.nodes.objects.TaintNode;
import org.jruby.truffle.nodes.objects.TaintNodeGen;
import org.jruby.truffle.runtime.ObjectIDOperations;
import org.jruby.truffle.runtime.object.ObjectIDOperations;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyNilClass;
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ public RegexpSetLastMatchPrimitiveNode(RubyContext context, SourceSection source
public Object setLastMatch(RubyClass regexpClass, Object matchData) {
notDesignedForCompilation();

getContext().getThreadManager().getCurrentThread().getThreadLocals().getOperations().setInstanceVariable(
getContext().getThreadManager().getCurrentThread().getThreadLocals().getObjectType().setInstanceVariable(
getContext().getThreadManager().getCurrentThread().getThreadLocals(), "$~", matchData);

return matchData;
Original file line number Diff line number Diff line change
@@ -37,6 +37,8 @@
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.methods.InternalMethod;
import org.jruby.truffle.runtime.object.ObjectIDOperations;
import org.jruby.truffle.runtime.object.RubyObjectType;
import org.jruby.truffle.runtime.subsystems.*;
import org.jruby.truffle.translator.NodeWrapper;
import org.jruby.truffle.translator.TranslatorDriver;
@@ -126,7 +128,7 @@ public RubyContext(Ruby runtime) {
// Object space manager needs to come early before we create any objects
objectSpaceManager = new ObjectSpaceManager(this);

emptyShape = RubyBasicObject.LAYOUT.createShape(new RubyOperations(this));
emptyShape = RubyBasicObject.LAYOUT.createShape(new RubyObjectType(this));

coreLibrary = new CoreLibrary(this);
rootLexicalScope = new LexicalScope(null, coreLibrary.getObjectClass());
@@ -390,7 +392,7 @@ public IRubyObject toJRuby(RubyEncoding encoding) {
public org.jruby.RubyString toJRuby(RubyString string) {
final org.jruby.RubyString jrubyString = runtime.newString(string.getByteList().dup());

final Object tainted = string.getOperations().getInstanceVariable(string, RubyBasicObject.TAINTED_IDENTIFIER);
final Object tainted = string.getObjectType().getInstanceVariable(string, RubyBasicObject.TAINTED_IDENTIFIER);

if (tainted instanceof Boolean && (boolean) tainted) {
jrubyString.setTaint(true);
@@ -449,7 +451,7 @@ public RubyString toTruffle(org.jruby.RubyString jrubyString) {
final RubyString truffleString = new RubyString(getCoreLibrary().getStringClass(), jrubyString.getByteList().dup());

if (jrubyString.isTaint()) {
truffleString.getOperations().setInstanceVariable(truffleString, RubyBasicObject.TAINTED_IDENTIFIER, true);
truffleString.getObjectType().setInstanceVariable(truffleString, RubyBasicObject.TAINTED_IDENTIFIER, true);
}

return truffleString;
Original file line number Diff line number Diff line change
@@ -50,7 +50,6 @@

public class CoreLibrary {

private static final boolean LOAD_CORE = Options.TRUFFLE_LOAD_CORE.load();
private static final String CLI_RECORD_SEPARATOR = Options.CLI_RECORD_SEPARATOR.load();

private final RubyContext context;
@@ -364,25 +363,25 @@ private void initializeGlobalVariables() {

RubyBasicObject globals = globalVariablesObject;

globals.getOperations().setInstanceVariable(globals, "$LOAD_PATH", new RubyArray(arrayClass));
globals.getOperations().setInstanceVariable(globals, "$LOADED_FEATURES", new RubyArray(arrayClass));
globals.getOperations().setInstanceVariable(globals, "$:", globals.getInstanceVariable("$LOAD_PATH"));
globals.getOperations().setInstanceVariable(globals, "$\"", globals.getInstanceVariable("$LOADED_FEATURES"));
globals.getOperations().setInstanceVariable(globals, "$,", nilObject);
globals.getOperations().setInstanceVariable(globals, "$0", context.toTruffle(context.getRuntime().getGlobalVariables().get("$0")));
globals.getObjectType().setInstanceVariable(globals, "$LOAD_PATH", new RubyArray(arrayClass));
globals.getObjectType().setInstanceVariable(globals, "$LOADED_FEATURES", new RubyArray(arrayClass));
globals.getObjectType().setInstanceVariable(globals, "$:", globals.getInstanceVariable("$LOAD_PATH"));
globals.getObjectType().setInstanceVariable(globals, "$\"", globals.getInstanceVariable("$LOADED_FEATURES"));
globals.getObjectType().setInstanceVariable(globals, "$,", nilObject);
globals.getObjectType().setInstanceVariable(globals, "$0", context.toTruffle(context.getRuntime().getGlobalVariables().get("$0")));

globals.getOperations().setInstanceVariable(globals, "$DEBUG", context.getRuntime().isDebug());
globals.getObjectType().setInstanceVariable(globals, "$DEBUG", context.getRuntime().isDebug());

Object value = context.getRuntime().warningsEnabled() ? context.getRuntime().isVerbose() : nilObject;
globals.getOperations().setInstanceVariable(globals, "$VERBOSE", value);
globals.getObjectType().setInstanceVariable(globals, "$VERBOSE", value);

final RubyString defaultRecordSeparator = RubyString.fromJavaString(stringClass, CLI_RECORD_SEPARATOR);
defaultRecordSeparator.freeze();

// TODO (nirvdrum 05-Feb-15) We need to support the $-0 alias as well.
globals.getOperations().setInstanceVariable(globals, "$/", defaultRecordSeparator);
globals.getObjectType().setInstanceVariable(globals, "$/", defaultRecordSeparator);

globals.getOperations().setInstanceVariable(globals, "$SAFE", 0);
globals.getObjectType().setInstanceVariable(globals, "$SAFE", 0);
}

private void initializeConstants() {
@@ -476,21 +475,19 @@ public void initializeAfterMethodsAdded() {

// Load Ruby core

if (LOAD_CORE) {
try {
state = State.LOADING_RUBY_CORE;
loadRubyCore("core.rb");
} catch (RaiseException e) {
final RubyException rubyException = e.getRubyException();

for (String line : Backtrace.DISPLAY_FORMATTER.format(getContext(), rubyException, rubyException.getBacktrace())) {
System.err.println(line);
}
try {
state = State.LOADING_RUBY_CORE;
loadRubyCore("core.rb");
} catch (RaiseException e) {
final RubyException rubyException = e.getRubyException();

throw new TruffleFatalException("couldn't load the core library", e);
} finally {
state = State.LOADED;
for (String line : Backtrace.DISPLAY_FORMATTER.format(getContext(), rubyException, rubyException.getBacktrace())) {
System.err.println(line);
}

throw new TruffleFatalException("couldn't load the core library", e);
} finally {
state = State.LOADED;
}
}

@@ -818,7 +815,7 @@ public RubyException typeErrorWrongArgumentType(Object object, String expectedTy
public RubyException nameError(String message, String name, Node currentNode) {
CompilerAsserts.neverPartOfCompilation();
RubyException nameError = new RubyException(nameErrorClass, context.makeString(message), RubyCallStack.getBacktrace(currentNode));
nameError.getOperations().setInstanceVariable(nameError, "@name", context.getSymbolTable().getSymbol(name));
nameError.getObjectType().setInstanceVariable(nameError, "@name", context.getSymbolTable().getSymbol(name));
return nameError;
}

@@ -870,7 +867,7 @@ public RubyException nameErrorPrivateMethod(String name, RubyModule module, Node
public RubyException noMethodError(String message, String name, Node currentNode) {
CompilerAsserts.neverPartOfCompilation();
RubyException noMethodError = new RubyException(context.getCoreLibrary().getNoMethodErrorClass(), context.makeString(message), RubyCallStack.getBacktrace(currentNode));
noMethodError.getOperations().setInstanceVariable(noMethodError, "@name", context.getSymbolTable().getSymbol(name));
noMethodError.getObjectType().setInstanceVariable(noMethodError, "@name", context.getSymbolTable().getSymbol(name));
return noMethodError;
}

Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
import org.jruby.truffle.runtime.DebugOperations;
import org.jruby.truffle.runtime.ModuleOperations;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.RubyOperations;
import org.jruby.truffle.runtime.object.RubyObjectType;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.subsystems.ObjectSpaceManager;

@@ -144,24 +144,24 @@ public void setInstanceVariables(Map<Object, Object> instanceVariables) {

assert instanceVariables != null;

getOperations().setInstanceVariables(this, instanceVariables);
getObjectType().setInstanceVariables(this, instanceVariables);
}


public Map<Object, Object> getInstanceVariables() {
RubyNode.notDesignedForCompilation();

return getOperations().getInstanceVariables(this);
return getObjectType().getInstanceVariables(this);
}

public Object[] getFieldNames() {
return getOperations().getFieldNames(this);
return getObjectType().getFieldNames(this);
}

public Object getInstanceVariable(String name) {
RubyNode.notDesignedForCompilation();

final Object value = getOperations().getInstanceVariable(this, name);
final Object value = getObjectType().getInstanceVariable(this, name);

if (value == null) {
return getContext().getCoreLibrary().getNilObject();
@@ -171,7 +171,7 @@ public Object getInstanceVariable(String name) {
}

public boolean isFieldDefined(String name) {
return getOperations().isFieldDefined(this, name);
return getObjectType().isFieldDefined(this, name);
}

@Override
@@ -183,7 +183,7 @@ public final void visitObjectGraph(ObjectSpaceManager.ObjectGraphVisitor visitor
if (visitor.visit(this)) {
metaClass.visitObjectGraph(visitor);

for (Object instanceVariable : getOperations().getInstanceVariables(this).values()) {
for (Object instanceVariable : getObjectType().getInstanceVariables(this).values()) {
if (instanceVariable instanceof RubyBasicObject) {
((RubyBasicObject) instanceVariable).visitObjectGraph(visitor);
}
@@ -208,8 +208,8 @@ public Shape getObjectLayout() {
return dynamicObject.getShape();
}

public RubyOperations getOperations() {
return (RubyOperations) dynamicObject.getShape().getObjectType();
public RubyObjectType getObjectType() {
return (RubyObjectType) dynamicObject.getShape().getObjectType();
}

public RubyClass getLogicalClass() {
Original file line number Diff line number Diff line change
@@ -239,7 +239,7 @@ public void setThread(String name, Object value) {
assert value != null;

RubyNode.notDesignedForCompilation();
getContext().getThreadManager().getCurrentThread().getThreadLocals().getOperations().setInstanceVariable(getContext().getThreadManager().getCurrentThread().getThreadLocals(), name, value);
getContext().getThreadManager().getCurrentThread().getThreadLocals().getObjectType().setInstanceVariable(getContext().getThreadManager().getCurrentThread().getThreadLocals(), name, value);
}

@CompilerDirectives.TruffleBoundary
Loading