fix threads and LU

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2233 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2008-05-10 23:24:13 +00:00
parent ed339dcb12
commit 257c3a2cbc
15 changed files with 150 additions and 109 deletions

View File

@ -12,7 +12,7 @@
* Last rev: * * Last rev: *
* mods: * * mods: *
* comments: allocating space * * comments: allocating space *
* version:$Id: alloc.c,v 1.94 2008-04-06 12:06:48 vsc Exp $ * * version:$Id: alloc.c,v 1.95 2008-05-10 23:24:11 vsc Exp $ *
*************************************************************************/ *************************************************************************/
#ifdef SCCS #ifdef SCCS
static char SccsId[] = "%W% %G%"; static char SccsId[] = "%W% %G%";
@ -208,7 +208,7 @@ struct various_codes *Yap_heap_regs;
static void static void
InitHeap(void) InitHeap(void)
{ {
Yap_heap_regs = (struct various_codes *)malloc(sizeof(struct various_codes)); Yap_heap_regs = (struct various_codes *)calloc(1, sizeof(struct various_codes));
} }
void void
@ -265,14 +265,14 @@ Yap_InitExStacks(int Trail, int Stack)
InitExStacks(Trail, Stack); InitExStacks(Trail, Stack);
} }
#if defined(YAPOR) || defined(THREADS) #if defined(THREADS)
void void
Yap_KillStacks(int wid) Yap_KillStacks(int wid)
{ {
ADDR gb = Yap_thread_gl[wid].global_base; ADDR gb = ThreadHandle[wid].stack_address;
if (gb) { if (gb) {
free(gb); free(gb);
Yap_thread_gl[wid].global_base = NULL; ThreadHandle[wid].stack_address = NULL;
} }
} }
#else #else
@ -300,6 +300,9 @@ Yap_ExtendWorkSpace(Int s)
nbp = realloc(basebp, s+s0); nbp = realloc(basebp, s+s0);
if (nbp == NULL) if (nbp == NULL)
return FALSE; return FALSE;
#if defined(THREADS)
ThreadHandle[worker_id].stack_address = (char *)nbp;
#endif
Yap_GlobalBase = (char *)nbp; Yap_GlobalBase = (char *)nbp;
return TRUE; return TRUE;
} }

View File

@ -234,6 +234,7 @@ p_uminus(Term t E_ARGS)
#ifdef USE_GMP #ifdef USE_GMP
case big_int_e: case big_int_e:
mpz_neg(v.big, v.big); mpz_neg(v.big, v.big);
fprintf(stderr,"Here I am %p\n", v.big);
RBIG(v.big); RBIG(v.big);
#endif #endif
default: default:

View File

