CVS: sml/src/runtime/mach-dep ALPHA32.prim.asm,1.3,1.4 HPPA.prim.asm,1.2,1.3 PPC.prim.asm,1.7,1.8 SPARC.prim.asm,1.3,1.4 X86.prim.asm,1.7,1.8 X86.prim.masm,1.4,1.5 signal-util.c,1.4,1.5 unix-signal.c,1.5,1.6
John Reppy <[email protected]>
| Newsgroups | gmane.comp.lang.sml.smlnj.commits |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/smlnj/sml/src/runtime/mach-dep
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30184/mach-dep
Modified Files:
ALPHA32.prim.asm HPPA.prim.asm PPC.prim.asm SPARC.prim.asm
X86.prim.asm X86.prim.masm signal-util.c unix-signal.c
Log Message:
New scheme for managing signals in the runtime system that should avoid
race conditions (thanks to Cynbe for the design).
Index: ALPHA32.prim.asm
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/mach-dep/ALPHA32.prim.asm,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ALPHA32.prim.asm 29 Mar 2002 19:09:47 -0000 1.3
--- ALPHA32.prim.asm 3 May 2005 17:26:47 -0000 1.4
***************
*** 302,307 ****
ldl PTRTMP,NPendingSysOffVSP(NEEDGC)
.set noat
! ldl $28,NPendingOffVSP(NEEDGC)
! addq PTRTMP,$28,PTRTMP
.set at
bne PTRTMP,pending_sigs
--- 302,308 ----
ldl PTRTMP,NPendingSysOffVSP(NEEDGC)
.set noat
! ldl $28,SigsRecvOffVSP(NEEDGC)
! ldl PTRTMP,SigsHandledOffVSP(NEEDGC)
! cmpeq $28,PTRTMP,PTRTMP
.set at
bne PTRTMP,pending_sigs
Index: HPPA.prim.asm
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/mach-dep/HPPA.prim.asm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HPPA.prim.asm 1 Jun 2000 18:33:51 -0000 1.2
--- HPPA.prim.asm 3 May 2005 17:26:47 -0000 1.3
***************
*** 323,330 ****
ldw PCOffMSP(tmp1), pc
/* check for pending signals */
! ldw NPendingSysOffVSP(tmp4), tmp2
! ldw NPendingOffVSP(tmp4), tmp3
! add tmp2, tmp3, tmp2
! combf,= tmp2, zero, pending_sigs
nop
--- 323,329 ----
ldw PCOffMSP(tmp1), pc
/* check for pending signals */
! ldw SigsRecvOffVSP(tmp4), tmp2
! ldw SigsHandledOffVSP(tmp4), tmp3
! combf,= tmp2, tmp3, pending_sigs
nop
Index: PPC.prim.asm
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/mach-dep/PPC.prim.asm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** PPC.prim.asm 13 Jul 2004 03:49:09 -0000 1.7
--- PPC.prim.asm 3 May 2005 17:26:47 -0000 1.8
***************
*** 446,454 ****
mtlr atmp3
/* check for pending signals */
! lwz atmp1,NPendingSysOffVSP(atmp2)
! lwz atmp3,NPendingOffVSP(atmp2)
! add atmp1,atmp1,atmp3
! cmpi CR0,atmp1,0
! bf CR0_EQ,pending_sigs
--- 446,453 ----
mtlr atmp3
/* check for pending signals */
! lwz atmp1,SigsRecvOffVSP(atmp2) /* number of signals received */
! lwz atmp3,SigsHandledOffVSP(atmp2) /* number of signals handled */
! cmp CR0,atmp1,atmp3
! bne pending_sigs /* if not equal, then pending sigs */
***************
*** 464,470 ****
pending_sigs: /* there are pending signals */
- lwz atmp1,InSigHandlerOffVSP(atmp2)
- cmpi CR0,atmp1,0
- bf CR0_EQ,CSYM(ml_go)
/* check if currently handling a signal */
lwz atmp1,InSigHandlerOffVSP(atmp2)
--- 463,466 ----
Index: SPARC.prim.asm
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/mach-dep/SPARC.prim.asm,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SPARC.prim.asm 15 Jun 2001 19:05:19 -0000 1.3
--- SPARC.prim.asm 3 May 2005 17:26:48 -0000 1.4
***************
*** 287,293 ****
set 1,TMPREG2 /* note that we have entered ML code */
st TMPREG2,[VProcPtr+InMLOffVSP]
! ld [VProcPtr+NPendingSysOffVSP],TMPREG2 /* check for pending signals */
! ld [VProcPtr+NPendingOffVSP],TMPREG3
! addcc TMPREG2,TMPREG3,%g0
bne pending_sigs
nop
--- 287,293 ----
set 1,TMPREG2 /* note that we have entered ML code */
st TMPREG2,[VProcPtr+InMLOffVSP]
! ld [VProcPtr+SigsRecvOffVSP],TMPREG2 /* check for pending signals */
! ld [VProcPtr+SigsHandledOffVSP],TMPREG3
! subcc TMPREG2,TMPREG3,%g0
bne pending_sigs
nop
Index: X86.prim.asm
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/mach-dep/X86.prim.asm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** X86.prim.asm 16 May 2003 16:59:29 -0000 1.7
--- X86.prim.asm 3 May 2005 17:26:49 -0000 1.8
***************
*** 307,313 ****
/* handle signals */
! MOV_L(REGOFF(NPendingSysOffVSP,vsp),tmpreg)
! ADD_L(REGOFF(NPendingOffVSP,vsp),tmpreg)
! CMP_L(CONST(0),tmpreg)
#undef tmpreg
--- 307,312 ----
/* handle signals */
! MOV_L(REGOFF(SigsRecvOffVSP,vsp),tmpreg)
! CMP_L(REGOFF(SigsHandledOffVSP,vsp),tmpreg)
#undef tmpreg
Index: X86.prim.masm
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/mach-dep/X86.prim.masm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** X86.prim.masm 11 Aug 2003 20:45:59 -0000 1.4
--- X86.prim.masm 3 May 2005 17:26:49 -0000 1.5
***************
*** 336,342 ****
/* handle signals */
! MOVL (REGOFF(NPendingSysOffVSP,vsp),tmpreg)
! ADDL (REGOFF(NPendingOffVSP,vsp),tmpreg)
! CMPL (IMMED(0),tmpreg)
#undef tmpreg
--- 336,341 ----
/* handle signals */
! MOV_L(REGOFF(SigsRecvOffVSP,vsp),tmpreg)
! CMP_L(REGOFF(SigsHandledOffVSP,vsp),tmpreg)
#undef tmpreg
Index: signal-util.c
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/mach-dep/signal-util.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** signal-util.c 19 Jun 2001 21:24:35 -0000 1.4
--- signal-util.c 3 May 2005 17:26:49 -0000 1.5
***************
*** 26,42 ****
void ChooseSignal (vproc_state_t *vsp)
{
! ASSERT(vsp->vp_numInQ > 0);
! /* record the signal and count */
! vsp->vp_sigCode = vsp->vp_pendingSigQ[vsp->vp_nextPendingSig].sigNum;
! vsp->vp_sigCount = vsp->vp_pendingSigQ[vsp->vp_nextPendingSig].count;
! if (IS_SYSTEM_SIG(vsp->vp_sigCode))
! vsp->vp_numPendingSysSigs -= vsp->vp_sigCount;
! else
! vsp->vp_numPendingSigs -= vsp->vp_sigCount;
! /* advance the pending queue */
! if ((--vsp->vp_numInQ == 0) || (++vsp->vp_nextPendingSig == NUM_SIGS))
! vsp->vp_nextPendingSig = 0;
#ifdef SIGNAL_DEBUG
--- 26,47 ----
void ChooseSignal (vproc_state_t *vsp)
{
! int i, j, delta;
! /* scan the signal counts looking for a signal that needs to be handled. */
! i = vsp->vp_nextPendingSig;
! j = 0;
! do {
! ASSERT (j++ < NUM_SIGS);
! i++;
! if (i == SIGMAP_SZ) i = MIN_SYSTEM_SIG;
! delta = vsp->vp_sigCounts[i].nReceived - vsp->vp_sigCounts[i].nHandled;
! } while (delta == 0);
! vsp->vp_nextPendingSig = i;
! /* record the signal and count */
! vsp->vp_sigCode = i;
! vsp->vp_sigCount = delta;
! vsp->vp_sigCounts[i].nHandled += delta;
! vsp->vp_totalSigCount.nHandled += delta;
#ifdef SIGNAL_DEBUG
***************
*** 48,82 ****
- /* EnqueueSignal:
- *
- * Add a signal to the pending queue; if the signal is already present, then
- * bump its count.
- */
- void EnqueueSignal (vproc_state_t *vsp, int sigCode)
- {
- int i, j;
-
- #ifdef SIGNAL_DEBUG
- SayDebug("EnqueueSignal: numInQ = %d, sig = %d\n", vsp->vp_numInQ, sigCode);
- #endif
-
- ASSERT(vsp->vp_numInQ >= 0);
-
- for (i = vsp->vp_nextPendingSig, j = vsp->vp_numInQ; --j >= 0; ) {
- if (vsp->vp_pendingSigQ[i].sigNum == sigCode)
- break;
- if (++i == NUM_SIGS) i = 0;
- }
- if (j < 0) {
- vsp->vp_pendingSigQ[i].sigNum = sigCode;
- vsp->vp_pendingSigQ[i].count = 1;
- vsp->vp_numInQ++;
- }
- else
- vsp->vp_pendingSigQ[i].count++;
-
- } /* end of EnqueueSignal */
-
-
/* MakeResumeCont:
*
--- 53,56 ----
***************
*** 169,189 ****
} /* end of LoadResumeState */
-
-
- /* GCSignal:
- *
- * Record a garbage collection signal (if enabled). Return true, if a signal
- * was recorded.
- */
- bool_t GCSignal (vproc_state_t *vsp)
- {
- if (vsp->vp_gcSigState == ML_SIG_ENABLED) {
- vsp->vp_numPendingSigs++;
- EnqueueSignal (vsp, RUNSIG_GC);
- return TRUE;
- }
- else
- return FALSE;
-
- } /* end of GCSignal */
-
--- 143,144 ----
Index: unix-signal.c
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/mach-dep/unix-signal.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** unix-signal.c 20 Apr 2001 15:07:30 -0000 1.5
--- unix-signal.c 3 May 2005 17:26:49 -0000 1.6
***************
*** 138,143 ****
vproc_state_t *vsp = SELF_VPROC;
! EnqueueSignal(vsp, sig);
! vsp->vp_numPendingSysSigs++;
/* The following line is needed only when currently executing
--- 138,148 ----
vproc_state_t *vsp = SELF_VPROC;
! vsp->vp_sigCounts[sig].nReceived++;
! vsp->vp_totalSigCount.nReceived++;
!
! #ifdef SIGNAL_DEBUG
! SayDebug ("CSigHandler: sig = %d, pending = %d, inHandler = %d\n",
! sig, vsp->vp_handlerPending, vsp->vp_inSigHandler);
! #endif
/* The following line is needed only when currently executing
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20