changeset 11205:13d0d29aa15c

Merge.
author Doug Simon <doug.simon@oracle.com>
date Mon, 05 Aug 2013 22:37:13 +0200
parents f4601ec50637 (diff) 7fc3e1fb3965 (current diff)
children dba746f54e6a
files mxtool/mx.py
diffstat 8 files changed, 56 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java	Mon Aug 05 19:50:34 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java	Mon Aug 05 22:37:13 2013 +0200
@@ -46,8 +46,10 @@
         ValueNode javaClass = getJavaClass();
         if (javaClass.isConstant()) {
             Class c = (Class) javaClass.asConstant().asObject();
-            Class componentType = c.getComponentType();
-            return ConstantNode.forObject(componentType, tool.runtime(), graph());
+            if (c != null) {
+                Class componentType = c.getComponentType();
+                return ConstantNode.forObject(componentType, tool.runtime(), graph());
+            }
         }
         return this;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java	Mon Aug 05 19:50:34 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java	Mon Aug 05 22:37:13 2013 +0200
@@ -46,7 +46,9 @@
         ValueNode javaClass = getJavaClass();
         if (javaClass.isConstant()) {
             Class c = (Class) javaClass.asConstant().asObject();
-            return ConstantNode.forInt(c.getModifiers(), graph());
+            if (c != null) {
+                return ConstantNode.forInt(c.getModifiers(), graph());
+            }
         }
         return this;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java	Mon Aug 05 19:50:34 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java	Mon Aug 05 22:37:13 2013 +0200
@@ -46,8 +46,10 @@
         ValueNode javaClass = getJavaClass();
         if (javaClass.isConstant()) {
             Class c = (Class) javaClass.asConstant().asObject();
-            Class superclass = c.getSuperclass();
-            return ConstantNode.forObject(superclass, tool.runtime(), graph());
+            if (c != null) {
+                Class superclass = c.getSuperclass();
+                return ConstantNode.forObject(superclass, tool.runtime(), graph());
+            }
         }
         return this;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java	Mon Aug 05 19:50:34 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java	Mon Aug 05 22:37:13 2013 +0200
@@ -46,7 +46,9 @@
         ValueNode javaClass = getJavaClass();
         if (javaClass.isConstant()) {
             Class c = (Class) javaClass.asConstant().asObject();
-            return ConstantNode.forBoolean(c.isArray(), graph());
+            if (c != null) {
+                return ConstantNode.forBoolean(c.isArray(), graph());
+            }
         }
         return this;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInstanceNode.java	Mon Aug 05 19:50:34 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInstanceNode.java	Mon Aug 05 22:37:13 2013 +0200
@@ -54,16 +54,18 @@
         if (javaClass.isConstant()) {
             ValueNode object = getObject();
             Class c = (Class) javaClass.asConstant().asObject();
-            if (c.isPrimitive()) {
-                return ConstantNode.forBoolean(false, graph());
+            if (c != null) {
+                if (c.isPrimitive()) {
+                    return ConstantNode.forBoolean(false, graph());
+                }
+                if (object.isConstant()) {
+                    Object o = object.asConstant().asObject();
+                    return ConstantNode.forBoolean(o != null && c.isInstance(o), graph());
+                }
+                HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) HotSpotResolvedObjectType.fromClass(c);
+                InstanceOfNode instanceOf = graph().unique(new InstanceOfNode(type, object, null));
+                return graph().unique(new ConditionalNode(instanceOf, ConstantNode.forBoolean(true, graph()), ConstantNode.forBoolean(false, graph())));
             }
-            if (object.isConstant()) {
-                Object o = object.asConstant().asObject();
-                return ConstantNode.forBoolean(o != null && c.isInstance(o), graph());
-            }
-            HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) HotSpotResolvedObjectType.fromClass(c);
-            InstanceOfNode instanceOf = graph().unique(new InstanceOfNode(type, object, null));
-            return graph().unique(new ConditionalNode(instanceOf, ConstantNode.forBoolean(true, graph()), ConstantNode.forBoolean(false, graph())));
         }
         return this;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java	Mon Aug 05 19:50:34 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java	Mon Aug 05 22:37:13 2013 +0200
@@ -46,7 +46,9 @@
         ValueNode javaClass = getJavaClass();
         if (javaClass.isConstant()) {
             Class c = (Class) javaClass.asConstant().asObject();
-            return ConstantNode.forBoolean(c.isInterface(), graph());
+            if (c != null) {
+                return ConstantNode.forBoolean(c.isInterface(), graph());
+            }
         }
         return this;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java	Mon Aug 05 19:50:34 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java	Mon Aug 05 22:37:13 2013 +0200
@@ -46,7 +46,9 @@
         ValueNode javaClass = getJavaClass();
         if (javaClass.isConstant()) {
             Class c = (Class) javaClass.asConstant().asObject();
-            return ConstantNode.forBoolean(c.isPrimitive(), graph());
+            if (c != null) {
+                return ConstantNode.forBoolean(c.isPrimitive(), graph());
+            }
         }
         return this;
     }
--- a/mxtool/mx.py	Mon Aug 05 19:50:34 2013 +0200
+++ b/mxtool/mx.py	Mon Aug 05 22:37:13 2013 +0200
@@ -3278,6 +3278,26 @@
                         log(classname)
     return matches
 
+def select_items(candidates):
+    """
+    Presents a command line interface for selecting one or more items from a sequence.
+    """
+    if len(candidates) == 0:
+        return []
+    elif len(candidates) > 1:
+        log('[0] <all>')
+        for i in range(0, len(candidates)):
+            log('[{0}] {1}'.format(i + 1, candidates[i]))
+        s = raw_input('Enter number of selection: ')
+        try:
+            si = int(s)
+        except:
+            si = 0
+        if si == 0 or si not in range(1, len(candidates) + 1):
+            return candidates
+        else:
+            return [candidates[si - 1]]
+
 def javap(args):
     """disassemble classes matching given pattern with javap"""
 
@@ -3285,7 +3305,11 @@
     if not exists(javap):
         abort('The javap executable does not exists: ' + javap)
     else:
-        run([javap, '-private', '-verbose', '-classpath', classpath()] + findclass(args, logToConsole=False))
+        candidates = findclass(args, logToConsole=False)
+        if len(candidates) == 0:
+            log('no matches')
+        selection = select_items(candidates)
+        run([javap, '-private', '-verbose', '-classpath', classpath()] + selection)
 
 def show_projects(args):
     """show all loaded projects"""