- fix memory leaks
- avoid unnecessary mallocs by having a first alloc to do th ework.
This commit is contained in:
parent
e231aea1b4
commit
c4b12d5cbe
@ -122,9 +122,7 @@ static char * my_realloc(char *ptr, UInt sz, UInt osz, int safe)
|
|||||||
long long unsigned int mallocs, reallocs, frees;
|
long long unsigned int mallocs, reallocs, frees;
|
||||||
long long unsigned int tmalloc;
|
long long unsigned int tmalloc;
|
||||||
|
|
||||||
#if DEBUG
|
#undef INSTRUMENT_MALLOC
|
||||||
#define INSTRUMENT_MALLOC 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static inline char *
|
static inline char *
|
||||||
@ -264,7 +262,6 @@ Yap_InitPreAllocCodeSpace(void)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
#if INSTRUMENT_MALLOC
|
#if INSTRUMENT_MALLOC
|
||||||
fprintf(stderr,"vsc ptr=%p\n",ptr);
|
|
||||||
sz -= sizeof(CELL);
|
sz -= sizeof(CELL);
|
||||||
*(CELL*)ptr = sz;
|
*(CELL*)ptr = sz;
|
||||||
ptr += sizeof(CELL);
|
ptr += sizeof(CELL);
|
||||||
@ -308,7 +305,6 @@ Yap_ExpandPreAllocCodeSpace(UInt sz0, void *cip, int safe)
|
|||||||
reallocs++;
|
reallocs++;
|
||||||
tmalloc -= ScratchPad.sz;
|
tmalloc -= ScratchPad.sz;
|
||||||
tmalloc += sz;
|
tmalloc += sz;
|
||||||
fprintf(stderr,"vsc ptr=%p\n",ScratchPad.ptr);
|
|
||||||
#endif
|
#endif
|
||||||
if (!(ptr = my_realloc(ScratchPad.ptr, sz, ScratchPad.sz, safe))) {
|
if (!(ptr = my_realloc(ScratchPad.ptr, sz, ScratchPad.sz, safe))) {
|
||||||
Yap_PrologMode &= ~MallocMode;
|
Yap_PrologMode &= ~MallocMode;
|
||||||
|
36
C/amasm.c
36
C/amasm.c
@ -3819,6 +3819,7 @@ init_dbterms_list(yamop *code_p, PredEntry *ap)
|
|||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DEFAULT_NLABELS 4096
|
||||||
|
|
||||||
yamop *
|
yamop *
|
||||||
Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates *cip, UInt max_label)
|
Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates *cip, UInt max_label)
|
||||||
@ -3835,10 +3836,22 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
|||||||
int clause_has_dbterm = FALSE;
|
int clause_has_dbterm = FALSE;
|
||||||
|
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
cip->label_offset = (Int *)Yap_AllocCodeSpace(sizeof(Int)*max_label);
|
if (!Yap_LabelFirstArray && max_label <= DEFAULT_NLABELS) {
|
||||||
if (!cip->label_offset) {
|
Yap_LabelFirstArray = (Int *)Yap_AllocCodeSpace(sizeof(Int)*DEFAULT_NLABELS);
|
||||||
save_machine_regs();
|
Yap_LabelFirstArraySz = DEFAULT_NLABELS;
|
||||||
longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
if (!Yap_LabelFirstArray) {
|
||||||
|
save_machine_regs();
|
||||||
|
longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Yap_LabelFirstArray && max_label <= Yap_LabelFirstArraySz) {
|
||||||
|
cip->label_offset = Yap_LabelFirstArray;
|
||||||
|
} else {
|
||||||
|
cip->label_offset = (Int *)Yap_AllocCodeSpace(sizeof(Int)*max_label);
|
||||||
|
if (!cip->label_offset) {
|
||||||
|
save_machine_regs();
|
||||||
|
longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
cip->label_offset = (Int *)cip->freep;
|
cip->label_offset = (Int *)cip->freep;
|
||||||
@ -3863,7 +3876,8 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
|||||||
|
|
||||||
if(!(x = fetch_clause_space(&t,size,cip,&osize))){
|
if(!(x = fetch_clause_space(&t,size,cip,&osize))){
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
if (cip->label_offset != Yap_LabelFirstArray)
|
||||||
|
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -3880,7 +3894,8 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
|||||||
UInt osize;
|
UInt osize;
|
||||||
if(!(x = fetch_clause_space(&t,size,cip,&osize))) {
|
if(!(x = fetch_clause_space(&t,size,cip,&osize))) {
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
if (cip->label_offset != Yap_LabelFirstArray)
|
||||||
|
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -3892,7 +3907,8 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
|||||||
cl->ClSize = osize;
|
cl->ClSize = osize;
|
||||||
ProfEnd=code_p;
|
ProfEnd=code_p;
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
if (cip->label_offset != Yap_LabelFirstArray)
|
||||||
|
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
||||||
#endif
|
#endif
|
||||||
return entry_code;
|
return entry_code;
|
||||||
} else {
|
} else {
|
||||||
@ -3902,7 +3918,8 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
|||||||
Yap_Error_TYPE = OUT_OF_HEAP_ERROR;
|
Yap_Error_TYPE = OUT_OF_HEAP_ERROR;
|
||||||
Yap_Error_Size = size;
|
Yap_Error_Size = size;
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
if (cip->label_offset != Yap_LabelFirstArray)
|
||||||
|
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -3928,7 +3945,8 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
|||||||
}
|
}
|
||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
if (cip->label_offset != Yap_LabelFirstArray)
|
||||||
|
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
||||||
#endif
|
#endif
|
||||||
return entry_code;
|
return entry_code;
|
||||||
}
|
}
|
||||||
|
@ -83,31 +83,71 @@ YP_FILE *Yap_logfile;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct mem_blk {
|
typedef struct mem_blk {
|
||||||
struct mem_blk *next;
|
union {
|
||||||
|
struct mem_blk *next;
|
||||||
|
double fill;
|
||||||
|
} u;
|
||||||
char contents[1];
|
char contents[1];
|
||||||
} MemBlk;
|
} MemBlk;
|
||||||
|
|
||||||
|
#define CMEM_BLK_SIZE (4*4096)
|
||||||
|
#define FIRST_CMEM_BLK_SIZE (16*4096)
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
AllocCMem (int size, struct intermediates *cip)
|
AllocCMem (int size, struct intermediates *cip)
|
||||||
{
|
{
|
||||||
#if USE_SYSTEM_MALLOC
|
|
||||||
struct mem_blk *p = (struct mem_blk *)Yap_AllocCodeSpace(size+sizeof(struct mem_blk *));
|
|
||||||
if (!p) {
|
|
||||||
Yap_Error_Size = size;
|
|
||||||
save_machine_regs();
|
|
||||||
longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
|
||||||
}
|
|
||||||
p->next = cip->blks;
|
|
||||||
cip->blks = p;
|
|
||||||
return p->contents;
|
|
||||||
#else
|
|
||||||
char *p;
|
|
||||||
p = cip->freep;
|
|
||||||
#if SIZEOF_INT_P==8
|
#if SIZEOF_INT_P==8
|
||||||
size = (size + 7) & 0xfffffffffffffff8L;
|
size = (size + 7) & 0xfffffffffffffff8L;
|
||||||
#else
|
#else
|
||||||
size = (size + 3) & 0xfffffffcL;
|
size = (size + 3) & 0xfffffffcL;
|
||||||
#endif
|
#endif
|
||||||
|
#if USE_SYSTEM_MALLOC
|
||||||
|
if (!cip->blks || cip->blk_cur+size > cip->blk_top) {
|
||||||
|
UInt blksz;
|
||||||
|
struct mem_blk *p;
|
||||||
|
|
||||||
|
if (size > CMEM_BLK_SIZE)
|
||||||
|
blksz = size+sizeof(struct mem_blk);
|
||||||
|
else
|
||||||
|
blksz = CMEM_BLK_SIZE;
|
||||||
|
if (!cip->blks) {
|
||||||
|
if (Yap_CMemFirstBlock) {
|
||||||
|
p = Yap_CMemFirstBlock;
|
||||||
|
blksz = Yap_CMemFirstBlockSz;
|
||||||
|
p->u.next = NULL;
|
||||||
|
} else {
|
||||||
|
if (blksz < FIRST_CMEM_BLK_SIZE)
|
||||||
|
blksz = FIRST_CMEM_BLK_SIZE;
|
||||||
|
p = (struct mem_blk *)Yap_AllocCodeSpace(blksz);
|
||||||
|
if (!p) {
|
||||||
|
Yap_Error_Size = size;
|
||||||
|
save_machine_regs();
|
||||||
|
longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||||
|
}
|
||||||
|
Yap_CMemFirstBlock = p;
|
||||||
|
Yap_CMemFirstBlockSz = blksz;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p = (struct mem_blk *)Yap_AllocCodeSpace(blksz);
|
||||||
|
if (!p) {
|
||||||
|
Yap_Error_Size = size;
|
||||||
|
save_machine_regs();
|
||||||
|
longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p->u.next = cip->blks;
|
||||||
|
cip->blks = p;
|
||||||
|
cip->blk_cur = p->contents;
|
||||||
|
cip->blk_top = (char *)p+blksz;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char *out = cip->blk_cur;
|
||||||
|
cip->blk_cur += size;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
char *p;
|
||||||
|
p = cip->freep;
|
||||||
cip->freep += size;
|
cip->freep += size;
|
||||||
if (ASP <= CellPtr (cip->freep) + 256) {
|
if (ASP <= CellPtr (cip->freep) + 256) {
|
||||||
Yap_Error_Size = 256+((char *)cip->freep - (char *)H);
|
Yap_Error_Size = 256+((char *)cip->freep - (char *)H);
|
||||||
@ -124,8 +164,9 @@ Yap_ReleaseCMem (struct intermediates *cip)
|
|||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
struct mem_blk *p = cip->blks;
|
struct mem_blk *p = cip->blks;
|
||||||
while (p) {
|
while (p) {
|
||||||
struct mem_blk *nextp = p->next;
|
struct mem_blk *nextp = p->u.next;
|
||||||
Yap_FreeCodeSpace((ADDR)p);
|
if (p != Yap_CMemFirstBlock)
|
||||||
|
Yap_FreeCodeSpace((ADDR)p);
|
||||||
p = nextp;
|
p = nextp;
|
||||||
}
|
}
|
||||||
cip->blks = NULL;
|
cip->blks = NULL;
|
||||||
|
@ -1200,7 +1200,7 @@ mark_variable(CELL_PTR current)
|
|||||||
next = GET_NEXT(ccur);
|
next = GET_NEXT(ccur);
|
||||||
|
|
||||||
if (IsVarTerm(ccur)) {
|
if (IsVarTerm(ccur)) {
|
||||||
if (IsAttVar(current) && current==next) {
|
if (IN_BETWEEN(H0,current,H) && IsAttVar(current) && current==next) {
|
||||||
mark_att_var(current);
|
mark_att_var(current);
|
||||||
POP_CONTINUATION();
|
POP_CONTINUATION();
|
||||||
} else if (ONHEAP(next)) {
|
} else if (ONHEAP(next)) {
|
||||||
|
141
C/index.c
141
C/index.c
@ -2666,8 +2666,8 @@ do_blobs(GroupDef *grp, Term t, struct intermediates *cint, UInt argno, int firs
|
|||||||
|
|
||||||
ics = fetch_centry(cs, min->Tag, i, n);
|
ics = fetch_centry(cs, min->Tag, i, n);
|
||||||
ics->Tag = min->Tag;
|
ics->Tag = min->Tag;
|
||||||
while ((max+1)->Tag == min->Tag &&
|
while (max != grp->LastClause &&
|
||||||
max != grp->LastClause) max++;
|
(max+1)->Tag == min->Tag) max++;
|
||||||
if (min != max &&
|
if (min != max &&
|
||||||
(ap->PredFlags & LogUpdatePredFlag)) {
|
(ap->PredFlags & LogUpdatePredFlag)) {
|
||||||
ics->u.Label = suspend_indexing(min, max, ap, cint);
|
ics->u.Label = suspend_indexing(min, max, ap, cint);
|
||||||
@ -3310,7 +3310,6 @@ compile_index(struct intermediates *cint)
|
|||||||
{
|
{
|
||||||
PredEntry *ap = cint->CurrentPred;
|
PredEntry *ap = cint->CurrentPred;
|
||||||
int NClauses = ap->cs.p_code.NOfClauses;
|
int NClauses = ap->cs.p_code.NOfClauses;
|
||||||
ClauseDef *cls;
|
|
||||||
CELL *top = (CELL *) TR;
|
CELL *top = (CELL *) TR;
|
||||||
UInt res;
|
UInt res;
|
||||||
|
|
||||||
@ -3319,49 +3318,55 @@ compile_index(struct intermediates *cint)
|
|||||||
|
|
||||||
Yap_Error_Size = 0;
|
Yap_Error_Size = 0;
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
cls = (ClauseDef *)Yap_AllocCodeSpace(NClauses*sizeof(ClauseDef));
|
if (!cint->cls) {
|
||||||
if (!cls) {
|
cint->cls = (ClauseDef *)Yap_AllocCodeSpace(NClauses*sizeof(ClauseDef));
|
||||||
/* tell how much space we need */
|
if (!cint->cls) {
|
||||||
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
/* tell how much space we need */
|
||||||
/* grow stack */
|
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
||||||
save_machine_regs();
|
/* grow stack */
|
||||||
longjmp(cint->CompilerBotch,2);
|
save_machine_regs();
|
||||||
|
longjmp(cint->CompilerBotch,2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cint->freep = (char *)H;
|
cint->freep = (char *)H;
|
||||||
#else
|
#else
|
||||||
/* reserve double the space for compiler */
|
/* reserve double the space for compiler */
|
||||||
cls = (ClauseDef *)H;
|
cint->cls = (ClauseDef *)H;
|
||||||
if (cls+2*NClauses > (ClauseDef *)(ASP-4096)) {
|
if (cint->cls+2*NClauses > (ClauseDef *)(ASP-4096)) {
|
||||||
/* tell how much space we need */
|
/* tell how much space we need */
|
||||||
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
||||||
/* grow stack */
|
/* grow stack */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,3);
|
longjmp(cint->CompilerBotch,3);
|
||||||
}
|
}
|
||||||
cint->freep = (char *)(cls+NClauses);
|
cint->freep = (char *)(cint->cls+NClauses);
|
||||||
#endif
|
#endif
|
||||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||||
/* throw away a label */
|
/* throw away a label */
|
||||||
new_label(cint);
|
new_label(cint);
|
||||||
init_log_upd_clauses(cls,ap);
|
init_log_upd_clauses(cint->cls,ap);
|
||||||
} else if (ap->PredFlags & UDIPredFlag) {
|
} else if (ap->PredFlags & UDIPredFlag) {
|
||||||
UInt lbl = new_label(cint);
|
UInt lbl = new_label(cint);
|
||||||
Yap_emit(user_switch_op, Unsigned(ap), Unsigned(&(ap->cs.p_code.ExpandCode)), cint);
|
Yap_emit(user_switch_op, Unsigned(ap), Unsigned(&(ap->cs.p_code.ExpandCode)), cint);
|
||||||
#if USE_SYSTEM_MALLOC
|
|
||||||
Yap_FreeCodeSpace((ADDR)cls);
|
|
||||||
#endif
|
|
||||||
return lbl;
|
return lbl;
|
||||||
} else {
|
} else {
|
||||||
/* prepare basic data structures */
|
/* prepare basic data structures */
|
||||||
init_clauses(cls,ap);
|
init_clauses(cint->cls,ap);
|
||||||
}
|
}
|
||||||
res = do_index(cls, cls+(NClauses-1), cint, 1, (UInt)FAILCODE, TRUE, 0, top);
|
res = do_index(cint->cls, cint->cls+(NClauses-1), cint, 1, (UInt)FAILCODE, TRUE, 0, top);
|
||||||
#if USE_SYSTEM_MALLOC
|
|
||||||
Yap_FreeCodeSpace((ADDR)cls);
|
|
||||||
#endif
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
CleanCls(struct intermediates *cint)
|
||||||
|
{
|
||||||
|
#if USE_SYSTEM_MALLOC
|
||||||
|
if (cint->cls) {
|
||||||
|
Yap_FreeCodeSpace((ADDR)cint->cls);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
cint->cls = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
yamop *
|
yamop *
|
||||||
Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
||||||
@ -3374,12 +3379,14 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
|||||||
cint.CurrentPred = ap;
|
cint.CurrentPred = ap;
|
||||||
cint.code_addr = NULL;
|
cint.code_addr = NULL;
|
||||||
cint.blks = NULL;
|
cint.blks = NULL;
|
||||||
|
cint.cls = NULL;
|
||||||
Yap_Error_Size = 0;
|
Yap_Error_Size = 0;
|
||||||
|
|
||||||
if ((setjres = setjmp(cint.CompilerBotch)) == 3) {
|
if ((setjres = setjmp(cint.CompilerBotch)) == 3) {
|
||||||
restore_machine_regs();
|
restore_machine_regs();
|
||||||
recover_from_failed_susp_on_cls(&cint, 0);
|
recover_from_failed_susp_on_cls(&cint, 0);
|
||||||
if (!Yap_gcl(Yap_Error_Size, ap->ArityOfPE+NSlots, ENV, next_pc)) {
|
if (!Yap_gcl(Yap_Error_Size, ap->ArityOfPE+NSlots, ENV, next_pc)) {
|
||||||
|
CleanCls(&cint);
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
@ -3387,6 +3394,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
|||||||
restore_machine_regs();
|
restore_machine_regs();
|
||||||
Yap_Error_Size = recover_from_failed_susp_on_cls(&cint, Yap_Error_Size);
|
Yap_Error_Size = recover_from_failed_susp_on_cls(&cint, Yap_Error_Size);
|
||||||
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
||||||
|
CleanCls(&cint);
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
@ -3394,6 +3402,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
|||||||
restore_machine_regs();
|
restore_machine_regs();
|
||||||
recover_from_failed_susp_on_cls(&cint, 0);
|
recover_from_failed_susp_on_cls(&cint, 0);
|
||||||
if (!Yap_growtrail(Yap_Error_Size, FALSE)) {
|
if (!Yap_growtrail(Yap_Error_Size, FALSE)) {
|
||||||
|
CleanCls(&cint);
|
||||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
@ -3402,6 +3411,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
|||||||
recover_from_failed_susp_on_cls(&cint, 0);
|
recover_from_failed_susp_on_cls(&cint, 0);
|
||||||
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
|
CleanCls(&cint);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3412,6 +3422,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
|||||||
Yap_ErrorMessage = NULL;
|
Yap_ErrorMessage = NULL;
|
||||||
if (compile_index(&cint) == (UInt)FAILCODE) {
|
if (compile_index(&cint) == (UInt)FAILCODE) {
|
||||||
Yap_ReleaseCMem(&cint);
|
Yap_ReleaseCMem(&cint);
|
||||||
|
CleanCls(&cint);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -3427,6 +3438,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
|||||||
if ((indx_out = Yap_assemble(ASSEMBLING_INDEX, TermNil, ap, FALSE, &cint, cint.i_labelno+1)) == NULL) {
|
if ((indx_out = Yap_assemble(ASSEMBLING_INDEX, TermNil, ap, FALSE, &cint, cint.i_labelno+1)) == NULL) {
|
||||||
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
||||||
Yap_ReleaseCMem(&cint);
|
Yap_ReleaseCMem(&cint);
|
||||||
|
CleanCls(&cint);
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -3434,9 +3446,11 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Yap_ReleaseCMem(&cint);
|
Yap_ReleaseCMem(&cint);
|
||||||
|
CleanCls(&cint);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Yap_ReleaseCMem(&cint);
|
Yap_ReleaseCMem(&cint);
|
||||||
|
CleanCls(&cint);
|
||||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||||
LogUpdIndex *cl = ClauseCodeToLogUpdIndex(indx_out);
|
LogUpdIndex *cl = ClauseCodeToLogUpdIndex(indx_out);
|
||||||
cl->ClFlags |= SwitchRootMask;
|
cl->ClFlags |= SwitchRootMask;
|
||||||
@ -3908,7 +3922,7 @@ expand_index(struct intermediates *cint) {
|
|||||||
PredEntry *ap = cint->CurrentPred;
|
PredEntry *ap = cint->CurrentPred;
|
||||||
yamop *first, *last = NULL, *alt = NULL;
|
yamop *first, *last = NULL, *alt = NULL;
|
||||||
istack_entry *stack, *sp;
|
istack_entry *stack, *sp;
|
||||||
ClauseDef *cls = (ClauseDef *)H, *max;
|
ClauseDef *max;
|
||||||
int NClauses;
|
int NClauses;
|
||||||
/* last clause to experiment with */
|
/* last clause to experiment with */
|
||||||
yamop *ipc;
|
yamop *ipc;
|
||||||
@ -4343,16 +4357,19 @@ expand_index(struct intermediates *cint) {
|
|||||||
|
|
||||||
eblk = cint->expand_block = ipc;
|
eblk = cint->expand_block = ipc;
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
cls = (ClauseDef *)Yap_AllocCodeSpace(nclauses*sizeof(ClauseDef));
|
if (!cint->cls) {
|
||||||
if (!cls) {
|
cint->cls = (ClauseDef *)Yap_AllocCodeSpace(nclauses*sizeof(ClauseDef));
|
||||||
/* tell how much space we need */
|
if (!cint->cls) {
|
||||||
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
/* tell how much space we need */
|
||||||
/* grow stack */
|
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
||||||
save_machine_regs();
|
/* grow stack */
|
||||||
longjmp(cint->CompilerBotch,2);
|
save_machine_regs();
|
||||||
|
longjmp(cint->CompilerBotch,2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (cls+2*nclauses > (ClauseDef *)(ASP-4096)) {
|
cint->cls = (ClauseDef *)H;
|
||||||
|
if (cint->cls+2*nclauses > (ClauseDef *)(ASP-4096)) {
|
||||||
/* tell how much space we need (worst case) */
|
/* tell how much space we need (worst case) */
|
||||||
Yap_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
Yap_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
||||||
/* grow stack */
|
/* grow stack */
|
||||||
@ -4361,23 +4378,26 @@ expand_index(struct intermediates *cint) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||||
max = install_log_upd_clauseseq(cls, ap, stack, clp, clp+nclauses);
|
max = install_log_upd_clauseseq(cint->cls, ap, stack, clp, clp+nclauses);
|
||||||
} else {
|
} else {
|
||||||
max = install_clauseseq(cls, ap, stack, clp, clp+nclauses);
|
max = install_clauseseq(cint->cls, ap, stack, clp, clp+nclauses);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cint->expand_block = NULL;
|
cint->expand_block = NULL;
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
cls = (ClauseDef *)Yap_AllocCodeSpace(NClauses*sizeof(ClauseDef));
|
if (!cint->cls) {
|
||||||
if (!cls) {
|
cint->cls = (ClauseDef *)Yap_AllocCodeSpace(NClauses*sizeof(ClauseDef));
|
||||||
/* tell how much space we need */
|
if (!cint->cls) {
|
||||||
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
/* tell how much space we need */
|
||||||
/* grow stack */
|
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
||||||
save_machine_regs();
|
/* grow stack */
|
||||||
longjmp(cint->CompilerBotch,2);
|
save_machine_regs();
|
||||||
|
longjmp(cint->CompilerBotch,2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (cls+2*NClauses > (ClauseDef *)(ASP-4096)) {
|
cint->cls = (ClauseDef *)H;
|
||||||
|
if (cint->cls+2*NClauses > (ClauseDef *)(ASP-4096)) {
|
||||||
/* tell how much space we need (worst case) */
|
/* tell how much space we need (worst case) */
|
||||||
Yap_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
Yap_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
@ -4385,9 +4405,9 @@ expand_index(struct intermediates *cint) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||||
max = install_log_upd_clauses(cls, ap, stack, first, last);
|
max = install_log_upd_clauses(cint->cls, ap, stack, first, last);
|
||||||
} else {
|
} else {
|
||||||
max = install_clauses(cls, ap, stack, first, last);
|
max = install_clauses(cint->cls, ap, stack, first, last);
|
||||||
}
|
}
|
||||||
#if DEBUG_EXPAND
|
#if DEBUG_EXPAND
|
||||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||||
@ -4400,11 +4420,8 @@ expand_index(struct intermediates *cint) {
|
|||||||
}
|
}
|
||||||
/* don't count last clause if you don't have to */
|
/* don't count last clause if you don't have to */
|
||||||
if (alt && max->Code == last) max--;
|
if (alt && max->Code == last) max--;
|
||||||
if (max < cls && labp != NULL) {
|
if (max < cint->cls && labp != NULL) {
|
||||||
*labp = FAILCODE;
|
*labp = FAILCODE;
|
||||||
#if USE_SYSTEM_MALLOC
|
|
||||||
Yap_FreeCodeSpace((ADDR)cls);
|
|
||||||
#endif
|
|
||||||
return labp;
|
return labp;
|
||||||
}
|
}
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
@ -4417,14 +4434,14 @@ expand_index(struct intermediates *cint) {
|
|||||||
if (!IsVarTerm(sp[-1].val) && sp > stack) {
|
if (!IsVarTerm(sp[-1].val) && sp > stack) {
|
||||||
if (IsAtomOrIntTerm(sp[-1].val)) {
|
if (IsAtomOrIntTerm(sp[-1].val)) {
|
||||||
if (s_reg == NULL) { /* we have not yet looked into terms */
|
if (s_reg == NULL) { /* we have not yet looked into terms */
|
||||||
lab = do_index(cls, max, cint, argno+1, fail_l, isfirstcl, clleft, top);
|
lab = do_index(cint->cls, max, cint, argno+1, fail_l, isfirstcl, clleft, top);
|
||||||
} else {
|
} else {
|
||||||
UInt arity = 0;
|
UInt arity = 0;
|
||||||
|
|
||||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||||
reinstall_log_upd_clauses(cls, max, ap, stack);
|
reinstall_log_upd_clauses(cint->cls, max, ap, stack);
|
||||||
} else {
|
} else {
|
||||||
reinstall_clauses(cls, max, ap, stack);
|
reinstall_clauses(cint->cls, max, ap, stack);
|
||||||
}
|
}
|
||||||
sp--;
|
sp--;
|
||||||
while (sp > stack) {
|
while (sp > stack) {
|
||||||
@ -4444,33 +4461,30 @@ expand_index(struct intermediates *cint) {
|
|||||||
sp--;
|
sp--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lab = do_compound_index(cls, max, s_reg, cint, i, arity, argno, fail_l, isfirstcl, is_last_arg, clleft, top, FALSE);
|
lab = do_compound_index(cint->cls, max, s_reg, cint, i, arity, argno, fail_l, isfirstcl, is_last_arg, clleft, top, FALSE);
|
||||||
}
|
}
|
||||||
} else if (IsPairTerm(sp[-1].val) && sp > stack) {
|
} else if (IsPairTerm(sp[-1].val) && sp > stack) {
|
||||||
lab = do_compound_index(cls, max, s_reg, cint, i, 2, argno, fail_l, isfirstcl, is_last_arg, clleft, top, FALSE);
|
lab = do_compound_index(cint->cls, max, s_reg, cint, i, 2, argno, fail_l, isfirstcl, is_last_arg, clleft, top, FALSE);
|
||||||
} else {
|
} else {
|
||||||
Functor f = (Functor)RepAppl(sp[-1].val);
|
Functor f = (Functor)RepAppl(sp[-1].val);
|
||||||
/* we are continuing within a compound term */
|
/* we are continuing within a compound term */
|
||||||
if (IsExtensionFunctor(f)) {
|
if (IsExtensionFunctor(f)) {
|
||||||
lab = do_index(cls, max, cint, argno+1, fail_l, isfirstcl, clleft, top);
|
lab = do_index(cint->cls, max, cint, argno+1, fail_l, isfirstcl, clleft, top);
|
||||||
} else {
|
} else {
|
||||||
lab = do_compound_index(cls, max, s_reg, cint, i, ArityOfFunctor(f), argno, fail_l, isfirstcl, is_last_arg, clleft, top, FALSE);
|
lab = do_compound_index(cint->cls, max, s_reg, cint, i, ArityOfFunctor(f), argno, fail_l, isfirstcl, is_last_arg, clleft, top, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (argno == ap->ArityOfPE) {
|
if (argno == ap->ArityOfPE) {
|
||||||
lab =
|
lab =
|
||||||
do_var_clauses(cls, max, FALSE, cint, isfirstcl, clleft, fail_l, ap->ArityOfPE+1);
|
do_var_clauses(cint->cls, max, FALSE, cint, isfirstcl, clleft, fail_l, ap->ArityOfPE+1);
|
||||||
} else {
|
} else {
|
||||||
lab = do_index(cls, max, cint, argno+1, fail_l, isfirstcl, clleft, top);
|
lab = do_index(cint->cls, max, cint, argno+1, fail_l, isfirstcl, clleft, top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (labp && !(lab & 1)) {
|
if (labp && !(lab & 1)) {
|
||||||
*labp = (yamop *)lab; /* in case we have a single clause */
|
*labp = (yamop *)lab; /* in case we have a single clause */
|
||||||
}
|
}
|
||||||
#if USE_SYSTEM_MALLOC
|
|
||||||
Yap_FreeCodeSpace((ADDR)cls);
|
|
||||||
#endif
|
|
||||||
return labp;
|
return labp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4483,6 +4497,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) {
|
|||||||
struct intermediates cint;
|
struct intermediates cint;
|
||||||
|
|
||||||
cint.blks = NULL;
|
cint.blks = NULL;
|
||||||
|
cint.cls = NULL;
|
||||||
cint.code_addr = NULL;
|
cint.code_addr = NULL;
|
||||||
if ((cb = setjmp(cint.CompilerBotch)) == 3) {
|
if ((cb = setjmp(cint.CompilerBotch)) == 3) {
|
||||||
restore_machine_regs();
|
restore_machine_regs();
|
||||||
@ -4515,6 +4530,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
|
CleanCls(&cint);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
} else if (cb == 4) {
|
} else if (cb == 4) {
|
||||||
@ -4530,6 +4546,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) {
|
|||||||
cl = ClauseCodeToStaticIndex(ap->cs.p_code.TrueCodeOfPred);
|
cl = ClauseCodeToStaticIndex(ap->cs.p_code.TrueCodeOfPred);
|
||||||
Yap_kill_iblock((ClauseUnion *)cl, NULL, ap);
|
Yap_kill_iblock((ClauseUnion *)cl, NULL, ap);
|
||||||
}
|
}
|
||||||
|
CleanCls(&cint);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4596,6 +4613,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) {
|
|||||||
recover_ecls_block(expand_clauses);
|
recover_ecls_block(expand_clauses);
|
||||||
}
|
}
|
||||||
Yap_ReleaseCMem(&cint);
|
Yap_ReleaseCMem(&cint);
|
||||||
|
CleanCls(&cint);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
if (*labp == FAILCODE) {
|
if (*labp == FAILCODE) {
|
||||||
@ -4604,6 +4622,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) {
|
|||||||
recover_ecls_block(expand_clauses);
|
recover_ecls_block(expand_clauses);
|
||||||
}
|
}
|
||||||
Yap_ReleaseCMem(&cint);
|
Yap_ReleaseCMem(&cint);
|
||||||
|
CleanCls(&cint);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -4620,6 +4639,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) {
|
|||||||
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
Yap_ReleaseCMem(&cint);
|
Yap_ReleaseCMem(&cint);
|
||||||
|
CleanCls(&cint);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
goto restart_index;
|
goto restart_index;
|
||||||
@ -4631,6 +4651,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) {
|
|||||||
recover_ecls_block(expand_clauses);
|
recover_ecls_block(expand_clauses);
|
||||||
}
|
}
|
||||||
Yap_ReleaseCMem(&cint);
|
Yap_ReleaseCMem(&cint);
|
||||||
|
CleanCls(&cint);
|
||||||
return *labp;
|
return *labp;
|
||||||
}
|
}
|
||||||
if (indx_out == NULL) {
|
if (indx_out == NULL) {
|
||||||
@ -4639,9 +4660,11 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) {
|
|||||||
recover_ecls_block(expand_clauses);
|
recover_ecls_block(expand_clauses);
|
||||||
}
|
}
|
||||||
Yap_ReleaseCMem(&cint);
|
Yap_ReleaseCMem(&cint);
|
||||||
|
CleanCls(&cint);
|
||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
Yap_ReleaseCMem(&cint);
|
Yap_ReleaseCMem(&cint);
|
||||||
|
CleanCls(&cint);
|
||||||
*labp = indx_out;
|
*labp = indx_out;
|
||||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||||
/* add to head of current code children */
|
/* add to head of current code children */
|
||||||
|
@ -252,6 +252,7 @@ typedef struct intermediates {
|
|||||||
char *freep;
|
char *freep;
|
||||||
char *freep0;
|
char *freep0;
|
||||||
struct mem_blk *blks;
|
struct mem_blk *blks;
|
||||||
|
char *blk_cur, *blk_top;
|
||||||
struct PSEUDO *cpc;
|
struct PSEUDO *cpc;
|
||||||
struct PSEUDO *CodeStart;
|
struct PSEUDO *CodeStart;
|
||||||
struct PSEUDO *icpc;
|
struct PSEUDO *icpc;
|
||||||
@ -269,6 +270,8 @@ typedef struct intermediates {
|
|||||||
/* for expanding code */
|
/* for expanding code */
|
||||||
yamop **current_try_lab, **current_trust_lab;
|
yamop **current_try_lab, **current_trust_lab;
|
||||||
yamop *try_instructions;
|
yamop *try_instructions;
|
||||||
|
struct StructClauseDef *cls;
|
||||||
|
/* for expanding code */
|
||||||
union {
|
union {
|
||||||
struct static_index *si;
|
struct static_index *si;
|
||||||
struct logic_upd_index *lui;
|
struct logic_upd_index *lui;
|
||||||
|
@ -131,6 +131,12 @@
|
|||||||
#define GlobalVariables WL->global_variables
|
#define GlobalVariables WL->global_variables
|
||||||
#define Yap_AllowRestart WL->allow_restart
|
#define Yap_AllowRestart WL->allow_restart
|
||||||
|
|
||||||
|
#define Yap_CMemFirstBlock WL->cmem_first_block
|
||||||
|
#define Yap_CMemFirstBlockSz WL->cmem_first_block_sz
|
||||||
|
|
||||||
|
#define Yap_LabelFirstArray WL->label_first_array
|
||||||
|
#define Yap_LabelFirstArraySz WL->label_first_array_sz
|
||||||
|
|
||||||
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
||||||
#define WORKER WL->worker
|
#define WORKER WL->worker
|
||||||
#endif
|
#endif
|
||||||
|
@ -133,6 +133,12 @@ typedef struct worker_local {
|
|||||||
struct global_entry* global_variables;
|
struct global_entry* global_variables;
|
||||||
int allow_restart;
|
int allow_restart;
|
||||||
|
|
||||||
|
struct mem_blk* cmem_first_block;
|
||||||
|
UInt cmem_first_block_sz;
|
||||||
|
|
||||||
|
Int* label_first_array;
|
||||||
|
UInt label_first_array_sz;
|
||||||
|
|
||||||
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
||||||
struct worker worker;
|
struct worker worker;
|
||||||
#endif
|
#endif
|
||||||
|
@ -131,6 +131,12 @@ static void InitWorker(int wid) {
|
|||||||
FOREIGN_WL(wid)->global_variables = NULL;
|
FOREIGN_WL(wid)->global_variables = NULL;
|
||||||
FOREIGN_WL(wid)->allow_restart = FALSE;
|
FOREIGN_WL(wid)->allow_restart = FALSE;
|
||||||
|
|
||||||
|
FOREIGN_WL(wid)->cmem_first_block = NULL;
|
||||||
|
FOREIGN_WL(wid)->cmem_first_block_sz = 0L;
|
||||||
|
|
||||||
|
FOREIGN_WL(wid)->label_first_array = NULL;
|
||||||
|
FOREIGN_WL(wid)->label_first_array_sz = 0L;
|
||||||
|
|
||||||
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -131,6 +131,12 @@ static void RestoreWorker(int wid) {
|
|||||||
FOREIGN_WL(wid)->global_variables = PtoGlobalEAdjust(FOREIGN_WL(wid)->global_variables);
|
FOREIGN_WL(wid)->global_variables = PtoGlobalEAdjust(FOREIGN_WL(wid)->global_variables);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,6 +145,14 @@ struct static_array_entry* static_arrays StaticArrays =NULL PtoArraySAdjust
|
|||||||
struct global_entry* global_variables GlobalVariables =NULL PtoGlobalEAdjust
|
struct global_entry* global_variables GlobalVariables =NULL PtoGlobalEAdjust
|
||||||
int allow_restart Yap_AllowRestart =FALSE
|
int allow_restart Yap_AllowRestart =FALSE
|
||||||
|
|
||||||
|
// Thread Local Area for Fast Storage of Intermediate Compiled Code.
|
||||||
|
struct mem_blk* cmem_first_block Yap_CMemFirstBlock =NULL
|
||||||
|
UInt cmem_first_block_sz Yap_CMemFirstBlockSz =0L
|
||||||
|
|
||||||
|
// Thread Local Area for Labels.
|
||||||
|
Int* label_first_array Yap_LabelFirstArray =NULL
|
||||||
|
UInt label_first_array_sz Yap_LabelFirstArraySz =0L
|
||||||
|
|
||||||
// Ricardo's stuff
|
// Ricardo's stuff
|
||||||
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
|
||||||
struct worker worker WORKER void
|
struct worker worker WORKER void
|
||||||
|
Reference in New Issue
Block a user