4444import static com .oracle .graal .python .util .PythonUtils .TS_ENCODING ;
4545
4646import com .oracle .graal .python .builtins .objects .bytes .PBytesLike ;
47- import com .oracle .graal .python .builtins .objects .common .HashingStorageNodes .HashingStorageLen ;
48- import com .oracle .graal .python .builtins .objects .dict .PDict ;
47+ import com .oracle .graal .python .builtins .objects .common .PHashingCollection ;
4948import com .oracle .graal .python .builtins .objects .list .PList ;
50- import com .oracle .graal .python .builtins .objects .set .PSet ;
5149import com .oracle .graal .python .builtins .objects .str .PString ;
5250import com .oracle .graal .python .builtins .objects .str .StringNodes ;
5351import com .oracle .graal .python .builtins .objects .tuple .PTuple ;
6260import com .oracle .graal .python .runtime .exception .PException ;
6361import com .oracle .truffle .api .HostCompilerDirectives .InliningCutoff ;
6462import com .oracle .truffle .api .dsl .Cached ;
63+ import com .oracle .truffle .api .dsl .Cached .Exclusive ;
6564import com .oracle .truffle .api .dsl .Cached .Shared ;
6665import com .oracle .truffle .api .dsl .Fallback ;
6766import com .oracle .truffle .api .dsl .GenerateCached ;
7271import com .oracle .truffle .api .frame .Frame ;
7372import com .oracle .truffle .api .frame .VirtualFrame ;
7473import com .oracle .truffle .api .nodes .Node ;
75- import com .oracle .truffle .api .profiles .InlinedBranchProfile ;
7674import com .oracle .truffle .api .strings .TruffleString ;
7775
7876/**
@@ -106,17 +104,10 @@ static int doTuple(PTuple object) {
106104 return object .getSequenceStorage ().length ();
107105 }
108106
109- @ Specialization (guards = "cannotBeOverriddenForImmutableType(object)" )
110- static int doDict (Node inliningTarget , PDict object ,
111- @ Shared ("hashingStorageLen" ) @ Cached HashingStorageLen lenNode ) {
112- return lenNode .execute (inliningTarget , object .getDictStorage ());
113- }
114-
115- @ Specialization (guards = "cannotBeOverridden(object, inliningTarget, getClassNode)" )
116- static int doSet (Node inliningTarget , PSet object ,
117- @ Shared ("getClass" ) @ SuppressWarnings ("unused" ) @ Cached GetPythonObjectClassNode getClassNode ,
118- @ Shared ("hashingStorageLen" ) @ Cached HashingStorageLen lenNode ) {
119- return lenNode .execute (inliningTarget , object .getDictStorage ());
107+ @ Specialization
108+ static int doPHashingCollection (Node inliningTarget , PHashingCollection object ,
109+ @ Exclusive @ Cached PRaiseNode .Lazy raise ) {
110+ throw raise .get (inliningTarget ).raise (TypeError , ErrorMessages .IS_NOT_A_SEQUENCE , object );
120111 }
121112
122113 @ Specialization (guards = "cannotBeOverridden(object, inliningTarget, getClassNode)" )
@@ -137,8 +128,7 @@ static int doPBytes(Node inliningTarget, PBytesLike object,
137128 static int doOthers (Frame frame , Node inliningTarget , Object object ,
138129 @ Cached GetObjectSlotsNode getTpSlotsNode ,
139130 @ Cached TpSlotLen .CallSlotLenNode callSlotLenNode ,
140- @ Cached InlinedBranchProfile hasNoSqLenBranch ,
141- @ Cached PRaiseNode .Lazy raiseNode ) {
131+ @ Exclusive @ Cached PRaiseNode .Lazy raiseNode ) {
142132 TpSlots slots = getTpSlotsNode .execute (inliningTarget , object );
143133 if (slots .sq_length () != null ) {
144134 return callSlotLenNode .execute ((VirtualFrame ) frame , inliningTarget , slots .sq_length (), object );
0 commit comments