Skip to content

Commit 48d44b8

Browse files
committed
Merge branch 'master' into truffle-head
Conflicts: truffle/src/main/java/org/jruby/truffle/nodes/interop/InteropNode.java truffle/src/main/java/org/jruby/truffle/runtime/core/RubyBasicObject.java
2 parents a43063a + d92c6b0 commit 48d44b8

40 files changed

+853
-545
lines changed
Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,2 @@
1-
fails:Process.getrlimit returns a two-element Array of Integers
2-
fails:Process.getrlimit when passed an Object calls #to_int to convert to an Integer
3-
fails:Process.getrlimit when passed an Object raises a TypeError if #to_int does not return an Integer
4-
fails:Process.getrlimit when passed a Symbol coerces :AS into RLIMIT_AS
5-
fails:Process.getrlimit when passed a Symbol coerces :CORE into RLIMIT_CORE
6-
fails:Process.getrlimit when passed a Symbol coerces :CPU into RLIMIT_CPU
7-
fails:Process.getrlimit when passed a Symbol coerces :DATA into RLIMIT_DATA
8-
fails:Process.getrlimit when passed a Symbol coerces :FSIZE into RLIMIT_FSIZE
9-
fails:Process.getrlimit when passed a Symbol coerces :NOFILE into RLIMIT_NOFILE
10-
fails:Process.getrlimit when passed a Symbol coerces :STACK into RLIMIT_STACK
11-
fails:Process.getrlimit when passed a Symbol coerces :MEMLOCK into RLIMIT_MEMLOCK
12-
fails:Process.getrlimit when passed a Symbol coerces :NPROC into RLIMIT_NPROC
13-
fails:Process.getrlimit when passed a Symbol coerces :RSS into RLIMIT_RSS
14-
fails:Process.getrlimit when passed a Symbol raises ArgumentError when passed an unknown resource
15-
fails:Process.getrlimit when passed a String coerces 'AS' into RLIMIT_AS
16-
fails:Process.getrlimit when passed a String coerces 'CORE' into RLIMIT_CORE
17-
fails:Process.getrlimit when passed a String coerces 'CPU' into RLIMIT_CPU
18-
fails:Process.getrlimit when passed a String coerces 'DATA' into RLIMIT_DATA
19-
fails:Process.getrlimit when passed a String coerces 'FSIZE' into RLIMIT_FSIZE
20-
fails:Process.getrlimit when passed a String coerces 'NOFILE' into RLIMIT_NOFILE
21-
fails:Process.getrlimit when passed a String coerces 'STACK' into RLIMIT_STACK
22-
fails:Process.getrlimit when passed a String coerces 'MEMLOCK' into RLIMIT_MEMLOCK
23-
fails:Process.getrlimit when passed a String coerces 'NPROC' into RLIMIT_NPROC
24-
fails:Process.getrlimit when passed a String coerces 'RSS' into RLIMIT_RSS
25-
fails:Process.getrlimit when passed a String raises ArgumentError when passed an unknown resource
26-
fails:Process.getrlimit when passed on Object calls #to_str to convert to a String
27-
fails:Process.getrlimit when passed on Object calls #to_int if #to_str does not return a String
281
fails:Process.getrlimit when passed a Symbol coerces :SBSIZE into RLIMIT_SBSIZE
29-
fails:Process.getrlimit when passed a Symbol coerces :RTTIME into RLIMIT_RTTIME
30-
fails:Process.getrlimit when passed a Symbol coerces :MSGQUEUE into RLIMIT_MSGQUEUE
31-
fails:Process.getrlimit when passed a Symbol coerces :SIGPENDING into RLIMIT_SIGPENDING
32-
fails:Process.getrlimit when passed a Symbol coerces :RTPRIO into RLIMIT_RTPRIO
33-
fails:Process.getrlimit when passed a Symbol coerces :NICE into RLIMIT_NICE
342
fails:Process.getrlimit when passed a String coerces 'SBSIZE' into RLIMIT_SBSIZE
35-
fails:Process.getrlimit when passed a String coerces 'RTTIME' into RLIMIT_RTTIME
36-
fails:Process.getrlimit when passed a String coerces 'MSGQUEUE' into RLIMIT_MSGQUEUE
37-
fails:Process.getrlimit when passed a String coerces 'SIGPENDING' into RLIMIT_SIGPENDING
38-
fails:Process.getrlimit when passed a String coerces 'RTPRIO' into RLIMIT_RTPRIO
39-
fails:Process.getrlimit when passed a String coerces 'NICE' into RLIMIT_NICE

spec/truffle/tags/core/process/setrlimit_tags.txt

Lines changed: 0 additions & 38 deletions
This file was deleted.

tool/truffle/translate_rubinius_config.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
puts " // Generated from tool/truffle/translate_rubinius_config.rb < ../rubinius/runtime/platform.conf"
1212

