hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPoolCache.java
changeset 46427 54713555867e
parent 35898 ddc274f0052f
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPoolCache.java	Wed May 03 02:32:02 2017 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPoolCache.java	Fri Mar 03 23:08:35 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,8 @@
     elementSize    = elType.getSize();
     length         = new CIntField(type.getCIntegerField("_length"), 0);
     intSize        = VM.getVM().getObjectHeap().getIntSize();
+    resolvedReferences = type.getAddressField("_resolved_references");
+    referenceMap   = type.getAddressField("_reference_map");
   }
 
   public ConstantPoolCache(Address addr) {
@@ -65,7 +67,8 @@
   private static long elementSize;
   private static CIntField length;
   private static long intSize;
-
+  private static AddressField  resolvedReferences;
+  private static AddressField  referenceMap;
 
   public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
 
@@ -100,4 +103,18 @@
         entry.iterateFields(visitor);
       }
     }
+
+  public Oop getResolvedReferences() {
+    Address handle = resolvedReferences.getValue(getAddress());
+    if (handle != null) {
+      // Load through the handle
+      OopHandle refs = handle.getOopHandleAt(0);
+      return VM.getVM().getObjectHeap().newOop(refs);
+    }
+    return null;
+  }
+
+  public U2Array referenceMap() {
+    return new U2Array(referenceMap.getValue(getAddress()));
+  }
 };