Skip to content

Commit

Permalink
Showing 35 changed files with 92 additions and 154 deletions.
4 changes: 0 additions & 4 deletions core/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -143,10 +143,6 @@ public RubyNilClass executeRubyNilClass(VirtualFrame frame) throws UnexpectedRes
return RubyTypesGen.RUBYTYPES.expectRubyNilClass(execute(frame));
}

public RubyObject executeRubyObject(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectRubyObject(execute(frame));
}

public RubyProc executeRubyProc(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectRubyProc(execute(frame));
}
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/truffle/nodes/RubyTypes.java
Original file line number Diff line number Diff line change
@@ -62,7 +62,6 @@
RubiniusChannel.class, //
RubiniusByteArray.class, //
RubyEncodingConverter.class, //
RubyObject.class, //
RubyBasicObject.class, //
Object[].class})

Original file line number Diff line number Diff line change
@@ -134,11 +134,6 @@ public RubyNilClass executeRubyNilClass(VirtualFrame frame) throws UnexpectedRes
return child.executeRubyNilClass(frame);
}

@Override
public RubyObject executeRubyObject(VirtualFrame frame) throws UnexpectedResultException {
return child.executeRubyObject(frame);
}

@Override
public RubyProc executeRubyProc(VirtualFrame frame) throws UnexpectedResultException {
return child.executeRubyProc(frame);
36 changes: 17 additions & 19 deletions core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@

import com.oracle.truffle.api.CompilerDirectives.SlowPath;
import com.oracle.truffle.api.*;
import com.oracle.truffle.api.nodes.SlowPathException;
import com.oracle.truffle.api.source.*;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.api.frame.*;
@@ -32,7 +31,6 @@
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.BacktraceFormatter;
import org.jruby.truffle.runtime.backtrace.MRIBacktraceFormatter;
import org.jruby.truffle.runtime.control.*;
import org.jruby.truffle.runtime.core.*;
@@ -148,7 +146,7 @@ public CompareNode(CompareNode prev) {
}

@Specialization
public Object compare(VirtualFrame frame, RubyObject self, RubyObject other) {
public Object compare(VirtualFrame frame, RubyBasicObject self, RubyBasicObject other) {
notDesignedForCompilation();

if ((self == other) || booleanCast.executeBoolean(frame, equalNode.call(frame, self, "==", null, other))) {
@@ -668,7 +666,7 @@ public FreezeNode(FreezeNode prev) {
}

@Specialization
public RubyObject freeze(RubyObject self) {
public RubyBasicObject freeze(RubyBasicObject self) {
notDesignedForCompilation();

self.freeze();
@@ -689,7 +687,7 @@ public FrozenNode(FrozenNode prev) {
}

@Specialization
public boolean isFrozen(RubyObject self) {
public boolean isFrozen(RubyBasicObject self) {
notDesignedForCompilation();

return self.isFrozen();
@@ -789,7 +787,7 @@ public int hash(BigInteger value) {
}

@Specialization
public int hash(RubyObject self) {
public int hash(RubyBasicObject self) {
notDesignedForCompilation();

return self.hashCode();
@@ -879,14 +877,14 @@ public InstanceVariableDefinedNode(InstanceVariableDefinedNode prev) {
public boolean isInstanceVariableDefined(RubyBasicObject object, RubyString name) {
notDesignedForCompilation();

return object.isFieldDefined(RubyObject.checkInstanceVariableName(getContext(), name.toString(), this));
return object.isFieldDefined(RubyContext.checkInstanceVariableName(getContext(), name.toString(), this));
}

@Specialization
public boolean isInstanceVariableDefined(RubyBasicObject object, RubySymbol name) {
notDesignedForCompilation();

return object.isFieldDefined(RubyObject.checkInstanceVariableName(getContext(), name.toString(), this));
return object.isFieldDefined(RubyContext.checkInstanceVariableName(getContext(), name.toString(), this));
}

}
@@ -906,14 +904,14 @@ public InstanceVariableGetNode(InstanceVariableGetNode prev) {
public Object isInstanceVariableGet(RubyBasicObject object, RubyString name) {
notDesignedForCompilation();

return object.getInstanceVariable(RubyObject.checkInstanceVariableName(getContext(), name.toString(), this));
return object.getInstanceVariable(RubyContext.checkInstanceVariableName(getContext(), name.toString(), this));
}

@Specialization
public Object isInstanceVariableGet(RubyBasicObject object, RubySymbol name) {
notDesignedForCompilation();

return object.getInstanceVariable(RubyObject.checkInstanceVariableName(getContext(), name.toString(), this));
return object.getInstanceVariable(RubyContext.checkInstanceVariableName(getContext(), name.toString(), this));
}

}
@@ -933,15 +931,15 @@ public InstanceVariableSetNode(InstanceVariableSetNode prev) {
public Object isInstanceVariableSet(RubyBasicObject object, RubyString name, Object value) {
notDesignedForCompilation();

object.setInstanceVariable(RubyObject.checkInstanceVariableName(getContext(), name.toString(), this), value);
object.setInstanceVariable(RubyContext.checkInstanceVariableName(getContext(), name.toString(), this), value);
return value;
}

@Specialization
public Object isInstanceVariableSet(RubyBasicObject object, RubySymbol name, Object value) {
notDesignedForCompilation();

object.setInstanceVariable(RubyObject.checkInstanceVariableName(getContext(), name.toString(), this), value);
object.setInstanceVariable(RubyContext.checkInstanceVariableName(getContext(), name.toString(), this), value);
return value;
}

@@ -959,7 +957,7 @@ public InstanceVariablesNode(InstanceVariablesNode prev) {
}

@Specialization
public RubyArray instanceVariables(RubyObject self) {
public RubyArray instanceVariables(RubyBasicObject self) {
notDesignedForCompilation();

final String[] instanceVariableNames = self.getFieldNames();
@@ -1124,12 +1122,12 @@ public MethodsNode(MethodsNode prev) {
}

@Specialization
public RubyArray methods(RubyObject self, @SuppressWarnings("unused") UndefinedPlaceholder unused) {
public RubyArray methods(RubyBasicObject self, @SuppressWarnings("unused") UndefinedPlaceholder unused) {
return methods(self, true);
}

@Specialization
public RubyArray methods(RubyObject self, boolean includeInherited) {
public RubyArray methods(RubyBasicObject self, boolean includeInherited) {
notDesignedForCompilation();

final RubyArray array = new RubyArray(self.getContext().getCoreLibrary().getArrayClass());
@@ -1330,7 +1328,7 @@ public PublicMethodsNode(PublicMethodsNode prev) {
}

@Specialization
public RubyArray methods(RubyObject self, boolean includeInherited) {
public RubyArray methods(RubyBasicObject self, boolean includeInherited) {
notDesignedForCompilation();

if (!includeInherited) {
@@ -1341,7 +1339,7 @@ public RubyArray methods(RubyObject self, boolean includeInherited) {
}

@Specialization
public RubyArray methods(RubyObject self, @SuppressWarnings("unused") UndefinedPlaceholder includeInherited) {
public RubyArray methods(RubyBasicObject self, @SuppressWarnings("unused") UndefinedPlaceholder includeInherited) {
notDesignedForCompilation();

final RubyArray array = new RubyArray(self.getContext().getCoreLibrary().getArrayClass());
@@ -1659,7 +1657,7 @@ public SingletonMethodsNode(SingletonMethodsNode prev) {
}

@Specialization
public RubyArray singletonMethods(RubyObject self, boolean includeInherited) {
public RubyArray singletonMethods(RubyBasicObject self, boolean includeInherited) {
notDesignedForCompilation();

final RubyArray array = new RubyArray(self.getContext().getCoreLibrary().getArrayClass());
@@ -1680,7 +1678,7 @@ public RubyArray singletonMethods(RubyObject self, boolean includeInherited) {
}

@Specialization
public RubyArray singletonMethods(RubyObject self, @SuppressWarnings("unused") UndefinedPlaceholder includeInherited) {
public RubyArray singletonMethods(RubyBasicObject self, @SuppressWarnings("unused") UndefinedPlaceholder includeInherited) {
return singletonMethods(self, false);
}

Original file line number Diff line number Diff line change
@@ -656,13 +656,13 @@ public ClassVariableGetNode(ClassVariableGetNode prev) {
@Specialization
public Object getClassVariable(RubyModule module, RubyString name) {
notDesignedForCompilation();
return ModuleOperations.lookupClassVariable(module, RubyObject.checkClassVariableName(getContext(), name.toString(), this));
return ModuleOperations.lookupClassVariable(module, RubyContext.checkClassVariableName(getContext(), name.toString(), this));
}

@Specialization
public Object getClassVariable(RubyModule module, RubySymbol name) {
notDesignedForCompilation();
return ModuleOperations.lookupClassVariable(module, RubyObject.checkClassVariableName(getContext(), name.toString(), this));
return ModuleOperations.lookupClassVariable(module, RubyContext.checkClassVariableName(getContext(), name.toString(), this));
}

}
Original file line number Diff line number Diff line change
@@ -1010,7 +1010,7 @@ public DataNode(DataNode prev) {
}

@Specialization
public RubyObject data(RubyString string) {
public RubyBasicObject data(RubyString string) {
return new RubiniusByteArray(getContext().getCoreLibrary().getRubiniusLibrary().getByteArrayCLass(), string.getBytes().getUnsafeBytes());
}
}
19 changes: 0 additions & 19 deletions core/src/main/java/org/jruby/truffle/nodes/debug/ProxyNode.java
Original file line number Diff line number Diff line change
@@ -421,25 +421,6 @@ public RubyNilClass executeRubyNilClass(VirtualFrame frame) throws UnexpectedRes
return result;
}

@Override
public RubyObject executeRubyObject(VirtualFrame frame) throws UnexpectedResultException {
enter(frame);

final RubyObject result;

try {
result = child.executeRubyObject(frame);
leave(frame, result);
} catch (KillException e) {
throw (e);
} catch (Exception e) {
leaveExceptional(frame, e);
throw e;
}

return result;
}

@Override
public RubyProc executeRubyProc(VirtualFrame frame) throws UnexpectedResultException {
enter(frame);
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ public ReadClassVariableNode(RubyContext context, SourceSection sourceSection, S
public Object execute(VirtualFrame frame) {
notDesignedForCompilation();

final RubyObject object = (RubyObject) module.execute(frame);
final RubyBasicObject object = (RubyBasicObject) module.execute(frame);

RubyModule moduleObject;

@@ -58,7 +58,7 @@ public Object execute(VirtualFrame frame) {
public Object isDefined(VirtualFrame frame) {
final RubyContext context = getContext();

final RubyObject object = (RubyObject) module.execute(frame);
final RubyBasicObject object = (RubyBasicObject) module.execute(frame);

RubyModule moduleObject;

Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyClass;
import org.jruby.truffle.runtime.core.RubyObject;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.rubinius.RubiniusByteArray;
import org.jruby.truffle.runtime.util.TypeConversionUtils;
@@ -38,7 +38,7 @@ public AllocateNode(AllocateNode prev) {
}

@Specialization
public RubyObject allocate(RubyObject baClass, RubyObject size) {
public RubyBasicObject allocate(RubyBasicObject baClass, RubyBasicObject size) {
throw new RaiseException(getContext().getCoreLibrary().typeError("ByteArray cannot be created via allocate()", this));
}
}
@@ -59,7 +59,7 @@ public AllocateSizedNode(AllocateSizedNode prev) {
}

@Specialization
public RubyObject allocate_sized(VirtualFrame frame, RubyObject bytes) {
public RubyBasicObject allocate_sized(VirtualFrame frame, RubyBasicObject bytes) {
RubyClass self = (RubyClass) RubyArguments.getSelf(frame.getArguments());
return RubiniusByteArray.allocate_sized(this, self, TypeConversionUtils.convertToLong(this, bytesToIntNode, frame, bytes));
}
@@ -85,7 +85,7 @@ public FetchBytesNode(FetchBytesNode prev) {
}

@Specialization
public RubyObject fetch_bytes(VirtualFrame frame, RubiniusByteArray self, RubyObject start, RubyObject count) {
public RubyBasicObject fetch_bytes(VirtualFrame frame, RubiniusByteArray self, RubyBasicObject start, RubyBasicObject count) {
return self.fetch_bytes(this, TypeConversionUtils.convertToLong(this, startToIntNode, frame, start), TypeConversionUtils.convertToLong(this, countToIntNode, frame, count));
}
}
@@ -114,7 +114,7 @@ public MoveBytesNode(MoveBytesNode prev) {
}

@Specialization
public RubyObject move_bytes(VirtualFrame frame, RubiniusByteArray self, RubyObject start, RubyObject count, RubyObject dest) {
public RubyBasicObject move_bytes(VirtualFrame frame, RubiniusByteArray self, RubyBasicObject start, RubyBasicObject count, RubyBasicObject dest) {
self.move_bytes(this, TypeConversionUtils.convertToLong(this, startToIntNode, frame, start), TypeConversionUtils.convertToLong(this, countToIntNode, frame, count),
TypeConversionUtils.convertToLong(this, destToIntNode, frame, dest));
return count;
@@ -137,7 +137,7 @@ public GetByteNode(GetByteNode prev) {
}

@Specialization
public int get_byte(VirtualFrame frame, RubiniusByteArray self, RubyObject index) {
public int get_byte(VirtualFrame frame, RubiniusByteArray self, RubyBasicObject index) {
return self.get_byte(this, TypeConversionUtils.convertToLong(this, indexToIntNode, frame, index));
}
}
@@ -162,7 +162,7 @@ public SetByteNode(SetByteNode prev) {
}

@Specialization
public int set_byte(VirtualFrame frame, RubiniusByteArray self, RubyObject index, RubyObject value) {
public int set_byte(VirtualFrame frame, RubiniusByteArray self, RubyBasicObject index, RubyBasicObject value) {
return self.set_byte(this, TypeConversionUtils.convertToLong(this, indexToIntNode, frame, index), TypeConversionUtils.convertToLong(this, valueToIntNode, frame, value));
}
}
@@ -187,7 +187,7 @@ public CompareBytesNode(CompareBytesNode prev) {
}

@Specialization
public int compare_bytes(VirtualFrame frame, RubiniusByteArray self, RubiniusByteArray other, RubyObject a, RubyObject b) {
public int compare_bytes(VirtualFrame frame, RubiniusByteArray self, RubiniusByteArray other, RubyBasicObject a, RubyBasicObject b) {
return self.compare_bytes(this, other, TypeConversionUtils.convertToLong(this, aToIntNode, frame, a), TypeConversionUtils.convertToLong(this, bToIntNode, frame, b));
}
}
@@ -232,7 +232,7 @@ public LocateNode(LocateNode prev) {
}

@Specialization
public Object locate(VirtualFrame frame, RubiniusByteArray self, RubyObject pattern, RubyObject start, RubyObject max_o) {
public Object locate(VirtualFrame frame, RubiniusByteArray self, RubyBasicObject pattern, RubyBasicObject start, RubyBasicObject max_o) {
return self.locate((RubyString) patternToStringNode.call(frame, pattern, "to_s", null), TypeConversionUtils.convertToLong(this, startToIntNode, frame, start),
TypeConversionUtils.convertToLong(this, max_oToIntNode, frame, max_o));
}
@@ -254,7 +254,7 @@ public PrependNode(PrependNode prev) {
}

@Specialization
public RubyObject prepend(VirtualFrame frame, RubiniusByteArray self, RubyObject str) {
public RubyBasicObject prepend(VirtualFrame frame, RubiniusByteArray self, RubyBasicObject str) {
return self.prepend((RubyString) strToStringNode.call(frame, str, "to_s", null));
}
}
@@ -270,7 +270,7 @@ public Utf8CharNode(Utf8CharNode prev) {
}

@Specialization
public RubyObject utf8_char(RubiniusByteArray self, RubyObject offset) {
public RubyBasicObject utf8_char(RubiniusByteArray self, RubyBasicObject offset) {
return self.utf8_char(this, offset);
}
}
@@ -295,7 +295,7 @@ public ReverseNode(ReverseNode prev) {
}

@Specialization
public RubyObject reverse(VirtualFrame frame, RubiniusByteArray self, RubyObject o_start, RubyObject o_total) {
public RubyBasicObject reverse(VirtualFrame frame, RubiniusByteArray self, RubyBasicObject o_start, RubyBasicObject o_total) {
return self.reverse(TypeConversionUtils.convertToLong(this, o_startToIntNode, frame, o_start), TypeConversionUtils.convertToLong(this, o_totalToIntNode, frame, o_total));
}
}
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
import org.jruby.truffle.nodes.core.CoreMethodNode;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyObject;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.rubinius.RubiniusChannel;

@CoreClass(name = "Channel")
@@ -33,7 +33,7 @@ public SendNode(SendNode prev) {
}

@Specialization
public Object send(RubiniusChannel self, RubyObject value) {
public Object send(RubiniusChannel self, RubyBasicObject value) {
self.send(value);
return getContext().getCoreLibrary().getNilObject();
}
20 changes: 20 additions & 0 deletions core/src/main/java/org/jruby/truffle/runtime/RubyContext.java
Original file line number Diff line number Diff line change
@@ -107,6 +107,26 @@ public RubyContext(Ruby runtime) {
rootLexicalScope = new LexicalScope(null, coreLibrary.getObjectClass());
}

public static String checkInstanceVariableName(RubyContext context, String name, RubyNode currentNode) {
RubyNode.notDesignedForCompilation();

if (!name.startsWith("@")) {
throw new RaiseException(context.getCoreLibrary().nameErrorInstanceNameNotAllowable(name, currentNode));
}

return name;
}

public static String checkClassVariableName(RubyContext context, String name, RubyNode currentNode) {
RubyNode.notDesignedForCompilation();

if (!name.startsWith("@@")) {
throw new RaiseException(context.getCoreLibrary().nameErrorInstanceNameNotAllowable(name, currentNode));
}

return name;
}

public void load(Source source, RubyNode currentNode) {
execute(this, source, TranslatorDriver.ParserContext.TOP_LEVEL, coreLibrary.getMainObject(), null, currentNode);
}
Original file line number Diff line number Diff line change
@@ -271,7 +271,7 @@ public void initialize() {

// Create some key objects

mainObject = new RubyObject(objectClass);
mainObject = new RubyBasicObject(objectClass);
nilObject = new RubyNilClass(nilClass);

// Create the globals object
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
/**
* Implements the Ruby {@code Array} class.
*/
public final class RubyArray extends RubyObject {
public final class RubyArray extends RubyBasicObject {

public static final int ARRAYS_SMALL = Options.TRUFFLE_ARRAYS_SMALL.load();

Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
/**
* Represents the Ruby {@code Binding} class.
*/
public class RubyBinding extends RubyObject {
public class RubyBinding extends RubyBasicObject {

private final Object self;
private final MaterializedFrame frame;
Original file line number Diff line number Diff line change
@@ -140,7 +140,7 @@ public void unsafeSetSuperclass(RubyClass newSuperclass) {

@SlowPath
public RubyBasicObject newInstance(RubyNode currentNode) {
return new RubyObject(this);
return new RubyBasicObject(this);
}

public boolean isSingleton() {
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
/**
* This is a bridge between JRuby encoding and Truffle encoding
*/
public class RubyEncoding extends RubyObject {
public class RubyEncoding extends RubyBasicObject {

private static Map<Encoding, RubyEncoding> map = new HashMap<>();

Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyContext;

public class RubyEncodingConverter extends RubyObject {
public class RubyEncodingConverter extends RubyBasicObject {

public EConv getEConv() {
return econv;
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
/**
* Represents the Ruby {@code Exception} class.
*/
public class RubyException extends RubyObject {
public class RubyException extends RubyBasicObject {

/**
* The class from which we create the object that is {@code Exception}. A subclass of
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
* different Ruby threads. Take note of the lock contracts on {@link #waitForResume} and
* {@link #resume}.
*/
public class RubyFiber extends RubyObject {
public class RubyFiber extends RubyBasicObject {

public static class RubyFiberClass extends RubyClass {

Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
/**
* Represents the Ruby {@code File} class.
*/
public class RubyFile extends RubyObject {
public class RubyFile extends RubyBasicObject {

private final Reader reader;
private final Writer writer;
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
/**
* Represents the Ruby {@code Hash} class.
*/
public class RubyHash extends RubyObject {
public class RubyHash extends RubyBasicObject {

public static final int HASHES_SMALL = Options.TRUFFLE_HASHES_SMALL.load();

Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
/**
* Represents the Ruby {@code MatchData} class.
*/
public class RubyMatchData extends RubyObject {
public class RubyMatchData extends RubyBasicObject {

private final Object[] values;

Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
/**
* Represents the Ruby {@code Module} class.
*/
public class RubyModule extends RubyObject implements ModuleChain {
public class RubyModule extends RubyBasicObject implements ModuleChain {

/**
* A reference to an included RubyModule.
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
/**
* Represents the Ruby {@code NilClass} class.
*/
public class RubyNilClass extends RubyObject {
public class RubyNilClass extends RubyBasicObject {

public RubyNilClass(RubyClass rubyClass) {
super(rubyClass);
52 changes: 0 additions & 52 deletions core/src/main/java/org/jruby/truffle/runtime/core/RubyObject.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
/**
* Represents the Ruby {@code Proc} class.
*/
public class RubyProc extends RubyObject implements MethodLike {
public class RubyProc extends RubyBasicObject implements MethodLike {

public static final boolean PROC_BINDING = Options.TRUFFLE_PROC_BINDING.load();

Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@

import org.jruby.truffle.runtime.subsystems.ObjectSpaceManager;

public abstract class RubyRange extends RubyObject {
public abstract class RubyRange extends RubyBasicObject {

protected final boolean excludeEnd;

Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
/**
* Represents the Ruby {@code Regexp} class.
*/
public class RubyRegexp extends RubyObject {
public class RubyRegexp extends RubyBasicObject {

/**
* The class from which we create the object that is {@code Regexp}. A subclass of
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
/**
* Represents the Ruby {@code String} class.
*/
public class RubyString extends RubyObject {
public class RubyString extends RubyBasicObject {

/**
* The class from which we create the object that is {@code String}. A subclass of
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
/**
* Represents the Ruby {@code Symbol} class.
*/
public class RubySymbol extends RubyObject {
public class RubySymbol extends RubyBasicObject {

private final String symbol;
private final ByteList symbolBytes;
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
* not a one-to-one mapping between Ruby threads and Java threads - specifically in combination with
* fibers as they are currently implemented as their own Java threads.
*/
public class RubyThread extends RubyObject {
public class RubyThread extends RubyBasicObject {

public Object getValue() {
return value;
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
* enough to run benchmark harnesses.
*/

public class RubyTime extends RubyObject {
public class RubyTime extends RubyBasicObject {

/**
* The class from which we create the object that is {@code Time}. A subclass of
Original file line number Diff line number Diff line change
@@ -34,11 +34,11 @@
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyClass;
import org.jruby.truffle.runtime.core.RubyObject;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.util.ByteList;

public class RubiniusByteArray extends RubyObject {
public class RubiniusByteArray extends RubyBasicObject {
private final byte[] bytes;

public RubiniusByteArray(RubyClass cls, int size) {
@@ -51,7 +51,7 @@ public RubiniusByteArray(RubyClass cls, byte[] bytes) {
this.bytes = bytes;
}

public static RubyObject allocate_sized(RubyNode currentNode, RubyClass baClass, long size) {
public static RubyBasicObject allocate_sized(RubyNode currentNode, RubyClass baClass, long size) {
if (size < 0) {
RubiniusLibrary.throwArgumentError(currentNode, "negative byte array size");
} else if (size > Integer.MAX_VALUE) {
@@ -64,7 +64,7 @@ public int size() {
return bytes.length;
}

public RubyObject fetch_bytes(RubyNode currentNode, long src, long cnt) {
public RubyBasicObject fetch_bytes(RubyNode currentNode, long src, long cnt) {
if (src < 0) {
RubiniusLibrary.throwObjectBoundsExceededError(currentNode, "start less than zero");
} else if (cnt < 0) {
@@ -157,19 +157,19 @@ public Object locate(RubyString pattern, long start, long max) {
return getContext().getCoreLibrary().getNilObject();
}

public RubyObject prepend(RubyString str) {
public RubyBasicObject prepend(RubyString str) {
RubiniusByteArray ba = new RubiniusByteArray(getLogicalClass(), size() + str.getBytes().getRealSize());
System.arraycopy(str.getBytes().unsafeBytes(), str.getBytes().getBegin(), ba.bytes, 0, str.getBytes().getRealSize());
System.arraycopy(bytes, 0, ba.bytes, str.getBytes().getRealSize(), size());
return ba;
}

public RubyObject utf8_char(RubyNode currentNode, RubyObject offset) {
public RubyBasicObject utf8_char(RubyNode currentNode, RubyBasicObject offset) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(currentNode.getContext().getCoreLibrary().runtimeError("ByteArray#utf8_char not implemented", currentNode));
}

public RubyObject reverse(long start, long total) {
public RubyBasicObject reverse(long start, long total) {
if (total <= 0 || start < 0 || start >= size()) {
return this;
}
Original file line number Diff line number Diff line change
@@ -31,23 +31,23 @@

import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.core.RubyClass;
import org.jruby.truffle.runtime.core.RubyObject;
import org.jruby.truffle.runtime.core.RubyBasicObject;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

public class RubiniusChannel extends RubyObject {
private final LinkedBlockingQueue<RubyObject> queue = new LinkedBlockingQueue<>();
public class RubiniusChannel extends RubyBasicObject {
private final LinkedBlockingQueue<RubyBasicObject> queue = new LinkedBlockingQueue<>();

public RubiniusChannel(RubyClass cls) {
super(cls);
}

public RubyObject allocate(RubyClass klazz) {
public RubyBasicObject allocate(RubyClass klazz) {
return new RubiniusChannel(klazz);
}

public void send(RubyObject value) {
public void send(RubyBasicObject value) {
queue.add(value);
}

@@ -72,7 +72,7 @@ public Object receive_timeout(long time) {
}

public Object try_receive() {
RubyObject result = queue.poll();
RubyBasicObject result = queue.poll();
if (result == null)
return getContext().getCoreLibrary().getNilObject();
return result;
Original file line number Diff line number Diff line change
@@ -14,11 +14,12 @@
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.UseMethodMissingException;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyObject;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyBasicObject;

public class TypeConversionUtils {

public static long convertToLong(RubyNode currentNode, DispatchHeadNode dispatch, VirtualFrame frame, RubyObject object) {
public static long convertToLong(RubyNode currentNode, DispatchHeadNode dispatch, VirtualFrame frame, RubyBasicObject object) {
try {
return dispatch.callLongFixnum(frame, object, "to_i", null);
} catch (UseMethodMissingException e) {

0 comments on commit 28403ca

Please sign in to comment.