changeset 9603:c010001c38ce

updated javadoc for HotSpotInstalledCode to document why the nmethod::_graal_installed_code can only be a weak reference
author Doug Simon <doug.simon@oracle.com>
date Tue, 07 May 2013 21:51:07 +0200
parents 19c5a07c7843
children 8fe7e6e7b443
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java	Tue May 07 12:03:21 2013 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java	Tue May 07 21:51:07 2013 +0200
@@ -32,9 +32,14 @@
 import com.oracle.graal.hotspot.*;
 
 /**
- * Implementation of {@link InstalledCode} for HotSpot. Stores a reference to the nmethod which
- * contains the compiled code. The nmethod also stores a weak reference to the HotSpotCompiledMethod
- * instance which is necessary to keep the nmethod from being unloaded.
+ * Implementation of {@link InstalledCode} for HotSpot. If the code is installed as an nmethod (as
+ * opposed to some other subclass of CodeBlob such as RuntimeStub), then the nmethod stores a weak
+ * reference to an instance of this class. This is necessary to keep the nmethod from being unloaded
+ * while the associated {@link HotSpotInstalledCode} instance is alive.
+ * <p>
+ * Note that there is no (current) way for the reference from an nmethod to a
+ * {@link HotSpotInstalledCode} instance to be anything but weak. This is due to the fact that
+ * HotSpot does not treat nmethods as strong GC roots.
  */
 public class HotSpotInstalledCode extends CompilerObject implements InstalledCode {
 
@@ -84,7 +89,7 @@
 
     @Override
     public String toString() {
-        return String.format("InstalledCode[method=%s, codeBlob=0x%x]", method, codeBlob);
+        return String.format("InstalledCode[method=%s, codeBlob=0x%x, isDefault=%b, isNmethod=%b]", method, codeBlob, isDefault, isNmethod);
     }
 
     @Override