< prev index next >
src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java
Print this page
@@ -20,11 +20,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.vm.ci.hotspot;
-import java.lang.reflect.Field;
+import java.util.Map;
import jdk.vm.ci.code.BailoutException;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.code.CodeCacheProvider;
import jdk.vm.ci.code.CompiledCode;
@@ -54,41 +54,32 @@
}
@Override
public String getMarkName(Mark mark) {
int markId = (int) mark.id;
- Field[] fields = runtime.getConfig().getClass().getDeclaredFields();
- for (Field f : fields) {
- if (f.getName().startsWith("MARKID_")) {
- f.setAccessible(true);
- try {
- if (f.getInt(runtime.getConfig()) == markId) {
- return f.getName();
- }
- } catch (Exception e) {
- }
+ HotSpotVMConfigStore store = runtime.getConfigStore();
+ for (Map.Entry<String, Long> e : store.getConstants().entrySet()) {
+ String name = e.getKey();
+ if (name.startsWith("MARKID_") && e.getValue() == markId) {
+ return name;
}
}
return CodeCacheProvider.super.getMarkName(mark);
}
/**
* Decodes a call target to a mnemonic if possible.
*/
@Override
public String getTargetName(Call call) {
- Field[] fields = runtime.getConfig().getClass().getDeclaredFields();
- for (Field f : fields) {
- if (f.getName().endsWith("Stub")) {
- f.setAccessible(true);
- Object address;
- try {
- address = f.get(runtime.getConfig());
- if (address.equals(call.target)) {
- return f.getName() + ":0x" + Long.toHexString((Long) address);
- }
- } catch (IllegalArgumentException | IllegalAccessException e) {
+ if (call.target instanceof HotSpotForeignCallTarget) {
+ long address = ((HotSpotForeignCallTarget) call.target).address;
+ HotSpotVMConfigStore store = runtime.getConfigStore();
+ for (Map.Entry<String, VMField> e : store.getFields().entrySet()) {
+ VMField field = e.getValue();
+ if (field.isStatic() && field.value == address) {
+ return e.getValue() + ":0x" + Long.toHexString(address);
}
}
}
return CodeCacheProvider.super.getTargetName(call);
}
< prev index next >