diff jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java @ 23994:ebce30b702eb

[GR-2538] reduced memory overhead of HotSpotVMConfigStore
author Doug Simon <doug.simon@oracle.com>
date Thu, 02 Feb 2017 23:58:25 +0100
parents 724fbad94ee3
children 11f0412408cd
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java	Tue Jan 31 22:59:16 2017 +0100
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java	Thu Feb 02 23:58:25 2017 +0100
@@ -67,21 +67,6 @@
     }
 
     /**
-     * Gets the size of a C++ type.
-     *
-     * @param name name of the type
-     * @return the size in bytes of the requested field
-     * @throws JVMCIError if the field is not present and {@code notPresent} is null
-     */
-    public int getTypeSize(String name) {
-        Long entry = store.vmTypeSizes.get(name);
-        if (entry == null) {
-            throw new JVMCIError("expected VM type not found: " + name);
-        }
-        return (int) (long) entry;
-    }
-
-    /**
      * Gets the value of a C++ constant.
      *
      * @param name name of the constant (e.g., {@code "frame::arg_reg_save_area_bytes"})
@@ -291,13 +276,24 @@
      */
     public <T> T getFlag(String name, Class<T> type, T notPresent) {
         VMFlag entry = store.vmFlags.get(name);
+        Object value;
+        String cppType;
         if (entry == null) {
-            if (notPresent != null) {
-                return notPresent;
+            // Fall back to VM call
+            value = store.compilerToVm.getFlagValue(name);
+            if (value == null) {
+                if (notPresent != null) {
+                    return notPresent;
+                }
+                throw new JVMCIError("expected VM flag not found: " + name);
+            } else {
+                cppType = null;
             }
-            throw new JVMCIError("expected VM flag not found: " + name);
+        } else {
+            value = entry.value;
+            cppType = entry.type;
         }
-        return type.cast(convertValue(name, type, entry.value, entry.type));
+        return type.cast(convertValue(name, type, value, cppType));
     }
 
     private static <T> Object convertValue(String name, Class<T> toType, Object value, String cppType) throws JVMCIError {