@ -240,19 +240,11 @@ STATIC_PROTO(PredEntry *new_lu_int_key, (Int));
STATIC_PROTO(PredEntry *find_lu_entry, (Term)); STATIC_PROTO(PredEntry *find_lu_entry, (Term));
STATIC_PROTO(DBProp find_int_key, (Int)); STATIC_PROTO(DBProp find_int_key, (Int));
#if USE_SYSTEM_MALLOC
#define db_check_trail(x) { \ #define db_check_trail(x) { \
if (Unsigned(dbg->tofref) == Unsigned(x)) { \ if (Unsigned(dbg->tofref) == Unsigned(x)) { \
goto error_tr_overflow; \ goto error_tr_overflow; \
} \ } \
} }
#else
#define db_check_trail(x) { \
if (Unsigned(dbg->tofref) == Unsigned(x)) { \
goto error_tr_overflow; \
} \
}
#endif
static UInt new_trail_size(void) static UInt new_trail_size(void)
{ {
@ -3689,7 +3681,7 @@ index_sz(LogUpdIndex *x)
if (op == _enter_lu_pred) { if (op == _enter_lu_pred) {
PredEntry *ap = x->ClPred; PredEntry *ap = x->ClPred;
OPCODE endop, op1; OPCODE endop, op1;
UInt count = 0, count0 = start->u.Ill.s, dead=0; UInt count = 0, dead=0;
if (ap->PredFlags & CountPredFlag) if (ap->PredFlags & CountPredFlag)
endop = Yap_opcode(_count_trust_logical); endop = Yap_opcode(_count_trust_logical);
@ -3706,12 +3698,6 @@ index_sz(LogUpdIndex *x)
dead++; dead++;
start = start->u.lld.n; start = start->u.lld.n;
} while (op1 != endop); } while (op1 != endop);
if (x->ClFlags & InUseMask)
fprintf(stderr,"Inuse -- %p(%p)\n",ap,x);
if (x->ClFlags & DirtyMask)
fprintf(stderr,"Dirty -- %p(%p)\n",ap,x);
if (count > 200)
fprintf(stderr,"%lu/%lu/%lu -- %p(%p)\n",(unsigned long int)count,(unsigned long int)count0,(unsigned long int)dead,ap,x);
} }
x = x->ChildIndex; x = x->ChildIndex;
while (x != NULL) { while (x != NULL) {

View File

@ -11,8 +11,12 @@
* File: index.c * * File: index.c *
* comments: Indexing a Prolog predicate * * comments: Indexing a Prolog predicate *
* * * *
* Last rev: $Date: 2008-04-16 17:16:47 $,$Author: vsc $ * * Last rev: $Date: 2008-05-10 23:24:11 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.200 2008/04/16 17:16:47 vsc
* make static_clause only commit to a lause if it is sure that is the true
* clause. Otherwise, search for the clause.
*
* Revision 1.199 2008/04/14 21:20:35 vsc * Revision 1.199 2008/04/14 21:20:35 vsc
* fixed a bug in static_clause (thanks to Jose Santos) * fixed a bug in static_clause (thanks to Jose Santos)
* *
@ -3839,8 +3843,12 @@ emit_single_switch_case(ClauseDef *min, struct intermediates *cint, int first, i
} }
} }
#endif /* TABLING */ #endif /* TABLING */
if (cint->CurrentPred->PredFlags & LogUpdatePredFlag) {
return (UInt)(min->Code);
} else {
return (UInt)(min->CurrentCode); return (UInt)(min->CurrentCode);
} }
}
static UInt static UInt
suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermediates *cint) suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermediates *cint)
@ -4120,8 +4128,12 @@ do_pair(GroupDef *grp, Term t, struct intermediates *cint, UInt argno, int first
grp->FirstClause = max+1; grp->FirstClause = max+1;
if (min == max) { if (min == max) {
/* single clause, no need to do indexing, but we do know it is a list */ /* single clause, no need to do indexing, but we do know it is a list */
if (cint->CurrentPred->PredFlags & LogUpdatePredFlag) {
return (UInt)(min->Code);
} else {
return (UInt)(min->CurrentCode); return (UInt)(min->CurrentCode);
} }
}
if (min != max && !IsPairTerm(t)) { if (min != max && !IsPairTerm(t)) {
if (yap_flags[INDEXING_MODE_FLAG] == INDEX_MODE_SINGLE) { if (yap_flags[INDEXING_MODE_FLAG] == INDEX_MODE_SINGLE) {
return do_index(min, max, cint, cint->CurrentPred->ArityOfPE+1, nxtlbl, first, clleft, top); return do_index(min, max, cint, cint->CurrentPred->ArityOfPE+1, nxtlbl, first, clleft, top);
@ -6491,19 +6503,13 @@ expandz_block(path_stack_entry *sp, PredEntry *ap, ClauseDef *cls, int group1, y
} }
static LogUpdClause * static LogUpdClause *
lu_clause(yamop *ipc) lu_clause(yamop *ipc, PredEntry *ap)
{ {
LogUpdClause *c;
CELL *p = (CELL *)ipc;
if (ipc == FAILCODE) if (ipc == FAILCODE)
return NULL; return NULL;
while ((c = ClauseCodeToLogUpdClause(p))->Id != FunctorDBRef || if (ipc == (yamop *)(&(ap->OpcodeOfPred)))
!(c->ClFlags & LogUpdMask) || return NULL;
(c->ClFlags & (IndexMask|DynamicMask|SwitchTableMask|SwitchRootMask))) { return ClauseCodeToLogUpdClause(ipc);
p--;
}
return c;
} }
static StaticClause * static StaticClause *
@ -6526,6 +6532,8 @@ static_clause(yamop *ipc, PredEntry *ap, int trust)
if (ipc == FAILCODE) if (ipc == FAILCODE)
return NULL; return NULL;
if (ipc == (yamop*)(&(ap->OpcodeOfPred)))
return NULL;
if (ap->PredFlags & MegaClausePredFlag) if (ap->PredFlags & MegaClausePredFlag)
return (StaticClause *)ipc; return (StaticClause *)ipc;
if (ap->PredFlags & TabledPredFlag) if (ap->PredFlags & TabledPredFlag)
@ -6572,8 +6580,10 @@ static_clause(yamop *ipc, PredEntry *ap, int trust)
} }
static StaticClause * static StaticClause *
simple_static_clause(yamop *ipc) simple_static_clause(yamop *ipc, PredEntry *ap)
{ {
if (ipc == (yamop*)(&(ap->OpcodeOfPred)))
return NULL;
if (ipc == FAILCODE) if (ipc == FAILCODE)
return NULL; return NULL;
return ClauseCodeToStaticClause(ipc); return ClauseCodeToStaticClause(ipc);
@ -6598,7 +6608,7 @@ kill_unsafe_block(path_stack_entry *sp, op_numbers op, PredEntry *ap, int first,
} }
if (ap->PredFlags & LogUpdatePredFlag) { if (ap->PredFlags & LogUpdatePredFlag) {
struct intermediates intrs; struct intermediates intrs;
LogUpdClause *lc = lu_clause(ipc); LogUpdClause *lc = lu_clause(ipc, ap);
if (first) { if (first) {
cld[0].Code = cls[0].Code; cld[0].Code = cls[0].Code;
@ -6956,7 +6966,11 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
move_next(cls, 1); move_next(cls, 1);
if (nipc == FAILCODE) { if (nipc == FAILCODE) {
/* jump straight to clause */ /* jump straight to clause */
if (ap->PredFlags & LogUpdatePredFlag) {
ipc->u.llll.l1 = cls->Code;
} else {
ipc->u.llll.l1 = cls->CurrentCode; ipc->u.llll.l1 = cls->CurrentCode;
}
ipc = pop_path(&sp, cls, ap); ipc = pop_path(&sp, cls, ap);
} else { } else {
/* go on */ /* go on */
@ -7010,7 +7024,11 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
move_next(cls, Yap_regtoregno(ipc->u.xllll.x)); move_next(cls, Yap_regtoregno(ipc->u.xllll.x));
if (nipc == FAILCODE) { if (nipc == FAILCODE) {
/* jump straight to clause */ /* jump straight to clause */
if (ap->PredFlags & LogUpdatePredFlag) {
ipc->u.xllll.l1 = cls->Code;
} else {
ipc->u.xllll.l1 = cls->CurrentCode; ipc->u.xllll.l1 = cls->CurrentCode;
}
ipc = pop_path(&sp, cls, ap); ipc = pop_path(&sp, cls, ap);
} else { } else {
/* go on */ /* go on */
@ -7059,7 +7077,11 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
} }
if (nipc == FAILCODE) { if (nipc == FAILCODE) {
/* jump straight to clause */ /* jump straight to clause */
if (ap->PredFlags & LogUpdatePredFlag) {
ipc->u.sllll.l1 = cls->Code;
} else {
ipc->u.sllll.l1 = cls->CurrentCode; ipc->u.sllll.l1 = cls->CurrentCode;
}
ipc = pop_path(&sp, cls, ap); ipc = pop_path(&sp, cls, ap);
} else { } else {
/* go on */ /* go on */
@ -7141,7 +7163,11 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
fe->Tag = f; fe->Tag = f;
ipc->u.sssl.e++; ipc->u.sssl.e++;
} }
if (ap->PredFlags & LogUpdatePredFlag) {
fe->u.labp = cls->Code;
} else {
fe->u.labp = cls->CurrentCode; fe->u.labp = cls->CurrentCode;
}
ipc = pop_path(&sp, cls, ap); ipc = pop_path(&sp, cls, ap);
} else { } else {
yamop *newpc = fe->u.labp; yamop *newpc = fe->u.labp;
@ -7193,7 +7219,11 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
ae->Tag = at; ae->Tag = at;
ipc->u.sssl.e++; ipc->u.sssl.e++;
} }
if (ap->PredFlags & LogUpdatePredFlag) {
ae->u.labp = cls->Code;
} else {
ae->u.labp = cls->CurrentCode; ae->u.labp = cls->CurrentCode;
}
ipc = pop_path(&sp, cls, ap); ipc = pop_path(&sp, cls, ap);
} else { } else {
yamop *newpc = ae->u.labp; yamop *newpc = ae->u.labp;
@ -7696,9 +7726,6 @@ remove_from_index(PredEntry *ap, path_stack_entry *sp, ClauseDef *cls, yamop *bg
case _lock_lu: case _lock_lu:
ipc = NEXTOP(ipc,p); ipc = NEXTOP(ipc,p);
break; break;
case _unlock_lu:
ipc = NEXTOP(ipc,e);
break;
default: default:
if (IN_BETWEEN(bg,ipc,lt)) { if (IN_BETWEEN(bg,ipc,lt)) {
sp = kill_unsafe_block(sp, op, ap, TRUE, TRUE, cls); sp = kill_unsafe_block(sp, op, ap, TRUE, TRUE, cls);
@ -7867,11 +7894,11 @@ static LogUpdClause *
to_clause(yamop *ipc, PredEntry *ap) to_clause(yamop *ipc, PredEntry *ap)
{ {
if (ap->PredFlags & LogUpdatePredFlag) if (ap->PredFlags & LogUpdatePredFlag)
return lu_clause(ipc); return lu_clause(ipc, ap);
else if (ap->PredFlags & MegaClausePredFlag) else if (ap->PredFlags & MegaClausePredFlag)
return (LogUpdClause *)ipc; return (LogUpdClause *)ipc;
else else
return (LogUpdClause *)simple_static_clause(ipc); return (LogUpdClause *)simple_static_clause(ipc, ap);
} }
LogUpdClause * LogUpdClause *
@ -7902,7 +7929,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
case _try_in: case _try_in:
update_clause_choice_point(NEXTOP(ipc,l), ap_pc); update_clause_choice_point(NEXTOP(ipc,l), ap_pc);
if (lu_pred) if (lu_pred)
return lu_clause(ipc->u.l.l); return lu_clause(ipc->u.l.l, ap);
else else
return (LogUpdClause *)static_clause(ipc->u.l.l, ap, unbounded); return (LogUpdClause *)static_clause(ipc->u.l.l, ap, unbounded);
break; break;
@ -7918,7 +7945,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
update_clause_choice_point(NEXTOP(ipc,ld), ap_pc); update_clause_choice_point(NEXTOP(ipc,ld), ap_pc);
} }
if (lu_pred) if (lu_pred)
return lu_clause(ipc->u.ld.d); return lu_clause(ipc->u.ld.d, ap);
else else
return (LogUpdClause *)static_clause(ipc->u.ld.d, ap, unbounded); return (LogUpdClause *)static_clause(ipc->u.ld.d, ap, unbounded);
case _try_clause2: case _try_clause2:
@ -7932,7 +7959,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
update_clause_choice_point(NEXTOP(ipc,l), ap_pc); update_clause_choice_point(NEXTOP(ipc,l), ap_pc);
} }
if (lu_pred) if (lu_pred)
return lu_clause(ipc->u.l.l); return lu_clause(ipc->u.l.l, ap);
else else
return (LogUpdClause *)static_clause(ipc->u.l.l, ap, unbounded); return (LogUpdClause *)static_clause(ipc->u.l.l, ap, unbounded);
case _try_me: case _try_me:
@ -7958,7 +7985,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
#endif #endif
update_clause_choice_point(NEXTOP(ipc,ld),ap_pc); update_clause_choice_point(NEXTOP(ipc,ld),ap_pc);
if (lu_pred) if (lu_pred)
return lu_clause(ipc->u.ld.d); return lu_clause(ipc->u.ld.d, ap);
else else
return (LogUpdClause *)static_clause(ipc->u.ld.d, ap, TRUE); return (LogUpdClause *)static_clause(ipc->u.ld.d, ap, TRUE);
case _retry2: case _retry2:
@ -7966,7 +7993,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
case _retry4: case _retry4:
update_clause_choice_point(NEXTOP(ipc,l),ap_pc); update_clause_choice_point(NEXTOP(ipc,l),ap_pc);
if (lu_pred) if (lu_pred)
return lu_clause(ipc->u.l.l); return lu_clause(ipc->u.l.l, ap);
else else
return (LogUpdClause *)static_clause(ipc->u.l.l, ap, TRUE); return (LogUpdClause *)static_clause(ipc->u.l.l, ap, TRUE);
case _retry_me: case _retry_me:
@ -7997,7 +8024,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
#endif /* YAPOR */ #endif /* YAPOR */
b0 = B; b0 = B;
if (lu_pred) if (lu_pred)
return lu_clause(ipc->u.ld.d); return lu_clause(ipc->u.ld.d, ap);
else else
return (LogUpdClause *)static_clause(ipc->u.ld.d, ap, TRUE); return (LogUpdClause *)static_clause(ipc->u.ld.d, ap, TRUE);
case _profiled_trust_me: case _profiled_trust_me:
@ -8352,9 +8379,6 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
case _lock_lu: case _lock_lu:
ipc = NEXTOP(ipc,p); ipc = NEXTOP(ipc,p);
break; break;
case _unlock_lu:
ipc = NEXTOP(ipc,e);
break;
#if THREADS #if THREADS
case _thread_local: case _thread_local:
ap = Yap_GetThreadPred(ap); ap = Yap_GetThreadPred(ap);
@ -8410,7 +8434,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
if (op == _op_fail) if (op == _op_fail)
return NULL; return NULL;
if (lu_pred) if (lu_pred)
return lu_clause(ipc); return lu_clause(ipc, ap);
else else
return (LogUpdClause *)static_clause(ipc, ap, unbounded); return (LogUpdClause *)static_clause(ipc, ap, unbounded);
} }

View File

@ -972,6 +972,9 @@ InitCodes(void)
Yap_heap_regs->thread_handle[i].in_use = FALSE; Yap_heap_regs->thread_handle[i].in_use = FALSE;
Yap_heap_regs->thread_handle[i].zombie = FALSE; Yap_heap_regs->thread_handle[i].zombie = FALSE;
Yap_heap_regs->thread_handle[i].local_preds = NULL; Yap_heap_regs->thread_handle[i].local_preds = NULL;
#ifdef LOW_LEVEL_TRACER
Yap_heap_regs->thread_handle[i].thread_inst_count = 0LL;
#endif
pthread_mutex_init(&Yap_heap_regs->thread_handle[i].tlock, NULL); pthread_mutex_init(&Yap_heap_regs->thread_handle[i].tlock, NULL);
} }
} }

