44
44
import static com .oracle .graal .python .util .PythonUtils .TS_ENCODING ;
45
45
46
46
import 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 ;
49
48
import com .oracle .graal .python .builtins .objects .list .PList ;
50
- import com .oracle .graal .python .builtins .objects .set .PSet ;
51
49
import com .oracle .graal .python .builtins .objects .str .PString ;
52
50
import com .oracle .graal .python .builtins .objects .str .StringNodes ;
53
51
import com .oracle .graal .python .builtins .objects .tuple .PTuple ;
62
60
import com .oracle .graal .python .runtime .exception .PException ;
63
61
import com .oracle .truffle .api .HostCompilerDirectives .InliningCutoff ;
64
62
import com .oracle .truffle .api .dsl .Cached ;
63
+ import com .oracle .truffle .api .dsl .Cached .Exclusive ;
65
64
import com .oracle .truffle .api .dsl .Cached .Shared ;
66
65
import com .oracle .truffle .api .dsl .Fallback ;
67
66
import com .oracle .truffle .api .dsl .GenerateCached ;
72
71
import com .oracle .truffle .api .frame .Frame ;
73
72
import com .oracle .truffle .api .frame .VirtualFrame ;
74
73
import com .oracle .truffle .api .nodes .Node ;
75
- import com .oracle .truffle .api .profiles .InlinedBranchProfile ;
76
74
import com .oracle .truffle .api .strings .TruffleString ;
77
75
78
76
/**
@@ -106,17 +104,10 @@ static int doTuple(PTuple object) {
106
104
return object .getSequenceStorage ().length ();
107
105
}
108
106
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 );
120
111
}
121
112
122
113
@ Specialization (guards = "cannotBeOverridden(object, inliningTarget, getClassNode)" )
@@ -137,8 +128,7 @@ static int doPBytes(Node inliningTarget, PBytesLike object,
137
128
static int doOthers (Frame frame , Node inliningTarget , Object object ,
138
129
@ Cached GetObjectSlotsNode getTpSlotsNode ,
139
130
@ Cached TpSlotLen .CallSlotLenNode callSlotLenNode ,
140
- @ Cached InlinedBranchProfile hasNoSqLenBranch ,
141
- @ Cached PRaiseNode .Lazy raiseNode ) {
131
+ @ Exclusive @ Cached PRaiseNode .Lazy raiseNode ) {
142
132
TpSlots slots = getTpSlotsNode .execute (inliningTarget , object );
143
133
if (slots .sq_length () != null ) {
144
134
return callSlotLenNode .execute ((VirtualFrame ) frame , inliningTarget , slots .sq_length (), object );
0 commit comments