Skip to content

Commit

Permalink
Merge branch 'master' into truffle-head
Browse files Browse the repository at this point in the history
Conflicts:
	truffle/src/main/java/org/jruby/truffle/nodes/interop/InteropNode.java
	truffle/src/main/java/org/jruby/truffle/runtime/core/RubyBasicObject.java
  • Loading branch information
chrisseaton committed May 30, 2015
2 parents a43063a + d92c6b0 commit 48d44b8
Show file tree
Hide file tree
Showing 40 changed files with 853 additions and 545 deletions.
37 changes: 0 additions & 37 deletions spec/truffle/tags/core/process/getrlimit_tags.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,2 @@
fails:Process.getrlimit returns a two-element Array of Integers
fails:Process.getrlimit when passed an Object calls #to_int to convert to an Integer
fails:Process.getrlimit when passed an Object raises a TypeError if #to_int does not return an Integer
fails:Process.getrlimit when passed a Symbol coerces :AS into RLIMIT_AS
fails:Process.getrlimit when passed a Symbol coerces :CORE into RLIMIT_CORE
fails:Process.getrlimit when passed a Symbol coerces :CPU into RLIMIT_CPU
fails:Process.getrlimit when passed a Symbol coerces :DATA into RLIMIT_DATA
fails:Process.getrlimit when passed a Symbol coerces :FSIZE into RLIMIT_FSIZE
fails:Process.getrlimit when passed a Symbol coerces :NOFILE into RLIMIT_NOFILE
fails:Process.getrlimit when passed a Symbol coerces :STACK into RLIMIT_STACK
fails:Process.getrlimit when passed a Symbol coerces :MEMLOCK into RLIMIT_MEMLOCK
fails:Process.getrlimit when passed a Symbol coerces :NPROC into RLIMIT_NPROC
fails:Process.getrlimit when passed a Symbol coerces :RSS into RLIMIT_RSS
fails:Process.getrlimit when passed a Symbol raises ArgumentError when passed an unknown resource
fails:Process.getrlimit when passed a String coerces 'AS' into RLIMIT_AS
fails:Process.getrlimit when passed a String coerces 'CORE' into RLIMIT_CORE
fails:Process.getrlimit when passed a String coerces 'CPU' into RLIMIT_CPU
fails:Process.getrlimit when passed a String coerces 'DATA' into RLIMIT_DATA
fails:Process.getrlimit when passed a String coerces 'FSIZE' into RLIMIT_FSIZE
fails:Process.getrlimit when passed a String coerces 'NOFILE' into RLIMIT_NOFILE
fails:Process.getrlimit when passed a String coerces 'STACK' into RLIMIT_STACK
fails:Process.getrlimit when passed a String coerces 'MEMLOCK' into RLIMIT_MEMLOCK
fails:Process.getrlimit when passed a String coerces 'NPROC' into RLIMIT_NPROC
fails:Process.getrlimit when passed a String coerces 'RSS' into RLIMIT_RSS
fails:Process.getrlimit when passed a String raises ArgumentError when passed an unknown resource
fails:Process.getrlimit when passed on Object calls #to_str to convert to a String
fails:Process.getrlimit when passed on Object calls #to_int if #to_str does not return a String
fails:Process.getrlimit when passed a Symbol coerces :SBSIZE into RLIMIT_SBSIZE
fails:Process.getrlimit when passed a Symbol coerces :RTTIME into RLIMIT_RTTIME
fails:Process.getrlimit when passed a Symbol coerces :MSGQUEUE into RLIMIT_MSGQUEUE
fails:Process.getrlimit when passed a Symbol coerces :SIGPENDING into RLIMIT_SIGPENDING
fails:Process.getrlimit when passed a Symbol coerces :RTPRIO into RLIMIT_RTPRIO
fails:Process.getrlimit when passed a Symbol coerces :NICE into RLIMIT_NICE
fails:Process.getrlimit when passed a String coerces 'SBSIZE' into RLIMIT_SBSIZE
fails:Process.getrlimit when passed a String coerces 'RTTIME' into RLIMIT_RTTIME
fails:Process.getrlimit when passed a String coerces 'MSGQUEUE' into RLIMIT_MSGQUEUE
fails:Process.getrlimit when passed a String coerces 'SIGPENDING' into RLIMIT_SIGPENDING
fails:Process.getrlimit when passed a String coerces 'RTPRIO' into RLIMIT_RTPRIO
fails:Process.getrlimit when passed a String coerces 'NICE' into RLIMIT_NICE
38 changes: 0 additions & 38 deletions spec/truffle/tags/core/process/setrlimit_tags.txt

