< prev index next >

src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java

Print this page
rev 12604 : 8173912: [JVMCI] fix memory overhead of JVMCI

*** 65,89 **** public long getAddress(String name) { return getAddress(name, null); } /** - * 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"}) * @param type the boxed type to which the constant value will be converted * @param notPresent if non-null and the constant is not present then this value is returned --- 65,74 ----
*** 289,305 **** * present * @throws JVMCIError if the flag is not present and {@code notPresent == null} */ public <T> T getFlag(String name, Class<T> type, T notPresent) { VMFlag entry = store.vmFlags.get(name); if (entry == null) { if (notPresent != null) { return notPresent; } throw new JVMCIError("expected VM flag not found: " + name); } ! return type.cast(convertValue(name, type, entry.value, entry.type)); } private static <T> Object convertValue(String name, Class<T> toType, Object value, String cppType) throws JVMCIError { if (toType == Boolean.class) { if (value instanceof String) { --- 274,301 ---- * present * @throws JVMCIError if the flag is not present and {@code notPresent == null} */ public <T> T getFlag(String name, Class<T> type, T notPresent) { VMFlag entry = store.vmFlags.get(name); + Object value; + String cppType; if (entry == null) { + // Fall back to VM call + value = store.compilerToVm.getFlagValue(name); + if (value == store.compilerToVm) { if (notPresent != null) { return notPresent; } throw new JVMCIError("expected VM flag not found: " + name); + } else { + cppType = null; + } + } else { + value = entry.value; + cppType = 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 { if (toType == Boolean.class) { if (value instanceof String) {
*** 317,326 **** --- 313,326 ---- if (value instanceof Integer) { return value; } else if (value instanceof Long) { return (int) (long) value; } + } else if (toType == String.class) { + if (value == null || value instanceof String) { + return value; + } } else if (toType == Long.class) { return value; } throw new JVMCIError("cannot convert " + name + " of type " + value.getClass().getSimpleName() + (cppType == null ? "" : " [" + cppType + "]") + " to " + toType.getSimpleName());
< prev index next >