fix slot handling

This commit is contained in:
Vitor Santos Costa 2014-03-11 15:33:38 +00:00
parent 2812ad5704
commit d0adb0b910
6 changed files with 20 additions and 21 deletions

View File

@ -623,8 +623,8 @@ stack_overflow( CELL *env, yamop *cp USES_REGS )
if ((Int)(Unsigned(YREG) - Unsigned(HR)) < StackGap( PASS_REGS1 ) ||
Yap_undo_signal( YAP_STOVF_SIGNAL )) {
if (!Yap_gc(((PredEntry *)(S))->ArityOfPE, env, cp)) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
return 0;
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
return 0;
}
return 1;
}
@ -783,6 +783,7 @@ interrupt_handler_either( USES_REGS1 )
/* ARG0 has an extra argument for suspended cuts */
ARG2 = XREGS[0];
YENV[E_CB] = (CELL) B;
SET_ASP(YENV, E_CB*sizeof(CELL));
return interrupt_handler( PASS_REGS1 );
}
@ -874,9 +875,7 @@ interrupt_pexecute( PredEntry *pen USES_REGS )
if (Yap_only_has_signal(YAP_CREEP_SIGNAL))
return 2; /* keep on creeping */
S = (CELL *) pen;
ASP = YENV;
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
ASP = (CELL *)PROTECT_FROZEN_B(B);
SET_ASP(YENV, E_CB*sizeof(CELL));
/* setup GB */
YENV[E_CB] = (CELL) B;
if ((v = code_overflow(YENV PASS_REGS)) >= 0) return v;
@ -914,11 +913,7 @@ interrupt_deallocate( USES_REGS1 )
PP = PREVOP(P,p)->u.p.p;
ASP = YENV+E_CB;
/* cut_e */
if (YENV <= ASP) {
ASP = YENV-EnvSizeInCells;
}
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
ASP = (CELL *)PROTECT_FROZEN_B(B);
SET_ASP(YENV, E_CB*sizeof(CELL));
if ((v = code_overflow(YENV PASS_REGS)) >= 0) return v;
if (Yap_has_a_signal()) {
if (Yap_op_from_opcode(P->opc) == _cut_e) {

View File

@ -2516,9 +2516,13 @@ YAP_RunGoal(Term t)
ENV = B->cp_env;
ENV = (CELL *)ENV[E_E];
CP = old_CP;
HR = B->cp_h;
TR = B->cp_tr;
B = B->cp_b;
LOCAL_AllowRestart = FALSE;
ASP = ENV;
SET_ASP(ENV, E_CB*sizeof(CELL));
// make sure the slots are ok.
ASP = LCL0-(CurSlot+2+IntOfTerm(LCL0[-CurSlot-1]));
LOCAL_CurSlot = CurSlot;
}
RECOVER_MACHINE_REGS();

View File

@ -391,7 +391,7 @@ toggle_low_level_trace(void)
static Int p_start_low_level_trace( USES_REGS1 )
{
GLOBAL_stderr = Sopen_file("TRACER_LOG", "w");
GLOBAL_stderr = Serror; //Sopen_file("TRACER_LOG", "w");
Yap_do_low_level_trace = TRUE;
return(TRUE);
}

9
H/Regs.h Normal file → Executable file
View File

@ -722,3 +722,12 @@ CalculateStackGap( USES_REGS1 )
CreepFlag = EventFlag = StackGap( PASS_REGS1 );
}
#define SET_ASP(Y,S) SET_ASP__(Y,S PASS_REGS)
static inline
void SET_ASP__(CELL *yreg, Int sz USES_REGS) {
ASP = (CELL *) (((char *) yreg) + sz);
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
ASP = (CELL *)PROTECT_FROZEN_B(B);
}

0
H/YapHandles.h Normal file → Executable file
View File

9
H/absmi.h Normal file → Executable file
View File

@ -1588,15 +1588,6 @@ prune(choiceptr cp USES_REGS)
}
}
#define SET_ASP(Y,S) SET_ASP__(Y,S PASS_REGS)
static inline
void SET_ASP__(CELL *yreg, Int sz USES_REGS) {
ASP = (CELL *) (((char *) yreg) + sz);
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
ASP = (CELL *)PROTECT_FROZEN_B(B);
}
#if YAPOR
#define INITIALIZE_PERMVAR(PTR, V) Bind_Local((PTR), (V))
#else