Skip to content

Commit 383b10a

Browse files
committed
Merge branch 'master' into truffle-head
Conflicts: core/src/main/java/org/jruby/truffle/nodes/core/BignumNodes.java core/src/main/java/org/jruby/truffle/nodes/core/FixnumNodes.java core/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java core/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
2 parents a15994c + 0e4c83c commit 383b10a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+301
-827
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ env:
2727
- TARGET='-Prake -Dtask=spec:compiler'
2828
- TARGET='-Prake -Dtask=spec:ffi'
2929
- TARGET='-Prake -Dtask=spec:regression'
30-
- TARGET='-Prake -Dtask=spec:ci_interpreted_travis'
30+
- TARGET='-Prake -Dtask=spec:ruby:fast'
3131
- TARGET='-Ptruffle-specs-language'
3232
- TARGET='-Ptruffle-specs-core'
3333

core/.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<classpathentry kind="var" path="M2_REPO/org/jruby/jcodings/jcodings/1.0.12-SNAPSHOT/jcodings-1.0.12-SNAPSHOT.jar"/>
2525
<classpathentry kind="var" path="M2_REPO/org/jruby/extras/bytelist/1.0.12-SNAPSHOT/bytelist-1.0.12-SNAPSHOT.jar"/>
2626
<classpathentry kind="var" path="M2_REPO/org/jruby/yecht/1.0/yecht-1.0.jar"/>
27-
<classpathentry kind="var" path="M2_REPO/com/headius/invokebinder/1.4-SNAPSHOT/invokebinder-1.4-SNAPSHOT.jar"/>
27+
<classpathentry kind="var" path="M2_REPO/com/headius/invokebinder/1.4/invokebinder-1.4.jar"/>
2828
<classpathentry kind="var" path="M2_REPO/com/headius/options/1.1/options-1.1.jar"/>
2929
<classpathentry kind="var" path="M2_REPO/com/headius/coro-mock/1.0/coro-mock-1.0.jar"/>
3030
<classpathentry kind="var" path="M2_REPO/com/headius/unsafe-mock/8.0/unsafe-mock-8.0.jar"/>

core/pom.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
jar 'org.jruby.extras:bytelist:1.0.12-SNAPSHOT'
4646
jar 'org.jruby.jcodings:jcodings:1.0.12-SNAPSHOT'
4747

48-
jar 'com.headius:invokebinder:1.4-SNAPSHOT'
48+
jar 'com.headius:invokebinder:1.4'
4949
jar 'com.headius:options:1.1'
5050
jar 'com.headius:coro-mock:1.0', :scope => 'provided'
5151
jar 'com.headius:unsafe-mock', '${unsafe.version}', :scope => 'provided'

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<dependency>
113113
<groupId>com.headius</groupId>
114114
<artifactId>invokebinder</artifactId>
115-
<version>1.4-SNAPSHOT</version>
115+
<version>1.4</version>
116116
</dependency>
117117
<dependency>
118118
<groupId>com.headius</groupId>

core/src/main/java/org/jruby/Ruby.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3497,6 +3497,10 @@ public RaiseException newErrnoEINVALError() {
34973497
return newRaiseException(getErrno().getClass("EINVAL"), "Invalid file");
34983498
}
34993499

