Skip to content

Commit 4483a7a

Browse files
committed
switch to using the ContainsKeyNode instead of GetItemNode
1 parent c6cef98 commit 4483a7a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/HashingStorageNodes.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,16 +1107,16 @@ public static EqualsNode create() {
11071107
}
11081108

11091109
public abstract static class KeysEqualsNode extends DictStorageBaseNode {
1110-
@Child private GetItemNode getRightItemNode;
1110+
@Child private ContainsKeyNode rightContainsKeyNode;
11111111

11121112
public abstract boolean execute(HashingStorage selfStorage, HashingStorage other);
11131113

1114-
private GetItemNode getRightItemNode() {
1115-
if (getRightItemNode == null) {
1114+
private ContainsKeyNode getRightContainsKeyNode() {
1115+
if (rightContainsKeyNode == null) {
11161116
CompilerDirectives.transferToInterpreterAndInvalidate();
1117-
getRightItemNode = insert(GetItemNode.create());
1117+
rightContainsKeyNode = insert(ContainsKeyNode.create());
11181118
}
1119-
return getRightItemNode;
1119+
return rightContainsKeyNode;
11201120
}
11211121

11221122
@Specialization(guards = "selfStorage.length() == other.length()")
@@ -1132,8 +1132,7 @@ boolean doKeywordsString(DynamicObjectStorage selfStorage, DynamicObjectStorage
11321132
if (selfStorage.length() == other.length()) {
11331133
Iterable<Object> keys = selfStorage.keys();
11341134
for (Object key : keys) {
1135-
Object rightItem = getRightItemNode().execute(other, key);
1136-
if (rightItem == null) {
1135+
if (!getRightContainsKeyNode().execute(other, key)) {
11371136
return false;
11381137
}
11391138
}
@@ -1147,8 +1146,7 @@ boolean doKeywordsString(HashingStorage selfStorage, HashingStorage other) {
11471146
if (selfStorage.length() == other.length()) {
11481147
Iterable<Object> keys = selfStorage.keys();
11491148
for (Object key : keys) {
1150-
Object rightItem = getRightItemNode().execute(other, key);
1151-
if (rightItem == null) {
1149+
if (!getRightContainsKeyNode().execute(other, key)) {
11521150
return false;
11531151
}
11541152
}

0 commit comments

Comments
 (0)