Skip to content

Commit 34d2416

Browse files
committed
Remove getElementTypeNode
1 parent 53ce5bc commit 34d2416

17 files changed

+113
-220
lines changed

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

Lines changed: 42 additions & 134 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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
33
* Copyright (c) 2013, Regents of the University of California
44
*
55
* All rights reserved.
@@ -27,6 +27,10 @@
2727

2828
public abstract class BasicSequenceStorage extends SequenceStorage {
2929

30+
public BasicSequenceStorage(ListStorageType type) {
31+
super(type);
32+
}
33+
3034
// nominated storage length
3135
protected int length;
3236

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
33
* Copyright (c) 2013, Regents of the University of California
44
*
55
* All rights reserved.
@@ -32,6 +32,7 @@ public final class BoolSequenceStorage extends TypedSequenceStorage {
3232
private boolean[] values;
3333

3434
public BoolSequenceStorage() {
35+
super(ListStorageType.Boolean);
3536
values = new boolean[]{};
3637
}
3738

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

4243
public BoolSequenceStorage(boolean[] elements, int length) {
44+
super(ListStorageType.Boolean);
4345
this.values = elements;
4446
this.capacity = values.length;
4547
this.length = length;
4648
}
4749

4850
public BoolSequenceStorage(int capacity) {
51+
super(ListStorageType.Boolean);
4952
this.values = new boolean[capacity];
5053
this.capacity = capacity;
5154
this.length = 0;
@@ -259,9 +262,4 @@ public Object getCopyOfInternalArrayObject() {
259262
public void setInternalArrayObject(Object arrayObject) {
260263
this.values = (boolean[]) arrayObject;
261264
}
262-
263-
@Override
264-
public ListStorageType getElementType() {
265-
return ListStorageType.Boolean;
266-
}
267265
}

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
33
* Copyright (c) 2013, Regents of the University of California
44
*
55
* All rights reserved.
@@ -44,12 +44,14 @@ public ByteSequenceStorage(byte[] elements) {
4444
}
4545

4646
public ByteSequenceStorage(byte[] elements, int length) {
47+
super(ListStorageType.Byte);
4748
this.values = elements;
4849
this.capacity = values.length;
4950
this.length = length;
5051
}
5152

5253
public ByteSequenceStorage(int capacity) {
54+
super(ListStorageType.Byte);
5355
this.values = new byte[capacity];
5456
this.capacity = capacity;
5557
this.length = 0;
@@ -366,9 +368,4 @@ public Object getCopyOfInternalArrayObject() {
366368
public void setInternalArrayObject(Object arrayObject) {
367369
this.values = (byte[]) arrayObject;
368370
}
369-
370-
@Override
371-
public ListStorageType getElementType() {
372-
return ListStorageType.Byte;
373-
}
374371
}

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -47,12 +47,14 @@ public final class CharSequenceStorage extends TypedSequenceStorage {
4747
private char[] values;
4848

4949
public CharSequenceStorage(char[] elements) {
50+
super(ListStorageType.Char);
5051
this.values = elements;
5152
this.capacity = values.length;
5253
this.length = elements.length;
5354
}
5455

5556
public CharSequenceStorage(int capacity) {
57+
super(ListStorageType.Char);
5658
this.values = new char[capacity];
5759
this.capacity = capacity;
5860
this.length = 0;
@@ -155,11 +157,6 @@ public void setInternalArrayObject(Object arrayObject) {
155157
this.values = (char[]) arrayObject;
156158
}
157159

158-
@Override
159-
public ListStorageType getElementType() {
160-
return ListStorageType.Char;
161-
}
162-
163160
public void setCharItemNormalized(int idx, char value) {
164161
values[idx] = value;
165162
}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
33
* Copyright (c) 2013, Regents of the University of California
44
*
55
* All rights reserved.
@@ -34,22 +34,26 @@ public final class DoubleSequenceStorage extends TypedSequenceStorage {
3434
private double[] values;
3535

3636
public DoubleSequenceStorage() {
37+
super(ListStorageType.Double);
3738
values = new double[]{};
3839
}
3940

4041
public DoubleSequenceStorage(double[] elements) {
42+
super(ListStorageType.Double);
4143
this.values = elements;
4244
this.capacity = elements.length;
4345
this.length = elements.length;
4446
}
4547

4648
public DoubleSequenceStorage(double[] elements, int length) {
49+
super(ListStorageType.Double);
4750
this.values = elements;
4851
this.capacity = elements.length;
4952
this.length = length;
5053
}
5154

5255
public DoubleSequenceStorage(int capacity) {
56+
super(ListStorageType.Double);
5357
this.values = new double[capacity];
5458
this.capacity = capacity;
5559
this.length = 0;
@@ -263,9 +267,4 @@ public Object getCopyOfInternalArrayObject() {
263267
public void setInternalArrayObject(Object arrayObject) {
264268
this.values = (double[]) arrayObject;
265269
}
266-
267-
@Override
268-
public ListStorageType getElementType() {
269-
return ListStorageType.Double;
270-
}
271270
}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
33
* Copyright (c) 2013, Regents of the University of California
44
*
55
* All rights reserved.
@@ -35,6 +35,10 @@
3535

3636
public final class EmptySequenceStorage extends SequenceStorage {
3737

38+
public EmptySequenceStorage() {
39+
super(ListStorageType.Empty);
40+
}
41+
3842
public static final EmptySequenceStorage INSTANCE = new EmptySequenceStorage();
3943

4044
@Override
@@ -152,9 +156,4 @@ public void ensureCapacity(int newCapacity) {
152156
public Object getInternalArrayObject() {
153157
return null;
154158
}
155-
156-
@Override
157-
public ListStorageType getElementType() {
158-
return ListStorageType.Empty;
159-
}
160159
}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
33
* Copyright (c) 2013, Regents of the University of California
44
*
55
* All rights reserved.
@@ -34,22 +34,26 @@ public final class IntSequenceStorage extends TypedSequenceStorage {
3434
private int[] values;
3535

3636
public IntSequenceStorage() {
37+
super(ListStorageType.Int);
3738
values = new int[]{};
3839
}
3940

4041
public IntSequenceStorage(int[] elements) {
42+
super(ListStorageType.Int);
4143
this.values = elements;
4244
this.capacity = values.length;
4345
this.length = elements.length;
4446
}
4547

4648
public IntSequenceStorage(int[] elements, int length) {
49+
super(ListStorageType.Int);
4750
this.values = elements;
4851
this.capacity = values.length;
4952
this.length = length;
5053
}
5154

5255
public IntSequenceStorage(int capacity) {
56+
super(ListStorageType.Int);
5357
this.values = new int[capacity];
5458
this.capacity = capacity;
5559
this.length = 0;
@@ -263,9 +267,4 @@ public Object getCopyOfInternalArrayObject() {
263267
public void setInternalArrayObject(Object arrayObject) {
264268
this.values = (int[]) arrayObject;
265269
}
266-
267-
@Override
268-
public ListStorageType getElementType() {
269-
return ListStorageType.Int;
270-
}
271270
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
33
* Copyright (c) 2013, Regents of the University of California
44
*
55
* All rights reserved.
@@ -34,18 +34,21 @@ public final class ListSequenceStorage extends TypedSequenceStorage {
3434
private PList[] values;
3535

3636
public ListSequenceStorage(PList[] elements) {
37+
super(ListStorageType.List);
3738
this.values = elements;
3839
capacity = values.length;
3940
length = elements.length;
4041
}
4142

4243
public ListSequenceStorage(PList[] elements, int length) {
44+
super(ListStorageType.List);
4345
this.values = elements;
4446
capacity = values.length;
4547
this.length = length;
4648
}
4749

4850
public ListSequenceStorage(int capacity) {
51+
super(ListStorageType.List);
4952
this.values = new PList[capacity];
5053
this.capacity = capacity;
5154
length = 0;
@@ -264,9 +267,4 @@ public Object getCopyOfInternalArrayObject() {
264267
public void setInternalArrayObject(Object arrayObject) {
265268
this.values = (PList[]) arrayObject;
266269
}
267-
268-
@Override
269-
public ListStorageType getElementType() {
270-
return ListStorageType.List;
271-
}
272270
}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
33
* Copyright (c) 2013, Regents of the University of California
44
*
55
* All rights reserved.
@@ -35,22 +35,26 @@ public final class LongSequenceStorage extends TypedSequenceStorage {
3535
private long[] values;
3636

3737
public LongSequenceStorage() {
38+
super(ListStorageType.Long);
3839
values = new long[]{};
3940
}
4041

4142
public LongSequenceStorage(long[] elements) {
43+
super(ListStorageType.Long);
4244
this.values = elements;
4345
this.capacity = values.length;
4446
this.length = elements.length;
4547
}
4648

4749
public LongSequenceStorage(long[] elements, int length) {
50+
super(ListStorageType.Long);
4851
this.values = elements;
4952
this.capacity = values.length;
5053
this.length = length;
5154
}
5255

5356
public LongSequenceStorage(int capacity) {
57+
super(ListStorageType.Long);
5458
this.values = new long[capacity];
5559
this.capacity = capacity;
5660
this.length = 0;
@@ -268,9 +272,4 @@ public Object getCopyOfInternalArrayObject() {
268272
public void setInternalArrayObject(Object arrayObject) {
269273
this.values = (long[]) arrayObject;
270274
}
271-
272-
@Override
273-
public ListStorageType getElementType() {
274-
return ListStorageType.Long;
275-
}
276275
}

0 commit comments

Comments
 (0)