|
107 | 107 | import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
|
108 | 108 | import com.oracle.truffle.api.dsl.Bind;
|
109 | 109 | import com.oracle.truffle.api.dsl.Cached;
|
| 110 | +import com.oracle.truffle.api.dsl.Cached.Exclusive; |
110 | 111 | import com.oracle.truffle.api.dsl.Cached.Shared;
|
111 | 112 | import com.oracle.truffle.api.dsl.Fallback;
|
112 | 113 | import com.oracle.truffle.api.dsl.GenerateCached;
|
@@ -419,21 +420,26 @@ abstract static class RichCompareNode extends PythonTernaryBuiltinNode {
|
419 | 420 | @Specialization(guards = {"opCode == cachedOp.opCode"}, limit = "6")
|
420 | 421 | static Object doPTuple(VirtualFrame frame, PTuple left, PTuple right, @SuppressWarnings("unused") int opCode,
|
421 | 422 | @SuppressWarnings("unused") @Cached("fromOpCode(opCode)") ComparisonOp cachedOp,
|
422 |
| - @Cached("createCmpNode(cachedOp)") SequenceStorageNodes.CmpNode cmpNode) { |
| 423 | + @Exclusive @Cached("createCmpNode(cachedOp)") SequenceStorageNodes.CmpNode cmpNode) { |
423 | 424 | return cmpNode.execute(frame, left.getSequenceStorage(), right.getSequenceStorage());
|
424 | 425 | }
|
425 | 426 |
|
426 |
| - @Specialization(guards = {"opCode == cachedOp.opCode", "checkRight.execute(inliningTarget, right)"}, limit = "6", replaces = "doPTuple") |
427 |
| - static Object doRelOp(VirtualFrame frame, Object left, Object right, @SuppressWarnings("unused") int opCode, |
| 427 | + @Specialization(guards = {"opCode == cachedOp.opCode"}, limit = "6", replaces = "doPTuple") |
| 428 | + static Object doGeneric(VirtualFrame frame, Object left, Object right, @SuppressWarnings("unused") int opCode, |
428 | 429 | @Bind("this") Node inliningTarget,
|
429 | 430 | @SuppressWarnings("unused") @Cached("fromOpCode(opCode)") ComparisonOp cachedOp,
|
430 |
| - @SuppressWarnings("unused") @Cached PyTupleCheckNode checkRight, |
| 431 | + @Cached PyTupleCheckNode checkLeft, |
| 432 | + @Cached PyTupleCheckNode checkRight, |
431 | 433 | @Cached GetTupleStorage getLeft,
|
432 | 434 | @Cached GetTupleStorage getRight,
|
433 |
| - @Cached("createCmpNode(cachedOp)") SequenceStorageNodes.CmpNode cmpNode) { |
| 435 | + @Exclusive @Cached("createCmpNode(cachedOp)") SequenceStorageNodes.CmpNode cmpNode) { |
| 436 | + if (!checkLeft.execute(inliningTarget, left) || !checkRight.execute(inliningTarget, right)) { |
| 437 | + return PNotImplemented.NOT_IMPLEMENTED; |
| 438 | + } |
434 | 439 | return cmpNode.execute(frame, getLeft.execute(inliningTarget, left), getRight.execute(inliningTarget, right));
|
435 | 440 | }
|
436 | 441 |
|
| 442 | + @NeverDefault |
437 | 443 | static SequenceStorageNodes.CmpNode createCmpNode(ComparisonOp op) {
|
438 | 444 | switch (op) {
|
439 | 445 | case LE:
|
|
0 commit comments