Skip to content

Commit 8fd88f1

Browse files
committed
Fix missing specialization for limit overflow
1 parent 1074288 commit 8fd88f1

File tree

1 file changed

+10
-14
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/set

1 file changed

+10
-14
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/set/SetBuiltins.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
import com.oracle.graal.python.builtins.objects.common.HashingStorage;
4747
import com.oracle.graal.python.builtins.objects.common.HashingStorageLibrary;
4848
import com.oracle.graal.python.builtins.objects.common.PHashingCollection;
49+
import com.oracle.graal.python.builtins.objects.common.SequenceNodes;
50+
import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodes;
4951
import com.oracle.graal.python.builtins.objects.dict.PDictView;
5052
import com.oracle.graal.python.builtins.objects.object.PythonObjectLibrary;
5153
import com.oracle.graal.python.builtins.objects.str.PString;
@@ -65,7 +67,6 @@
6567
import com.oracle.graal.python.runtime.exception.PythonErrorType;
6668
import com.oracle.graal.python.runtime.sequence.PSequence;
6769
import com.oracle.graal.python.runtime.sequence.storage.SequenceStorage;
68-
import com.oracle.truffle.api.dsl.Bind;
6970
import com.oracle.truffle.api.dsl.Cached;
7071
import com.oracle.truffle.api.dsl.Fallback;
7172
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
@@ -226,24 +227,19 @@ static boolean isBuiltinSequence(Object other, GetClassNode getClassNode) {
226227
return other instanceof PSequence && !(other instanceof PString) && getClassNode.execute((PSequence) other) instanceof PythonBuiltinClassType;
227228
}
228229

229-
static SequenceStorage getSequenceStorage(PSequence sequence, Class<? extends PSequence> clazz) {
230-
return clazz.cast(sequence).getSequenceStorage();
231-
}
232-
233-
@Specialization(guards = {"isBuiltinSequence(other, getClassNode)", "other.getClass() == sequenceClass",
234-
"sequenceStorage.getClass() == storageClass"}, limit = "getCallSiteInlineCacheMaxDepth()")
235-
static HashingStorage doIterable(VirtualFrame frame, HashingStorage storage, @SuppressWarnings("unused") PSequence other,
230+
@Specialization(guards = "isBuiltinSequence(other, getClassNode)", limit = "1")
231+
static HashingStorage doBuiltin(VirtualFrame frame, HashingStorage storage, @SuppressWarnings("unused") PSequence other,
236232
@SuppressWarnings("unused") @Cached GetClassNode getClassNode,
237-
@SuppressWarnings("unused") @Cached("other.getClass()") Class<? extends PSequence> sequenceClass,
238-
@Bind("getSequenceStorage(other, sequenceClass)") SequenceStorage sequenceStorage,
239-
@SuppressWarnings("unused") @Cached("sequenceStorage.getClass()") Class<? extends SequenceStorage> storageClass,
233+
@Cached SequenceNodes.GetSequenceStorageNode getSequenceStorageNode,
234+
@Cached SequenceStorageNodes.LenNode lenNode,
235+
@Cached SequenceStorageNodes.GetItemScalarNode getItemScalarNode,
240236
@Cached ConditionProfile hasFrame,
241237
@CachedLibrary(limit = "2") HashingStorageLibrary lib) {
242-
SequenceStorage profiledSequenceStorage = storageClass.cast(sequenceStorage);
243-
int length = profiledSequenceStorage.length();
238+
SequenceStorage sequenceStorage = getSequenceStorageNode.execute(other);
239+
int length = lenNode.execute(sequenceStorage);
244240
HashingStorage curStorage = storage;
245241
for (int i = 0; i < length; i++) {
246-
Object key = profiledSequenceStorage.getItemNormalized(i);
242+
Object key = getItemScalarNode.execute(sequenceStorage, i);
247243
curStorage = lib.setItemWithFrame(curStorage, key, PNone.NONE, hasFrame, frame);
248244
}
249245
return curStorage;

0 commit comments

Comments
 (0)