SF.net SVN: jikesrvm:[15770] rvmroot/trunk/rvm/src/org/jikesrvm/jni/ JNIEnvironment.java

View: New views
1 Messages — Rating Filter:   Alert me  

SF.net SVN: jikesrvm:[15770] rvmroot/trunk/rvm/src/org/jikesrvm/jni/ JNIEnvironment.java

by dframpton-oss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Revision: 15770
          http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15770&view=rev
Author:   dframpton-oss
Date:     2009-08-20 00:05:22 +0000 (Thu, 20 Aug 2009)

Log Message:
-----------
Fix for RVM-827. Was an off-by-one error/inconsistency in how the 'frames' on the JNI stack were managed. I have changed the enter/exit JNI methods in JNIEnvironment to match the way things used to be done so the ia32 GCMapIterator just works. This way when PPC moves across to using these methods things will continue to work without changing the ppc GCMapIterator.

Modified Paths:
--------------
    rvmroot/trunk/rvm/src/org/jikesrvm/jni/JNIEnvironment.java

Modified: rvmroot/trunk/rvm/src/org/jikesrvm/jni/JNIEnvironment.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/jni/JNIEnvironment.java 2009-08-19 04:36:18 UTC (rev 15769)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/jni/JNIEnvironment.java 2009-08-20 00:05:22 UTC (rev 15770)
@@ -352,9 +352,10 @@
     }
 
     // Save current JNI ref stack pointer
-    int oldJNIRefsSavedFP = JNIRefsSavedFP;
-    JNIRefsSavedFP = JNIRefsTop;
-    uninterruptiblePushJNIRef(Address.fromIntSignExtend(oldJNIRefsSavedFP), false);
+    if (JNIRefsTop > 0) {
+      uninterruptiblePushJNIRef(Address.fromIntSignExtend(JNIRefsSavedFP), false);
+      JNIRefsSavedFP = JNIRefsTop;
+    }
 
     // Convert arguments on stack from objects to JNI references
     Address fp = Magic.getFramePointer();
@@ -387,9 +388,10 @@
     RVMThread.leaveJNIFromCallIntoNative();
 
     // Restore JNI ref top and saved frame pointer
-    JNIRefsTop = JNIRefsSavedFP;
-    if (JNIRefsTop > 0) {
-      JNIRefsSavedFP = JNIRefs.get((JNIRefsTop >> LOG_BYTES_IN_ADDRESS) + 1).toInt();
+    JNIRefsTop = 0;
+    if (JNIRefsSavedFP > 0) {
+      JNIRefsTop = JNIRefsSavedFP - BYTES_IN_ADDRESS;
+      JNIRefsSavedFP = JNIRefs.get(JNIRefsSavedFP >> LOG_BYTES_IN_ADDRESS).toInt();
     }
 
     // Throw and clear any pending exceptions


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-commits mailing list
Jikesrvm-commits@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-commits