changeset 17000:e35a3af4f680

Add a getter method to that returns the HotSpot VM symbol string associated via HotSpotVMField annotation. Renamed a similar existing method that returns HotSpot VM symbol string associated via HotSpotVMValue annotation.
author bharadwaj
date Fri, 29 Aug 2014 16:01:23 -0400
parents f8565347bb3b
children 5d16da2ca0c8
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java
diffstat 1 files changed, 37 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Fri Aug 29 13:48:04 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Fri Aug 29 16:01:23 2014 -0400
@@ -1594,21 +1594,21 @@
     }
 
     /**
-     * Returns the name of the C/C++ function that is associated (via HotSpotVMValue annotation)
-     * with the HotSpotVMConfig object's field containing {@code foreignCalltargetAddress}; returns
-     * null if no field holds the provided address.
+     * Returns the name of the C/C++ symbol that is associated (via HotSpotVMValue annotation) with
+     * the HotSpotVMConfig object's field containing {@code value}; returns null if no field holds
+     * the provided address.
      *
-     * @param foreignCallTargetAddress address of foreign call target
+     * @param value value of the field
      * @return C/C++ symbol name or null
      */
-    public String getCSymbol(long foreignCallTargetAddress) {
+    public String getVMValueCSymbol(long value) {
         for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
             if (f.isAnnotationPresent(HotSpotVMValue.class)) {
                 HotSpotVMValue annotation = f.getAnnotation(HotSpotVMValue.class);
 
                 if (annotation.get() == HotSpotVMValue.Type.ADDRESS) {
                     try {
-                        if (foreignCallTargetAddress == f.getLong(this)) {
+                        if (value == f.getLong(this)) {
                             return (annotation.expression() + annotation.signature());
                         }
                     } catch (IllegalArgumentException e1) {
@@ -1623,4 +1623,35 @@
         }
         return null;
     }
+
+    /**
+     * Returns the name of the C/C++ symbol that is associated (via HotSpotVMField annotation) with
+     * the HotSpotVMConfig object's field containing {@code value}; returns null if no field holds
+     * the provided address.
+     *
+     * @param value value of the field
+     * @return C/C++ symbol name or null
+     */
+    public String getVMFieldCSymbol(long value) {
+        for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
+            if (f.isAnnotationPresent(HotSpotVMField.class)) {
+                HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class);
+
+                if (annotation.get() == HotSpotVMField.Type.VALUE) {
+                    try {
+                        if (value == f.getLong(this)) {
+                            return (annotation.name());
+                        }
+                    } catch (IllegalArgumentException e1) {
+                        // TODO Auto-generated catch block
+                        e1.printStackTrace();
+                    } catch (IllegalAccessException e1) {
+                        // TODO Auto-generated catch block
+                        e1.printStackTrace();
+                    }
+                }
+            }
+        }
+        return null;
+    }
 }