fixes: checking sigs & no threads

This commit is contained in:
Vítor Santos Costa 2014-09-03 11:02:28 -05:00
parent b942c1ef13
commit f291c37dfc

View File

@ -151,13 +151,13 @@ get_signal(yap_signals sig USES_REGS)
// reset the flag // reset the flag
if ( (old =__sync_fetch_and_and( &LOCAL_Signals, ~SIGNAL_TO_BIT(sig) ) ) != if ( (old =__sync_fetch_and_and( &LOCAL_Signals, ~SIGNAL_TO_BIT(sig) ) ) !=
SIGNAL_TO_BIT(sig)) { SIGNAL_TO_BIT(sig)) {
if (!(old & SIGNAL_TO_BIT(sig)) ) {
// weird, it was consumed?
return FALSE;
}
if (!LOCAL_InterruptsDisabled && LOCAL_Signals != 0) { if (!LOCAL_InterruptsDisabled && LOCAL_Signals != 0) {
CreepFlag = (CELL)LCL0; CreepFlag = (CELL)LCL0;
} }
if (!(old & SIGNAL_TO_BIT(sig)) ) {
// not there?
return FALSE;
}
// more likely case, we have other interrupts. // more likely case, we have other interrupts.
return TRUE; return TRUE;
} }
@ -165,10 +165,10 @@ get_signal(yap_signals sig USES_REGS)
return TRUE; return TRUE;
// should we set the flag? // should we set the flag?
#else #else
if (LOCAL_Signals & 1LL<sig) { if (LOCAL_Signals & SIGNAL_TO_BIT(sig)) {
LOCAL_Signals &= ~(1LL<sig); LOCAL_Signals &= ~SIGNAL_TO_BIT(sig);
if (!LOCAL_InterruptsDisabled && LOCAL_Signals != 0) { if (!LOCAL_InterruptsDisabled && LOCAL_Signals != 0) {
Creep Flag = (CELL)LCL0; CreepFlag = (CELL)LCL0;
} else { } else {
CalculateStackGap( PASS_REGS1 ); CalculateStackGap( PASS_REGS1 );
} }
@ -270,7 +270,7 @@ Yap_get_signal__(yap_signals sig USES_REGS)
int int
Yap_has_signals__(yap_signals sig1, yap_signals sig2 USES_REGS) Yap_has_signals__(yap_signals sig1, yap_signals sig2 USES_REGS)
{ {
return LOCAL_Signals & (1LL<sig1|1LL<sig2); return LOCAL_Signals & (SIGNAL_TO_BIT(sig1)|SIGNAL_TO_BIT(sig2));
} }
@ -278,8 +278,8 @@ int
Yap_only_has_signals__(yap_signals sig1, yap_signals sig2 USES_REGS) Yap_only_has_signals__(yap_signals sig1, yap_signals sig2 USES_REGS)
{ {
uint64_t sigs = LOCAL_Signals; uint64_t sigs = LOCAL_Signals;
return sigs & (1LL<sig1 | 1LL<sig2) && return sigs & (SIGNAL_TO_BIT(sig1) | SIGNAL_TO_BIT(sig2)) &&
! (sigs & ~(1LL<sig1 | 1LL<sig2)) ; ! (sigs & ~(SIGNAL_TO_BIT(sig1) | SIGNAL_TO_BIT(sig2))) ;
} }
#ifdef DEBUG #ifdef DEBUG