fix gc handling from deallocate

This commit is contained in:
Vítor Santos Costa 2016-01-06 12:30:33 +00:00
parent c56b822cba
commit c8addfd509
2 changed files with 9 additions and 6 deletions

View File

@ -1109,7 +1109,7 @@ interrupt_deallocate( USES_REGS1 )
} }
return interrupt_handler( pe PASS_REGS ); return interrupt_handler( pe PASS_REGS );
} }
if (!Yap_locked_gc(0, ENV, CP)) { if (!Yap_locked_gc(0, ENV, YESCODE)) {
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
} }
S = ASP; S = ASP;

View File

@ -426,6 +426,10 @@
Op(deallocate, p); Op(deallocate, p);
CACHE_Y_AS_ENV(YREG); CACHE_Y_AS_ENV(YREG);
check_trail(TR); check_trail(TR);
#ifndef NO_CHECKING
/* check stacks */
check_stack(NoStackDeallocate, HR);
#endif
PREG = NEXTOP(PREG, p); PREG = NEXTOP(PREG, p);
/* other instructions do depend on S being set by deallocate /* other instructions do depend on S being set by deallocate
:-( */ :-( */
@ -452,24 +456,23 @@
ENV_YREG = (CELL *) ((CELL) ENV_YREG + ENV_Size(CPREG)); ENV_YREG = (CELL *) ((CELL) ENV_YREG + ENV_Size(CPREG));
#endif /* FROZEN_STACKS */ #endif /* FROZEN_STACKS */
WRITEBACK_Y_AS_ENV(); WRITEBACK_Y_AS_ENV();
#ifndef NO_CHECKING
/* check stacks */
check_stack(NoStackDeallocate, HR);
#endif
ENDCACHE_Y_AS_ENV(); ENDCACHE_Y_AS_ENV();
GONext(); GONext();
NoStackDeallocate: NoStackDeallocate:
BEGD(d0); BEGD(d0);
#ifdef SHADOW_S #ifdef SHADOW_S
Yap_REGS.S_ = SREG; Yap_REGS.S_ = YREG;
#endif #endif
PREG = NEXTOP(PREG,p);
saveregs(); saveregs();
d0 = interrupt_deallocate( PASS_REGS1 ); d0 = interrupt_deallocate( PASS_REGS1 );
setregs(); setregs();
PREG = PREVOP(PREG,p);
#ifdef SHADOW_S #ifdef SHADOW_S
SREG = Yap_REGS.S_; SREG = Yap_REGS.S_;
#endif #endif
// return to original deallocate
if (!d0) FAIL(); if (!d0) FAIL();
JMPNext(); JMPNext();
ENDD(d0); ENDD(d0);