View File

@ -100,6 +100,7 @@ kill_thread_engine (int wid)
} }
Yap_KillStacks(wid); Yap_KillStacks(wid);
Yap_FreeCodeSpace((ADDR)(ThreadHandle[wid].tgoal)); Yap_FreeCodeSpace((ADDR)(ThreadHandle[wid].tgoal));
ThreadHandle[wid].tgoal = NULL;
Yap_heap_regs->wl[wid].active_signals = 0L; Yap_heap_regs->wl[wid].active_signals = 0L;
free(Yap_heap_regs->wl[wid].scratchpad.ptr); free(Yap_heap_regs->wl[wid].scratchpad.ptr);
free(ThreadHandle[wid].default_yaam_regs); free(ThreadHandle[wid].default_yaam_regs);
@ -131,12 +132,12 @@ setup_engine(int myworker_id)
{ {
REGSTORE *standard_regs; REGSTORE *standard_regs;
standard_regs = (REGSTORE *)malloc(sizeof(REGSTORE)); standard_regs = (REGSTORE *)calloc(1,sizeof(REGSTORE));
/* create the YAAM descriptor */ /* create the YAAM descriptor */
ThreadHandle[myworker_id].default_yaam_regs = standard_regs; ThreadHandle[myworker_id].default_yaam_regs = standard_regs;
pthread_setspecific(Yap_yaamregs_key, (void *)standard_regs); pthread_setspecific(Yap_yaamregs_key, (void *)standard_regs);
worker_id = myworker_id; worker_id = myworker_id;
Yap_InitExStacks(ThreadHandle[myworker_id].ssize, ThreadHandle[myworker_id].tsize); Yap_InitExStacks(ThreadHandle[myworker_id].tsize, ThreadHandle[myworker_id].ssize);
CurrentModule = ThreadHandle[myworker_id].cmod; CurrentModule = ThreadHandle[myworker_id].cmod;
Yap_InitTime(); Yap_InitTime();
Yap_InitYaamRegs(); Yap_InitYaamRegs();
@ -419,7 +420,6 @@ static Int
p_thread_exit(void) p_thread_exit(void)
{ {
thread_die(worker_id, FALSE); thread_die(worker_id, FALSE);
fprintf(stderr,"2 the end of worker_id=%d\n",worker_id);
pthread_exit(NULL); pthread_exit(NULL);
return TRUE; return TRUE;
} }

View File

@ -164,6 +164,11 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
LOCK(Yap_heap_regs->low_level_trace_lock); LOCK(Yap_heap_regs->low_level_trace_lock);
sc = Yap_heap_regs; sc = Yap_heap_regs;
vsc_count++; vsc_count++;
#ifdef THREADS
Yap_heap_regs->thread_handle[worker_id].thread_inst_count++;
#endif
UNLOCK(Yap_heap_regs->low_level_trace_lock);
return;
#ifdef COMMENTED #ifdef COMMENTED
//*(H0+(0xb65f2850-0xb64b2008)/sizeof(CELL))==0xc || //*(H0+(0xb65f2850-0xb64b2008)/sizeof(CELL))==0xc ||
//0x4fd4d //0x4fd4d

View File

@ -19,7 +19,7 @@ static char SccsId[] = "@(#)utilpreds.c 1.3";
#endif #endif
#include "Yap.h" #include "Yap.h"
#include "Yatom.h" #include "clause.h"
#include "Heap.h" #include "Heap.h"
#include "yapio.h" #include "yapio.h"
#include "eval.h" #include "eval.h"
@ -155,9 +155,22 @@ copy_complex_term(CELL *pt0, CELL *pt0_end, int share, int newattvs, CELL *ptf,
f = (Functor)(*ap2); f = (Functor)(*ap2);
if (IsExtensionFunctor(f)) { if (IsExtensionFunctor(f)) {
{ #if defined(YAPOR) || defined(THREADS)
*ptf++ = d0; /* you can just copy other extensions. */ if (f == FunctorDBRef) {
DBRef entryref = DBRefOfTerm(d0);
if (entryref->Flags & LogUpdMask) {
LogUpdClause *luclause = (LogUpdClause *)entryref;
LOCK(luclause->ClPred->PELock);
UNLOCK(luclause->ClPred->PELock);
} else {
LOCK(entryref->lock);
TRAIL_REF(entryref); /* So that fail will erase it */
INC_DBREF_COUNT(entryref);
UNLOCK(entryref->lock);
} }
}
#endif
*ptf++ = d0; /* you can just copy other extensions. */
continue; continue;
} }
*ptf = AbsAppl(H); *ptf = AbsAppl(H);
@ -545,7 +558,6 @@ static Term vars_in_complex_term(register CELL *pt0, register CELL *pt0_end, Ter
/* store the terms to visit */ /* store the terms to visit */
ap2 = RepAppl(d0); ap2 = RepAppl(d0);
f = (Functor)(*ap2); f = (Functor)(*ap2);
if (IsExtensionFunctor(f)) { if (IsExtensionFunctor(f)) {
continue; continue;
} }

View File

@ -10,7 +10,7 @@
* File: Heap.h * * File: Heap.h *
* mods: * * mods: *
* comments: Heap Init Structure * * comments: Heap Init Structure *
* version: $Id: Heap.h,v 1.130 2008-04-02 17:37:06 vsc Exp $ * * version: $Id: Heap.h,v 1.131 2008-05-10 23:24:12 vsc Exp $ *
*************************************************************************/ *************************************************************************/
/* information that can be stored in Code Space */ /* information that can be stored in Code Space */
@ -196,6 +196,9 @@ typedef struct thandle {
struct pred_entry *local_preds; struct pred_entry *local_preds;
pthread_t handle; pthread_t handle;
int ref_count; int ref_count;
#ifdef LOW_LEVEL_TRACER
long long int thread_inst_count;
#endif
pthread_mutex_t tlock; pthread_mutex_t tlock;
#if HAVE_GETRUSAGE #if HAVE_GETRUSAGE
struct timeval *start_of_timesp; struct timeval *start_of_timesp;

View File

@ -18,6 +18,8 @@ fetch_arch(Arch) :-
gen_arch(L,mac) :- gen_arch(L,mac) :-
append(_,[0'd,0'a,0'r,0'w,0'i,0'n|_],L), !. append(_,[0'd,0'a,0'r,0'w,0'i,0'n|_],L), !.
% handle compilation in 64 bit machine of 32 bit binary.
gen_arch([0'x,0'8,0'6,0'_,0'6,0'4|_],i386) :- yap_flag(max_tagged_integer, 67108863).
gen_arch([0'x,0'8,0'6,0'_,0'6,0'4|_],amd64). gen_arch([0'x,0'8,0'6,0'_,0'6,0'4|_],amd64).
gen_arch([0'i,_,0'8,0'6|_],i386). % take all versions of X86 gen_arch([0'i,_,0'8,0'6|_],i386). % take all versions of X86
gen_arch([0's,0'p,0'a,0'r,0'c|_],sparc). gen_arch([0's,0'p,0'a,0'r,0'c|_],sparc).

View File

@ -1,4 +1,4 @@
/* $Id: jpl.c,v 1.15 2008-04-14 21:20:36 vsc Exp $ /* $Id: jpl.c,v 1.16 2008-05-10 23:24:12 vsc Exp $
Part of JPL -- SWI-Prolog/Java interface Part of JPL -- SWI-Prolog/Java interface
@ -1796,6 +1796,9 @@ jni_create_jvm_c(
/* opt[optn].optionString = "abort"; // I don't understand this yet... */ /* opt[optn].optionString = "abort"; // I don't understand this yet... */
/* opt[optn++].extraInfo = jvm_abort; // this function has been moved to jpl_extras.c */ /* opt[optn++].extraInfo = jvm_abort; // this function has been moved to jpl_extras.c */
/* opt[optn++].optionString = "-Xcheck:jni"; // extra checking of JNI calls */ /* opt[optn++].optionString = "-Xcheck:jni"; // extra checking of JNI calls */
#if __YAP_PROLOG__
opt[optn++].optionString = "-Xmx1512m"; // give java enough space
#endif
/* opt[optn++].optionString = "-Xnoclassgc"; // so method/field IDs remain valid (?) */ /* opt[optn++].optionString = "-Xnoclassgc"; // so method/field IDs remain valid (?) */
/* opt[optn].optionString = "vfprintf"; */ /* opt[optn].optionString = "vfprintf"; */
/* opt[optn++].extraInfo = fprintf; // no O/P, then SEGV */ /* opt[optn++].extraInfo = fprintf; // no O/P, then SEGV */

View File

@ -17,6 +17,8 @@ xb
<h2>Yap-5.1.3:</h2> <h2>Yap-5.1.3:</h2>
<ul> <ul>
<li> FIXED: don't ever jump to mid of lu code.</li>
<li> FIXED: bad mem management in threads (obs from Paulo Moura).</li>
<li> FIXED: should init_slots when sucessfully exiting (obs from <li> FIXED: should init_slots when sucessfully exiting (obs from
Trevor Walker).</li> Trevor Walker).</li>
<li> FIXED: predicate_property should work for empty dynamic predicates.</li> <li> FIXED: predicate_property should work for empty dynamic predicates.</li>

View File

@ -399,8 +399,7 @@ yap_flag(max_integer,X) :-
'$do_error'(domain_error(flag_value,max_integer+X),yap_flag(max_integer,X)). '$do_error'(domain_error(flag_value,max_integer+X),yap_flag(max_integer,X)).
yap_flag(max_tagged_integer,X) :- yap_flag(max_tagged_integer,X) :-
var(X), !, '$max_tagged_integer'(X), !.
'$max_tagged_integer'(X).
yap_flag(max_tagged_integer,X) :- yap_flag(max_tagged_integer,X) :-
integer(X), X > 0, !, integer(X), X > 0, !,
'$do_error'(permission_error(modify,flag,max_tagged_integer),yap_flag(max_tagged_integer,X)). '$do_error'(permission_error(modify,flag,max_tagged_integer),yap_flag(max_tagged_integer,X)).
@ -418,8 +417,7 @@ yap_flag(min_integer,X) :-
'$do_error'(domain_error(flag_value,min_integer+X),yap_flag(min_integer,X)). '$do_error'(domain_error(flag_value,min_integer+X),yap_flag(min_integer,X)).
yap_flag(min_tagged_integer,X) :- yap_flag(min_tagged_integer,X) :-
var(X), !, '$min_tagged_integer'( X), !.
'$min_tagged_integer'( X).
yap_flag(min_tagged_integer,X) :- yap_flag(min_tagged_integer,X) :-
integer(X), X > 0, !, integer(X), X > 0, !,
'$do_error'(permission_error(modify,flag,min_tagged_integer),yap_flag(min_tagged_integer,X)). '$do_error'(permission_error(modify,flag,min_tagged_integer),yap_flag(min_tagged_integer,X)).

View File

@ -638,7 +638,6 @@ message_queue_destroy(Queue) :-
recorded('$queue',q(Queue,Mutex,Cond,_,QKey),R), !, recorded('$queue',q(Queue,Mutex,Cond,_,QKey),R), !,
erase(R), erase(R),
'$cond_destroy'(Cond), '$cond_destroy'(Cond),
write(Queue:Mutex),nl,
'$destroy_mutex'(Mutex), '$destroy_mutex'(Mutex),
'$unlock_mutex'(QMutex), '$unlock_mutex'(QMutex),
'$clean_mqueue'(QKey). '$clean_mqueue'(QKey).