|
19 | 19 | import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodesFactory.CmpNodeGen;
|
20 | 20 | import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodesFactory.ConcatNodeGen;
|
21 | 21 | import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodesFactory.ContainsNodeGen;
|
22 |
| -import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodesFactory.EqNodeGen; |
23 | 22 | import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodesFactory.GetItemNodeGen;
|
24 | 23 | import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodesFactory.GetItemScalarNodeGen;
|
25 | 24 | import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodesFactory.GetItemSliceNodeGen;
|
@@ -1274,106 +1273,6 @@ public static CmpNode createEq() {
|
1274 | 1273 | }
|
1275 | 1274 | }
|
1276 | 1275 |
|
1277 |
| - public abstract static class EqNode extends SequenceStorageBaseNode { |
1278 |
| - @Child private GetItemScalarNode getItemNode; |
1279 |
| - @Child private GetItemScalarNode getRightItemNode; |
1280 |
| - @Child private BinaryComparisonNode equalsNode; |
1281 |
| - @Child private CastToBooleanNode castToBooleanNode; |
1282 |
| - |
1283 |
| - public abstract boolean execute(SequenceStorage left, SequenceStorage right); |
1284 |
| - |
1285 |
| - @Specialization(guards = {"isEmpty(left)", "isEmpty(right)"}) |
1286 |
| - boolean doEmpty(@SuppressWarnings("unused") SequenceStorage left, @SuppressWarnings("unused") SequenceStorage right) { |
1287 |
| - return true; |
1288 |
| - } |
1289 |
| - |
1290 |
| - @Specialization(guards = {"left.getClass() == right.getClass()", "!isNative(left)"}) |
1291 |
| - boolean doManagedManagedSameType(SequenceStorage left, SequenceStorage right) { |
1292 |
| - assert !isNative(right); |
1293 |
| - // TODO type profile or cache on class |
1294 |
| - return left.equals(right); |
1295 |
| - } |
1296 |
| - |
1297 |
| - @Specialization(guards = "left.getElementType() == right.getElementType()") |
1298 |
| - boolean doNativeNativeSameType(NativeSequenceStorage left, NativeSequenceStorage right) { |
1299 |
| - // TODO profile or guard ! |
1300 |
| - if (left.length() != right.length()) { |
1301 |
| - return false; |
1302 |
| - } |
1303 |
| - for (int i = 0; i < left.length(); i++) { |
1304 |
| - // use the same 'getItemNode' |
1305 |
| - Object leftItem = getGetItemNode().execute(left, i); |
1306 |
| - Object rightItem = getGetItemNode().execute(right, i); |
1307 |
| - if (!eq(leftItem, rightItem)) { |
1308 |
| - return false; |
1309 |
| - } |
1310 |
| - } |
1311 |
| - return true; |
1312 |
| - } |
1313 |
| - |
1314 |
| - @Specialization(guards = {"!isNative(left)", "compatible(left, right)"}) |
1315 |
| - boolean doManagedNative(SequenceStorage left, NativeSequenceStorage right) { |
1316 |
| - // TODO profile or guard ! |
1317 |
| - if (left.length() != right.length()) { |
1318 |
| - return false; |
1319 |
| - } |
1320 |
| - for (int i = 0; i < left.length(); i++) { |
1321 |
| - Object leftItem = getGetItemNode().execute(left, i); |
1322 |
| - Object rightItem = getGetRightItemNode().execute(right, i); |
1323 |
| - if (!eq(leftItem, rightItem)) { |
1324 |
| - return false; |
1325 |
| - } |
1326 |
| - } |
1327 |
| - return true; |
1328 |
| - } |
1329 |
| - |
1330 |
| - @Specialization(guards = {"!isNative(right)", "compatible(right, left)"}) |
1331 |
| - boolean doNatveManaged(NativeSequenceStorage left, SequenceStorage right) { |
1332 |
| - return doManagedNative(right, left); |
1333 |
| - } |
1334 |
| - |
1335 |
| - @Fallback |
1336 |
| - boolean doFallback(@SuppressWarnings("unused") SequenceStorage left, @SuppressWarnings("unused") SequenceStorage right) { |
1337 |
| - return false; |
1338 |
| - } |
1339 |
| - |
1340 |
| - private GetItemScalarNode getGetItemNode() { |
1341 |
| - if (getItemNode == null) { |
1342 |
| - CompilerDirectives.transferToInterpreterAndInvalidate(); |
1343 |
| - getItemNode = insert(GetItemScalarNode.create()); |
1344 |
| - } |
1345 |
| - return getItemNode; |
1346 |
| - } |
1347 |
| - |
1348 |
| - private GetItemScalarNode getGetRightItemNode() { |
1349 |
| - if (getRightItemNode == null) { |
1350 |
| - CompilerDirectives.transferToInterpreterAndInvalidate(); |
1351 |
| - getRightItemNode = insert(GetItemScalarNode.create()); |
1352 |
| - } |
1353 |
| - return getRightItemNode; |
1354 |
| - } |
1355 |
| - |
1356 |
| - private boolean eq(Object left, Object right) { |
1357 |
| - if (equalsNode == null) { |
1358 |
| - CompilerDirectives.transferToInterpreterAndInvalidate(); |
1359 |
| - equalsNode = insert(BinaryComparisonNode.create(__EQ__, __EQ__, "==")); |
1360 |
| - } |
1361 |
| - return castToBoolean(equalsNode.executeWith(left, right)); |
1362 |
| - } |
1363 |
| - |
1364 |
| - private boolean castToBoolean(Object value) { |
1365 |
| - if (castToBooleanNode == null) { |
1366 |
| - CompilerDirectives.transferToInterpreterAndInvalidate(); |
1367 |
| - castToBooleanNode = insert(CastToBooleanNode.createIfTrueNode()); |
1368 |
| - } |
1369 |
| - return castToBooleanNode.executeWith(value); |
1370 |
| - } |
1371 |
| - |
1372 |
| - public static EqNode create() { |
1373 |
| - return EqNodeGen.create(); |
1374 |
| - } |
1375 |
| - } |
1376 |
| - |
1377 | 1276 | public abstract static class NormalizeIndexNode extends PBaseNode {
|
1378 | 1277 | public static final String INDEX_OUT_OF_BOUNDS = "index out of range";
|
1379 | 1278 | public static final String RANGE_OUT_OF_BOUNDS = "range index out of range";
|
|
0 commit comments