fix S handling in new interrupt code
This commit is contained in:
parent
b65dee6b3a
commit
6402360691
66
C/absmi.c
66
C/absmi.c
@ -793,9 +793,16 @@ interrupt_handler_either( USES_REGS1 )
|
|||||||
return interrupt_handler( PASS_REGS1 );
|
return interrupt_handler( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* trave interrupt calls */
|
||||||
|
//#define DEBUG_INTERRUPTS 1
|
||||||
|
|
||||||
static int
|
static int
|
||||||
interrupt_fail( USES_REGS1 )
|
interrupt_fail( USES_REGS1 )
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
check_alarm_fail_int( FALSE PASS_REGS );
|
check_alarm_fail_int( FALSE PASS_REGS );
|
||||||
/* don't do debugging and stack expansion here: space will
|
/* don't do debugging and stack expansion here: space will
|
||||||
be recovered. automatically by fail, so
|
be recovered. automatically by fail, so
|
||||||
@ -817,6 +824,10 @@ interrupt_execute( USES_REGS1 )
|
|||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
check_alarm_fail_int( TRUE PASS_REGS );
|
check_alarm_fail_int( TRUE PASS_REGS );
|
||||||
PP = P->u.pp.p0;
|
PP = P->u.pp.p0;
|
||||||
if ((PP->ExtraPredFlags & NoDebugPredFlag) && (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL))
|
if ((PP->ExtraPredFlags & NoDebugPredFlag) && (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL))
|
||||||
@ -833,6 +844,10 @@ interrupt_call( USES_REGS1 )
|
|||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
check_alarm_fail_int( TRUE PASS_REGS );
|
check_alarm_fail_int( TRUE PASS_REGS );
|
||||||
// printf("%lx %p %p %lx\n", LOCAL_ActiveSignals, P->u.Osbpp.p, P->u.Osbpp.p0, P->u.Osbpp.p0->ExtraPredFlags);
|
// printf("%lx %p %p %lx\n", LOCAL_ActiveSignals, P->u.Osbpp.p, P->u.Osbpp.p0, P->u.Osbpp.p0->ExtraPredFlags);
|
||||||
PP = P->u.Osbpp.p0;
|
PP = P->u.Osbpp.p0;
|
||||||
@ -850,6 +865,10 @@ interrupt_pexecute( PredEntry *pen USES_REGS )
|
|||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
check_alarm_fail_int( 2 PASS_REGS );
|
check_alarm_fail_int( 2 PASS_REGS );
|
||||||
PP = NULL;
|
PP = NULL;
|
||||||
if (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL)
|
if (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL)
|
||||||
@ -875,6 +894,10 @@ interrupt_deallocate( USES_REGS1 )
|
|||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
check_alarm_fail_int( TRUE PASS_REGS );
|
check_alarm_fail_int( TRUE PASS_REGS );
|
||||||
/*
|
/*
|
||||||
don't do a creep here; also, if our instruction is followed by
|
don't do a creep here; also, if our instruction is followed by
|
||||||
@ -918,6 +941,10 @@ interrupt_deallocate( USES_REGS1 )
|
|||||||
static int
|
static int
|
||||||
interrupt_cut( USES_REGS1 )
|
interrupt_cut( USES_REGS1 )
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
check_alarm_fail_int( 2 PASS_REGS );
|
check_alarm_fail_int( 2 PASS_REGS );
|
||||||
if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) {
|
if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) {
|
||||||
return 2;
|
return 2;
|
||||||
@ -932,6 +959,10 @@ interrupt_cut( USES_REGS1 )
|
|||||||
static int
|
static int
|
||||||
interrupt_cut_t( USES_REGS1 )
|
interrupt_cut_t( USES_REGS1 )
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
check_alarm_fail_int( 2 PASS_REGS );
|
check_alarm_fail_int( 2 PASS_REGS );
|
||||||
if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) {
|
if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) {
|
||||||
return 2;
|
return 2;
|
||||||
@ -946,7 +977,10 @@ interrupt_cut_t( USES_REGS1 )
|
|||||||
static int
|
static int
|
||||||
interrupt_commit_y( USES_REGS1 )
|
interrupt_commit_y( USES_REGS1 )
|
||||||
{
|
{
|
||||||
check_alarm_fail_int( 2 PASS_REGS );
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) {
|
if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
@ -960,6 +994,10 @@ interrupt_commit_y( USES_REGS1 )
|
|||||||
static int
|
static int
|
||||||
interrupt_commit_x( USES_REGS1 )
|
interrupt_commit_x( USES_REGS1 )
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
check_alarm_fail_int( 2 PASS_REGS );
|
check_alarm_fail_int( 2 PASS_REGS );
|
||||||
if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) {
|
if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) {
|
||||||
return 2;
|
return 2;
|
||||||
@ -987,6 +1025,10 @@ interrupt_either( USES_REGS1 )
|
|||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
check_alarm_fail_int( 2 PASS_REGS );
|
check_alarm_fail_int( 2 PASS_REGS );
|
||||||
if (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL)
|
if (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL)
|
||||||
return 2;
|
return 2;
|
||||||
@ -1006,6 +1048,10 @@ interrupt_dexecute( USES_REGS1 )
|
|||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
|
#ifdef DEBUG_INTERRUPTS
|
||||||
|
fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \
|
||||||
|
__FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP);
|
||||||
|
#endif
|
||||||
check_alarm_fail_int( 2 PASS_REGS );
|
check_alarm_fail_int( 2 PASS_REGS );
|
||||||
PP = P->u.pp.p0;
|
PP = P->u.pp.p0;
|
||||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL &&
|
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL &&
|
||||||
@ -3009,9 +3055,15 @@ Yap_absmi(int inp)
|
|||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
NoStackFail:
|
NoStackFail:
|
||||||
BEGD(d0);
|
BEGD(d0);
|
||||||
|
#ifdef SHADOW_S
|
||||||
|
Yap_REGS.S_ = SREG;
|
||||||
|
#endif
|
||||||
saveregs();
|
saveregs();
|
||||||
d0 = interrupt_fail( PASS_REGS1 );
|
d0 = interrupt_fail( PASS_REGS1 );
|
||||||
setregs();
|
setregs();
|
||||||
|
#ifdef SHADOW_S
|
||||||
|
SREG = Yap_REGS.S_;
|
||||||
|
#endif
|
||||||
if (!d0) FAIL();
|
if (!d0) FAIL();
|
||||||
JMPNext();
|
JMPNext();
|
||||||
ENDD(d0);
|
ENDD(d0);
|
||||||
@ -3480,9 +3532,15 @@ Yap_absmi(int inp)
|
|||||||
|
|
||||||
NoStackDeallocate:
|
NoStackDeallocate:
|
||||||
BEGD(d0);
|
BEGD(d0);
|
||||||
|
#ifdef SHADOW_S
|
||||||
|
Yap_REGS.S_ = SREG;
|
||||||
|
#endif
|
||||||
saveregs();
|
saveregs();
|
||||||
d0 = interrupt_deallocate( PASS_REGS1 );
|
d0 = interrupt_deallocate( PASS_REGS1 );
|
||||||
setregs();
|
setregs();
|
||||||
|
#ifdef SHADOW_S
|
||||||
|
SREG = Yap_REGS.S_;
|
||||||
|
#endif
|
||||||
if (!d0) FAIL();
|
if (!d0) FAIL();
|
||||||
JMPNext();
|
JMPNext();
|
||||||
ENDD(d0);
|
ENDD(d0);
|
||||||
@ -13648,9 +13706,15 @@ Yap_absmi(int inp)
|
|||||||
/* at this point, we have the arguments all set in the argument registers, pen says who is the current predicate. don't remove. */
|
/* at this point, we have the arguments all set in the argument registers, pen says who is the current predicate. don't remove. */
|
||||||
NoStackPExecute:
|
NoStackPExecute:
|
||||||
WRITEBACK_Y_AS_ENV();
|
WRITEBACK_Y_AS_ENV();
|
||||||
|
#ifdef SHADOW_S
|
||||||
|
Yap_REGS.S_ = SREG;
|
||||||
|
#endif
|
||||||
saveregs();
|
saveregs();
|
||||||
d0 = interrupt_pexecute( pen PASS_REGS );
|
d0 = interrupt_pexecute( pen PASS_REGS );
|
||||||
setregs();
|
setregs();
|
||||||
|
#ifdef SHADOW_S
|
||||||
|
SREG = Yap_REGS.S_;
|
||||||
|
#endif
|
||||||
if (!d0) FAIL();
|
if (!d0) FAIL();
|
||||||
if (d0 == 2) goto execute_stack_checked;
|
if (d0 == 2) goto execute_stack_checked;
|
||||||
goto execute_end;
|
goto execute_end;
|
||||||
|
@ -159,7 +159,6 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
gc_ENV = (CELL *) gc_ENV[E_E]; /* link to prev
|
gc_ENV = (CELL *) gc_ENV[E_E]; /* link to prev
|
||||||
* environment */
|
* environment */
|
||||||
}
|
}
|
||||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
|
||||||
return;
|
return;
|
||||||
{
|
{
|
||||||
choiceptr b_p = B;
|
choiceptr b_p = B;
|
||||||
|
14
H/absmi.h
14
H/absmi.h
@ -1607,6 +1607,19 @@ void SET_ASP__(CELL *yreg, Int sz USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef SHADOW_S
|
||||||
|
#define PROCESS_INT( F, C ) \
|
||||||
|
BEGD(d0); \
|
||||||
|
Yap_REGS.S_ = SREG; \
|
||||||
|
saveregs(); \
|
||||||
|
d0 = F ( PASS_REGS1 );\
|
||||||
|
setregs(); \
|
||||||
|
SREG = Yap_REGS.S_; \
|
||||||
|
if (!d0) FAIL(); \
|
||||||
|
if (d0 == 2) goto C; \
|
||||||
|
JMPNext(); \
|
||||||
|
ENDD(d0);
|
||||||
|
#else
|
||||||
#define PROCESS_INT( F, C ) \
|
#define PROCESS_INT( F, C ) \
|
||||||
BEGD(d0); \
|
BEGD(d0); \
|
||||||
saveregs(); \
|
saveregs(); \
|
||||||
@ -1616,4 +1629,5 @@ void SET_ASP__(CELL *yreg, Int sz USES_REGS) {
|
|||||||
if (d0 == 2) goto C; \
|
if (d0 == 2) goto C; \
|
||||||
JMPNext(); \
|
JMPNext(); \
|
||||||
ENDD(d0);
|
ENDD(d0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -2291,7 +2291,7 @@ X_API void PL_register_foreign_in_module(const char *module, const char *name, i
|
|||||||
Int nflags = 0;
|
Int nflags = 0;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (flags & (PL_FA_NOTRACE|PL_FA_CREF)) {
|
if (flags & (PL_FA_CREF)) {
|
||||||
fprintf(stderr,"PL_register_foreign_in_module called with non-implemented flag %x when creating predicate %s:%s/%d\n", flags, module, name, arity);
|
fprintf(stderr,"PL_register_foreign_in_module called with non-implemented flag %x when creating predicate %s:%s/%d\n", flags, module, name, arity);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user