Skip to content

Commit 874853c

Browse files
committed
Revert "Remove getElementTypeNode"
This reverts commit 34d2416. fix
1 parent fe790de commit 874853c

17 files changed

+204
-97
lines changed

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

Lines changed: 134 additions & 42 deletions
Large diffs are not rendered by default.

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727

2828
public abstract class BasicSequenceStorage extends SequenceStorage {
2929

30-
public BasicSequenceStorage(ListStorageType type) {
31-
super(type);
32-
}
33-
3430
// nominated storage length
3531
protected int length;
3632

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public final class BoolSequenceStorage extends TypedSequenceStorage {
3232
private boolean[] values;
3333

3434
public BoolSequenceStorage() {
35-
super(ListStorageType.Boolean);
3635
values = new boolean[]{};
3736
}
3837

@@ -41,14 +40,12 @@ public BoolSequenceStorage(boolean[] elements) {
4140
}
4241

4342
public BoolSequenceStorage(boolean[] elements, int length) {
44-
super(ListStorageType.Boolean);
4543
this.values = elements;
4644
this.capacity = values.length;
4745
this.length = length;
4846
}
4947

5048
public BoolSequenceStorage(int capacity) {
51-
super(ListStorageType.Boolean);
5249
this.values = new boolean[capacity];
5350
this.capacity = capacity;
5451
this.length = 0;
@@ -262,4 +259,9 @@ public Object getCopyOfInternalArrayObject() {
262259
public void setInternalArrayObject(Object arrayObject) {
263260
this.values = (boolean[]) arrayObject;
264261
}
262+
263+
@Override
264+
public ListStorageType getElementType() {
265+
return ListStorageType.Boolean;
266+
}
265267
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ public ByteSequenceStorage(byte[] elements) {
4444
}
4545

4646
public ByteSequenceStorage(byte[] elements, int length) {
47-
super(ListStorageType.Byte);
4847
this.values = elements;
4948
this.capacity = values.length;
5049
this.length = length;
5150
}
5251

5352
public ByteSequenceStorage(int capacity) {
54-
super(ListStorageType.Byte);
5553
this.values = new byte[capacity];
5654
this.capacity = capacity;
5755
this.length = 0;
@@ -368,4 +366,9 @@ public Object getCopyOfInternalArrayObject() {
368366
public void setInternalArrayObject(Object arrayObject) {
369367
this.values = (byte[]) arrayObject;
370368
}
369+
370+
@Override
371+
public ListStorageType getElementType() {
372+
return ListStorageType.Byte;
373+
}
371374
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ public final class CharSequenceStorage extends TypedSequenceStorage {
4747
private char[] values;
4848

4949
public CharSequenceStorage(char[] elements) {
50-
super(ListStorageType.Char);
5150
this.values = elements;
5251
this.capacity = values.length;
5352
this.length = elements.length;
5453
}
5554

5655
public CharSequenceStorage(int capacity) {
57-
super(ListStorageType.Char);
5856
this.values = new char[capacity];
5957
this.capacity = capacity;
6058
this.length = 0;
@@ -157,6 +155,11 @@ public void setInternalArrayObject(Object arrayObject) {
157155
this.values = (char[]) arrayObject;
158156
}
159157

158+
@Override
159+
public ListStorageType getElementType() {
160+
return ListStorageType.Char;
161+
}
162+
160163
public void setCharItemNormalized(int idx, char value) {
161164
values[idx] = value;
162165
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,22 @@ public final class DoubleSequenceStorage extends TypedSequenceStorage {
3434
private double[] values;
3535

3636
public DoubleSequenceStorage() {
37-
super(ListStorageType.Double);
3837
values = new double[]{};
3938
}
4039

4140
public DoubleSequenceStorage(double[] elements) {
42-
super(ListStorageType.Double);
4341
this.values = elements;
4442
this.capacity = elements.length;
4543
this.length = elements.length;
4644
}
4745

4846
public DoubleSequenceStorage(double[] elements, int length) {
49-
super(ListStorageType.Double);
5047
this.values = elements;
5148
this.capacity = elements.length;
5249
this.length = length;
5350
}
5451

5552
public DoubleSequenceStorage(int capacity) {
56-
super(ListStorageType.Double);
5753
this.values = new double[capacity];
5854
this.capacity = capacity;
5955
this.length = 0;
@@ -267,4 +263,9 @@ public Object getCopyOfInternalArrayObject() {
267263
public void setInternalArrayObject(Object arrayObject) {
268264
this.values = (double[]) arrayObject;
269265
}
266+
267+
@Override
268+
public ListStorageType getElementType() {
269+
return ListStorageType.Double;
270+
}
270271
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535

3636
public final class EmptySequenceStorage extends SequenceStorage {
3737

38-
public EmptySequenceStorage() {
39-
super(ListStorageType.Empty);
40-
}
41-
4238
public static final EmptySequenceStorage INSTANCE = new EmptySequenceStorage();
4339

4440
@Override
@@ -156,4 +152,9 @@ public void ensureCapacity(int newCapacity) {
156152
public Object getInternalArrayObject() {
157153
return null;
158154
}
155+
156+
@Override
157+
public ListStorageType getElementType() {
158+
return ListStorageType.Empty;
159+
}
159160
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,22 @@ public final class IntSequenceStorage extends TypedSequenceStorage {
3434
private int[] values;
3535

3636
public IntSequenceStorage() {
37-
super(ListStorageType.Int);
3837
values = new int[]{};
3938
}
4039

4140
public IntSequenceStorage(int[] elements) {
42-
super(ListStorageType.Int);
4341
this.values = elements;
4442
this.capacity = values.length;
4543
this.length = elements.length;
4644
}
4745

4846
public IntSequenceStorage(int[] elements, int length) {
49-
super(ListStorageType.Int);
5047
this.values = elements;
5148
this.capacity = values.length;
5249
this.length = length;
5350
}
5451

5552
public IntSequenceStorage(int capacity) {
56-
super(ListStorageType.Int);
5753
this.values = new int[capacity];
5854
this.capacity = capacity;
5955
this.length = 0;
@@ -267,4 +263,9 @@ public Object getCopyOfInternalArrayObject() {
267263
public void setInternalArrayObject(Object arrayObject) {
268264
this.values = (int[]) arrayObject;
269265
}
266+
267+
@Override
268+
public ListStorageType getElementType() {
269+
return ListStorageType.Int;
270+
}
270271
}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,18 @@ public final class ListSequenceStorage extends TypedSequenceStorage {
3434
private PList[] values;
3535

3636
public ListSequenceStorage(PList[] elements) {
37-
super(ListStorageType.List);
3837
this.values = elements;
3938
capacity = values.length;
4039
length = elements.length;
4140
}
4241

4342
public ListSequenceStorage(PList[] elements, int length) {
44-
super(ListStorageType.List);
4543
this.values = elements;
4644
capacity = values.length;
4745
this.length = length;
4846
}
4947

5048
public ListSequenceStorage(int capacity) {
51-
super(ListStorageType.List);
5249
this.values = new PList[capacity];
5350
this.capacity = capacity;
5451
length = 0;
@@ -267,4 +264,9 @@ public Object getCopyOfInternalArrayObject() {
267264
public void setInternalArrayObject(Object arrayObject) {
268265
this.values = (PList[]) arrayObject;
269266
}
267+
268+
@Override
269+
public ListStorageType getElementType() {
270+
return ListStorageType.List;
271+
}
270272
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,22 @@ public final class LongSequenceStorage extends TypedSequenceStorage {
3535
private long[] values;
3636

3737
public LongSequenceStorage() {
38-
super(ListStorageType.Long);
3938
values = new long[]{};
4039
}
4140

4241
public LongSequenceStorage(long[] elements) {
43-
super(ListStorageType.Long);
4442
this.values = elements;
4543
this.capacity = values.length;
4644
this.length = elements.length;
4745
}
4846

4947
public LongSequenceStorage(long[] elements, int length) {
50-
super(ListStorageType.Long);
5148
this.values = elements;
5249
this.capacity = values.length;
5350
this.length = length;
5451
}
5552

5653
public LongSequenceStorage(int capacity) {
57-
super(ListStorageType.Long);
5854
this.values = new long[capacity];
5955
this.capacity = capacity;
6056
this.length = 0;
@@ -272,4 +268,9 @@ public Object getCopyOfInternalArrayObject() {
272268
public void setInternalArrayObject(Object arrayObject) {
273269
this.values = (long[]) arrayObject;
274270
}
271+
272+
@Override
273+
public ListStorageType getElementType() {
274+
return ListStorageType.Long;
275+
}
275276
}

0 commit comments

Comments
 (0)