@@ -133,6 +133,14 @@ Object run(PBaseSet self, PBaseSet other) {
133133 abstract static class AndNode extends PythonBinaryBuiltinNode {
134134 @ Child private HashingStorageNodes .IntersectNode intersectNode ;
135135
136+ private HashingStorageNodes .IntersectNode getIntersectNode () {
137+ if (intersectNode == null ) {
138+ CompilerDirectives .transferToInterpreterAndInvalidate ();
139+ intersectNode = insert (HashingStorageNodes .IntersectNode .create ());
140+ }
141+ return intersectNode ;
142+ }
143+
136144 @ Specialization
137145 PBaseSet doPBaseSet (PSet left , PBaseSet right ) {
138146 HashingStorage intersectedStorage = getIntersectNode ().execute (left .getDictStorage (), right .getDictStorage ());
@@ -144,14 +152,6 @@ PBaseSet doPBaseSet(PFrozenSet left, PBaseSet right) {
144152 HashingStorage intersectedStorage = getIntersectNode ().execute (left .getDictStorage (), right .getDictStorage ());
145153 return factory ().createFrozenSet (intersectedStorage );
146154 }
147-
148- private HashingStorageNodes .IntersectNode getIntersectNode () {
149- if (intersectNode == null ) {
150- CompilerDirectives .transferToInterpreterAndInvalidate ();
151- intersectNode = insert (HashingStorageNodes .IntersectNode .create ());
152- }
153- return intersectNode ;
154- }
155155 }
156156
157157 @ Builtin (name = __SUB__ , fixedNumOfArguments = 2 )
@@ -198,6 +198,22 @@ abstract static class UnionNode extends PythonBuiltinNode {
198198
199199 @ CompilationFinal private ValueProfile setTypeProfile ;
200200
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+
201217 @ Specialization (guards = {"args.length == len" , "args.length < 32" }, limit = "3" )
202218 PBaseSet doCached (PBaseSet self , Object [] args ,
203219 @ Cached ("args.length" ) int len ,
@@ -225,30 +241,21 @@ private PBaseSet create(PBaseSet left, HashingStorage storage) {
225241 }
226242 return factory ().createSet (storage );
227243 }
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-
245244 }
246245
247246 abstract static class BinaryUnionNode extends PBaseNode {
248247 @ Child private Equivalence equivalenceNode ;
249248
250249 public abstract PBaseSet execute (PBaseSet container , HashingStorage left , Object right );
251250
251+ protected Equivalence getEquivalence () {
252+ if (equivalenceNode == null ) {
253+ CompilerDirectives .transferToInterpreterAndInvalidate ();
254+ equivalenceNode = insert (new PythonEquivalence ());
255+ }
256+ return equivalenceNode ;
257+ }
258+
252259 @ Specialization
253260 PBaseSet doHashingCollection (PBaseSet container , EconomicMapStorage selfStorage , PHashingCollection other ) {
254261 for (Object key : other .getDictStorage ().keys ()) {
@@ -277,14 +284,6 @@ PBaseSet doIterable(PBaseSet container, HashingStorage dictStorage, Object itera
277284 }
278285 }
279286
280- protected Equivalence getEquivalence () {
281- if (equivalenceNode == null ) {
282- CompilerDirectives .transferToInterpreterAndInvalidate ();
283- equivalenceNode = insert (new PythonEquivalence ());
284- }
285- return equivalenceNode ;
286- }
287-
288287 public static BinaryUnionNode create () {
289288 return BinaryUnionNodeGen .create ();
290289 }
0 commit comments