This file was deleted.

6 changes: 4 additions & 2 deletions tool/truffle/translate_rubinius_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
puts " // Generated from tool/truffle/translate_rubinius_config.rb < ../rubinius/runtime/platform.conf"

ARGF.each do |line|
next unless /^(?<var>rbx(\.\w+)*) = (?<value>.+)$/ =~ line
next unless /^(?<var>rbx(\.\w+)*) = (?<value>.*)$/ =~ line
code = case value
when ""
0
when /^-?\d+$/
case Integer(value)
when (-2**31...2**31)
Expand All @@ -25,7 +27,7 @@
when "true"
value
else
"context.makeString(\"#{value}\")"
"string(context, \"#{value}\")"
end
puts " configuration.config(\"#{var}\", #{code});"
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.core.StringNodes;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.core.RubySymbol;
Expand All @@ -36,7 +37,7 @@ protected RubySymbol toSymbol(RubySymbol symbol) {

@Specialization
protected RubySymbol toSymbol(RubyString string) {
return getContext().getSymbol(string.getByteList());
return getContext().getSymbol(StringNodes.getByteList(string));
}

@Specialization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public InstanceEvalNode(RubyContext context, SourceSection sourceSection) {
public Object instanceEval(VirtualFrame frame, Object receiver, RubyString string, NotProvided block) {
CompilerDirectives.transferToInterpreter();

return getContext().instanceEval(string.getByteList(), receiver, this);
return getContext().instanceEval(StringNodes.getByteList(string), receiver, this);
}

@Specialization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public CompatibleQueryNode(RubyContext context, SourceSection sourceSection) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyString first, RubyString second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first, second);
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getCodeRangeable(first), StringNodes.getCodeRangeable(second));

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
Expand All @@ -79,7 +79,7 @@ public Object isCompatible(RubyEncoding first, RubyEncoding second) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyString first, RubyRegexp second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getByteList().getEncoding(), second.getRegex().getEncoding());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getByteList(first).getEncoding(), second.getRegex().getEncoding());

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
Expand All @@ -91,7 +91,7 @@ public Object isCompatible(RubyString first, RubyRegexp second) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyRegexp first, RubyString second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getRegex().getEncoding(), second.getByteList().getEncoding());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getRegex().getEncoding(), StringNodes.getByteList(second).getEncoding());

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
Expand Down Expand Up @@ -139,7 +139,7 @@ public Object isCompatible(RubySymbol first, RubyRegexp second) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyString first, RubySymbol second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first, second);
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getCodeRangeable(first), second);

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
Expand All @@ -163,7 +163,7 @@ public Object isCompatible(RubySymbol first, RubySymbol second) {
@TruffleBoundary
@Specialization
public Object isCompatible(RubyString first, RubyEncoding second) {
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getByteList().getEncoding(), second.getEncoding());
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getByteList(first).getEncoding(), second.getEncoding());

if (compatibleEncoding != null) {
return RubyEncoding.getEncoding(compatibleEncoding);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public RubyRegexp executeRubyRegexp(VirtualFrame frame) {

for (int n = 0; n < children.length; n++) {
final Object child = children[n].execute(frame);
strings[n] = org.jruby.RubyString.newString(getContext().getRuntime(), ((RubyString) toS.call(frame, child, "to_s", null)).getByteList());
strings[n] = org.jruby.RubyString.newString(getContext().getRuntime(), StringNodes.getByteList(((RubyString) toS.call(frame, child, "to_s", null))));
}

// TODO 27-APR=2015 BJF Adding workaround to temporarily fix CGI error until Regex overhaul https://github.com/jruby/jruby/issues/2802
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
Expand Down Expand Up @@ -80,7 +79,7 @@ private RubyString concat(RubyString[] strings) {
try {
builder.append19(getContext().toJRuby(string));
} catch (org.jruby.exceptions.RaiseException e) {
throw new RaiseException(getContext().getCoreLibrary().encodingCompatibilityErrorIncompatible(builder.getEncoding().getCharsetName(), string.getByteList().getEncoding().getCharsetName(), this));
throw new RaiseException(getContext().getCoreLibrary().encodingCompatibilityErrorIncompatible(builder.getEncoding().getCharsetName(), StringNodes.getByteList(string).getEncoding().getCharsetName(), this));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ protected RubyBinding getCallerBinding(VirtualFrame frame) {
public Object eval(VirtualFrame frame, RubyString source, NotProvided binding, NotProvided filename, NotProvided lineNumber) {
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), getCallerBinding(frame), true, this);
return getContext().eval(StringNodes.getByteList(source), getCallerBinding(frame), true, this);
}

@Specialization(guards = "isNil(noBinding)")
Expand All @@ -486,21 +486,21 @@ public Object eval(VirtualFrame frame, RubyString source, Object noBinding, Ruby
public Object eval(RubyString source, RubyBinding binding, NotProvided filename, NotProvided lineNumber) {
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), binding, false, this);
return getContext().eval(StringNodes.getByteList(source), binding, false, this);
}

@Specialization
public Object eval(RubyString source, RubyBinding binding, RubyString filename, NotProvided lineNumber) {
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), binding, false, filename.toString(), this);
return getContext().eval(StringNodes.getByteList(source), binding, false, filename.toString(), this);
}