3500+
public RaiseException newErrnoELOOPError() {
3501+
return newRaiseException(getErrno().getClass("ELOOP"), "Too many levels of symbolic links");
3502+
}
3503+
35003504
public RaiseException newErrnoENOENTError() {
35013505
return newRaiseException(getErrno().getClass("ENOENT"), "File not found");
35023506
}
@@ -3854,6 +3858,8 @@ public RaiseException newIOErrorFromException(IOException e) {
38543858
|| "An existing connection was forcibly closed by the remote host".equals(e.getMessage()) ||
38553859
(Platform.IS_WINDOWS && e.getMessage().contains("connection was aborted"))) {
38563860
return newErrnoECONNRESETError();
3861+
} else if ("Too many levels of symbolic links".equals(e.getMessage())) {
3862+
return newErrnoELOOPError();
38573863
}
38583864
return newRaiseException(getIOError(), e.getMessage());
38593865
} else {

core/src/main/java/org/jruby/parser/Parser.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ public Node parse(String file, LexerSource lexerSource, DynamicScope blockScope,
122122
// but I am not sure which conditions leads to this...so lame message.
123123
throw runtime.newSyntaxError("Problem reading source: " + e);
124124
} catch (SyntaxException e) {
125-
e.printStackTrace();
126125
switch (e.getPid()) {
127126
case UNKNOWN_ENCODING:
128127
case NOT_ASCII_COMPATIBLE:

core/src/main/java/org/jruby/truffle/nodes/cast/BoxingNode.java

Lines changed: 40 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
*/
1010
package org.jruby.truffle.nodes.cast;
1111

12-
import com.oracle.truffle.api.CompilerDirectives;
13-
import com.oracle.truffle.api.source.SourceSection;
12+
import com.oracle.truffle.api.dsl.NodeChild;
13+
import com.oracle.truffle.api.dsl.Specialization;
1414
import com.oracle.truffle.api.frame.VirtualFrame;
15-
import com.oracle.truffle.api.nodes.Node;
15+
import com.oracle.truffle.api.source.SourceSection;
16+
import com.oracle.truffle.api.utilities.ConditionProfile;
1617
import org.jruby.truffle.nodes.RubyNode;
17-
import org.jruby.truffle.runtime.core.*;
1818
import org.jruby.truffle.runtime.RubyContext;
1919
import org.jruby.truffle.runtime.core.RubyBasicObject;
2020
import org.jruby.truffle.runtime.core.RubyBignum;
@@ -23,112 +23,59 @@
2323

2424
import java.math.BigInteger;
2525

26-
public class BoxingNode extends RubyNode {
27-
28-
@Child protected RubyNode child;
26+
@NodeChild("child")
27+
public abstract class BoxingNode extends RubyNode {
2928

30-
@CompilerDirectives.CompilationFinal private boolean seenBoxed = false;
31-
@CompilerDirectives.CompilationFinal private boolean seenNil = false;
32-
@CompilerDirectives.CompilationFinal private boolean seenBoolean = false;
33-
@CompilerDirectives.CompilationFinal private boolean seenInteger = false;
34-
@CompilerDirectives.CompilationFinal private boolean seenLong = false;
35-
@CompilerDirectives.CompilationFinal private boolean seenDouble = false;
36-
@CompilerDirectives.CompilationFinal private boolean seenBigInteger = false;
29+
private final ConditionProfile booleanProfile = ConditionProfile.createCountingProfile();
3730

3831
public BoxingNode(RubyContext context, SourceSection sourceSection) {
39-
this(context, sourceSection, null);
40-
}
41-
42-
public BoxingNode(RubyContext context, SourceSection sourceSection, RubyNode child) {
4332
super(context, sourceSection);
44-
this.child = child;
4533
}
4634

47-
@Override
48-
public RubyBasicObject executeRubyBasicObject(VirtualFrame frame) {
49-
return box(child.execute(frame));
35+
public BoxingNode(BoxingNode prev) {
36+
super(prev);
5037
}
5138

52-
@Override
53-
public Object execute(VirtualFrame frame) {
54-
return executeRubyBasicObject(frame);
55-
}
56-
57-
public RubyBasicObject box(Object value) {
58-
if (seenBoxed && value instanceof RubyBasicObject) {
59-
return (RubyBasicObject) value;
60-
}
61-
62-
if (seenNil && value instanceof RubyNilClass) {
63-
return getContext().getCoreLibrary().getNilObject();
64-
}
39+
public abstract RubyBasicObject executeRubyBasicObject(VirtualFrame frame);
6540

66-
if (seenBoolean && value instanceof Boolean) {
67-
if ((boolean) value) {
68-
return getContext().getCoreLibrary().getTrueObject();
69-
} else {
70-
return getContext().getCoreLibrary().getFalseObject();
71-
}
72-
}
73-
74-
if (seenInteger && value instanceof Integer) {
75-
return new RubyFixnum.IntegerFixnum(getContext().getCoreLibrary().getFixnumClass(), (int) value);
76-
}
77-
78-
if (seenLong && value instanceof Long) {
79-
return new RubyFixnum.LongFixnum(getContext().getCoreLibrary().getFixnumClass(), (long) value);
80-
}
81-
82-
if (seenDouble && value instanceof Double) {
83-
return new RubyFloat(getContext().getCoreLibrary().getFloatClass(), (double) value);
84-
}
41+
protected abstract RubyBasicObject executeRubyBasicObject(VirtualFrame frame, Object value);
8542

86-
if (seenBigInteger && value instanceof BigInteger) {
87-
return new RubyBignum(getContext().getCoreLibrary().getFixnumClass(), (BigInteger) value);
88-
}
89-
90-
CompilerDirectives.transferToInterpreterAndInvalidate();
91-
92-
if (value instanceof RubyBasicObject) {
93-
seenBoxed = true;
94-
return (RubyBasicObject) value;
95-
}
96-
97-
if (value instanceof RubyNilClass) {
98-
seenNil = true;
99-
return getContext().getCoreLibrary().getNilObject();
100-
}
43+
public RubyBasicObject box(Object value) {
44+
return executeRubyBasicObject(null, value);
45+
}
10146

102-
if (value instanceof Boolean) {
103-
seenBoolean = true;
104-
if ((boolean) value) {
105-
return getContext().getCoreLibrary().getTrueObject();
106-
} else {
107-
return getContext().getCoreLibrary().getFalseObject();
108-
}
109-
}
47+
@Specialization
48+
public RubyBasicObject box(RubyBasicObject object) {
49+
return object;
50+
}
11051

111-
if (value instanceof Integer) {
112-
seenInteger = true;
113-
return new RubyFixnum.IntegerFixnum(getContext().getCoreLibrary().getFixnumClass(), (int) value);
52+
@Specialization
53+
public RubyBasicObject box(boolean value) {
54+
if (booleanProfile.profile(value)) {
55+
return getContext().getCoreLibrary().getTrueObject();
56+
} else {
57+
return getContext().getCoreLibrary().getFalseObject();
11458
}
59+
}
11560

116-
if (value instanceof Long) {
117-
seenLong = true;
118-
return new RubyFixnum.LongFixnum(getContext().getCoreLibrary().getFixnumClass(), (long) value);
119-
}
61+
@Specialization
62+
public RubyBasicObject box(int value) {
63+
return new RubyFixnum.IntegerFixnum(getContext().getCoreLibrary().getFixnumClass(), value);
64+
}
12065

121-
if (value instanceof Double) {
122-
seenDouble = true;
123-
return new RubyFloat(getContext().getCoreLibrary().getFloatClass(), (double) value);
124-
}
66+
@Specialization
67+
public RubyBasicObject box(long value) {
68+
return new RubyFixnum.LongFixnum(getContext().getCoreLibrary().getFixnumClass(), value);
69+
}
12570

126-
if (value instanceof BigInteger) {
127-
seenBigInteger = true;
128-
return new RubyBignum(getContext().getCoreLibrary().getFixnumClass(), (BigInteger) value);
129-
}
71+
@Specialization
72+
public RubyBasicObject box(double value) {
73+
return new RubyFloat(getContext().getCoreLibrary().getFloatClass(), value);
74+
}
13075

131-
throw new UnsupportedOperationException(value.getClass().getName());
76+
@Specialization
77+
public RubyBasicObject box(BigInteger value) {
78+
return new RubyBignum(getContext().getCoreLibrary().getFixnumClass(), value);
13279
}
13380

13481
}

core/src/main/java/org/jruby/truffle/nodes/control/ElidableResultNode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* a non-void type is used. It is not executed at all if a void typed execute method is used.
2424
* Therefore it should not perform any observable side effects.
2525
*/
26+
@NodeInfo(cost = NodeCost.NONE)
2627
public class ElidableResultNode extends RubyNode {
2728

2829
@Child protected RubyNode required;

core/src/main/java/org/jruby/truffle/nodes/control/PassthroughNode.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
package org.jruby.truffle.nodes.control;
1111

1212
import com.oracle.truffle.api.frame.VirtualFrame;
13+
import com.oracle.truffle.api.nodes.NodeCost;
14+
import com.oracle.truffle.api.nodes.NodeInfo;
1315
import com.oracle.truffle.api.nodes.UnexpectedResultException;
1416
import org.jruby.truffle.nodes.RubyNode;
1517
import org.jruby.truffle.runtime.core.*;

core/src/main/java/org/jruby/truffle/nodes/control/SequenceNode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/**
2626
* A sequence of statements to be executed in serial.
2727
*/
28+
@NodeInfo(cost = NodeCost.NONE)
2829
public final class SequenceNode extends RubyNode {
2930

3031
@Children protected final RubyNode[] body;

0 commit comments

Comments
 (0)