changeset 5287:e96c8d2925da

let NodeClass.getDebugProperties handle arrays and doubles
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 24 Apr 2012 17:17:44 +0200
parents dcb4695e3bb0
children d30314b667eb
files graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java	Tue Apr 24 17:16:43 2012 +0200
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java	Tue Apr 24 17:17:44 2012 +0200
@@ -561,11 +561,22 @@
                     value = unsafe.getInt(node, dataOffsets[i]);
                 } else if (type == Boolean.TYPE) {
                     value = unsafe.getBoolean(node, dataOffsets[i]);
+                } else if (type == Double.TYPE) {
+                    value = String.format(Locale.ENGLISH, "%7.5f", unsafe.getDouble(node, dataOffsets[i]));
                 } else {
                     assert false;
                 }
             } else {
                 value = unsafe.getObject(node, dataOffsets[i]);
+                if (type.isArray()) {
+                    if (!type.getComponentType().isPrimitive()) {
+                        value = Arrays.toString((Object[]) value);
+                    } else if (type.getComponentType() == Integer.TYPE) {
+                        value = Arrays.toString((int[]) value);
+                    } else if (type.getComponentType() == Double.TYPE) {
+                        value = Arrays.toString((double[]) value);
+                    }
+                }
             }
             properties.put("data." + dataNames[i], value);
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java	Tue Apr 24 17:16:43 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java	Tue Apr 24 17:17:44 2012 +0200
@@ -34,10 +34,8 @@
  */
 public final class HotSpotTypeResolvedImpl extends HotSpotType implements HotSpotTypeResolved {
 
-    /**
-     *
-     */
     private static final long serialVersionUID = 3481514353553840471L;
+
     private Class javaMirror;
     private String simpleName;
     private int accessFlags;