Skip to content

Commit

Permalink
Bring up-to-date with RVM at r15696
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Rogers committed May 26, 2009
1 parent 3db3489 commit dc32152
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,13 @@ void generateMagic(Assembler asm, MethodReference m, RVMMethod cm, Offset sd) {
// Store at offset
if (VM.BuildFor32Addr) {
asm.emitPOP_Reg(T0); // T0 = offset
asm.emitADD_Reg_RegDisp(T0, SP, THREE_SLOTS); // T0 = base+offset
asm.emitADD_Reg_RegDisp(T0, SP, TWO_SLOTS); // T0 = base+offset
asm.emitPOP_RegInd(T0); // [T0] <- value low
asm.emitPOP_RegDisp(T0, ONE_SLOT); // [T0+4] <- value high
asm.emitPOP_Reg(T0); // throw away slot
} else {
asm.emitPOP_Reg(T0); // offset
asm.emitADD_Reg_RegDisp_Quad(T0, SP, THREE_SLOTS); // T0 = base+offset
asm.emitADD_Reg_RegDisp_Quad(T0, SP, TWO_SLOTS); // T0 = base+offset
asm.emitPOP_RegInd(T0); // T0 <- value
asm.emitPOP_Reg(T0); // throw away slot
asm.emitPOP_Reg(T0); // throw away slot
Expand Down
39 changes: 30 additions & 9 deletions rvm/src/org/jikesrvm/scheduler/RVMThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -3211,9 +3211,9 @@ public static int snapshotHandshakeThreads() {
@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)
Expand Down Expand Up @@ -3399,12 +3399,15 @@ public static void hardHandshakeSuspend(BlockAdapter ba,
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.
Expand Down Expand Up @@ -3454,6 +3457,17 @@ public static void hardHandshakeSuspend(BlockAdapter ba,
* 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;
Expand All @@ -3467,6 +3481,8 @@ public static void hardHandshakeResume(BlockAdapter ba,
HardHandshakeVisitor hhv) {
long before=sysCall.sysNanoTime();

handshakeLock.lockWithHandshake();

RVMThread current=getCurrentThread();
worldStopped=false;
acctLock.lockNoHandshake();
Expand All @@ -3484,12 +3500,7 @@ public static void hardHandshakeResume(BlockAdapter ba,
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) {
Expand All @@ -3499,6 +3510,16 @@ public static void hardHandshakeResume(BlockAdapter ba,
}
}

@Unpreemptible
public static void hardHandshakeSuspend() {
hardHandshakeSuspend(handshakeBlockAdapter,allButGC);
}

@Unpreemptible
public static void hardHandshakeResume() {
hardHandshakeResume(handshakeBlockAdapter,allButGC);
}

public static boolean worldStopped() {
return worldStopped;
}
Expand Down
24 changes: 7 additions & 17 deletions tools/bootloader/sysTime.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
#include <sys/time.h>
#endif

#if !defined(RVM_FOR_HARMONY) && defined(__MACH__)
mach_timebase_info_data_t timebaseInfo;
#endif

EXTERNAL long long sysCurrentTimeMillis()
{
SYS_START();
Expand Down Expand Up @@ -58,19 +54,13 @@ EXTERNAL long long sysNanoTime()
retVal = hytime_current_time_millis() * 1000000;
#else
#ifdef __MACH__
unsigned long long high;
unsigned long long low;

low = mach_absolute_time();

high = low >> 32;
low &= 0xffffffff;

high *= timebaseInfo.numer;
low *= timebaseInfo.numer;

retVal = (high / timebaseInfo.denom) << 32;
retVal += (low + ((high % timebaseInfo.denom) << 32)) / timebaseInfo.denom;
struct timeval tv;
gettimeofday(&tv,NULL);
retVal=tv.tv_sec;
retVal*=1000;
retVal*=1000;
retVal+=tv.tv_usec;
retVal*=1000;
#else
struct timespec tp;
int rc = clock_gettime(CLOCK_MONOTONIC, &tp);
Expand Down

0 comments on commit dc32152

Please sign in to comment.