Revision: 15695
http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15695&view=revAuthor: pizlo
Date: 2009-05-25 02:37:12 +0000 (Mon, 25 May 2009)
Log Message:
-----------
Fix hardHandshakeSuspend/Resume so that you can do STW GC while the world is suspended. Useful for dynamic software updating. NOTE - this is a tricky change; lets watch the regressions for deadlocks\!
Modified Paths:
--------------
rvmroot/trunk/rvm/src/org/jikesrvm/scheduler/RVMThread.java
Modified: rvmroot/trunk/rvm/src/org/jikesrvm/scheduler/RVMThread.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/scheduler/RVMThread.java 2009-05-23 02:14:29 UTC (rev 15694)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/scheduler/RVMThread.java 2009-05-25 02:37:12 UTC (rev 15695)
@@ -3214,9 +3214,9 @@
@Unpreemptible("Does not perform actions that lead to blocking, but may wait for threads to rendezvous with the soft handshake")
public static void softHandshake(SoftHandshakeVisitor v) {
handshakeLock.lockWithHandshake(); /*
- * prevent multiple (soft or hard) handshakes
- * from proceeding concurrently
- */
+ * prevent multiple (soft or hard) handshakes
+ * from proceeding concurrently
+ */
int numToHandshake = snapshotHandshakeThreads();
if (VM.VerifyAssertions)
@@ -3402,12 +3402,15 @@
RVMThread current=getCurrentThread();
handshakeLock.lockWithHandshake();
+ int numLockedLocks=0;
for (int i=0;i<nextSlot;++i) {
Monitor l=communicationLockBySlot[i];
if (l!=null) {
l.lockWithHandshake();
+ numLockedLocks++;
}
}
+
// fixpoint until there are no threads that we haven't blocked.
// fixpoint is needed in case some thread spawns another thread
// while we're waiting. that is unlikely but possible.
@@ -3457,6 +3460,17 @@
* that they had stopped.
*/
+ int numUnlockedLocks=0;
+ for (int i=0;i<nextSlot;++i) {
+ Monitor l=communicationLockBySlot[i];
+ if (l!=null) {
+ l.unlock();
+ numUnlockedLocks++;
+ }
+ }
+ if (VM.VerifyAssertions) VM._assert(numLockedLocks==numUnlockedLocks);
+ handshakeLock.unlock();
+
if (false) {
long after=sysCall.sysNanoTime();
totalSuspendTime+=after-before;
@@ -3470,6 +3484,8 @@
HardHandshakeVisitor hhv) {
long before=sysCall.sysNanoTime();
+ handshakeLock.lockWithHandshake();
+
RVMThread current=getCurrentThread();
worldStopped=false;
acctLock.lockNoHandshake();
@@ -3487,12 +3503,7 @@
handshakeThreads[i].unblock(ba);
handshakeThreads[i]=null; // help GC
}
- for (int i=0;i<nextSlot;++i) {
- Monitor l=communicationLockBySlot[i];
- if (l!=null) {
- l.unlock();
- }
- }
+
handshakeLock.unlock();
if (false) {
@@ -3502,6 +3513,16 @@
}
}
+ @Unpreemptible
+ public static void hardHandshakeSuspend() {
+ hardHandshakeSuspend(handshakeBlockAdapter,allButGC);
+ }
+
+ @Unpreemptible
+ public static void hardHandshakeResume() {
+ hardHandshakeResume(handshakeBlockAdapter,allButGC);
+ }
+
public static boolean worldStopped() {
return worldStopped;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship.
http://www.creativitycat.com
_______________________________________________
Jikesrvm-commits mailing list
Jikesrvm-commits@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-commits