1313
ARGF.each do |line|
14-
next unless /^(?<var>rbx(\.\w+)*) = (?<value>.+)$/ =~ line
14+
next unless /^(?<var>rbx(\.\w+)*) = (?<value>.*)$/ =~ line
1515
code = case value
16+
when ""
17+
0
1618
when /^-?\d+$/
1719
case Integer(value)
1820
when (-2**31...2**31)
@@ -25,7 +27,7 @@
2527
when "true"
2628
value
2729
else
28-
"context.makeString(\"#{value}\")"
30+
"string(context, \"#{value}\")"
2931
end
3032
puts " configuration.config(\"#{var}\", #{code});"
3133
end

truffle/src/main/java/org/jruby/truffle/nodes/conversion/ToSymbolNode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.oracle.truffle.api.frame.VirtualFrame;
1515
import com.oracle.truffle.api.source.SourceSection;
1616
import org.jruby.truffle.nodes.RubyNode;
17+
import org.jruby.truffle.nodes.core.StringNodes;
1718
import org.jruby.truffle.runtime.RubyContext;
1819
import org.jruby.truffle.runtime.core.RubyString;
1920
import org.jruby.truffle.runtime.core.RubySymbol;
@@ -36,7 +37,7 @@ protected RubySymbol toSymbol(RubySymbol symbol) {
3637

3738
@Specialization
3839
protected RubySymbol toSymbol(RubyString string) {
39-
return getContext().getSymbol(string.getByteList());
40+
return getContext().getSymbol(StringNodes.getByteList(string));
4041
}
4142

4243
@Specialization

truffle/src/main/java/org/jruby/truffle/nodes/core/BasicObjectNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public InstanceEvalNode(RubyContext context, SourceSection sourceSection) {
180180
public Object instanceEval(VirtualFrame frame, Object receiver, RubyString string, NotProvided block) {
181181
CompilerDirectives.transferToInterpreter();
182182

183-
return getContext().instanceEval(string.getByteList(), receiver, this);
183+
return getContext().instanceEval(StringNodes.getByteList(string), receiver, this);
184184
}
185185

186186
@Specialization

truffle/src/main/java/org/jruby/truffle/nodes/core/EncodingNodes.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public CompatibleQueryNode(RubyContext context, SourceSection sourceSection) {
5555
@TruffleBoundary
5656
@Specialization
5757
public Object isCompatible(RubyString first, RubyString second) {
58-
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first, second);
58+
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getCodeRangeable(first), StringNodes.getCodeRangeable(second));
5959

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

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

9696
if (compatibleEncoding != null) {
9797
return RubyEncoding.getEncoding(compatibleEncoding);
@@ -139,7 +139,7 @@ public Object isCompatible(RubySymbol first, RubyRegexp second) {
139139
@TruffleBoundary
140140
@Specialization
141141
public Object isCompatible(RubyString first, RubySymbol second) {
142-
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first, second);
142+
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getCodeRangeable(first), second);
143143

144144
if (compatibleEncoding != null) {
145145
return RubyEncoding.getEncoding(compatibleEncoding);
@@ -163,7 +163,7 @@ public Object isCompatible(RubySymbol first, RubySymbol second) {
163163
@TruffleBoundary
164164
@Specialization
165165
public Object isCompatible(RubyString first, RubyEncoding second) {
166-
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(first.getByteList().getEncoding(), second.getEncoding());
166+
final Encoding compatibleEncoding = org.jruby.RubyEncoding.areCompatible(StringNodes.getByteList(first).getEncoding(), second.getEncoding());
167167

168168
if (compatibleEncoding != null) {
169169
return RubyEncoding.getEncoding(compatibleEncoding);

truffle/src/main/java/org/jruby/truffle/nodes/core/InteroplatedRegexpNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public RubyRegexp executeRubyRegexp(VirtualFrame frame) {
4444

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

5050
// TODO 27-APR=2015 BJF Adding workaround to temporarily fix CGI error until Regex overhaul https://github.com/jruby/jruby/issues/2802

truffle/src/main/java/org/jruby/truffle/nodes/core/InterpolatedStringNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
package org.jruby.truffle.nodes.core;
1111

12-
import com.oracle.truffle.api.CompilerDirectives;
1312
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
1413
import com.oracle.truffle.api.frame.VirtualFrame;
1514
import com.oracle.truffle.api.nodes.ExplodeLoop;
@@ -80,7 +79,7 @@ private RubyString concat(RubyString[] strings) {
8079
try {
8180
builder.append19(getContext().toJRuby(string));
8281
} catch (org.jruby.exceptions.RaiseException e) {
83-
throw new RaiseException(getContext().getCoreLibrary().encodingCompatibilityErrorIncompatible(builder.getEncoding().getCharsetName(), string.getByteList().getEncoding().getCharsetName(), this));
82+
throw new RaiseException(getContext().getCoreLibrary().encodingCompatibilityErrorIncompatible(builder.getEncoding().getCharsetName(), StringNodes.getByteList(string).getEncoding().getCharsetName(), this));
8483
}
8584
}
8685
}

truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ protected RubyBinding getCallerBinding(VirtualFrame frame) {
471471
public Object eval(VirtualFrame frame, RubyString source, NotProvided binding, NotProvided filename, NotProvided lineNumber) {
472472
CompilerDirectives.transferToInterpreter();
473473

474-
return getContext().eval(source.getByteList(), getCallerBinding(frame), true, this);
474+
return getContext().eval(StringNodes.getByteList(source), getCallerBinding(frame), true, this);
475475
}
476476

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

489-
return getContext().eval(source.getByteList(), binding, false, this);
489+
return getContext().eval(StringNodes.getByteList(source), binding, false, this);
490490
}
491491

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

496-
return getContext().eval(source.getByteList(), binding, false, filename.toString(), this);
496+
return getContext().eval(StringNodes.getByteList(source), binding, false, filename.toString(), this);
497497
}
498498

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

503-
return getContext().eval(source.getByteList(), binding, false, filename.toString(), this);
503+
return getContext().eval(StringNodes.getByteList(source), binding, false, filename.toString(), this);
504504
}
505505

506506
@Specialization(guards = "!isRubyBinding(badBinding)")
@@ -1709,7 +1709,7 @@ public RubyString formatUncached(
17091709
throw handleException(e);
17101710
}
17111711

1712-
return finishFormat(format.getByteList(), result);
1712+
return finishFormat(StringNodes.getByteList(format), result);
17131713
}
17141714

17151715
private RuntimeException handleException(PackException exception) {
@@ -1764,16 +1764,16 @@ private RubyString finishFormat(ByteList format, PackResult result) {
17641764
}
17651765

17661766
protected ByteList privatizeByteList(RubyString string) {
1767-
return string.getByteList().dup();
1767+
return StringNodes.getByteList(string).dup();
17681768
}
17691769

17701770
protected boolean byteListsEqual(RubyString string, ByteList byteList) {
1771-
return string.getByteList().equal(byteList);
1771+
return StringNodes.getByteList(string).equal(byteList);
17721772
}
17731773

17741774
protected CallTarget compileFormat(RubyString format) {
17751775
try {
1776-
return new FormatParser(getContext()).parse(format.getByteList());
1776+
return new FormatParser(getContext()).parse(StringNodes.getByteList(format));
17771777
} catch (FormatException e) {
17781778
CompilerDirectives.transferToInterpreter();
17791779
throw new RaiseException(getContext().getCoreLibrary().argumentError(e.getMessage(), this));

truffle/src/main/java/org/jruby/truffle/nodes/core/MatchDataNodes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public Object getIndex(RubyMatchData matchData, RubyString index, NotProvided le
8585
CompilerDirectives.transferToInterpreter();
8686

8787
try {
88-
final int i = matchData.getBackrefNumber(index.getByteList());
88+
final int i = matchData.getBackrefNumber(StringNodes.getByteList(index));
8989

9090
return getIndex(matchData, i, NotProvided.INSTANCE);
9191
}
@@ -257,7 +257,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
257257
public RubyString toS(RubyMatchData matchData) {
258258
CompilerDirectives.transferToInterpreter();
259259

260-
final ByteList bytes = matchData.getGlobal().getByteList().dup();
260+
final ByteList bytes = StringNodes.getByteList(matchData.getGlobal()).dup();
261261
return createString(bytes);
262262
}
263263
}

truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ public Object classEval(VirtualFrame frame, RubyModule module, RubyString code,
624624

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

629629
CompilerDirectives.transferToInterpreter();
630630
Source source = Source.fromText(code.toString(), file);

truffle/src/main/java/org/jruby/truffle/nodes/core/RegexpNodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public EscapeNode(RubyContext context, SourceSection sourceSection) {
150150
@TruffleBoundary
151151
@Specialization
152152
public RubyString escape(RubyString pattern) {
153-
return createString(org.jruby.RubyRegexp.quote19(new ByteList(pattern.getByteList()), true).toString());
153+
return createString(org.jruby.RubyRegexp.quote19(new ByteList(StringNodes.getByteList(pattern)), true).toString());
154154
}
155155

156156
}
@@ -257,8 +257,8 @@ public QuoteNode(RubyContext context, SourceSection sourceSection) {
257257
@TruffleBoundary
258258
@Specialization
259259
public RubyString quote(RubyString raw) {
260-
boolean isAsciiOnly = raw.getByteList().getEncoding().isAsciiCompatible() && raw.scanForCodeRange() == CR_7BIT;
261-
return createString(org.jruby.RubyRegexp.quote19(raw.getByteList(), isAsciiOnly));
260+
boolean isAsciiOnly = StringNodes.getByteList(raw).getEncoding().isAsciiCompatible() && StringNodes.scanForCodeRange(raw) == CR_7BIT;
261+
return createString(org.jruby.RubyRegexp.quote19(StringNodes.getByteList(raw), isAsciiOnly));
262262
}
263263

264264
@Specialization

0 commit comments

Comments
 (0)