@Specialization
public Object eval(RubyString source, RubyBinding binding, RubyString filename, int lineNumber) {
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), binding, false, filename.toString(), this);
return getContext().eval(StringNodes.getByteList(source), binding, false, filename.toString(), this);
}

@Specialization(guards = "!isRubyBinding(badBinding)")
Expand Down Expand Up @@ -1709,7 +1709,7 @@ public RubyString formatUncached(
throw handleException(e);
}

return finishFormat(format.getByteList(), result);
return finishFormat(StringNodes.getByteList(format), result);
}

private RuntimeException handleException(PackException exception) {
Expand Down Expand Up @@ -1764,16 +1764,16 @@ private RubyString finishFormat(ByteList format, PackResult result) {
}

protected ByteList privatizeByteList(RubyString string) {
return string.getByteList().dup();
return StringNodes.getByteList(string).dup();
}

protected boolean byteListsEqual(RubyString string, ByteList byteList) {
return string.getByteList().equal(byteList);
return StringNodes.getByteList(string).equal(byteList);
}

protected CallTarget compileFormat(RubyString format) {
try {
return new FormatParser(getContext()).parse(format.getByteList());
return new FormatParser(getContext()).parse(StringNodes.getByteList(format));
} catch (FormatException e) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError(e.getMessage(), this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Object getIndex(RubyMatchData matchData, RubyString index, NotProvided le
CompilerDirectives.transferToInterpreter();

try {
final int i = matchData.getBackrefNumber(index.getByteList());
final int i = matchData.getBackrefNumber(StringNodes.getByteList(index));

return getIndex(matchData, i, NotProvided.INSTANCE);
}
Expand Down Expand Up @@ -257,7 +257,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
public RubyString toS(RubyMatchData matchData) {
CompilerDirectives.transferToInterpreter();

final ByteList bytes = matchData.getGlobal().getByteList().dup();
final ByteList bytes = StringNodes.getByteList(matchData.getGlobal()).dup();
return createString(bytes);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ public Object classEval(VirtualFrame frame, RubyModule module, RubyString code,

private Object classEvalSource(VirtualFrame frame, RubyModule module, RubyString code, String file) {
RubyBinding binding = getCallerBinding(frame);
Encoding encoding = code.getByteList().getEncoding();
Encoding encoding = StringNodes.getByteList(code).getEncoding();

CompilerDirectives.transferToInterpreter();
Source source = Source.fromText(code.toString(), file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public EscapeNode(RubyContext context, SourceSection sourceSection) {
@TruffleBoundary
@Specialization
public RubyString escape(RubyString pattern) {
return createString(org.jruby.RubyRegexp.quote19(new ByteList(pattern.getByteList()), true).toString());
return createString(org.jruby.RubyRegexp.quote19(new ByteList(StringNodes.getByteList(pattern)), true).toString());
}

}
Expand Down Expand Up @@ -257,8 +257,8 @@ public QuoteNode(RubyContext context, SourceSection sourceSection) {
@TruffleBoundary
@Specialization
public RubyString quote(RubyString raw) {
boolean isAsciiOnly = raw.getByteList().getEncoding().isAsciiCompatible() && raw.scanForCodeRange() == CR_7BIT;
return createString(org.jruby.RubyRegexp.quote19(raw.getByteList(), isAsciiOnly));
boolean isAsciiOnly = StringNodes.getByteList(raw).getEncoding().isAsciiCompatible() && StringNodes.scanForCodeRange(raw) == CR_7BIT;
return createString(org.jruby.RubyRegexp.quote19(StringNodes.getByteList(raw), isAsciiOnly));
}

@Specialization
Expand Down
Loading

0 comments on commit 48d44b8

Please sign in to comment.