|
42 | 42 |
|
43 | 43 | import com.oracle.graal.python.builtins.objects.common.HashingCollectionNodesFactory.GetDictStorageNodeGen;
|
44 | 44 | import com.oracle.graal.python.builtins.objects.common.HashingCollectionNodesFactory.LenNodeGen;
|
| 45 | +import com.oracle.graal.python.builtins.objects.common.HashingCollectionNodesFactory.SetDictStorageNodeGen; |
45 | 46 | import com.oracle.graal.python.builtins.objects.common.HashingCollectionNodesFactory.SetItemNodeGen;
|
46 | 47 | import com.oracle.graal.python.nodes.PGuards;
|
47 | 48 | import com.oracle.graal.python.nodes.PNodeWithContext;
|
@@ -131,4 +132,30 @@ public static GetDictStorageNode getUncached() {
|
131 | 132 | return GetDictStorageNodeGen.getUncached();
|
132 | 133 | }
|
133 | 134 | }
|
| 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 | + } |
134 | 161 | }
|
0 commit comments