logical update semantics:
instance of erased element should fail; garbage collection now tries to recover space for code. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@512 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
c2b588795e
commit
d5a459bb08
10
C/dbase.c
10
C/dbase.c
@ -3684,10 +3684,18 @@ p_instance(void)
|
||||
{
|
||||
Term TermDB;
|
||||
Term t1 = Deref(ARG1);
|
||||
DBRef dbr;
|
||||
|
||||
if (IsVarTerm(t1) || !IsDBRefTerm(t1))
|
||||
return (FALSE);
|
||||
while ((TermDB = GetDBTerm(DBRefOfTerm(t1))) == (CELL)0) {
|
||||
dbr = DBRefOfTerm(t1);
|
||||
if (dbr->Flags & ErasedMask) {
|
||||
/* instance/2 of erased terms should fail under log update
|
||||
semantics */
|
||||
if (dbr->Parent != NULL && dbr->Parent->KindOfPE & LogUpdDBBit)
|
||||
return(FALSE);
|
||||
}
|
||||
while ((TermDB = GetDBTerm(dbr)) == (CELL)0) {
|
||||
/* oops, we are in trouble, not enough stack space */
|
||||
gc(2, ENV, P);
|
||||
t1 = Deref(ARG1);
|
||||
|
27
C/heapgc.c
27
C/heapgc.c
@ -583,7 +583,7 @@ init_dbtable(tr_fr_ptr trail_ptr) {
|
||||
flags = Flags((CELL)pt0);
|
||||
/* for the moment, if all references to the term in the stacks
|
||||
are only pointers, reset the flag */
|
||||
if (FlagOn(DBClMask, flags) && !FlagOn(LogUpdMask, flags)) {
|
||||
if (FlagOn(DBClMask, flags)) {
|
||||
if (FlagOn(DBNoVars, flags)) {
|
||||
CODEADDR entry = ((CODEADDR)pt0 - (CELL) &(((DBRef) NIL)->Flags));
|
||||
store_ref_in_dbtable((DBRef)entry);
|
||||
@ -879,7 +879,14 @@ mark_variable(CELL_PTR current)
|
||||
if ((Functor)cnext == FunctorDBRef) {
|
||||
DBRef tref = DBRefOfTerm(ccur);
|
||||
/* make sure the reference is marked as in use */
|
||||
tref->Flags |= GcFoundMask;
|
||||
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);
|
||||
}
|
||||
@ -930,6 +937,7 @@ mark_variable(CELL_PTR current)
|
||||
POP_CONTINUATION();
|
||||
}
|
||||
}
|
||||
if (next < H0) POP_CONTINUATION();
|
||||
#ifdef INSTRUMENT_GC
|
||||
inc_vars_of_type(next,gc_func);
|
||||
#endif
|
||||
@ -982,7 +990,14 @@ mark_external_reference(CELL *ptr) {
|
||||
if ((Functor)(*next) == FunctorDBRef) {
|
||||
DBRef tref = DBRefOfTerm(reg);
|
||||
/* make sure the reference is marked as in use */
|
||||
tref->Flags |= GcFoundMask;
|
||||
if ((tref->Flags & ErasedMask) &&
|
||||
tref->Parent != NULL &&
|
||||
tref->Parent->KindOfPE & LogUpdDBBit) {
|
||||
*ptr = MkDBRefTerm(DBErasedMarker);
|
||||
MARK(ptr);
|
||||
} else {
|
||||
tref->Flags |= GcFoundMask;
|
||||
}
|
||||
} else {
|
||||
mark_db_fixed(next);
|
||||
}
|
||||
@ -1852,8 +1867,8 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!FlagOn(GcFoundMask, flags)) {
|
||||
if (FlagOn(DBClMask, flags) && !FlagOn(LogUpdMask, flags)) {
|
||||
if (!FlagOn(GcFoundMask, flags) && !FlagOn(LogUpdMask, flags)) {
|
||||
if (FlagOn(DBClMask, flags)) {
|
||||
Flags((CELL)pt0) = ResetFlag(InUseMask, flags);
|
||||
if (FlagOn(ErasedMask, flags)) {
|
||||
ErDBE((DBRef) ((CELL)pt0 - (CELL) &(((DBRef) NIL)->Flags)));
|
||||
@ -3076,7 +3091,7 @@ static Int
|
||||
p_gc(void)
|
||||
{
|
||||
#ifndef FIXED_STACKS
|
||||
do_gc(0, ENV, CP);
|
||||
do_gc(0, ENV, P);
|
||||
#endif /* FIXED_STACKS */
|
||||
return(TRUE);
|
||||
}
|
||||
|
8
C/init.c
8
C/init.c
@ -1070,8 +1070,16 @@ InitCodes(void)
|
||||
heap_regs->getworkcode.u.ld.p = (CODEADDR)RepPredProp(PredPropByAtom(LookupAtom("$getwork"), 0));
|
||||
heap_regs->getworkcode_seq.u.ld.p = (CODEADDR)RepPredProp(PredPropByAtom(LookupAtom("$getwork_seq"), 0));
|
||||
#endif
|
||||
heap_regs->db_erased_marker =
|
||||
(DBRef)AllocCodeSpace(sizeof(DBStruct));
|
||||
heap_regs->db_erased_marker->id = FunctorDBRef;
|
||||
heap_regs->db_erased_marker->Flags = ErasedMask;
|
||||
heap_regs->db_erased_marker->Code = NULL;
|
||||
INIT_LOCK(heap_regs->db_erased_marker->lock);
|
||||
INIT_DBREF_COUNT(heap_regs->db_erased_marker);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
InitVersion(void)
|
||||
{
|
||||
|
2
C/save.c
2
C/save.c
@ -1158,6 +1158,8 @@ restore_codes(void)
|
||||
#endif
|
||||
if (heap_regs->last_wtime != NULL)
|
||||
heap_regs->last_wtime = (void *)PtoHeapCellAdjust((CELL *)(heap_regs->last_wtime));
|
||||
heap_regs->db_erased_marker =
|
||||
DBRefAdjust(heap_regs->db_erased_marker);
|
||||
}
|
||||
|
||||
/* restore some heap registers */
|
||||
|
4
H/Heap.h
4
H/Heap.h
@ -10,7 +10,7 @@
|
||||
* File: Heap.h *
|
||||
* mods: *
|
||||
* comments: Heap Init Structure *
|
||||
* version: $Id: Heap.h,v 1.26 2002-05-23 03:52:34 vsc Exp $ *
|
||||
* version: $Id: Heap.h,v 1.27 2002-06-04 00:46:32 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
/* information that can be stored in Code Space */
|
||||
@ -282,6 +282,7 @@ typedef struct various_codes {
|
||||
PredEntry *pred_throw;
|
||||
PredEntry *pred_handle_throw;
|
||||
struct array_entry *dyn_array_list;
|
||||
struct DB_STRUCT *db_erased_marker;
|
||||
UInt n_of_file_aliases;
|
||||
UInt sz_of_file_aliases;
|
||||
struct AliasDescS * file_aliases;
|
||||
@ -474,6 +475,7 @@ typedef struct various_codes {
|
||||
#define PredThrow heap_regs->pred_throw
|
||||
#define PredHandleThrow heap_regs->pred_handle_throw
|
||||
#define DynArrayList heap_regs->dyn_array_list
|
||||
#define DBErasedMarker heap_regs->db_erased_marker
|
||||
#define NOfFileAliases heap_regs->n_of_file_aliases
|
||||
#define SzOfFileAliases heap_regs->sz_of_file_aliases
|
||||
#define FileAliases heap_regs->file_aliases
|
||||
|
@ -90,7 +90,7 @@ TEXI2PDF=texi2pdf
|
||||
#4.1VPATH=@srcdir@:@srcdir@/OPTYap
|
||||
CWD=$(PWD)
|
||||
#
|
||||
VERSION=Yap-4.3.21
|
||||
VERSION=Yap-4.3.22
|
||||
#
|
||||
|
||||
TAG_HEADERS= Tags_32bits.h Tags_32Ops.h Tags_32LowTag.h\
|
||||
|
@ -16,6 +16,14 @@
|
||||
|
||||
<h2>Yap-4.3.22:</h2>
|
||||
<ul>
|
||||
<li>FIXED: recover space for logical update semantics.</li>
|
||||
<li>FIXED: smash references to deleted entries with logical
|
||||
update semantics.</li>
|
||||
<li>FIXED: make instance of deleted fail for logical
|
||||
update semantics.</li>
|
||||
<li>FIXED: smash references to deleted references for logical
|
||||
update semantics.</li>
|
||||
<li>FIXED: garbage_collect should call do_gc with P, not CP.</li>
|
||||
<li>FIXED: use YAPSHAREDIR as in manual (Ashwin Srinivasan).</li>
|
||||
<li>FIXED: warning message about unify_extension.</li>
|
||||
</ul>
|
||||
|
@ -8,8 +8,8 @@
|
||||
@c @setchapternewpage odd
|
||||
@c %**end of header
|
||||
|
||||
@set VERSION 4.3.21
|
||||
@set EDITION 4.1.1
|
||||
@set VERSION 4.3.22
|
||||
@set EDITION 4.2.1
|
||||
@set UPDATED January 2002
|
||||
|
||||
@c Index for C-Prolog compatible predicate
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: Yap
|
||||
Summary: Prolog Compiler
|
||||
Version: 4.3.21
|
||||
Version: 4.3.22
|
||||
Packager: Vitor Santos Costa <vitor@cos.ufrj.br>
|
||||
Release: 1
|
||||
Source: http://www.ncc.up.pt/~vsc/Yap/Yap4.3/%{name}-%{version}.tar.gz
|
||||
|
Reference in New Issue
Block a user