Skip to content

Commit 7ff89fe

Browse files
committed
[GR-21590] Update imports
PullRequest: graalpython/3289
2 parents e0f2f07 + d691fdd commit 7ff89fe

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "e48c2d0867e9f758f6208d75c29e1ca013af7c4f" }
1+
{ "overlay": "758ce7b10944b137cfe11244fda3ba9f35c4b4c0" }

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinConstructors.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,6 @@ static Object reversed(VirtualFrame frame, Object cls, Object sequence,
10151015
@Cached("create(Reversed)") LookupSpecialMethodSlotNode lookupReversed,
10161016
@Cached CallUnaryMethodNode callReversed,
10171017
@Cached PySequenceSizeNode pySequenceSizeNode,
1018-
@Cached("create(GetItem)") LookupSpecialMethodSlotNode getItemNode,
10191018
@Cached InlinedConditionProfile noReversedProfile,
10201019
@Cached PySequenceCheckNode pySequenceCheck,
10211020
@Shared @Cached PythonObjectFactory factory,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/PythonAbstractObject.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public boolean hasArrayElements(
279279
// GR-44020: make shared:
280280
@Exclusive @Cached PRaiseNode.Lazy raiseNode,
281281
@Cached GetObjectSlotsNode getSlotsNode,
282-
@Cached PySequenceCheckNode sequenceCheck,
282+
@Exclusive @Cached PySequenceCheckNode sequenceCheck,
283283
@Exclusive @Cached GilNode gil) {
284284
boolean mustRelease = gil.acquire();
285285
try {
@@ -386,6 +386,7 @@ public long getArraySize(
386386
@Shared("getBehavior") @Cached GetInteropBehaviorNode getBehavior,
387387
@Shared("getValue") @Cached GetInteropBehaviorValueNode getValue,
388388
@Exclusive @Cached PySequenceSizeNode sequenceSizeNode,
389+
@Exclusive @Cached PySequenceCheckNode sequenceCheck,
389390
// GR-44020: make shared:
390391
@Exclusive @Cached CastToJavaLongExactNode toLongNode,
391392
// GR-44020: make shared:
@@ -398,6 +399,9 @@ public long getArraySize(
398399
if (behavior != null) {
399400
return getValue.executeLong(inliningTarget, behavior, method, toLongNode, raiseNode, this);
400401
} else {
402+
if (!sequenceCheck.execute(inliningTarget, this)) {
403+
throw UnsupportedMessageException.create();
404+
}
401405
try {
402406
return sequenceSizeNode.execute(null, inliningTarget, this);
403407
} catch (PException pe) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PySequenceSizeNode.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
import static com.oracle.graal.python.util.PythonUtils.TS_ENCODING;
4545

4646
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.HashingStorageNodes;
48+
import com.oracle.graal.python.builtins.objects.common.PHashingCollection;
4949
import com.oracle.graal.python.builtins.objects.list.PList;
50-
import com.oracle.graal.python.builtins.objects.set.PSet;
50+
import com.oracle.graal.python.builtins.objects.set.PBaseSet;
5151
import com.oracle.graal.python.builtins.objects.str.PString;
5252
import com.oracle.graal.python.builtins.objects.str.StringNodes;
5353
import com.oracle.graal.python.builtins.objects.tuple.PTuple;
@@ -62,6 +62,7 @@
6262
import com.oracle.graal.python.runtime.exception.PException;
6363
import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
6464
import com.oracle.truffle.api.dsl.Cached;
65+
import com.oracle.truffle.api.dsl.Cached.Exclusive;
6566
import com.oracle.truffle.api.dsl.Cached.Shared;
6667
import com.oracle.truffle.api.dsl.Fallback;
6768
import com.oracle.truffle.api.dsl.GenerateCached;
@@ -72,7 +73,6 @@
7273
import com.oracle.truffle.api.frame.Frame;
7374
import com.oracle.truffle.api.frame.VirtualFrame;
7475
import com.oracle.truffle.api.nodes.Node;
75-
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
7676
import com.oracle.truffle.api.strings.TruffleString;
7777

7878
/**
@@ -106,16 +106,16 @@ static int doTuple(PTuple object) {
106106
return object.getSequenceStorage().length();
107107
}
108108

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());
109+
@Specialization(guards = "!isAnySet(object)")
110+
static int doPHashingCollection(Node inliningTarget, PHashingCollection object,
111+
@Exclusive @Cached PRaiseNode.Lazy raise) {
112+
throw raise.get(inliningTarget).raise(TypeError, ErrorMessages.IS_NOT_A_SEQUENCE, object);
113113
}
114114

115115
@Specialization(guards = "cannotBeOverridden(object, inliningTarget, getClassNode)")
116-
static int doSet(Node inliningTarget, PSet object,
116+
static int doSet(Node inliningTarget, PBaseSet object,
117117
@Shared("getClass") @SuppressWarnings("unused") @Cached GetPythonObjectClassNode getClassNode,
118-
@Shared("hashingStorageLen") @Cached HashingStorageLen lenNode) {
118+
@Cached HashingStorageNodes.HashingStorageLen lenNode) {
119119
return lenNode.execute(inliningTarget, object.getDictStorage());
120120
}
121121

@@ -137,8 +137,7 @@ static int doPBytes(Node inliningTarget, PBytesLike object,
137137
static int doOthers(Frame frame, Node inliningTarget, Object object,
138138
@Cached GetObjectSlotsNode getTpSlotsNode,
139139
@Cached TpSlotLen.CallSlotLenNode callSlotLenNode,
140-
@Cached InlinedBranchProfile hasNoSqLenBranch,
141-
@Cached PRaiseNode.Lazy raiseNode) {
140+
@Exclusive @Cached PRaiseNode.Lazy raiseNode) {
142141
TpSlots slots = getTpSlotsNode.execute(inliningTarget, object);
143142
if (slots.sq_length() != null) {
144143
return callSlotLenNode.execute((VirtualFrame) frame, inliningTarget, slots.sq_length(), object);

mx.graalpython/suite.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,31 @@
4545
},
4646
{
4747
"name": "sdk",
48-
"version": "d1196beb6bc6e7d68c971d471d372506e4109c4e",
48+
"version": "b9126869e93338dde41dd3aa102131aa347bb803",
4949
"subdir": True,
5050
"urls": [
5151
{"url": "https://github.com/oracle/graal", "kind": "git"},
5252
]
5353
},
5454
{
5555
"name": "tools",
56-
"version": "d1196beb6bc6e7d68c971d471d372506e4109c4e",
56+
"version": "b9126869e93338dde41dd3aa102131aa347bb803",
5757
"subdir": True,
5858
"urls": [
5959
{"url": "https://github.com/oracle/graal", "kind": "git"},
6060
],
6161
},
6262
{
6363
"name": "sulong",
64-
"version": "d1196beb6bc6e7d68c971d471d372506e4109c4e",
64+
"version": "b9126869e93338dde41dd3aa102131aa347bb803",
6565
"subdir": True,
6666
"urls": [
6767
{"url": "https://github.com/oracle/graal", "kind": "git"},
6868
]
6969
},
7070
{
7171
"name": "regex",
72-
"version": "d1196beb6bc6e7d68c971d471d372506e4109c4e",
72+
"version": "b9126869e93338dde41dd3aa102131aa347bb803",
7373
"subdir": True,
7474
"urls": [
7575
{"url": "https://github.com/oracle/graal", "kind": "git"},

0 commit comments

Comments
 (0)