@@ -133,6 +133,14 @@ Object run(PBaseSet self, PBaseSet other) {
133
133
abstract static class AndNode extends PythonBinaryBuiltinNode {
134
134
@ Child private HashingStorageNodes .IntersectNode intersectNode ;
135
135
136
+ private HashingStorageNodes .IntersectNode getIntersectNode () {
137
+ if (intersectNode == null ) {
138
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
139
+ intersectNode = insert (HashingStorageNodes .IntersectNode .create ());
140
+ }
141
+ return intersectNode ;
142
+ }
143
+
136
144
@ Specialization
137
145
PBaseSet doPBaseSet (PSet left , PBaseSet right ) {
138
146
HashingStorage intersectedStorage = getIntersectNode ().execute (left .getDictStorage (), right .getDictStorage ());
@@ -144,14 +152,6 @@ PBaseSet doPBaseSet(PFrozenSet left, PBaseSet right) {
144
152
HashingStorage intersectedStorage = getIntersectNode ().execute (left .getDictStorage (), right .getDictStorage ());
145
153
return factory ().createFrozenSet (intersectedStorage );
146
154
}
147
-
148
- private HashingStorageNodes .IntersectNode getIntersectNode () {
149
- if (intersectNode == null ) {
150
- CompilerDirectives .transferToInterpreterAndInvalidate ();
151
- intersectNode = insert (HashingStorageNodes .IntersectNode .create ());
152
- }
153
- return intersectNode ;
154
- }
155
155
}
156
156
157
157
@ Builtin (name = __SUB__ , fixedNumOfArguments = 2 )
@@ -198,6 +198,22 @@ abstract static class UnionNode extends PythonBuiltinNode {
198
198
199
199
@ CompilationFinal private ValueProfile setTypeProfile ;
200
200
201
+ private BinaryUnionNode getBinaryUnionNode () {
202
+ if (binaryUnionNode == null ) {
203
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
204
+ binaryUnionNode = insert (BinaryUnionNode .create ());
205
+ }
206
+ return binaryUnionNode ;
207
+ }
208
+
209
+ private ValueProfile getSetTypeProfile () {
210
+ if (setTypeProfile == null ) {
211
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
212
+ setTypeProfile = ValueProfile .createClassProfile ();
213
+ }
214
+ return setTypeProfile ;
215
+ }
216
+
201
217
@ Specialization (guards = {"args.length == len" , "args.length < 32" }, limit = "3" )
202
218
PBaseSet doCached (PBaseSet self , Object [] args ,
203
219
@ Cached ("args.length" ) int len ,
@@ -225,30 +241,21 @@ private PBaseSet create(PBaseSet left, HashingStorage storage) {
225
241
}
226
242
return factory ().createSet (storage );
227
243
}
228
-
229
- private BinaryUnionNode getBinaryUnionNode () {
230
- if (binaryUnionNode == null ) {
231
- CompilerDirectives .transferToInterpreterAndInvalidate ();
232
- binaryUnionNode = insert (BinaryUnionNode .create ());
233
- }
234
- return binaryUnionNode ;
235
- }
236
-
237
- private ValueProfile getSetTypeProfile () {
238
- if (setTypeProfile == null ) {
239
- CompilerDirectives .transferToInterpreterAndInvalidate ();
240
- setTypeProfile = ValueProfile .createClassProfile ();
241
- }
242
- return setTypeProfile ;
243
- }
244
-
245
244
}
246
245
247
246
abstract static class BinaryUnionNode extends PBaseNode {
248
247
@ Child private Equivalence equivalenceNode ;
249
248
250
249
public abstract PBaseSet execute (PBaseSet container , HashingStorage left , Object right );
251
250
251
+ protected Equivalence getEquivalence () {
252
+ if (equivalenceNode == null ) {
253
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
254
+ equivalenceNode = insert (new PythonEquivalence ());
255
+ }
256
+ return equivalenceNode ;
257
+ }
258
+
252
259
@ Specialization
253
260
PBaseSet doHashingCollection (PBaseSet container , EconomicMapStorage selfStorage , PHashingCollection other ) {
254
261
for (Object key : other .getDictStorage ().keys ()) {
@@ -277,14 +284,6 @@ PBaseSet doIterable(PBaseSet container, HashingStorage dictStorage, Object itera
277
284
}
278
285
}
279
286
280
- protected Equivalence getEquivalence () {
281
- if (equivalenceNode == null ) {
282
- CompilerDirectives .transferToInterpreterAndInvalidate ();
283
- equivalenceNode = insert (new PythonEquivalence ());
284
- }
285
- return equivalenceNode ;
286
- }
287
-
288
287
public static BinaryUnionNode create () {
289
288
return BinaryUnionNodeGen .create ();
290
289
}
0 commit comments