# HG changeset patch # User bharadwaj # Date 1409342483 14400 # Node ID e35a3af4f680f365335a5f161dceae412ec90fd5 # Parent f8565347bb3b1deb49167613bf5f752bcd66b888 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. diff -r f8565347bb3b -r e35a3af4f680 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- 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; + } }