diff --git a/C/absmi.c b/C/absmi.c index 20d28fa87..957afdd55 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -10,8 +10,11 @@ * * * File: absmi.c * * comments: Portable abstract machine interpreter * -* Last rev: $Date: 2006-12-27 01:32:37 $,$Author: vsc $ * +* Last rev: $Date: 2006-12-29 01:57:50 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.215 2006/12/27 01:32:37 vsc +* diverse fixes +* * Revision 1.214 2006/11/28 00:46:28 vsc * fix bug in threaded implementation * @@ -507,7 +510,6 @@ char *Yap_op_names[_std_top + 1] = #endif - Int Yap_absmi(int inp) { @@ -2086,6 +2088,7 @@ Yap_absmi(int inp) #ifdef FROZEN_STACKS { tr_fr_ptr pt0, pt1, pbase; + pbase = B->cp_tr; pt0 = pt1 = TR - 1; while (pt1 >= pbase) { diff --git a/C/globals.c b/C/globals.c index 5a9743ca6..d73a1e4da 100644 --- a/C/globals.c +++ b/C/globals.c @@ -148,7 +148,7 @@ NewDelayArena(UInt size) UInt howmuch; while ((ADDR)min < Yap_GlobalBase+1024) { - if ((howmuch = Yap_InsertInGlobal((CELL *)max, size*sizeof(attvar_record))==0)) { + if ((howmuch = Yap_InsertInGlobal((CELL *)max, size*sizeof(attvar_record)))==0) { Yap_Error(OUT_OF_STACK_ERROR,TermNil,"No Stack Space for Non-Backtrackable terms"); return TermNil; } diff --git a/C/heapgc.c b/C/heapgc.c index fe845d561..5448d4211 100644 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -126,7 +126,7 @@ static cont *cont_top; static gc_ma_hash_entry gc_ma_hash_table[GC_MAVARS_HASH_SIZE]; -static gc_ma_hash_entry *gc_ma_h_top; +static gc_ma_hash_entry *gc_ma_h_top, *gc_ma_h_list; static UInt gc_timestamp; /* an unsigned int */ @@ -337,6 +337,11 @@ gc_lookup_ma_var(CELL *addr, tr_fr_ptr trp) { if (gc_ma_hash_table[i].timestmp != gc_timestamp) { gc_ma_hash_table[i].timestmp = gc_timestamp; gc_ma_hash_table[i].addr = addr; +#if TABLING + gc_ma_hash_table[i].loc = trp; + gc_ma_hash_table[i].more = gc_ma_h_list; + gc_ma_h_list = gc_ma_hash_table+i; +#endif gc_ma_hash_table[i].next = NULL; return NULL; } @@ -344,6 +349,13 @@ gc_lookup_ma_var(CELL *addr, tr_fr_ptr trp) { while (nptr) { optr = nptr; if (nptr->addr == addr) { +#if TABLING + /* + we're moving from oldest to more recent, so only a new entry + has the correct new value + */ + TrailVal(nptr->loc+1) = TrailVal(trp+1); +#endif return nptr; } nptr = nptr->next; @@ -351,13 +363,20 @@ gc_lookup_ma_var(CELL *addr, tr_fr_ptr trp) { nptr = GC_ALLOC_NEW_MASPACE(); optr->next = nptr; nptr->addr = addr; +#if TABLING + nptr->loc = trp; +#endif nptr->next = NULL; + nptr->more = gc_ma_h_list; + gc_ma_h_list = nptr; return NULL; } static inline void GC_NEW_MAHASH(gc_ma_hash_entry *top) { UInt time = ++gc_timestamp; + + gc_ma_h_list = NULL; if (time == 0) { unsigned int i; @@ -1651,11 +1670,10 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B mark_external_reference(&(TrailTerm(trail_base))); /* reset the gc to believe the original tag */ TrailTerm(trail_base) = AbsAppl((CELL *)TrailTerm(trail_base)); -#ifdef TABLING - mark_external_reference(&(TrailVal(trail_base))); -#endif } -#ifndef TABLING +#ifdef TABLING + mark_external_reference(&(TrailVal(trail_base))); +#else trail_base++; mark_external_reference(&(TrailTerm(trail_base))); #endif @@ -1666,9 +1684,6 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B mark_external_reference(&(TrailTerm(trail_base))); /* reset the gc to believe the original tag */ TrailTerm(trail_base) = AbsAppl((CELL *)TrailTerm(trail_base)); -#ifdef TABLING - mark_external_reference(&(TrailVal(trail_base))); -#endif } } else { remove_trash_entry: @@ -1695,6 +1710,19 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B #endif trail_base++; } +#if TABLING + /* + Ugly, but needed: we're not really sure about what were the new + values until the very end + */ + { + gc_ma_hash_entry *gl = gc_ma_h_list; + while (gl) { + mark_external_reference(&(TrailVal(gl->loc+1))); + gl = gl->more; + } + } +#endif #ifdef EASY_SHUNTING sTR = (tr_fr_ptr)old_cont_top0; while (begsTR != NULL) { @@ -2373,6 +2401,8 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR) Int marked_val_ptr = MARKED_PTR(&TrailVal(trail_ptr+1)); TrailTerm(dest+1) = TrailTerm(dest) = trail_cell; + TrailVal(dest) = old; + TrailVal(dest+1) = old1; if (marked_ptr) { UNMARK(&TrailTerm(dest)); UNMARK(&TrailTerm(dest+1)); diff --git a/C/tracer.c b/C/tracer.c index e077ccbc3..afd264619 100644 --- a/C/tracer.c +++ b/C/tracer.c @@ -160,7 +160,6 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) LOCK(Yap_heap_regs->low_level_trace_lock); sc = Yap_heap_regs; - vsc_count++; #ifdef COMMENTED if (vsc_count > 1388060LL && vsc_count < 1388070LL) { if (vsc_count==1388061LL) diff --git a/H/Heap.h b/H/Heap.h index be1bdb497..82f8e97ad 100644 --- a/H/Heap.h +++ b/H/Heap.h @@ -10,7 +10,7 @@ * File: Heap.h * * mods: * * comments: Heap Init Structure * -* version: $Id: Heap.h,v 1.111 2006-12-27 01:32:37 vsc Exp $ * +* version: $Id: Heap.h,v 1.112 2006-12-29 01:57:50 vsc Exp $ * *************************************************************************/ /* information that can be stored in Code Space */ @@ -46,6 +46,10 @@ typedef struct memory_hole { typedef struct gc_ma_hash_entry_struct { UInt timestmp; +#if TABLING + tr_fr_ptr loc; + struct gc_ma_hash_entry_struct *more; +#endif CELL* addr; struct gc_ma_hash_entry_struct *next; } gc_ma_hash_entry; @@ -153,6 +157,7 @@ typedef struct worker_local_struct { int disc_trail_entries; gc_ma_hash_entry Gc_ma_hash_table[GC_MAVARS_HASH_SIZE]; gc_ma_hash_entry *Gc_ma_h_top; + gc_ma_hash_entry *Gc_ma_h_list; UInt Gc_timestamp; /* an unsigned int */ ADDR DB_vec, DB_vec0; struct RB_red_blk_node *DB_root, *DB_nil; @@ -847,6 +852,7 @@ struct various_codes *Yap_heap_regs; #endif /* GC_NO_TAGS */ #define gc_ma_hash_table Yap_heap_regs->wl[worker_id].Gc_ma_hash_table #define gc_ma_h_top Yap_heap_regs->wl[worker_id].Gc_ma_h_top +#define gc_ma_h_list Yap_heap_regs->wl[worker_id].Gc_ma_h_list #define gc_timestamp Yap_heap_regs->wl[worker_id].Gc_timestamp #define cont_top0 Yap_heap_regs->wl[worker_id].conttop0 #define db_vec Yap_heap_regs->wl[worker_id].DB_vec diff --git a/changes-5.1.html b/changes-5.1.html index 894a33033..405714eba 100644 --- a/changes-5.1.html +++ b/changes-5.1.html @@ -16,6 +16,8 @@

Yap-5.1.2: