more fixes for USE_SYSTEM_MEMORY
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1047 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
38b965d2fa
commit
91f87b3109
10
C/absmi.c
10
C/absmi.c
@ -10,8 +10,12 @@
|
||||
* *
|
||||
* File: absmi.c *
|
||||
* comments: Portable abstract machine interpreter *
|
||||
* Last rev: $Date: 2004-04-22 03:24:17 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2004-04-22 20:07:02 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.130 2004/04/22 03:24:17 vsc
|
||||
* trust_logical should protect the last clause, otherwise it cannot
|
||||
* jump there.
|
||||
*
|
||||
* Revision 1.129 2004/04/16 19:27:30 vsc
|
||||
* more bug fixes
|
||||
*
|
||||
@ -1221,10 +1225,12 @@ Yap_absmi(int inp)
|
||||
to dispose of it
|
||||
*/
|
||||
LOCK(lcl->ClLock);
|
||||
if (lcl->ClRefCount == 1) {
|
||||
/* make sure the clause isn't destroyed */
|
||||
/* always add an extra reference */
|
||||
INC_CLREF_COUNT(lcl);
|
||||
TRAIL_CLREF(lcl);
|
||||
}
|
||||
UNLOCK(cl->ClLock);
|
||||
}
|
||||
Yap_ErLogUpdIndex(cl);
|
||||
@ -1242,7 +1248,7 @@ Yap_absmi(int inp)
|
||||
if (next != FAILCODE) {
|
||||
LogUpdClause *lcl = ClauseCodeToLogUpdClause(next);
|
||||
/* make sure we don't erase the clause we are jumping too */
|
||||
if (!(lcl->ClFlags & InUseMask)) {
|
||||
if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) {
|
||||
lcl->ClFlags |= InUseMask;
|
||||
TRAIL_CLREF(lcl);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Last rev: *
|
||||
* mods: *
|
||||
* comments: allocating space *
|
||||
* version:$Id: alloc.c,v 1.48 2004-03-05 15:26:32 vsc Exp $ *
|
||||
* version:$Id: alloc.c,v 1.49 2004-04-22 20:07:03 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
#ifdef SCCS
|
||||
static char SccsId[] = "%W% %G%";
|
||||
@ -114,6 +114,7 @@ Yap_ExpandPreAllocCodeSpace(UInt sz0)
|
||||
|
||||
if (!(ptr = realloc(ScratchPad.ptr, sz)))
|
||||
return NULL;
|
||||
ScratchPad.ptr = ptr;
|
||||
AuxSp = (CELL *)(AuxTop = ptr+sz);
|
||||
return ptr;
|
||||
}
|
||||
|
10
C/amasm.c
10
C/amasm.c
@ -11,8 +11,11 @@
|
||||
* File: amasm.c *
|
||||
* comments: abstract machine assembler *
|
||||
* *
|
||||
* Last rev: $Date: 2004-03-31 01:03:09 $ *
|
||||
* Last rev: $Date: 2004-04-22 20:07:04 $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.59 2004/03/31 01:03:09 vsc
|
||||
* support expand group of clauses
|
||||
*
|
||||
* Revision 1.58 2004/03/10 14:59:55 vsc
|
||||
* optimise -> for type tests
|
||||
* *
|
||||
@ -435,10 +438,11 @@ a_vv(op_numbers opcode, op_numbers opcodew, yamop *code_p, int pass_no, struct i
|
||||
}
|
||||
cip->cpc = cip->cpc->nextInst;
|
||||
if (pass_no) {
|
||||
ve = (Ventry *) cip->cpc->rnd1;
|
||||
OPREG var_offset;
|
||||
int is_y_var = (ve->KindOfVE == PermVar);
|
||||
int is_y_var;
|
||||
|
||||
ve = (Ventry *) cip->cpc->rnd1;
|
||||
is_y_var = (ve->KindOfVE == PermVar);
|
||||
var_offset = Var_Ref(ve, is_y_var);
|
||||
code_p->u.oxx.xr = emit_xreg(var_offset);
|
||||
}
|
||||
|
10
C/compiler.c
10
C/compiler.c
@ -11,8 +11,11 @@
|
||||
* File: compiler.c *
|
||||
* comments: Clause compiler *
|
||||
* *
|
||||
* Last rev: $Date: 2004-03-10 16:27:39 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2004-04-22 20:07:04 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.49 2004/03/10 16:27:39 vsc
|
||||
* skip compilation steps for ground facts.
|
||||
*
|
||||
* Revision 1.48 2004/03/08 19:31:01 vsc
|
||||
* move to 4.5.3
|
||||
* *
|
||||
@ -2732,12 +2735,11 @@ Yap_cclause(Term inp_clause, int NOfArgs, int mod, Term src)
|
||||
int botch_why;
|
||||
volatile Term my_clause = inp_clause;
|
||||
/* may botch while doing a different module */
|
||||
|
||||
/* first, initialise cglobs->cint.CompilerBotch to handle all cases of interruptions */
|
||||
Yap_ErrorMessage = NULL;
|
||||
Yap_Error_Size = 0;
|
||||
compiler_struct cglobs;
|
||||
|
||||
Yap_ErrorMessage = NULL;
|
||||
Yap_Error_Size = 0;
|
||||
if ((botch_why = setjmp(cglobs.cint.CompilerBotch)) == 3) {
|
||||
/* out of local stack, just duplicate the stack */
|
||||
restore_machine_regs();
|
||||
|
@ -655,6 +655,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
||||
CELL *ConstraintsBottom = NULL;
|
||||
CELL *origH = H;
|
||||
#endif
|
||||
CELL *CodeMaxBase = CodeMax;
|
||||
|
||||
loop:
|
||||
while (pt0 <= pt0_end) {
|
||||
@ -981,7 +982,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
||||
|
||||
error:
|
||||
Yap_Error_TYPE = OUT_OF_HEAP_ERROR;
|
||||
Yap_Error_Size = 1024+((char *)AuxSp-(char *)HeapTop);
|
||||
Yap_Error_Size = 1024+((char *)AuxSp-(char *)CodeMaxBase);
|
||||
*vars_foundp = vars_found;
|
||||
#ifdef RATIONAL_TREES
|
||||
while (to_visit > to_visit_base) {
|
||||
|
12
C/heapgc.c
12
C/heapgc.c
@ -763,7 +763,7 @@ check_global(void) {
|
||||
#if INSTRUMENT_GC
|
||||
if (IsVarTerm(ccurr)) {
|
||||
if (IsBlobFunctor((Functor)ccurr)) vars[gc_num]++;
|
||||
else if (ccurr != 0 && ccurr < (CELL)HeapTop) {
|
||||
else if (ccurr != 0 && (ccurr < (CELL)Yap_GlobalBase || ccurr > (CELL)Yap_TrailTop)) {
|
||||
/* printf("%p: %s/%d\n", current,
|
||||
RepAtom(NameOfFunctor((Functor)ccurr))->StrOfAE,
|
||||
ArityOfFunctor((Functor)ccurr));*/
|
||||
@ -875,7 +875,7 @@ mark_variable(CELL_PTR current)
|
||||
}
|
||||
goto begin;
|
||||
#ifdef DEBUG
|
||||
} else if (next < (CELL *)AtomBase || next < (CELL *)HeapTop) {
|
||||
} else if (next < (CELL *)Yap_GlobalBase || next > (CELL *)Yap_TrailTop) {
|
||||
fprintf(Yap_stderr, "ooops while marking %lx, %p at %p\n", (unsigned long int)ccur, current, next);
|
||||
#endif
|
||||
} else {
|
||||
@ -1844,7 +1844,8 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if ((CELL *)trail_cell < (CELL *)HeapTop) {
|
||||
} else if ((CELL *)trail_cell < (CELL *)Yap_GlobalBase ||
|
||||
(CELL *)trail_cell > (CELL *)Yap_TrailTop) {
|
||||
/* we may have pointers from the heap back into the cell */
|
||||
CELL *next = GET_NEXT(*CellPtr(trail_cell));
|
||||
UNMARK(CellPtr(trail_cell));
|
||||
@ -1871,7 +1872,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
||||
/* process all segments */
|
||||
if (
|
||||
#ifdef SBA
|
||||
(ADDR) pt0 >= HeapTop
|
||||
(ADDR) pt0 >= Yap_GlobalBase
|
||||
#else
|
||||
(ADDR) pt0 >= Yap_TrailBase
|
||||
#endif
|
||||
@ -2994,6 +2995,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
int gc_trace = FALSE;
|
||||
|
||||
#if USE_SYSTEM_MALLOC
|
||||
/* I can't use it because I may have pointers to high memory */
|
||||
return 0;
|
||||
#endif
|
||||
#if COROUTINING
|
||||
@ -3050,6 +3052,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
fprintf(Yap_stderr, "[GC] Trail:%8ld cells (%p-%p)\n",
|
||||
(unsigned long int)(TR-(tr_fr_ptr)Yap_TrailBase),Yap_TrailBase,TR);
|
||||
}
|
||||
#if !USE_SYSTEM_MALLOC
|
||||
if (HeapTop >= Yap_GlobalBase - MinHeapGap) {
|
||||
*--ASP = (CELL)current_env;
|
||||
if (!Yap_growheap(FALSE, MinHeapGap, NULL)) {
|
||||
@ -3059,6 +3062,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
||||
current_env = (CELL *)*ASP;
|
||||
ASP++;
|
||||
}
|
||||
#endif
|
||||
time_start = Yap_cputime();
|
||||
total_marked = 0;
|
||||
#ifdef COROUTING
|
||||
|
@ -86,7 +86,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, CELL *ptf, CELL *H
|
||||
*ptf = AbsPair(H);
|
||||
ptf++;
|
||||
#ifdef RATIONAL_TREES
|
||||
if (to_visit + 4 >= (CELL **)Yap_GlobalBase) {
|
||||
if (to_visit + 4 >= (CELL **)AuxSp) {
|
||||
goto heap_overflow;
|
||||
}
|
||||
to_visit[0] = pt0;
|
||||
@ -98,7 +98,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, CELL *ptf, CELL *H
|
||||
to_visit += 4;
|
||||
#else
|
||||
if (pt0 < pt0_end) {
|
||||
if (to_visit + 3 >= (CELL **)Yap_GlobalBase) {
|
||||
if (to_visit + 3 >= (CELL **)AuxSp) {
|
||||
goto heap_overflow;
|
||||
}
|
||||
to_visit[0] = pt0;
|
||||
@ -136,7 +136,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, CELL *ptf, CELL *H
|
||||
ptf++;
|
||||
/* store the terms to visit */
|
||||
#ifdef RATIONAL_TREES
|
||||
if (to_visit + 4 >= (CELL **)Yap_GlobalBase) {
|
||||
if (to_visit + 4 >= (CELL **)AuxSp) {
|
||||
goto heap_overflow;
|
||||
}
|
||||
to_visit[0] = pt0;
|
||||
@ -148,7 +148,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, CELL *ptf, CELL *H
|
||||
to_visit += 4;
|
||||
#else
|
||||
if (pt0 < pt0_end) {
|
||||
if (to_visit + 3 >= (CELL **)Yap_GlobalBase) {
|
||||
if (to_visit + 3 >= (CELL **)AuxSp) {
|
||||
goto heap_overflow;
|
||||
}
|
||||
to_visit[0] = pt0;
|
||||
@ -335,8 +335,8 @@ CopyTerm(Term inp) {
|
||||
t = Deref(ARG1);
|
||||
goto restart_attached;
|
||||
} else { /* handle overflow */
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage);
|
||||
if (!Yap_ExpandPreAllocCodeSpace(0)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||
return(FALSE);
|
||||
}
|
||||
t = Deref(ARG1);
|
||||
@ -371,8 +371,8 @@ CopyTerm(Term inp) {
|
||||
t = Deref(ARG1);
|
||||
goto restart_list;
|
||||
} else { /* handle overflow */
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage);
|
||||
if (!Yap_ExpandPreAllocCodeSpace(0)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||
return(FALSE);
|
||||
}
|
||||
t = Deref(ARG1);
|
||||
@ -406,8 +406,8 @@ CopyTerm(Term inp) {
|
||||
t = Deref(ARG1);
|
||||
goto restart_appl;
|
||||
} else { /* handle overflow */
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage);
|
||||
if (!Yap_ExpandPreAllocCodeSpace(0)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||
return(FALSE);
|
||||
}
|
||||
t = Deref(ARG1);
|
||||
@ -459,7 +459,7 @@ static int copy_complex_term_no_delays(register CELL *pt0, register CELL *pt0_en
|
||||
*ptf = AbsPair(H);
|
||||
ptf++;
|
||||
#ifdef RATIONAL_TREES
|
||||
if (to_visit + 4 >= (CELL **)Yap_GlobalBase) {
|
||||
if (to_visit + 4 >= (CELL **)AuxSp) {
|
||||
goto heap_overflow;
|
||||
}
|
||||
to_visit[0] = pt0;
|
||||
@ -471,7 +471,7 @@ static int copy_complex_term_no_delays(register CELL *pt0, register CELL *pt0_en
|
||||
to_visit += 4;
|
||||
#else
|
||||
if (pt0 < pt0_end) {
|
||||
if (to_visit + 3 >= (CELL **)Yap_GlobalBase) {
|
||||
if (to_visit + 3 >= (CELL **)AuxSp) {
|
||||
goto heap_overflow;
|
||||
}
|
||||
to_visit[0] = pt0;
|
||||
@ -507,7 +507,7 @@ static int copy_complex_term_no_delays(register CELL *pt0, register CELL *pt0_en
|
||||
ptf++;
|
||||
/* store the terms to visit */
|
||||
#ifdef RATIONAL_TREES
|
||||
if (to_visit + 4 >= (CELL **)Yap_GlobalBase) {
|
||||
if (to_visit + 4 >= (CELL **)AuxSp) {
|
||||
goto heap_overflow;
|
||||
}
|
||||
to_visit[0] = pt0;
|
||||
@ -518,7 +518,7 @@ static int copy_complex_term_no_delays(register CELL *pt0, register CELL *pt0_en
|
||||
*pt0 = AbsAppl(H);
|
||||
to_visit += 4;
|
||||
#else
|
||||
if (to_visit + 3 >= (CELL **)Yap_GlobalBase) {
|
||||
if (to_visit + 3 >= (CELL **)AuxSp) {
|
||||
goto heap_overflow;
|
||||
}
|
||||
if (pt0 < pt0_end) {
|
||||
@ -645,8 +645,8 @@ CopyTermNoDelays(Term inp) {
|
||||
t = Deref(ARG1);
|
||||
goto restart_list;
|
||||
} else { /* handle overflow */
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage);
|
||||
if (!Yap_ExpandPreAllocCodeSpace(0)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||
return(FALSE);
|
||||
}
|
||||
t = Deref(ARG1);
|
||||
@ -677,8 +677,8 @@ CopyTermNoDelays(Term inp) {
|
||||
t = Deref(ARG1);
|
||||
goto restart_appl;
|
||||
} else { /* handle overflow */
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage);
|
||||
if (!Yap_ExpandPreAllocCodeSpace(0)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||
return(FALSE);
|
||||
}
|
||||
t = Deref(ARG1);
|
||||
|
6
H/Heap.h
6
H/Heap.h
@ -10,7 +10,7 @@
|
||||
* File: Heap.h *
|
||||
* mods: *
|
||||
* comments: Heap Init Structure *
|
||||
* version: $Id: Heap.h,v 1.61 2004-03-02 16:44:55 vsc Exp $ *
|
||||
* version: $Id: Heap.h,v 1.62 2004-04-22 20:07:05 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
/* information that can be stored in Code Space */
|
||||
@ -402,7 +402,7 @@ typedef struct various_codes {
|
||||
AtomHashEntry *hash_chain;
|
||||
} all_heap_codes;
|
||||
|
||||
#ifdef THREADS
|
||||
#ifdef USE_SYSTEM_MALLOC
|
||||
struct various_codes *heap_regs;
|
||||
#else
|
||||
#define heap_regs ((all_heap_codes *)HEAP_INIT_BASE)
|
||||
@ -719,7 +719,7 @@ struct various_codes *heap_regs;
|
||||
|
||||
ADDR STD_PROTO(Yap_ExpandPreAllocCodeSpace, (UInt));
|
||||
#define Yap_ReleasePreAllocCodeSpace(x)
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#if USE_SYSTEM_MALLOC
|
||||
ADDR STD_PROTO(Yap_InitPreAllocCodeSpace, (void));
|
||||
EXTERN inline ADDR
|
||||
Yap_PreAllocCodeSpace(void)
|
||||
|
@ -51,7 +51,11 @@
|
||||
#define ONHEAP(ptr) (CellPtr(ptr) >= H0 && CellPtr(ptr) < H)
|
||||
|
||||
/* is ptr a pointer to code space? */
|
||||
#if USE_SYSTEM_MALLOC
|
||||
#define ONCODE(ptr) (Addr(ptr) < Yap_GlobalBase || Addr(ptr) > Yap_TrailTop)
|
||||
#else
|
||||
#define ONCODE(ptr) (Addr(ptr) < HeapTop && Addr(ptr) >= Yap_HeapBase)
|
||||
#endif
|
||||
|
||||
/* is val pointing to something bound to the heap? */
|
||||
|
||||
|
@ -10,10 +10,10 @@
|
||||
* File: TermExt.h *
|
||||
* mods: *
|
||||
* comments: Extensions to standard terms for YAP *
|
||||
* version: $Id: TermExt.h.m4,v 1.12 2004-01-23 02:23:12 vsc Exp $ *
|
||||
* version: $Id: TermExt.h.m4,v 1.13 2004-04-22 20:07:06 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
#ifdef THREADS
|
||||
#ifdef USE_SYSTEM_MALLOC
|
||||
#define SF_STORE (&(heap_regs->funcs))
|
||||
#else
|
||||
#define SF_STORE ((special_functors *)HEAP_INIT_BASE)
|
||||
|
@ -10,7 +10,7 @@
|
||||
* File: Yap.h.m4 *
|
||||
* mods: *
|
||||
* comments: main header file for YAP *
|
||||
* version: $Id: Yap.h.m4,v 1.56 2004-03-08 19:31:01 vsc Exp $ *
|
||||
* version: $Id: Yap.h.m4,v 1.57 2004-04-22 20:07:07 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
@ -255,7 +255,7 @@ extern char Yap_Option[20];
|
||||
#elif mips
|
||||
#define MMAP_ADDR 0x02000000
|
||||
#elif __APPLE__
|
||||
#define MMAP_ADDR 0x01000000
|
||||
#define MMAP_ADDR 0x20000000
|
||||
#else
|
||||
#define MMAP_ADDR 0x09000000
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user