Skip to content

Commit 5809dbe

Browse files
committed
Push SequenceStorage.setItemNormalized down
1 parent 8442c6f commit 5809dbe

File tree

5 files changed

+5
-27
lines changed

5 files changed

+5
-27
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/SequenceStorageNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3348,7 +3348,7 @@ protected static SequenceStorage doStorage(EmptySequenceStorage storage, int ind
33483348
@Specialization(limit = "MAX_ARRAY_STORAGES", guards = {"storage.getClass() == cachedClass"})
33493349
protected static SequenceStorage doStorage(BasicSequenceStorage storage, int index, Object value, boolean recursive,
33503350
@Shared @Cached(inline = false) InsertItemNode recursiveNode,
3351-
@Cached("storage.getClass()") Class<? extends SequenceStorage> cachedClass) {
3351+
@Cached("storage.getClass()") Class<? extends BasicSequenceStorage> cachedClass) {
33523352
try {
33533353
cachedClass.cast(storage).insertItem(index, value);
33543354
return storage;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/sequence/storage/BasicSequenceStorage.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ public abstract class BasicSequenceStorage extends SequenceStorage {
3232

3333
public abstract Object getItemNormalized(int idx);
3434

35+
public abstract void setItemNormalized(int idx, Object value) throws SequenceStoreException;
36+
37+
public abstract void insertItem(int idx, Object value) throws SequenceStoreException;
38+
3539
public abstract Object getCopyOfInternalArrayObject();
3640

3741
public abstract void setInternalArrayObject(Object arrayObject);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/sequence/storage/EmptySequenceStorage.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,6 @@ public Object[] getCopyOfInternalArray() {
9292
return PythonUtils.EMPTY_OBJECT_ARRAY;
9393
}
9494

95-
@Override
96-
public void setItemNormalized(int idx, Object value) throws SequenceStoreException {
97-
CompilerDirectives.transferToInterpreter();
98-
throw PRaiseNode.getUncached().raise(ValueError, ErrorMessages.LIST_ASSIGMENT_INDEX_OUT_OF_RANGE);
99-
}
100-
101-
@Override
102-
public void insertItem(int idx, Object value) throws SequenceStoreException {
103-
assert idx == 0;
104-
throw new SequenceStoreException(value);
105-
}
106-
10795
@Override
10896
public void copyItem(int idxTo, int idxFrom) {
10997
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/sequence/storage/NativeSequenceStorage.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,6 @@ public final Object[] getCopyOfInternalArray() {
123123
throw CompilerDirectives.shouldNotReachHere();
124124
}
125125

126-
@Override
127-
public final void setItemNormalized(int idx, Object value) throws SequenceStoreException {
128-
throw CompilerDirectives.shouldNotReachHere();
129-
}
130-
131-
@Override
132-
public final void insertItem(int idx, Object value) throws SequenceStoreException {
133-
throw CompilerDirectives.shouldNotReachHere();
134-
}
135-
136126
@Override
137127
public final SequenceStorage getSliceInBound(int start, int stop, int step, int len) {
138128
throw CompilerDirectives.shouldNotReachHere();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/sequence/storage/SequenceStorage.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ public final int getCapacity() {
9191

9292
public abstract Object[] getCopyOfInternalArray();
9393

94-
public abstract void setItemNormalized(int idx, Object value) throws SequenceStoreException;
95-
96-
public abstract void insertItem(int idx, Object value) throws SequenceStoreException;
97-
9894
public abstract SequenceStorage getSliceInBound(int start, int stop, int step, int len);
9995

10096
public abstract void reverse();

0 commit comments

Comments
 (0)