Skip to content

Commit 4486d07

Browse files
committed
[Truffle] Start to remove notDesignedForCompilation
1 parent f306391 commit 4486d07

Some content is hidden

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

47 files changed

+41
-100
lines changed

truffle/src/main/java/org/jruby/truffle/nodes/ReadConstantNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void executeVoid(VirtualFrame frame) {
5959

6060
@Override
6161
public Object isDefined(VirtualFrame frame) {
62-
notDesignedForCompilation();
62+
CompilerDirectives.transferToInterpreter();
6363

6464
final RubyContext context = getContext();
6565

truffle/src/main/java/org/jruby/truffle/nodes/RubyCallNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public RubyNode[] expandedArgumentNodes(InternalMethod method, RubyNode[] argume
345345

346346
@Override
347347
public Object isDefined(VirtualFrame frame) {
348-
notDesignedForCompilation();
348+
CompilerDirectives.transferToInterpreter();
349349

350350
if (receiver.isDefined(frame) == nil()) {
351351
return nil();

truffle/src/main/java/org/jruby/truffle/nodes/WriteConstantNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public WriteConstantNode(RubyContext context, SourceSection sourceSection, Strin
3434

3535
@Override
3636
public Object execute(VirtualFrame frame) {
37-
notDesignedForCompilation();
37+
CompilerDirectives.transferToInterpreter();
3838

3939
// Evaluate RHS first.
4040
final Object rhsValue = rhs.execute(frame);

truffle/src/main/java/org/jruby/truffle/nodes/cast/ArrayCastNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ public Object cast(RubyNilClass nil) {
100100

101101
@Specialization(guards = {"!isRubyNilClass(object)", "!isRubyArray(object)"})
102102
public Object cast(VirtualFrame frame, RubyBasicObject object) {
103-
notDesignedForCompilation();
104-
105103
final Object result = toArrayNode.call(frame, object, "to_ary", null, new Object[]{});
106104

107105
if (result == DispatchNode.MISSING) {

truffle/src/main/java/org/jruby/truffle/nodes/cast/HashCastNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ public RubyNilClass cast(RubyNilClass nil) {
7777

7878
@Specialization(guards = {"!isRubyNilClass(object)", "!isRubyHash(object)"})
7979
public Object cast(VirtualFrame frame, RubyBasicObject object) {
80-
notDesignedForCompilation();
81-
8280
final Object result = toHashNode.call(frame, object, "to_hash", null, new Object[]{});
8381

8482
if (result == DispatchNode.MISSING) {

truffle/src/main/java/org/jruby/truffle/nodes/cast/LambdaNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public LambdaNode(RubyContext context, SourceSection sourceSection, RubyNode def
3030

3131
@Override
3232
public Object execute(VirtualFrame frame) {
33-
notDesignedForCompilation();
34-
3533
final InternalMethod method = (InternalMethod) definition.execute(frame);
3634

3735
// TODO(CS): not sure we're closing over the correct state here

truffle/src/main/java/org/jruby/truffle/nodes/cast/ProcCastNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public RubyProc doRubyProc(RubyProc proc) {
4646

4747
@Specialization
4848
public RubyProc doObject(VirtualFrame frame, RubyBasicObject object) {
49-
notDesignedForCompilation();
50-
5149
return (RubyProc) toProc.call(frame, object, "to_proc", null);
5250
}
5351

truffle/src/main/java/org/jruby/truffle/nodes/cast/SingleValueCastNode.java

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

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.dsl.NodeChild;
1314
import com.oracle.truffle.api.dsl.Specialization;
1415
import com.oracle.truffle.api.frame.VirtualFrame;
@@ -36,11 +37,10 @@ protected RubyNilClass castNil(Object[] args) {
3637
protected Object castSingle(Object[] args) {
3738
return args[0];
3839
}
39-
40+
41+
@CompilerDirectives.TruffleBoundary
4042
@Specialization(guards = { "!noArguments(args)", "!singleArgument(args)" })
4143
protected RubyArray castMany(Object[] args) {
42-
notDesignedForCompilation();
43-
4444
return RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(), args);
4545
}
4646

truffle/src/main/java/org/jruby/truffle/nodes/cast/SplatCastNode.java

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

1212
import com.oracle.truffle.api.CompilerAsserts;
13+
import com.oracle.truffle.api.CompilerDirectives;
1314
import com.oracle.truffle.api.dsl.NodeChild;
1415
import com.oracle.truffle.api.dsl.Specialization;
1516
import com.oracle.truffle.api.frame.VirtualFrame;
@@ -84,8 +85,6 @@ public RubyArray splat(VirtualFrame frame, RubyArray array) {
8485

8586
@Specialization(guards = {"!isRubyNilClass(object)", "!isRubyArray(object)"})
8687
public RubyArray splat(VirtualFrame frame, Object object) {
87-
notDesignedForCompilation();
88-
8988
final String method;
9089

9190
if (useToAry) {
@@ -102,6 +101,7 @@ public RubyArray splat(VirtualFrame frame, Object object) {
102101
if (array instanceof RubyArray) {
103102
return (RubyArray) array;
104103
} else if (array instanceof RubyNilClass || array == DispatchNode.MISSING) {
104+
CompilerDirectives.transferToInterpreter();
105105
return RubyArray.fromObject(getContext().getCoreLibrary().getArrayClass(), object);
106106
} else {
107107
throw new RaiseException(getContext().getCoreLibrary().typeErrorCantConvertTo(

truffle/src/main/java/org/jruby/truffle/nodes/cast/StringToSymbolNode.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ public StringToSymbolNode(RubyContext context, SourceSection sourceSection) {
2828
super(context, sourceSection);
2929
}
3030

31-
@CompilerDirectives.TruffleBoundary
3231
@Specialization
3332
public RubySymbol doString(RubyString string) {
34-
notDesignedForCompilation();
35-
3633
return getContext().getSymbol(string.toString());
3734
}
3835

truffle/src/main/java/org/jruby/truffle/nodes/coerce/SymbolOrToStrNode.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ public String coerceRubyString(RubyString string) {
4747

4848
@Specialization(guards = { "!isRubySymbol(object)", "!isRubyString(object)" })
4949
public String coerceObject(VirtualFrame frame, Object object) {
50-
notDesignedForCompilation();
51-
5250
final Object coerced;
5351

5452
try {
@@ -63,7 +61,7 @@ public String coerceObject(VirtualFrame frame, Object object) {
6361
}
6462

6563
if (coerced instanceof RubyString) {
66-
return ((RubyString) coerced).toString();
64+
return coerced.toString();
6765
} else {
6866
CompilerDirectives.transferToInterpreter();
6967
throw new RaiseException(getContext().getCoreLibrary().typeErrorBadCoercion(object, "String", "to_str", coerced, this));

truffle/src/main/java/org/jruby/truffle/nodes/coerce/ToAryNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public RubyArray coerceRubyArray(RubyArray rubyArray) {
3838

3939
@Specialization(guards = "!isRubyArray(object)")
4040
public RubyArray coerceObject(VirtualFrame frame, Object object) {
41-
notDesignedForCompilation();
42-
4341
if (toAryNode == null) {
4442
CompilerDirectives.transferToInterpreter();
4543
toAryNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));

truffle/src/main/java/org/jruby/truffle/nodes/coerce/ToStrNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ public RubyString coerceRubyString(RubyString string) {
4141

4242
@Specialization(guards = "!isRubyString(object)")
4343
public RubyString coerceObject(VirtualFrame frame, Object object) {
44-
notDesignedForCompilation();
45-
4644
final Object coerced;
4745

4846
try {

truffle/src/main/java/org/jruby/truffle/nodes/control/FlipFlopNode.java

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

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.frame.VirtualFrame;
1314
import com.oracle.truffle.api.source.SourceSection;
1415
import org.jruby.truffle.nodes.RubyNode;
@@ -35,8 +36,6 @@ public FlipFlopNode(RubyContext context, SourceSection sourceSection, RubyNode b
3536

3637
@Override
3738
public boolean executeBoolean(VirtualFrame frame) {
38-
notDesignedForCompilation();
39-
4039
if (exclusive) {
4140
if (stateNode.getState(frame)) {
4241
if (end.executeBoolean(frame)) {

truffle/src/main/java/org/jruby/truffle/nodes/control/OnceNode.java

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

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.frame.VirtualFrame;
1314
import com.oracle.truffle.api.source.SourceSection;
1415
import com.oracle.truffle.api.utilities.AssumedValue;
@@ -29,8 +30,6 @@ public OnceNode(RubyContext context, SourceSection sourceSection, RubyNode child
2930

3031
@Override
3132
public Object execute(VirtualFrame frame) {
32-
notDesignedForCompilation();
33-
3433
Object value = valueMemo.get();
3534

3635
if (value == null) {

truffle/src/main/java/org/jruby/truffle/nodes/control/RescueClassesNode.java

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

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.frame.VirtualFrame;
1314
import com.oracle.truffle.api.nodes.ExplodeLoop;
1415
import com.oracle.truffle.api.source.SourceSection;
@@ -30,10 +31,9 @@ public RescueClassesNode(RubyContext context, SourceSection sourceSection, RubyN
3031
this.handlingClassNodes = handlingClassNodes;
3132
}
3233

33-
@ExplodeLoop
3434
@Override
3535
public boolean canHandle(VirtualFrame frame, RubyException exception) {
36-
notDesignedForCompilation();
36+
CompilerDirectives.transferToInterpreter();
3737

3838
final RubyClass exceptionRubyClass = exception.getLogicalClass();
3939

truffle/src/main/java/org/jruby/truffle/nodes/control/RescueSplatNode.java

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

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.frame.VirtualFrame;
1314
import com.oracle.truffle.api.nodes.ExplodeLoop;
1415
import com.oracle.truffle.api.source.SourceSection;
@@ -33,10 +34,9 @@ public RescueSplatNode(RubyContext context, SourceSection sourceSection, RubyNod
3334
this.handlingClassesArray = handlingClassesArray;
3435
}
3536

36-
@ExplodeLoop
3737
@Override
3838
public boolean canHandle(VirtualFrame frame, RubyException exception) {
39-
notDesignedForCompilation();
39+
CompilerDirectives.transferToInterpreter();
4040

4141
final RubyArray handlingClasses = (RubyArray) handlingClassesArray.execute(frame);
4242

truffle/src/main/java/org/jruby/truffle/nodes/control/TryNode.java

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

1212
import com.oracle.truffle.api.CompilerAsserts;
13+
import com.oracle.truffle.api.CompilerDirectives;
1314
import com.oracle.truffle.api.frame.VirtualFrame;
1415
import com.oracle.truffle.api.nodes.ControlFlowException;
1516
import com.oracle.truffle.api.nodes.ExplodeLoop;
@@ -80,11 +81,8 @@ public Object execute(VirtualFrame frame) {
8081
}
8182
}
8283

83-
@ExplodeLoop
8484
private Object handleException(VirtualFrame frame, RaiseException exception) {
85-
CompilerAsserts.neverPartOfCompilation();
86-
87-
notDesignedForCompilation();
85+
CompilerDirectives.transferToInterpreter();
8886

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

truffle/src/main/java/org/jruby/truffle/nodes/control/WhenSplatNode.java

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

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.frame.VirtualFrame;
1314
import com.oracle.truffle.api.nodes.UnexpectedResultException;
1415
import com.oracle.truffle.api.source.SourceSection;
@@ -33,7 +34,7 @@ public WhenSplatNode(RubyContext context, SourceSection sourceSection, RubyNode
3334

3435
@Override
3536
public boolean executeBoolean(VirtualFrame frame) {
36-
notDesignedForCompilation();
37+
CompilerDirectives.transferToInterpreter();
3738

3839
final Object caseExpression = readCaseExpression.execute(frame);
3940

truffle/src/main/java/org/jruby/truffle/nodes/globals/CheckMatchVariableTypeNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ public CheckMatchVariableTypeNode(RubyContext context, SourceSection sourceSecti
2828
}
2929

3030
public Object execute(VirtualFrame frame) {
31-
notDesignedForCompilation();
32-
3331
final Object childValue = child.execute(frame);
3432

3533
if (!(childValue instanceof RubyMatchData || childValue instanceof RubyNilClass || childValue instanceof RubyNilClass)) {

truffle/src/main/java/org/jruby/truffle/nodes/globals/CheckOutputSeparatorVariableTypeNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public CheckOutputSeparatorVariableTypeNode(RubyContext context, SourceSection s
2727
}
2828

2929
public Object execute(VirtualFrame frame) {
30-
notDesignedForCompilation();
31-
3230
final Object childValue = child.execute(frame);
3331

3432
if (!(childValue instanceof RubyString) && childValue != nil()) {

truffle/src/main/java/org/jruby/truffle/nodes/globals/CheckProgramNameVariableTypeNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public CheckProgramNameVariableTypeNode(RubyContext context, SourceSection sourc
2727
}
2828

2929
public Object execute(VirtualFrame frame) {
30-
notDesignedForCompilation();
31-
3230
final Object childValue = child.execute(frame);
3331

3432
if (!(childValue instanceof RubyString)) {

truffle/src/main/java/org/jruby/truffle/nodes/globals/CheckRecordSeparatorVariableTypeNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public CheckRecordSeparatorVariableTypeNode(RubyContext context, SourceSection s
2727
}
2828

2929
public Object execute(VirtualFrame frame) {
30-
notDesignedForCompilation();
31-
3230
final Object childValue = child.execute(frame);
3331

3432
if (!(childValue instanceof RubyString) && childValue != nil()) {

truffle/src/main/java/org/jruby/truffle/nodes/globals/CheckStdoutVariableTypeNode.java

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

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.frame.VirtualFrame;
1314
import com.oracle.truffle.api.source.SourceSection;
1415
import org.jruby.truffle.nodes.RubyNode;
@@ -26,7 +27,7 @@ public CheckStdoutVariableTypeNode(RubyContext context, SourceSection sourceSect
2627
}
2728

2829
public Object execute(VirtualFrame frame) {
29-
notDesignedForCompilation();
30+
CompilerDirectives.transferToInterpreter();
3031

3132
final Object childValue = child.execute(frame);
3233

truffle/src/main/java/org/jruby/truffle/nodes/globals/ReadMatchReferenceNode.java

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

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.frame.VirtualFrame;
1314
import com.oracle.truffle.api.source.SourceSection;
1415
import org.jruby.truffle.nodes.RubyNode;
@@ -31,7 +32,7 @@ public ReadMatchReferenceNode(RubyContext context, SourceSection sourceSection,
3132

3233
@Override
3334
public Object execute(VirtualFrame frame) {
34-
notDesignedForCompilation();
35+
CompilerDirectives.transferToInterpreter();
3536

3637
final Object match = getContext().getThreadManager().getCurrentThread().getThreadLocals().getInstanceVariable("$~");
3738

@@ -71,8 +72,6 @@ public Object execute(VirtualFrame frame) {
7172

7273
@Override
7374
public Object isDefined(VirtualFrame frame) {
74-
notDesignedForCompilation();
75-
7675
if (execute(frame) != nil()) {
7776
return getContext().makeString("global-variable");
7877
} else {

truffle/src/main/java/org/jruby/truffle/nodes/globals/UpdateVerbosityNode.java

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

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.frame.VirtualFrame;
1314
import com.oracle.truffle.api.source.SourceSection;
1415
import org.jruby.runtime.builtin.IRubyObject;
@@ -25,7 +26,7 @@ public UpdateVerbosityNode(RubyContext context, SourceSection sourceSection, Rub
2526
}
2627

2728
public Object execute(VirtualFrame frame) {
28-
notDesignedForCompilation();
29+
CompilerDirectives.transferToInterpreter();
2930

3031
final Object childValue = child.execute(frame);
3132

truffle/src/main/java/org/jruby/truffle/nodes/literal/ConcatHashLiteralNode.java

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

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.frame.VirtualFrame;
1314
import com.oracle.truffle.api.nodes.UnexpectedResultException;
1415
import com.oracle.truffle.api.source.SourceSection;
@@ -32,7 +33,7 @@ public ConcatHashLiteralNode(RubyContext context, SourceSection sourceSection, R
3233

3334
@Override
3435
public RubyHash executeRubyHash(VirtualFrame frame) {
35-
notDesignedForCompilation();
36+
CompilerDirectives.transferToInterpreter();
3637

3738
final List<KeyValue> keyValues = new ArrayList<>();
3839

truffle/src/main/java/org/jruby/truffle/nodes/literal/HashLiteralNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public GenericHashLiteralNode(RubyContext context, SourceSection sourceSection,
153153

154154
@Override
155155
public RubyHash executeRubyHash(VirtualFrame frame) {
156-
notDesignedForCompilation();
156+
CompilerDirectives.transferToInterpreter();
157157

158158
final List<KeyValue> entries = new ArrayList<>();
159159

0 commit comments

Comments
 (0)