Skip to content

Commit 43223bd

Browse files
qunaibitsteve-s
authored andcommitted
Add HashingStorage helpers
1 parent 2e613d7 commit 43223bd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@
4848
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodesFactory.HashingStorageDelItemNodeGen;
4949
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodesFactory.HashingStorageForEachNodeGen;
5050
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodesFactory.HashingStorageGetItemNodeGen;
51+
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodesFactory.HashingStorageGetItemWithHashNodeGen;
5152
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodesFactory.HashingStorageGetIteratorNodeGen;
5253
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodesFactory.HashingStorageGetReverseIteratorNodeGen;
54+
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodesFactory.HashingStorageIteratorKeyHashNodeGen;
5355
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodesFactory.HashingStorageIteratorKeyNodeGen;
5456
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodesFactory.HashingStorageIteratorNextNodeGen;
5557
import com.oracle.graal.python.builtins.objects.common.HashingStorageNodesFactory.HashingStorageIteratorValueNodeGen;
@@ -114,6 +116,11 @@ public static boolean mayHaveSideEffects(PHashingCollection wrapper) {
114116
@GenerateInline
115117
@GenerateCached(false)
116118
public abstract static class HashingStorageGetItemWithHash extends Node {
119+
120+
public static Object getItemWithHash(HashingStorage self, Object key, long keyHash) {
121+
return HashingStorageGetItemWithHashNodeGen.getUncached().execute(null, null, self, key, keyHash);
122+
}
123+
117124
public abstract Object execute(Frame frame, Node inliningTarget, HashingStorage self, Object key, long keyHash);
118125

119126
@Specialization
@@ -479,6 +486,10 @@ public static void executeUncached(HashingStorage self, Object key, PHashingColl
479486
HashingStorageDelItemNodeGen.getUncached().executeWithAsserts(null, null, self, key, false, toUpdate);
480487
}
481488

489+
public static void delWithHash(EconomicMapStorage storage, Object key, long hash) {
490+
ObjectHashMapFactory.RemoveNodeGen.getUncached().execute(null, null, storage.map, key, hash);
491+
}
492+
482493
public final void execute(Node inliningTarget, HashingStorage self, TruffleString key, PHashingCollection toUpdate) {
483494
// Shortcut for frequent usage with TruffleString. We do not need a frame in such case,
484495
// because the string's __hash__ does not need it. Some fast-paths avoid even invoking
@@ -644,6 +655,10 @@ public static HashingStorageCopy create() {
644655
return HashingStorageCopyNodeGen.create();
645656
}
646657

658+
public static HashingStorage executeUncached(HashingStorage source) {
659+
return HashingStorageCopyNodeGen.getUncached().execute(null, source);
660+
}
661+
647662
public final HashingStorage executeCached(HashingStorage source) {
648663
return execute(this, source);
649664
}
@@ -997,6 +1012,11 @@ static Object keywords(KeywordsStorage self, HashingStorageIterator it) {
9971012
@GenerateCached(false)
9981013
@ImportStatic({PGuards.class})
9991014
public abstract static class HashingStorageIteratorKeyHash extends Node {
1015+
1016+
public static long executeUncached(HashingStorage storage, HashingStorageIterator it) {
1017+
return HashingStorageIteratorKeyHashNodeGen.getUncached().execute(null, storage, it);
1018+
}
1019+
10001020
public abstract long execute(Node node, HashingStorage storage, HashingStorageIterator it);
10011021

10021022
@Specialization

0 commit comments

Comments
 (0)