From 7207c18e65d5e7a09e84e76b71bea5a2aef39045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20de=20Costa?= Date: Sat, 18 Oct 2008 11:03:25 +0100 Subject: [PATCH] fix longmp in trow not to recover trail. This way we do not need to do copy_term/2 and we avoid losing the attributed variable stack. --- C/exec.c | 2 ++ C/globals.c | 2 +- C/grow.c | 6 +++--- C/tracer.c | 2 +- H/sshift.h | 2 +- pl/boot.yap | 4 +--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/C/exec.c b/C/exec.c index 1ba47f3e9..f0d5a32fb 100644 --- a/C/exec.c +++ b/C/exec.c @@ -1925,6 +1925,8 @@ JumpToEnv(Term t) { B->cp_env = (CELL *)env[E_E]; /* cannot recover Heap because of copy term :-( */ B->cp_h = H; + /* nor can I recover terms */ + B->cp_tr = TR; /* I could backtrack here, but it is easier to leave the unwinding to the emulator */ B->cp_a3 = t; diff --git a/C/globals.c b/C/globals.c index 08bd9841b..87c906fbd 100644 --- a/C/globals.c +++ b/C/globals.c @@ -723,7 +723,7 @@ CopyTermToArena(Term t, Term arena, int share, UInt arity, Term *newarena, Term CELL *oldH = H; CELL *oldHB = HB; CELL *oldASP = ASP; - int res; + int res = 0; #if COROUTINING Term old_delay_arena; #endif diff --git a/C/grow.c b/C/grow.c index 483c8d281..6d6f736f7 100644 --- a/C/grow.c +++ b/C/grow.c @@ -856,9 +856,9 @@ static_growglobal(long size, CELL **ptr, CELL *hsplit) fprintf(Yap_stderr, "%% %cO Total of %g sec expanding stacks \n", vb_msg1, (double)total_delay_overflow_time/1000); } LeaveGrowMode(GrowStackMode); - if (hsplit) - return GDiff-GDiff0; - else + if (hsplit) { + return size0; + } else return GDiff-DelayDiff; } diff --git a/C/tracer.c b/C/tracer.c index 01d0dc3db..6898ae555 100644 --- a/C/tracer.c +++ b/C/tracer.c @@ -62,7 +62,7 @@ send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args) if (i > 0) fprintf(Yap_stderr, ","); #if DEBUG #if COROUTINING - Yap_Portray_delays = FALSE; + Yap_Portray_delays = TRUE; #endif #endif omax_depth = max_depth; diff --git a/H/sshift.h b/H/sshift.h index ed243e28e..f1b0f982a 100644 --- a/H/sshift.h +++ b/H/sshift.h @@ -149,7 +149,7 @@ inline EXTERN CELL DelayAdjust (CELL); inline EXTERN CELL DelayAdjust (CELL val) { - return (CELL) ((val + DelayDiff)); + return (CELL) (val + DelayDiff); } diff --git a/pl/boot.yap b/pl/boot.yap index 78a6ec73d..8671058d4 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -1138,10 +1138,8 @@ catch(G, C, A) :- % throw has to be *exactly* after system catch! % throw(Ball) :- - % get this off the unwound computation. - duplicate_term(Ball,NewBall), % get current jump point - '$jump_env_and_store_ball'(NewBall). + '$jump_env_and_store_ball'(Ball). % just create a choice-point