Skip to content

Commit ac76844

Browse files
committed
Do not use 'NormalizeIndexNode'.
1 parent c0e6522 commit ac76844

File tree

1 file changed

+4
-7
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/iterator

1 file changed

+4
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/iterator/IteratorBuiltins.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
4646
import com.oracle.graal.python.runtime.exception.PException;
4747
import com.oracle.graal.python.runtime.sequence.PSequence;
48-
import com.oracle.graal.python.runtime.sequence.SequenceUtil.NormalizeIndexNode;
4948
import com.oracle.graal.python.runtime.sequence.storage.SequenceStorage;
5049
import com.oracle.truffle.api.dsl.Cached;
5150
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
@@ -140,15 +139,13 @@ public Object next(PBaseSetIterator self) {
140139

141140
@Specialization(guards = "self.isPList()")
142141
public Object nextList(PSequenceIterator self,
143-
@Cached("createClassProfile()") ValueProfile storageProfile,
144-
@Cached("create()") NormalizeIndexNode normalize) {
142+
@Cached("createClassProfile()") ValueProfile storageProfile) {
145143
SequenceStorage storage = storageProfile.profile(((PList) self.getPSequence()).getSequenceStorage());
146144
int length = storage.length();
147-
if (!self.stopIterationReached && self.index < length) {
148-
int index = normalize.execute(self.index++, length, "list index out of range");
149-
return storage.getItemNormalized(index);
145+
if (!self.isExhausted() && self.index < length) {
146+
return storage.getItemNormalized(self.index++);
150147
}
151-
self.stopIterationReached = true;
148+
self.setExhausted();
152149
throw raise(StopIteration);
153150
}
154151

0 commit comments

Comments
 (0)