Skip to content

Commit af0d219

Browse files
committed
added HashingCollectionsNode.SetDictStorageNode
1 parent 2f5aafc commit af0d219

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
import com.oracle.graal.python.builtins.objects.common.HashingCollectionNodesFactory.GetDictStorageNodeGen;
4444
import com.oracle.graal.python.builtins.objects.common.HashingCollectionNodesFactory.LenNodeGen;
45+
import com.oracle.graal.python.builtins.objects.common.HashingCollectionNodesFactory.SetDictStorageNodeGen;
4546
import com.oracle.graal.python.builtins.objects.common.HashingCollectionNodesFactory.SetItemNodeGen;
4647
import com.oracle.graal.python.nodes.PGuards;
4748
import com.oracle.graal.python.nodes.PNodeWithContext;
@@ -131,4 +132,30 @@ public static GetDictStorageNode getUncached() {
131132
return GetDictStorageNodeGen.getUncached();
132133
}
133134
}
135+
136+
@ImportStatic({PGuards.class})
137+
@GenerateUncached
138+
public abstract static class SetDictStorageNode extends PNodeWithContext {
139+
140+
public abstract void execute(PHashingCollection c, HashingStorage storage);
141+
142+
@Specialization(limit = "4", guards = {"c.getClass() == cachedClass"})
143+
void setStorageCached(PHashingCollection c, HashingStorage storage,
144+
@Cached("c.getClass()") Class<? extends PHashingCollection> cachedClass) {
145+
cachedClass.cast(c).setDictStorage(storage);
146+
}
147+
148+
@Specialization(replaces = "setStorageCached")
149+
static void getStorageGeneric(PHashingCollection c, HashingStorage storage) {
150+
c.setDictStorage(storage);
151+
}
152+
153+
public static SetDictStorageNode create() {
154+
return SetDictStorageNodeGen.create();
155+
}
156+
157+
public static SetDictStorageNode getUncached() {
158+
return SetDictStorageNodeGen.getUncached();
159+
}
160+
}
134161
}

0 commit comments

Comments
 (0)