From 5c83d305fcaa7f6b35c69139429121dda4f76a32 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 17 Jun 2016 16:13:15 +0100 Subject: [PATCH] reorder init to handle possible overflows --- C/exec.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/C/exec.c b/C/exec.c index 7b8543dbd..16688e6c2 100755 --- a/C/exec.c +++ b/C/exec.c @@ -1553,7 +1553,7 @@ void Yap_fail_all(choiceptr bb USES_REGS) { P = saved_p; } -bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) { +bool Yap_execute_pred( PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) { yamop *saved_p, *saved_cp; yamop *CodeAdr; bool out; @@ -2085,7 +2085,6 @@ void Yap_InitYaamRegs(int myworker_id) { HR = RepAppl(REMOTE_GlobalArena(myworker_id)); } REMOTE_GlobalArena(myworker_id) = TermNil; - Yap_AllocateDefaultArena(128 * 1024, 2, myworker_id); Yap_InitPreAllocCodeSpace(myworker_id); #ifdef FROZEN_STACKS H_FZ = HR; @@ -2117,8 +2116,18 @@ void Yap_InitYaamRegs(int myworker_id) { PP = NULL; PREG_ADDR = NULL; #endif + Yap_AllocateDefaultArena(128 * 1024, 2, myworker_id); cut_c_initialize(myworker_id); Yap_PrepGoal(0, NULL, NULL PASS_REGS); +#ifdef FROZEN_STACKS + H_FZ = HR; +#ifdef YAPOR_SBA + BSEG = +#endif /* YAPOR_SBA */ + BBREG = B_FZ = (choiceptr)REMOTE_LocalBase(myworker_id); + TR = TR_FZ = (tr_fr_ptr)REMOTE_TrailBase(myworker_id); +#endif /* FROZEN_STACKS */ + CalculateStackGap(PASS_REGS1); #ifdef TABLING /* ensure that LOCAL_top_dep_fr is always valid */ if (REMOTE_top_dep_fr(myworker_id))