diff --git a/C/amasm.c b/C/amasm.c index 5d62066f7..f59f2d2ca 100644 --- a/C/amasm.c +++ b/C/amasm.c @@ -140,6 +140,8 @@ static Int c_arg; #define TYPE_XC 2 static int c_type; +static int clause_has_blobs; + inline static YREG emit_y(Ventry *ve) { @@ -614,6 +616,7 @@ a_blob(op_numbers opcode) code_p->u.c.c = AbsAppl((CELL *)(Unsigned(code_addr) + label_offset[cpc->rnd1])); } + clause_has_blobs = TRUE; GONEXT(c); } @@ -627,6 +630,7 @@ a_ublob(op_numbers opcode, op_numbers opcode_w) AbsAppl((CELL *)(Unsigned(code_addr) + label_offset[cpc->rnd1])); } + clause_has_blobs = TRUE; GONEXT(oc); } @@ -1985,6 +1989,9 @@ do_pass(void) cl_p->ClFlags = c_mask; if (log_update) cl_p->ClFlags |= LogUpdMask; + if (clause_has_blobs) { + cl_p->ClFlags |= HasBlobsMask; + } cl_p->u2.ClExt = NULL; cl_p->Owner = YapConsultingFile(); } @@ -2583,6 +2590,7 @@ assemble(int mode) code_addr = NIL; assembling = mode; + clause_has_blobs = FALSE; label_offset = (int *)freep; pass_no = 0; asm_error = FALSE; diff --git a/C/cdmgr.c b/C/cdmgr.c index 755f1afee..9b1a9a7dc 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -363,8 +363,14 @@ retract_all(PredEntry *p) } else { if (p->PredFlags & LogUpdatePredFlag) ErCl(cl); - else - FreeCodeSpace((char *)cl); + else { + if (cl->ClFlags & HasBlobsMask) { + cl->u.NextCl = DeadClauses; + DeadClauses = cl; + } else { + FreeCodeSpace((char *)cl); + } + } } } while (q1 != p->LastClause); } @@ -1247,8 +1253,15 @@ p_purge_clauses(void) q = NextClause(q); if (pred->PredFlags & LogUpdatePredFlag) ErCl(ClauseCodeToClause(q1)); - else - FreeCodeSpace((char *)ClauseCodeToClause(q1)); + else { + Clause *cl = ClauseCodeToClause(q1); + if (cl->ClFlags & HasBlobsMask) { + cl->u.NextCl = DeadClauses; + DeadClauses = cl; + } else { + FreeCodeSpace((char *)cl); + } + } } while (q1 != pred->LastClause); pred->FirstClause = pred->LastClause = NIL; pred->OpcodeOfPred = UNDEF_OPCODE; @@ -2299,6 +2312,7 @@ p_cut_transparent(void) return(TRUE); } + void InitCdMgr(void) { diff --git a/C/heapgc.c b/C/heapgc.c index 3f1188aee..37b4642e5 100644 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -879,13 +879,15 @@ mark_variable(CELL_PTR current) if ((Functor)cnext == FunctorDBRef) { DBRef tref = DBRefOfTerm(ccur); /* make sure the reference is marked as in use */ - if ((tref->Flags & ErasedMask) && - tref->Parent != NULL && - tref->Parent->KindOfPE & LogUpdDBBit) { - *current = MkDBRefTerm(DBErasedMarker); - MARK(current); - } else { - tref->Flags |= GcFoundMask; + if (tref->Flags & InUseMask) { + if ((tref->Flags & ErasedMask) && + tref->Parent != NULL && + tref->Parent->KindOfPE & LogUpdDBBit) { + *current = MkDBRefTerm(DBErasedMarker); + MARK(current); + } else { + tref->Flags |= GcFoundMask; + } } } else { mark_db_fixed(next); @@ -1850,7 +1852,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR) #endif /* FROZEN_STACKS */ flags = Flags((CELL)pt0); #ifdef DEBUG - if (FlagOn(DBClMask, flags) && !FlagOn(LogUpdMask, flags)) { + if (FlagOn(DBClMask, flags)) { hp_entrs++; if (!FlagOn(GcFoundMask, flags)) { hp_not_in_use++; @@ -1867,7 +1869,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR) } #endif - if (!FlagOn(GcFoundMask, flags) && !FlagOn(LogUpdMask, flags)) { + if (!FlagOn(GcFoundMask, flags)) { if (FlagOn(DBClMask, flags)) { Flags((CELL)pt0) = ResetFlag(InUseMask, flags); if (FlagOn(ErasedMask, flags)) { diff --git a/C/init.c b/C/init.c index 080c03c90..16ffc8909 100644 --- a/C/init.c +++ b/C/init.c @@ -1077,6 +1077,7 @@ InitCodes(void) heap_regs->db_erased_marker->id = FunctorDBRef; heap_regs->db_erased_marker->Flags = ErasedMask; heap_regs->db_erased_marker->Code = NULL; + heap_regs->db_erased_marker->Parent = NULL; INIT_LOCK(heap_regs->db_erased_marker->lock); INIT_DBREF_COUNT(heap_regs->db_erased_marker); } diff --git a/C/tracer.c b/C/tracer.c index 1be4ff6ae..4214e279c 100644 --- a/C/tracer.c +++ b/C/tracer.c @@ -112,8 +112,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) /* extern int gc_calls; */ vsc_count++; - /* if (vsc_count < 618000) return; */ - if (vsc_count == 64) { + if (vsc_count == 32) { printf("Here I go\n"); } /* if (vsc_count > 500000) exit(0); */ diff --git a/H/clause.h b/H/clause.h index 9beb5cb06..5e9ddd6e6 100644 --- a/H/clause.h +++ b/H/clause.h @@ -81,7 +81,7 @@ typedef struct clause_struct { /* the actual owner of the clause */ Atom Owner; /* A set of flags describing info on the clause */ - OPREG ClFlags; + CELL ClFlags; #if defined(YAPOR) || defined(THREADS) /* A lock for manipulating the clause */ lockvar ClLock; diff --git a/changes4.3.html b/changes4.3.html index ab140c523..53f98ba45 100644 --- a/changes4.3.html +++ b/changes4.3.html @@ -16,6 +16,7 @@

Yap-4.3.23: