changeset 9517:51973e9ec004

added comments clarifying the difference between _exception_oop and _pending_exception in the HotSpot Thread class
author Doug Simon <doug.simon@oracle.com>
date Thu, 02 May 2013 15:12:52 +0200
parents cf8104ed68ba
children f491f51e96b5
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java
diffstat 2 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Thu May 02 14:12:24 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Thu May 02 15:12:52 2013 +0200
@@ -179,7 +179,10 @@
     public int uninitializedIdentityHashCodeValue;
 
     /**
-     * Offset of the pending exception field.
+     * Offset of the _pending_exception field in ThreadShadow (defined in exceptions.hpp). This
+     * field is used to propagate exceptions through C/C++ calls.
+     * <p>
+     * <b>NOTE: This is not the same as {@link #threadExceptionOopOffset}.</b>
      */
     public int pendingExceptionOffset;
 
@@ -228,7 +231,15 @@
      */
     public int klassHasFinalizerFlag;
 
+    /**
+     * Offset of the _exception_oop field in Thread (defined in thread.hpp). This field is used to
+     * pass exception objects into and out of the runtime system during exception handling for
+     * compiled code.
+     * <p>
+     * <b>NOTE: This is not the same as {@link #pendingExceptionOffset}.</b>
+     */
     public int threadExceptionOopOffset;
+
     public int threadExceptionPcOffset;
     public long cardtableStartAddress;
     public int cardtableShift;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java	Thu May 02 14:12:24 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java	Thu May 02 15:12:52 2013 +0200
@@ -64,6 +64,9 @@
 
     public static final Object EXCEPTION_OOP_LOCATION = LocationNode.createLocation("ExceptionOop");
 
+    /**
+     * @see HotSpotVMConfig#threadExceptionOopOffset
+     */
     @Fold
     public static int threadExceptionOopOffset() {
         return config().threadExceptionOopOffset;
@@ -99,6 +102,9 @@
 
     public static final Object PENDING_EXCEPTION_LOCATION = LocationNode.createLocation("PendingException");
 
+    /**
+     * @see HotSpotVMConfig#pendingExceptionOffset
+     */
     @Fold
     private static int threadPendingExceptionOffset() {
         return config().pendingExceptionOffset;
@@ -111,14 +117,20 @@
         return config().threadObjectResultOffset;
     }
 
+    /**
+     * @see HotSpotVMConfig#threadExceptionOopOffset
+     */
     public static Object readExceptionOop(Word thread) {
         return thread.readObject(threadExceptionOopOffset(), EXCEPTION_OOP_LOCATION);
     }
 
     public static Word readExceptionPc(Word thread) {
-        return thread.readWord(threadExceptionOopOffset(), EXCEPTION_PC_LOCATION);
+        return thread.readWord(threadExceptionPcOffset(), EXCEPTION_PC_LOCATION);
     }
 
+    /**
+     * @see HotSpotVMConfig#threadExceptionOopOffset
+     */
     public static void writeExceptionOop(Word thread, Object value) {
         thread.writeObject(threadExceptionOopOffset(), value, EXCEPTION_OOP_LOCATION);
     }