changeset 22143:af393429ae26

removed 7 Shape methods from the API
author Andreas Woess <andreas.woess@oracle.com>
date Sat, 12 Sep 2015 22:03:23 +0200
parents cf604b9633c9
children 657d37ff352e
files truffle/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/Shape.java truffle/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/DefaultStrategy.java truffle/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/DynamicObjectBasic.java truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/debug/ShapeProfiler.java
diffstat 5 files changed, 21 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/Shape.java	Mon Sep 14 11:14:58 2015 +0200
+++ b/truffle/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/Shape.java	Sat Sep 12 22:03:23 2015 +0200
@@ -225,20 +225,6 @@
      */
     public abstract Object getMutex();
 
-    public abstract int getObjectArraySize();
-
-    public abstract int getObjectFieldSize();
-
-    public abstract int getPrimitiveArraySize();
-
-    public abstract int getPrimitiveFieldSize();
-
-    public abstract int getObjectArrayCapacity();
-
-    public abstract int getPrimitiveArrayCapacity();
-
-    public abstract boolean hasPrimitiveArray();
-
     /**
      * Are these two shapes related, i.e. do they have the same root?
      *
--- a/truffle/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/DefaultStrategy.java	Mon Sep 14 11:14:58 2015 +0200
+++ b/truffle/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/DefaultStrategy.java	Sat Sep 12 22:03:23 2015 +0200
@@ -41,8 +41,8 @@
 
     private static boolean assertLocationInRange(Shape shape, Location location) {
         BasicLayout layout = (BasicLayout) shape.getLayout();
-        assert (shape.getPrimitiveFieldSize() + ((LocationImpl) location).primitiveFieldCount() <= layout.getPrimitiveFieldCount());
-        assert (shape.getObjectFieldSize() + ((LocationImpl) location).objectFieldCount() <= layout.getObjectFieldCount());
+        assert (((ShapeImpl) shape).getPrimitiveFieldSize() + ((LocationImpl) location).primitiveFieldCount() <= layout.getPrimitiveFieldCount());
+        assert (((ShapeImpl) shape).getObjectFieldSize() + ((LocationImpl) location).objectFieldCount() <= layout.getObjectFieldCount());
         return true;
     }
 
--- a/truffle/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/DynamicObjectBasic.java	Mon Sep 14 11:14:58 2015 +0200
+++ b/truffle/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/DynamicObjectBasic.java	Sat Sep 12 22:03:23 2015 +0200
@@ -91,8 +91,8 @@
     @Override
     protected final void growPrimitiveStore(Shape oldShape, Shape newShape) {
         assert ((ShapeImpl) newShape).hasPrimitiveArray();
-        int oldPrimitiveCapacity = oldShape.getPrimitiveArrayCapacity();
-        int newPrimitiveCapacity = newShape.getPrimitiveArrayCapacity();
+        int oldPrimitiveCapacity = ((ShapeImpl) oldShape).getPrimitiveArrayCapacity();
+        int newPrimitiveCapacity = ((ShapeImpl) newShape).getPrimitiveArrayCapacity();
         if (newPrimitiveCapacity == 0) {
             // due to obsolescence, we might have to reserve an empty primitive array slot
             this.setPrimitiveStore(null, newShape);
@@ -116,10 +116,10 @@
     @Override
     protected final void resizeObjectStore(Shape oldShape, Shape newShape) {
         Object[] newObjectStore = null;
-        int destinationCapacity = newShape.getObjectArrayCapacity();
+        int destinationCapacity = ((ShapeImpl) newShape).getObjectArrayCapacity();
         if (destinationCapacity != 0) {
             newObjectStore = new Object[destinationCapacity];
-            int sourceCapacity = oldShape.getObjectArrayCapacity();
+            int sourceCapacity = ((ShapeImpl) oldShape).getObjectArrayCapacity();
             if (sourceCapacity != 0) {
                 Object[] oldObjectStore = getObjectStore(newShape);
                 for (int i = 0; i < Math.min(sourceCapacity, destinationCapacity); ++i) {
@@ -148,12 +148,12 @@
 
     @Override
     protected final void resizePrimitiveStore(Shape oldShape, Shape newShape) {
-        assert newShape.hasPrimitiveArray();
+        assert ((ShapeImpl) newShape).hasPrimitiveArray();
         long[] newPrimitiveArray = null;
-        int destinationCapacity = newShape.getPrimitiveArrayCapacity();
+        int destinationCapacity = ((ShapeImpl) newShape).getPrimitiveArrayCapacity();
         if (destinationCapacity != 0) {
             newPrimitiveArray = new long[destinationCapacity];
-            int sourceCapacity = oldShape.getPrimitiveArrayCapacity();
+            int sourceCapacity = ((ShapeImpl) oldShape).getPrimitiveArrayCapacity();
             if (sourceCapacity != 0) {
                 long[] oldPrimitiveArray = this.getPrimitiveStore(newShape);
                 for (int i = 0; i < Math.min(sourceCapacity, destinationCapacity); ++i) {
@@ -184,11 +184,11 @@
     @Override
     protected final boolean checkExtensionArrayInvariants(Shape newShape) {
         assert getShape() == newShape;
-        assert (getObjectStore(newShape) == null && newShape.getObjectArrayCapacity() == 0) ||
-                        (getObjectStore(newShape) != null && getObjectStore(newShape).length == newShape.getObjectArrayCapacity());
-        if (newShape.hasPrimitiveArray()) {
-            assert (getPrimitiveStore(newShape) == null && newShape.getPrimitiveArrayCapacity() == 0) ||
-                            (getPrimitiveStore(newShape) != null && getPrimitiveStore(newShape).length == newShape.getPrimitiveArrayCapacity());
+        assert (getObjectStore(newShape) == null && ((ShapeImpl) newShape).getObjectArrayCapacity() == 0) ||
+                        (getObjectStore(newShape) != null && getObjectStore(newShape).length == ((ShapeImpl) newShape).getObjectArrayCapacity());
+        if (((ShapeImpl) newShape).hasPrimitiveArray()) {
+            assert (getPrimitiveStore(newShape) == null && ((ShapeImpl) newShape).getPrimitiveArrayCapacity() == 0) ||
+                            (getPrimitiveStore(newShape) != null && getPrimitiveStore(newShape).length == ((ShapeImpl) newShape).getPrimitiveArrayCapacity());
         }
         return true;
     }
@@ -200,7 +200,7 @@
         if (this.getObjectStore(currentShape) != null) {
             clone.setObjectStore(this.getObjectStore(currentShape).clone(), currentShape);
         }
-        if (currentShape.hasPrimitiveArray() && this.getPrimitiveStore(currentShape) != null) {
+        if (((ShapeImpl) currentShape).hasPrimitiveArray() && this.getPrimitiveStore(currentShape) != null) {
             clone.setPrimitiveStore(this.getPrimitiveStore(currentShape).clone(), currentShape);
         }
         return clone;
--- a/truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java	Mon Sep 14 11:14:58 2015 +0200
+++ b/truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java	Sat Sep 12 22:03:23 2015 +0200
@@ -178,37 +178,30 @@
         }
     }
 
-    @Override
     public final int getObjectArraySize() {
         return objectArraySize;
     }
 
-    @Override
     public final int getObjectFieldSize() {
         return objectFieldSize;
     }
 
-    @Override
     public final int getPrimitiveFieldSize() {
         return primitiveFieldSize;
     }
 
-    @Override
     public final int getObjectArrayCapacity() {
         return objectArrayCapacity;
     }
 
-    @Override
     public final int getPrimitiveArrayCapacity() {
         return primitiveArrayCapacity;
     }
 
-    @Override
     public final int getPrimitiveArraySize() {
         return primitiveArraySize;
     }
 
-    @Override
     public final boolean hasPrimitiveArray() {
         return hasPrimitiveArray;
     }
--- a/truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/debug/ShapeProfiler.java	Mon Sep 14 11:14:58 2015 +0200
+++ b/truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/debug/ShapeProfiler.java	Sat Sep 12 22:03:23 2015 +0200
@@ -116,12 +116,12 @@
 
         public void profile(Shape shape) {
             jsObjects++;
-            oac += shape.getObjectArrayCapacity();
-            oas += shape.getObjectArraySize();
-            ofs += shape.getObjectFieldSize();
-            pac += shape.getPrimitiveArrayCapacity();
-            pas += shape.getPrimitiveArraySize();
-            pfs += shape.getPrimitiveFieldSize();
+            oac += ((ShapeImpl) shape).getObjectArrayCapacity();
+            oas += ((ShapeImpl) shape).getObjectArraySize();
+            ofs += ((ShapeImpl) shape).getObjectFieldSize();
+            pac += ((ShapeImpl) shape).getPrimitiveArrayCapacity();
+            pas += ((ShapeImpl) shape).getPrimitiveArraySize();
+            pfs += ((ShapeImpl) shape).getPrimitiveFieldSize();
         }
 
         public void add(ShapeStats stats) {