diff --git a/C/absmi.c b/C/absmi.c index 296163799..e06428ff3 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -2436,6 +2436,7 @@ Yap_absmi(int inp) ENDBOp(); NoStackExecute: + CHECK_ALARM(JMPNext()); SREG = (CELL *) PREG->u.pp.p; PP = PREG->u.pp.p0; if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) { @@ -2578,6 +2579,7 @@ Yap_absmi(int inp) ENDBOp(); NoStackCall: + CHECK_ALARM(JMPNext()); PP = PREG->u.Osbpp.p0; /* on X86 machines S will not actually be holding the pointer to pred */ if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { @@ -2615,6 +2617,7 @@ Yap_absmi(int inp) so I don't need to redo it. */ NoStackDeallocate: + CHECK_ALARM(JMPNext()); { CELL cut_b = LCL0-(CELL *)(SREG[E_CB]); @@ -2669,6 +2672,7 @@ Yap_absmi(int inp) /* This is easier: I know there is an environment so I cannot do allocate */ NoStackCut: + CHECK_ALARM(goto do_cut); /* find something to fool S */ if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) { goto do_cut; @@ -2689,6 +2693,7 @@ Yap_absmi(int inp) goto do_cut; NoStackCutT: + CHECK_ALARM(goto do_cut_t); /* find something to fool S */ if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) { goto do_cut_t; @@ -2709,8 +2714,9 @@ Yap_absmi(int inp) goto do_cut_t; NoStackCutE: + CHECK_ALARM(goto do_cut_e); if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) { - goto do_cut_t; + goto do_cut_e; } if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL; @@ -2729,6 +2735,7 @@ Yap_absmi(int inp) /* This is easier: I know there is an environment so I cannot do allocate */ NoStackCommitY: + CHECK_ALARM(goto do_commit_b_y); PP = PREG->u.yps.p0; /* find something to fool S */ if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) { @@ -2751,6 +2758,7 @@ Yap_absmi(int inp) /* Problem: have I got an environment or not? */ NoStackCommitX: + CHECK_ALARM(goto do_commit_b_x); PP = PREG->u.xps.p0; /* find something to fool S */ if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) { @@ -2788,6 +2796,7 @@ Yap_absmi(int inp) /* Problem: have I got an environment or not? */ NoStackFail: + CHECK_ALARM(goto fail); if (LOCAL_ActiveSignals && LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL; if (!LOCAL_ActiveSignals) @@ -2811,6 +2820,7 @@ Yap_absmi(int inp) /* don't forget I cannot creep at ; */ NoStackEither: + CHECK_ALARM(goto either_notest); if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL; if (!LOCAL_ActiveSignals) @@ -2893,6 +2903,7 @@ Yap_absmi(int inp) goto creep; NoStackDExecute: + CHECK_ALARM(JMPNext()); if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL; if (!LOCAL_ActiveSignals) @@ -2970,8 +2981,8 @@ Yap_absmi(int inp) NoStackExec: + CHECK_ALARM(JMPNext()); /* try performing garbage collection */ - if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL; if (!LOCAL_ActiveSignals) @@ -13027,6 +13038,7 @@ Yap_absmi(int inp) ENDD(d0); NoStackPExecute2: + CHECK_ALARM(goto execute2_end); if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL; if (!LOCAL_ActiveSignals) @@ -13232,6 +13244,7 @@ Yap_absmi(int inp) ENDD(d0); NoStackPExecute: + CHECK_ALARM(goto execute_end); if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL; if (!LOCAL_ActiveSignals) @@ -13464,6 +13477,7 @@ Yap_absmi(int inp) ENDD(d0); ENDP(pt0); NoStackPTExecute: + CHECK_ALARM(goto execute_after_comma); if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL; if (!LOCAL_ActiveSignals) diff --git a/C/adtdefs.c b/C/adtdefs.c index 9d90b7351..63d9621e0 100644 --- a/C/adtdefs.c +++ b/C/adtdefs.c @@ -847,15 +847,10 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod) } p->FunctorOfPred = fe; WRITE_UNLOCK(fe->FRWLock); -#ifdef LOW_PROF - if (ProfilerOn && - Yap_OffLineProfiler) { - Yap_inform_profiler_of_clause((yamop *)&(p->OpcodeOfPred), (yamop *)(&(p->OpcodeOfPred)+1), p, 1); - if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) { - Yap_inform_profiler_of_clause((yamop *)&(p->cs.p_code.ExpandCode), (yamop *)(&(p->cs.p_code.ExpandCode)+1), p, 1); - } + Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_FUNC); + if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) { + Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_FUNC); } -#endif /* LOW_PROF */ return AbsPredProp(p); } @@ -896,15 +891,10 @@ Yap_NewThreadPred(PredEntry *ap USES_REGS) p->NextOfPE = AbsPredProp(LOCAL_ThreadHandle.local_preds); LOCAL_ThreadHandle.local_preds = p; p->FunctorOfPred = ap->FunctorOfPred; -#ifdef LOW_PROF - if (ProfilerOn && - Yap_OffLineProfiler) { - Yap_inform_profiler_of_clause((yamop *)&(p->OpcodeOfPred), (yamop *)(&(p->OpcodeOfPred)+1), p, 1); - if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) { - Yap_inform_profiler_of_clause((yamop *)&(p->cs.p_code.ExpandCode), (yamop *)(&(p->cs.p_code.ExpandCode)+1), p, 1); - } - } -#endif /* LOW_PROF */ + Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_THREAD); + if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) { + Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_THREAD); + } return AbsPredProp(p); } #endif @@ -968,15 +958,10 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod) p0 = AbsPredProp(p); p->FunctorOfPred = (Functor)AbsAtom(ae); WRITE_UNLOCK(ae->ARWLock); -#ifdef LOW_PROF - if (ProfilerOn && - Yap_OffLineProfiler) { - Yap_inform_profiler_of_clause((yamop *)&(p->OpcodeOfPred), (yamop *)(&(p->OpcodeOfPred)+1), p, 1); - if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) { - Yap_inform_profiler_of_clause((yamop *)&(p->cs.p_code.ExpandCode), (yamop *)(&(p->cs.p_code.ExpandCode)+1), p, 1); - } - } -#endif /* LOW_PROF */ + Yap_inform_profiler_of_clause((yamop *)&(p->OpcodeOfPred), (yamop *)(&(p->OpcodeOfPred)+1), p, GPROF_NEW_PRED_ATOM); + if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) { + Yap_inform_profiler_of_clause((yamop *)&(p->cs.p_code.ExpandCode), (yamop *)(&(p->cs.p_code.ExpandCode)+1), p, GPROF_NEW_PRED_ATOM); + } return p0; } diff --git a/C/amasm.c b/C/amasm.c index f77e94676..980f3064f 100644 --- a/C/amasm.c +++ b/C/amasm.c @@ -2059,6 +2059,7 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod save_machine_regs(); siglongjmp(cip->CompilerBotch,2); } + Yap_inform_profiler_of_clause(newcp, (char *)(newcp)+size, ap, GPROF_INDEX); Yap_LUIndexSpace_CP += size; #ifdef DEBUG Yap_NewCps++; @@ -3935,6 +3936,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates cl->usc.ClSource = x; cl->ClSize = osize; LOCAL_ProfEnd=code_p; + Yap_inform_profiler_of_clause(cl, LOCAL_ProfEnd, ap, GPROF_CLAUSE); return entry_code; } else { while ((cip->code_addr = (yamop *) Yap_AllocCodeSpace(size)) == NULL) { @@ -3945,6 +3947,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates return NULL; } } + Yap_inform_profiler_of_clause(cip->code_addr, (char *)(cip->code_addr)+size, ap, ( mode == ASSEMBLING_INDEX ? GPROF_INDEX : GPROF_CLAUSE )); if (mode == ASSEMBLING_CLAUSE) { if (ap->PredFlags & LogUpdatePredFlag) { ((LogUpdClause *)(cip->code_addr))->ClSize = size; @@ -3960,13 +3963,6 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates } } code_p = do_pass(1, &entry_code, mode, &clause_has_blobs, &clause_has_dbterm, cip, size PASS_REGS); - LOCAL_ProfEnd=code_p; -#ifdef LOW_PROF - if (ProfilerOn && - Yap_OffLineProfiler) { - Yap_inform_profiler_of_clause(entry_code, LOCAL_ProfEnd, ap, mode == ASSEMBLING_INDEX); - } -#endif /* LOW_PROF */ return entry_code; } diff --git a/C/c_interface.c b/C/c_interface.c index ef9593fbc..610dc9c00 100644 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -2894,7 +2894,7 @@ do_bootfile (char *bootfilename) } YAP_EndConsult(bootfile); #ifdef DEBUG - if (output_msg) + if (Yap_output_msg) fprintf(stderr,"Boot loaded\n"); #endif } diff --git a/C/cdmgr.c b/C/cdmgr.c index 218bf9827..43754aa31 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -881,7 +881,7 @@ Yap_BuildMegaClause(PredEntry *ap) StaticClause *ncl, *curcl = cl; ncl = cl->ClNext; - Yap_InformOfRemoval((CODEADDR)cl); + Yap_InformOfRemoval(cl); Yap_ClauseSpace -= cl->ClSize; Yap_FreeCodeSpace((ADDR)cl); if (curcl->ClCode == ap->cs.p_code.LastClause) @@ -892,6 +892,7 @@ Yap_BuildMegaClause(PredEntry *ap) ap->cs.p_code.LastClause = mcl->ClCode; ap->PredFlags |= MegaClausePredFlag; + Yap_inform_profiler_of_clause(mcl, (char *)mcl+required, ap, GPROF_MEGA); } @@ -913,7 +914,7 @@ split_megaclause(PredEntry *ap) while (start) { StaticClause *cl = start; start = cl->ClNext; - Yap_InformOfRemoval((CODEADDR)cl); + Yap_InformOfRemoval(cl); Yap_ClauseSpace -= cl->ClSize; Yap_FreeCodeSpace((char *)cl); } @@ -1115,7 +1116,7 @@ release_wcls(yamop *cop, OPCODE ecs) cop->u.sssllp.snext->u.sssllp.sprev = cop->u.sssllp.sprev; } UNLOCK(ExpandClausesListLock); - Yap_InformOfRemoval((CODEADDR)cop); + Yap_InformOfRemoval(cop); Yap_FreeCodeSpace((char *)cop); } } @@ -1323,7 +1324,7 @@ kill_static_child_indxs(StaticIndex *indx, int in_use) DeadStaticIndices = indx; UNLOCK(DeadStaticIndicesLock); } else { - Yap_InformOfRemoval((CODEADDR)indx); + Yap_InformOfRemoval(indx); if (indx->ClFlags & SwitchTableMask) Yap_IndexSpace_SW -= indx->ClSize; else @@ -1378,7 +1379,7 @@ kill_off_lu_block(LogUpdIndex *c, LogUpdIndex *parent, PredEntry *ap) } else { DBErasedIList = c->SiblingIndex; } - Yap_InformOfRemoval((CODEADDR)c); + Yap_InformOfRemoval(c); if (c->ClFlags & SwitchTableMask) Yap_LUIndexSpace_SW -= c->ClSize; else { @@ -1576,7 +1577,7 @@ retract_all(PredEntry *p, int in_use) DeadMegaClauses = cl; UNLOCK(DeadMegaClausesLock); } else { - Yap_InformOfRemoval((CODEADDR)cl); + Yap_InformOfRemoval(cl); Yap_ClauseSpace -= cl->ClSize; Yap_FreeCodeSpace((char *)cl); } @@ -1595,7 +1596,7 @@ retract_all(PredEntry *p, int in_use) DeadStaticClauses = cl; UNLOCK(DeadStaticClausesLock); } else { - Yap_InformOfRemoval((CODEADDR)cl); + Yap_InformOfRemoval(cl); Yap_ClauseSpace -= cl->ClSize; Yap_FreeCodeSpace((char *)cl); } @@ -2397,7 +2398,7 @@ Yap_EraseStaticClause(StaticClause *cl, Term mod) { DeadStaticClauses = cl; UNLOCK(DeadStaticClausesLock); } else { - Yap_InformOfRemoval((CODEADDR)cl); + Yap_InformOfRemoval(cl); Yap_ClauseSpace -= cl->ClSize; Yap_FreeCodeSpace((char *)cl); } @@ -4184,7 +4185,7 @@ p_clean_up_dead_clauses( USES_REGS1 ) char *pt = (char *)DeadStaticClauses; Yap_ClauseSpace -= DeadStaticClauses->ClSize; DeadStaticClauses = DeadStaticClauses->ClNext; - Yap_InformOfRemoval((CODEADDR)pt); + Yap_InformOfRemoval(pt); Yap_FreeCodeSpace(pt); } while (DeadStaticIndices != NULL) { @@ -4194,14 +4195,14 @@ p_clean_up_dead_clauses( USES_REGS1 ) else Yap_IndexSpace_Tree -= DeadStaticIndices->ClSize; DeadStaticIndices = DeadStaticIndices->SiblingIndex; - Yap_InformOfRemoval((CODEADDR)pt); + Yap_InformOfRemoval(pt); Yap_FreeCodeSpace(pt); } while (DeadMegaClauses != NULL) { char *pt = (char *)DeadMegaClauses; Yap_ClauseSpace -= DeadMegaClauses->ClSize; DeadMegaClauses = DeadMegaClauses->ClNext; - Yap_InformOfRemoval((CODEADDR)pt); + Yap_InformOfRemoval(pt); Yap_FreeCodeSpace(pt); } return TRUE; @@ -5107,7 +5108,7 @@ static void add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp) { char *code_end = (char *)cl + cl->ClSize; - Yap_inform_profiler_of_clause(cl->ClCode, (yamop *)code_end, pp,0); + Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_LU_INDEX); cl = cl->ChildIndex; while (cl != NULL) { add_code_in_lu_index(cl, pp); @@ -5119,7 +5120,7 @@ static void add_code_in_static_index(StaticIndex *cl, PredEntry *pp) { char *code_end = (char *)cl + cl->ClSize; - Yap_inform_profiler_of_clause(cl->ClCode, (yamop *)code_end, pp,0); + Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_STATIC_INDEX); cl = cl->ChildIndex; while (cl != NULL) { add_code_in_static_index(cl, pp); @@ -5136,7 +5137,7 @@ add_code_in_pred(PredEntry *pp) { /* check if the codeptr comes from the indexing code */ /* highly likely this is used for indexing */ - Yap_inform_profiler_of_clause((yamop *)&(pp->OpcodeOfPred), (yamop *)(&(pp->OpcodeOfPred)+1), pp, 1); + Yap_inform_profiler_of_clause(&(pp->OpcodeOfPred), &(pp->OpcodeOfPred)+1, pp, GPROF_INIT_OPCODE); if (pp->PredFlags & (CPredFlag|AsmPredFlag)) { char *code_end; StaticClause *cl; @@ -5144,11 +5145,11 @@ add_code_in_pred(PredEntry *pp) { clcode = pp->CodeOfPred; cl = ClauseCodeToStaticClause(clcode); code_end = (char *)cl + cl->ClSize; - Yap_inform_profiler_of_clause(clcode, (yamop *)code_end, pp,0); + Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_INIT_SYSTEM_CODE); UNLOCK(pp->PELock); return; } - Yap_inform_profiler_of_clause((yamop *)&(pp->cs.p_code.ExpandCode), (yamop *)(&(pp->cs.p_code.ExpandCode)+1), pp, 1); + Yap_inform_profiler_of_clause(&(pp->cs.p_code.ExpandCode), &(pp->cs.p_code.ExpandCode)+1, pp, GPROF_INIT_EXPAND); clcode = pp->cs.p_code.TrueCodeOfPred; if (pp->PredFlags & IndexedPredFlag) { if (pp->PredFlags & LogUpdatePredFlag) { @@ -5167,7 +5168,7 @@ add_code_in_pred(PredEntry *pp) { char *code_end; code_end = (char *)cl + cl->ClSize; - Yap_inform_profiler_of_clause(cl->ClCode, (yamop *)code_end, pp,0); + Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_INIT_LOG_UPD_CLAUSE); cl = cl->ClNext; } while (cl != NULL); } else if (pp->PredFlags & DynamicPredFlag) { @@ -5177,7 +5178,7 @@ add_code_in_pred(PredEntry *pp) { cl = ClauseCodeToDynamicClause(clcode); code_end = (CODEADDR)cl + cl->ClSize; - Yap_inform_profiler_of_clause(clcode, (yamop *)code_end, pp,0); + Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_INIT_DYNAMIC_CLAUSE); if (clcode == pp->cs.p_code.LastClause) break; clcode = NextDynamicClause(clcode); @@ -5188,7 +5189,7 @@ add_code_in_pred(PredEntry *pp) { char *code_end; code_end = (char *)cl + cl->ClSize; - Yap_inform_profiler_of_clause(cl->ClCode, (yamop *)code_end, pp,0); + Yap_inform_profiler_of_clause(cl, code_end, pp,GPROF_INIT_STATIC_CLAUSE); if (cl->ClCode == pp->cs.p_code.LastClause) break; cl = cl->ClNext; @@ -5222,8 +5223,8 @@ Yap_dump_code_area_for_profiler(void) { } me = me->NextME; } - Yap_inform_profiler_of_clause(COMMA_CODE, FAILCODE, RepPredProp(Yap_GetPredPropByFunc(FunctorComma,0)),0); - Yap_inform_profiler_of_clause(FAILCODE, FAILCODE+1, RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)),0); + Yap_inform_profiler_of_clause(COMMA_CODE, FAILCODE, RepPredProp(Yap_GetPredPropByFunc(FunctorComma,0)), GPROF_INIT_COMMA); + Yap_inform_profiler_of_clause(FAILCODE, FAILCODE+1, RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)), GPROF_INIT_FAIL); } #endif /* LOW_PROF */ diff --git a/C/compiler.c b/C/compiler.c index e2053dfe6..d42504c72 100644 --- a/C/compiler.c +++ b/C/compiler.c @@ -3606,13 +3606,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src) if (acode == NULL) { return NULL; } else { -#ifdef LOW_PROF - if (ProfilerOn && - Yap_OffLineProfiler) { - Yap_inform_profiler_of_clause(acode, LOCAL_ProfEnd, cglobs.cint.CurrentPred,0); - } -#endif /* LOW_PROF */ - return(acode); + return acode; } } diff --git a/C/dbase.c b/C/dbase.c index 87d3bee2b..a7edad4cd 100644 --- a/C/dbase.c +++ b/C/dbase.c @@ -1892,12 +1892,7 @@ record_lu(PredEntry *pe, Term t, int position) if ((cl = new_lu_db_entry(t, pe)) == NULL) { return NULL; } -#ifdef LOW_PROF - if (ProfilerOn && - Yap_OffLineProfiler) { - Yap_inform_profiler_of_clause(cl->ClCode, (yamop *)(cl+cl->ClSize), pe, 0); - } -#endif /* LOW_PROF */ + Yap_inform_profiler_of_clause(cl, (char *)cl+cl->ClSize, pe, GPROF_NEW_LU_CLAUSE); Yap_add_logupd_clause(pe, cl, (position == MkFirst ? 2 : 0)); return cl; } @@ -4086,7 +4081,7 @@ complete_lu_erase(LogUpdClause *clau) } } } - Yap_InformOfRemoval((CODEADDR)clau); + Yap_InformOfRemoval(clau); Yap_LUClauseSpace -= clau->ClSize; Yap_FreeCodeSpace((char *)clau); } @@ -4198,7 +4193,7 @@ MyEraseClause(DynamicClause *clau USES_REGS) P = np; } } else { - Yap_InformOfRemoval((CODEADDR)clau); + Yap_InformOfRemoval(clau); Yap_LUClauseSpace -= clau->ClSize; Yap_FreeCodeSpace((char *)clau); #ifdef DEBUG diff --git a/C/gprof.c b/C/gprof.c index 3d475456f..1ea415dbc 100644 --- a/C/gprof.c +++ b/C/gprof.c @@ -129,12 +129,22 @@ typedef greg_t context_reg; #define PROFILING_FILE 1 #define PROFPREDS_FILE 2 +typedef struct { + char tag; + void *ptr; +} __attribute__ ((packed)) buf_ptr; +typedef struct { + gprof_info inf; + void *end; + PredEntry *pe; +} __attribute__ ((packed)) buf_extra; typedef struct RB_red_blk_node { yamop *key; /* first address */ yamop *lim; /* end address */ PredEntry *pe; /* parent predicate */ + gprof_info source; /* how block was allocated */ UInt pcs; /* counter with total for each clause */ int red; /* if red=0 then the node is black */ struct RB_red_blk_node* left; @@ -162,16 +172,18 @@ RBTreeCreate(void) { /* see the comment in the rb_red_blk_tree structure in red_black_tree.h */ /* for information on nil and root */ - temp=GLOBAL_ProfilerNil= RBMalloc(sizeof(rb_red_blk_node)); + temp=LOCAL_ProfilerNil= RBMalloc(sizeof(rb_red_blk_node)); temp->parent=temp->left=temp->right=temp; temp->pcs=0; temp->red=0; temp->key=temp->lim=NULL; temp->pe=NULL; + temp->source=GPROF_NO_EVENT;; temp = RBMalloc(sizeof(rb_red_blk_node)); - temp->parent=temp->left=temp->right=GLOBAL_ProfilerNil; + temp->parent=temp->left=temp->right=LOCAL_ProfilerNil; temp->key=temp->lim=NULL; temp->pe=NULL; + temp->source=GPROF_NO_EVENT; temp->pcs=0; temp->red=0; return temp; @@ -199,7 +211,7 @@ RBTreeCreate(void) { static void LeftRotate(rb_red_blk_node* x) { rb_red_blk_node* y; - rb_red_blk_node* nil=GLOBAL_ProfilerNil; + rb_red_blk_node* nil=LOCAL_ProfilerNil; /* I originally wrote this function to use the sentinel for */ /* nil to avoid checking for nil. However this introduces a */ @@ -230,7 +242,7 @@ LeftRotate(rb_red_blk_node* x) { x->parent=y; #ifdef DEBUG_ASSERT - Assert(!GLOBAL_ProfilerNil->red,"nil not red in LeftRotate"); + Assert(!LOCAL_ProfilerNil->red,"nil not red in LeftRotate"); #endif } @@ -255,7 +267,7 @@ LeftRotate(rb_red_blk_node* x) { static void RightRotate(rb_red_blk_node* y) { rb_red_blk_node* x; - rb_red_blk_node* nil=GLOBAL_ProfilerNil; + rb_red_blk_node* nil=LOCAL_ProfilerNil; /* I originally wrote this function to use the sentinel for */ /* nil to avoid checking for nil. However this introduces a */ @@ -285,7 +297,7 @@ RightRotate(rb_red_blk_node* y) { y->parent=x; #ifdef DEBUG_ASSERT - Assert(!GLOBAL_ProfilerNil->red,"nil not red in RightRotate"); + Assert(!LOCAL_ProfilerNil->red,"nil not red in RightRotate"); #endif } @@ -309,11 +321,11 @@ TreeInsertHelp(rb_red_blk_node* z) { /* This function should only be called by InsertRBTree (see above) */ rb_red_blk_node* x; rb_red_blk_node* y; - rb_red_blk_node* nil=GLOBAL_ProfilerNil; + rb_red_blk_node* nil=LOCAL_ProfilerNil; z->left=z->right=nil; - y=GLOBAL_ProfilerRoot; - x=GLOBAL_ProfilerRoot->left; + y=LOCAL_ProfilerRoot; + x=LOCAL_ProfilerRoot->left; while( x != nil) { y=x; if (x->key > z->key) { /* x.key > z.key */ @@ -323,7 +335,7 @@ TreeInsertHelp(rb_red_blk_node* z) { } } z->parent=y; - if ( (y == GLOBAL_ProfilerRoot) || + if ( (y == LOCAL_ProfilerRoot) || (y->key > z->key)) { /* y.key > z.key */ y->left=z; } else { @@ -331,7 +343,7 @@ TreeInsertHelp(rb_red_blk_node* z) { } #ifdef DEBUG_ASSERT - Assert(!GLOBAL_ProfilerNil->red,"nil not red in TreeInsertHelp"); + Assert(!LOCAL_ProfilerNil->red,"nil not red in TreeInsertHelp"); #endif } @@ -403,12 +415,12 @@ RBTreeInsert(yamop *key, yamop *lim) { } } } - GLOBAL_ProfilerRoot->left->red=0; + LOCAL_ProfilerRoot->left->red=0; return newNode; #ifdef DEBUG_ASSERT - Assert(!GLOBAL_ProfilerNil->red,"nil not red in RBTreeInsert"); - Assert(!GLOBAL_ProfilerRoot->red,"root not red in RBTreeInsert"); + Assert(!LOCAL_ProfilerNil->red,"nil not red in RBTreeInsert"); + Assert(!LOCAL_ProfilerRoot->red,"root not red in RBTreeInsert"); #endif } @@ -429,10 +441,10 @@ RBTreeInsert(yamop *key, yamop *lim) { static rb_red_blk_node* RBExactQuery(yamop* q) { rb_red_blk_node* x; - rb_red_blk_node* nil=GLOBAL_ProfilerNil; + rb_red_blk_node* nil=LOCAL_ProfilerNil; - if (!GLOBAL_ProfilerRoot) return NULL; - x=GLOBAL_ProfilerRoot->left; + if (!LOCAL_ProfilerRoot) return NULL; + x=LOCAL_ProfilerRoot->left; if (x == nil) return NULL; while(x->key != q) {/*assignemnt*/ if (x->key > q) { /* x->key > q */ @@ -450,10 +462,10 @@ static rb_red_blk_node* RBLookup(yamop *entry) { rb_red_blk_node *current; - if (!GLOBAL_ProfilerRoot) + if (!LOCAL_ProfilerRoot) return NULL; - current = GLOBAL_ProfilerRoot->left; - while (current != GLOBAL_ProfilerNil) { + current = LOCAL_ProfilerRoot->left; + while (current != LOCAL_ProfilerNil) { if (current->key <= entry && current->lim >= entry) { return current; } @@ -483,7 +495,7 @@ RBLookup(yamop *entry) { /***********************************************************************/ static void RBDeleteFixUp(rb_red_blk_node* x) { - rb_red_blk_node* root=GLOBAL_ProfilerRoot->left; + rb_red_blk_node* root=LOCAL_ProfilerRoot->left; rb_red_blk_node *w; while( (!x->red) && (root != x)) { @@ -563,8 +575,8 @@ static void RBDeleteFixUp(rb_red_blk_node* x) { static rb_red_blk_node* TreeSuccessor(rb_red_blk_node* x) { rb_red_blk_node* y; - rb_red_blk_node* nil=GLOBAL_ProfilerNil; - rb_red_blk_node* root=GLOBAL_ProfilerRoot; + rb_red_blk_node* nil=LOCAL_ProfilerNil; + rb_red_blk_node* root=LOCAL_ProfilerRoot; if (nil != (y = x->right)) { /* assignment to y is intentional */ while(y->left != nil) { /* returns the minium of the right subtree of x */ @@ -602,8 +614,8 @@ static void RBDelete(rb_red_blk_node* z){ rb_red_blk_node* y; rb_red_blk_node* x; - rb_red_blk_node* nil=GLOBAL_ProfilerNil; - rb_red_blk_node* root=GLOBAL_ProfilerRoot; + rb_red_blk_node* nil=LOCAL_ProfilerNil; + rb_red_blk_node* root=LOCAL_ProfilerRoot; y= ((z->left == nil) || (z->right == nil)) ? z : TreeSuccessor(z); x= (y->left == nil) ? y->right : y->left; @@ -656,21 +668,21 @@ int size=0; if (name!=NULL) { size=strlen(name)+1; - if (GLOBAL_DIRNAME!=NULL) free(GLOBAL_DIRNAME); - GLOBAL_DIRNAME=malloc(size); - if (GLOBAL_DIRNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } - strcpy(GLOBAL_DIRNAME,name); + if (LOCAL_DIRNAME!=NULL) free(LOCAL_DIRNAME); + LOCAL_DIRNAME=malloc(size); + if (LOCAL_DIRNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } + strcpy(LOCAL_DIRNAME,name); } - if (GLOBAL_DIRNAME==NULL) { + if (LOCAL_DIRNAME==NULL) { do { - if (GLOBAL_DIRNAME!=NULL) free(GLOBAL_DIRNAME); + if (LOCAL_DIRNAME!=NULL) free(LOCAL_DIRNAME); size+=20; - GLOBAL_DIRNAME=malloc(size); - if (GLOBAL_DIRNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } - } while (getcwd(GLOBAL_DIRNAME, size-15)==NULL); + LOCAL_DIRNAME=malloc(size); + if (LOCAL_DIRNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } + } while (getcwd(LOCAL_DIRNAME, size-15)==NULL); } -return GLOBAL_DIRNAME; +return LOCAL_DIRNAME; } char *profile_names(int); @@ -678,12 +690,12 @@ char *profile_names(int k) { static char *FNAME=NULL; int size=200; - if (GLOBAL_DIRNAME==NULL) set_profile_dir(NULL); - size=strlen(GLOBAL_DIRNAME)+40; + if (LOCAL_DIRNAME==NULL) set_profile_dir(NULL); + size=strlen(LOCAL_DIRNAME)+40; if (FNAME!=NULL) free(FNAME); FNAME=malloc(size); if (FNAME==NULL) { printf("Profiler Out of Mem\n"); exit(1); } - strcpy(FNAME,GLOBAL_DIRNAME); + strcpy(FNAME,LOCAL_DIRNAME); if (k==PROFILING_FILE) { sprintf(FNAME,"%s/PROFILING_%d",FNAME,getpid()); @@ -697,26 +709,25 @@ int size=200; void del_profile_files(void); void del_profile_files() { - if (GLOBAL_DIRNAME!=NULL) { + if (LOCAL_DIRNAME!=NULL) { remove(profile_names(PROFPREDS_FILE)); remove(profile_names(PROFILING_FILE)); } } void -Yap_inform_profiler_of_clause(yamop *code_start, yamop *code_end, PredEntry *pe,int index_code) { -static Int order=0; - - ProfPreds++; - GLOBAL_ProfOn = TRUE; - if (FPreds != NULL) { - Int temp; - - order++; - if (index_code) temp=-order; else temp=order; - fprintf(FPreds,"+%p %p %p %ld\n",code_start,code_end, pe, (long int)temp); - } - GLOBAL_ProfOn = FALSE; +Yap_inform_profiler_of_clause__(void *code_start, void *code_end, PredEntry *pe,gprof_info index_code) { + buf_ptr b; + buf_extra e; + LOCAL_ProfOn = TRUE; + b.tag = '+'; + b.ptr= code_start; + e.inf= index_code; + e.end= code_end; + e.pe= pe; + fwrite(&b,sizeof(b),1,LOCAL_FPreds); + fwrite(&e,sizeof(e),1,LOCAL_FPreds); + LOCAL_ProfOn = FALSE; } typedef struct clause_entry { @@ -731,7 +742,7 @@ static Int profend( USES_REGS1 ); static void clean_tree(rb_red_blk_node* node) { - if (node == GLOBAL_ProfilerNil) + if (node == LOCAL_ProfilerNil) return; clean_tree(node->left); clean_tree(node->right); @@ -740,18 +751,18 @@ clean_tree(rb_red_blk_node* node) { static void reset_tree(void) { - clean_tree(GLOBAL_ProfilerRoot); - Yap_FreeCodeSpace((char *)GLOBAL_ProfilerNil); - GLOBAL_ProfilerNil = GLOBAL_ProfilerRoot = NULL; - GLOBAL_ProfCalls = GLOBAL_ProfGCs = GLOBAL_ProfHGrows = GLOBAL_ProfSGrows = GLOBAL_ProfMallocs = GLOBAL_ProfOns = 0L; + clean_tree(LOCAL_ProfilerRoot); + Yap_FreeCodeSpace((char *)LOCAL_ProfilerNil); + LOCAL_ProfilerNil = LOCAL_ProfilerRoot = NULL; + LOCAL_ProfCalls = LOCAL_ProfGCs = LOCAL_ProfHGrows = LOCAL_ProfSGrows = LOCAL_ProfMallocs = LOCAL_ProfOns = 0L; } static int InitProfTree(void) { - if (GLOBAL_ProfilerRoot) + if (LOCAL_ProfilerRoot) reset_tree(); - while (!(GLOBAL_ProfilerRoot = RBTreeCreate())) { + while (!(LOCAL_ProfilerRoot = RBTreeCreate())) { if (!Yap_growheap(FALSE, 0, NULL)) { Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "while initialisating profiler"); return FALSE; @@ -760,57 +771,16 @@ InitProfTree(void) return TRUE; } -static void LookupNode(yamop *current_p) { - rb_red_blk_node *node; - - if ((node = RBLookup(current_p))) { - node->pcs++; - return; - } else { - PredEntry *pp = NULL; - CODEADDR start, end; - - pp = Yap_PredEntryForCode(current_p, FIND_PRED_FROM_ANYWHERE, &start, &end); - if (!pp) { -#if DEBUG - CACHE_REGS - fprintf(stderr,"lost %p, %d\n", P, Yap_op_from_opcode(P->opc)); -#endif - /* lost profiler event !! */ - return; - } -#if !USE_SYSTEM_MALLOC - /* add this clause as new node to the tree */ - if (start < (CODEADDR)Yap_HeapBase || start > (CODEADDR)HeapTop || - end < (CODEADDR)Yap_HeapBase || end > (CODEADDR)HeapTop) { -#if DEBUG - fprintf(stderr,"Oops2: %p->%lu %p, %p\n", current_p, (unsigned long int)(current_p->opc), start, end); -#endif - return; - } -#endif - if (pp->ArityOfPE > 100) { -#if DEBUG - fprintf(stderr,"%p(%lu)-->%p\n",current_p,(unsigned long int)Yap_op_from_opcode(current_p->opc),pp); -#endif - return; - } - node = RBTreeInsert((yamop *)start, (yamop *)end); - node->pe = pp; - node->pcs = 1; - } -} - static void RemoveCode(CODEADDR clau) { rb_red_blk_node* x, *node; PredEntry *pp; UInt count; - if (!GLOBAL_ProfilerRoot) return; + if (!LOCAL_ProfilerRoot) return; if (!(x = RBExactQuery((yamop *)clau))) { /* send message */ - GLOBAL_ProfOn = FALSE; + LOCAL_ProfOn = FALSE; return; } pp = x->pe; @@ -823,93 +793,95 @@ static void RemoveCode(CODEADDR clau) node->pe = pp; node->pcs = count; /* send message */ - GLOBAL_ProfOn = FALSE; + LOCAL_ProfOn = FALSE; return; } else { node->pcs += count; } } -#define MAX_LINE_SIZE 1024 - static int showprofres( USES_REGS1 ) { - char line[MAX_LINE_SIZE]; - yamop *pr_beg, *pr_end; - PredEntry *pr_pp; - long int pr_count; - + buf_ptr buf; profend( PASS_REGS1 ); /* Make sure profiler has ended */ /* First part: Read information about predicates and store it on yap trail */ InitProfTree(); - FProf=fopen(profile_names(PROFILING_FILE),"r"); - if (FProf==NULL) { fclose(FProf); return FALSE; } - while (fgets(line, MAX_LINE_SIZE, FProf) != NULL) { - if (line[0] == '+') { - rb_red_blk_node *node; - sscanf(line+1,"%p %p %p %ld",&pr_beg,&pr_end,&pr_pp,&pr_count); - node = RBTreeInsert(pr_beg, pr_end); - node->pe = pr_pp; - node->pcs = 0; - } else if (line[0] == '-') { - sscanf(line+1,"%p",&pr_beg); - RemoveCode((CODEADDR)pr_beg); - } else { - rb_red_blk_node *node; + LOCAL_ProfGCs=0; + LOCAL_ProfMallocs=0; + LOCAL_ProfHGrows=0; + LOCAL_ProfSGrows=0; + LOCAL_ProfIndexing=0; + LOCAL_FProf=fopen(profile_names(PROFILING_FILE),"r"); + if (LOCAL_FProf==NULL) { fclose(LOCAL_FProf); return FALSE; } + while (fread(&buf, sizeof(buf), 1, LOCAL_FProf)) { + switch (buf.tag) { + case '+': + { + rb_red_blk_node *node; + buf_extra e; - sscanf(line,"%p",&pr_beg); - node = RBLookup(pr_beg); - if (!node) { + if (fread(&e,sizeof(buf_extra),1,LOCAL_FProf) == 0) + return FALSE;; + node = RBTreeInsert(buf.ptr, e.end); + node->pe = e.pe; + node->source = e.inf; + node->pcs = 0; + } + break; + case '?': + { + prolog_exec_mode md; + + md = (prolog_exec_mode)buf.ptr; + if (md & GCMode) { + LOCAL_ProfGCs++; + } else if (md & MallocMode) { + LOCAL_ProfMallocs++; + } else if (md & GrowHeapMode) { + LOCAL_ProfHGrows++; + } else if (md & GrowStackMode) { + LOCAL_ProfSGrows++; + } + } + break; + case '-': + RemoveCode(buf.ptr); + break; + default: + { + rb_red_blk_node *node; + + node = RBLookup(buf.ptr); + if (!node) { #if DEBUG - fprintf(stderr,"Oops: %p\n", pr_beg); + fprintf(stderr,"Oops: %p\n", buf.ptr); #endif - } else { - node->pcs++; + } else { + switch(node->source) { + case GPROF_INDEX: + case GPROF_INDEX_EXPAND: + case GPROF_LU_INDEX: + case GPROF_STATIC_INDEX: + case GPROF_INIT_EXPAND: + case GPROF_INIT_LOG_UPD_CLAUSE: + case GPROF_NEW_LU_SWITCH: + case GPROF_NEW_STATIC_SWITCH: + case GPROF_NEW_EXPAND_BLOCK: + LOCAL_ProfIndexing++; + break; + default: + break; + } + node->pcs++; + } } } } - fclose(FProf); - if (GLOBAL_ProfCalls==0) - return TRUE; - return TRUE; -} - -static Int -p_test( USES_REGS1 ) { - char line[MAX_LINE_SIZE]; - yamop *pr_beg, *pr_end; - PredEntry *pr_pp; - long int pr_count; - - - profend( PASS_REGS1 ); /* Make sure profiler has ended */ - - /* First part: Read information about predicates and store it on yap trail */ - - InitProfTree(); - FProf=fopen("PROFILING_93920","r"); - if (FProf==NULL) { fclose(FProf); return FALSE; } - while (fgets(line, MAX_LINE_SIZE, FProf) != NULL) { - if (line[0] == '+') { - rb_red_blk_node *node; - sscanf(line+1,"%p %p %p %ld",&pr_beg,&pr_end,&pr_pp,&pr_count); - node = RBTreeInsert(pr_beg, pr_end); - node->pe = pr_pp; - node->pcs = 0; - } else if (line[0] == '-') { - sscanf(line+1,"%p",&pr_beg); - RemoveCode((CODEADDR)pr_beg); - } else { - rb_red_blk_node *node = RBTreeInsert(pr_beg, pr_end); - node->pe = pr_pp; - node->pcs = 1; - } - } - fclose(FProf); - if (GLOBAL_ProfCalls==0) + fclose(LOCAL_FProf); + if (LOCAL_ProfCalls==0) return TRUE; return TRUE; } @@ -922,44 +894,27 @@ static void prof_alrm(int signo, siginfo_t *si, void *scv) { CACHE_REGS - void * oldpc=(void *) CONTEXT_PC(scv); + void * oldpc; yamop *current_p; + buf_ptr b; - GLOBAL_ProfCalls++; + LOCAL_ProfCalls++; /* skip an interrupt */ - if (GLOBAL_ProfOn) { - GLOBAL_ProfOns++; + if (LOCAL_ProfOn) { + LOCAL_ProfOns++; return; } - GLOBAL_ProfOn = TRUE; + LOCAL_ProfOn = TRUE; + oldpc = (void *) CONTEXT_PC(scv); if (LOCAL_PrologMode & TestMode) { - if (LOCAL_PrologMode & GCMode) { - GLOBAL_ProfGCs++; - GLOBAL_ProfOn = FALSE; - return; - } - if (LOCAL_PrologMode & MallocMode) { - GLOBAL_ProfMallocs++; - GLOBAL_ProfOn = FALSE; - return; - } - - if (LOCAL_PrologMode & GrowHeapMode) { - GLOBAL_ProfHGrows++; - GLOBAL_ProfOn = FALSE; - return; - } - - if (LOCAL_PrologMode & GrowStackMode) { - GLOBAL_ProfSGrows++; - GLOBAL_ProfOn = FALSE; - return; - } - + b.tag = '?'; + b.ptr= (void *)LOCAL_PrologMode; + fwrite(&b,sizeof(b),1,LOCAL_FPreds); + LOCAL_ProfOn = FALSE; + return; } - if (oldpc>(void *) &Yap_absmi && oldpc <= (void *) &Yap_absmiEND) { CACHE_REGS /* we are running emulator code */ @@ -988,34 +943,33 @@ prof_alrm(int signo, siginfo_t *si, void *scv) #if DEBUG fprintf(stderr,"Oops: %p, %p\n", oldpc, current_p); #endif - GLOBAL_ProfOn = FALSE; + LOCAL_ProfOn = FALSE; return; } #endif - if (Yap_OffLineProfiler) { - fprintf(FProf,"%p\n", current_p); - GLOBAL_ProfOn = FALSE; - return; - } - - LookupNode(current_p); - GLOBAL_ProfOn = FALSE; + b.tag = '.'; + b.ptr= current_p; + fwrite(&b,sizeof(b),1,LOCAL_FPreds); + LOCAL_ProfOn = FALSE; } void -Yap_InformOfRemoval(CODEADDR clau) +Yap_InformOfRemoval(void *clau) { - GLOBAL_ProfOn = TRUE; - if (FPreds != NULL) { + LOCAL_ProfOn = TRUE; + if (LOCAL_FPreds != NULL) { /* just store info about what is going on */ - fprintf(FPreds,"-%p\n",clau); - GLOBAL_ProfOn = FALSE; + buf_ptr b; + + b.tag = '-'; + b.ptr= clau; + fwrite(&b,sizeof(b),1,LOCAL_FPreds); + LOCAL_ProfOn = FALSE; return; } - RemoveCode(clau); - GLOBAL_ProfOn = FALSE; + LOCAL_ProfOn = FALSE; } static Int profend( USES_REGS1 ); @@ -1025,25 +979,25 @@ profnode( USES_REGS1 ) { Term t1 = Deref(ARG1), tleft, tright; rb_red_blk_node *node; - if (!GLOBAL_ProfilerRoot) + if (!LOCAL_ProfilerRoot) return FALSE; if (!(node = (rb_red_blk_node *)IntegerOfTerm(t1))) - node = GLOBAL_ProfilerRoot; + node = LOCAL_ProfilerRoot; /* if (node->key) fprintf(stderr,"%p: %p,%p,%d,%p(%d),%p,%p\n",node,node->key,node->lim,node->pcs,node->pe,node->pe->ArityOfPE,node->right,node->left); */ - if (node->left == GLOBAL_ProfilerNil) { + if (node->left == LOCAL_ProfilerNil) { tleft = TermNil; } else { tleft = MkIntegerTerm((Int)node->left); } - if (node->left == GLOBAL_ProfilerNil) { + if (node->left == LOCAL_ProfilerNil) { tleft = TermNil; } else { tleft = MkIntegerTerm((Int)node->left); } - if (node->right == GLOBAL_ProfilerNil) { + if (node->right == LOCAL_ProfilerNil) { tright = TermNil; } else { tright = MkIntegerTerm((Int)node->right); @@ -1059,90 +1013,46 @@ profnode( USES_REGS1 ) { static Int profglobs( USES_REGS1 ) { return - Yap_unify(ARG1,MkIntegerTerm(GLOBAL_ProfCalls)) && - Yap_unify(ARG2,MkIntegerTerm(GLOBAL_ProfGCs)) && - Yap_unify(ARG3,MkIntegerTerm(GLOBAL_ProfHGrows)) && - Yap_unify(ARG4,MkIntegerTerm(GLOBAL_ProfSGrows)) && - Yap_unify(ARG5,MkIntegerTerm(GLOBAL_ProfMallocs)) && - Yap_unify(ARG6,MkIntegerTerm(GLOBAL_ProfOns)) ; + Yap_unify(ARG1,MkIntegerTerm(LOCAL_ProfCalls)) && + Yap_unify(ARG2,MkIntegerTerm(LOCAL_ProfGCs)) && + Yap_unify(ARG3,MkIntegerTerm(LOCAL_ProfHGrows)) && + Yap_unify(ARG4,MkIntegerTerm(LOCAL_ProfSGrows)) && + Yap_unify(ARG5,MkIntegerTerm(LOCAL_ProfMallocs)) && + Yap_unify(ARG6,MkIntegerTerm(LOCAL_ProfIndexing)) && + Yap_unify(ARG7,MkIntegerTerm(LOCAL_ProfOns)) ; } static Int do_profinit( USES_REGS1 ) { - if (Yap_OffLineProfiler) { - // FPreds=fopen(profile_names(PROFPREDS_FILE),"w+"); - // if (FPreds == NULL) return FALSE; - FProf=fopen(profile_names(PROFILING_FILE),"w+"); - if (FProf==NULL) { fclose(FProf); return FALSE; } - FPreds = FProf; + // LOCAL_FPreds=fopen(profile_names(PROFPREDS_FILE),"w+"); + // if (LOCAL_FPreds == NULL) return FALSE; + LOCAL_FProf=fopen(profile_names(PROFILING_FILE),"w+"); + if (LOCAL_FProf==NULL) { fclose(LOCAL_FProf); return FALSE; } + LOCAL_FPreds = LOCAL_FProf; - Yap_dump_code_area_for_profiler(); - } else { - InitProfTree(); - } + Yap_dump_code_area_for_profiler(); return TRUE; } static Int profinit( USES_REGS1 ) { - if (ProfilerOn!=0) return (FALSE); + if (LOCAL_ProfilerOn!=0) return (FALSE); if (!do_profinit( PASS_REGS1 )) return FALSE; - ProfilerOn = -1; /* Inited but not yet started */ + LOCAL_ProfilerOn = -1; /* Inited but not yet started */ return(TRUE); } -static Int profinit1( USES_REGS1 ) -{ - Term t = Deref(ARG1); - - if (IsVarTerm(t)) { - if (Yap_OffLineProfiler) - Yap_unify(ARG1,MkAtomTerm(AtomOffline)); - else - Yap_unify(ARG1,MkAtomTerm(AtomOnline)); - } else if (IsAtomTerm(t)) { - char *name = RepAtom(AtomOfTerm(t))->StrOfAE; - if (!strcmp(name,"offline")) - Yap_OffLineProfiler = TRUE; - else if (!strcmp(name,"online")) - Yap_OffLineProfiler = FALSE; - else { - Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE,t,"profinit only allows offline,online"); - return FALSE; - } - } else { - Yap_Error(TYPE_ERROR_ATOM,t,"profinit only allows offline,online"); - return FALSE; - } - return profinit( PASS_REGS1 ); -} - - -static Int proftype( USES_REGS1 ) -{ - if (Yap_OffLineProfiler) - return Yap_unify(ARG1,MkAtomTerm(AtomOffline)); - else - return Yap_unify(ARG1,MkAtomTerm(AtomOnline)); -} - static Int start_profilers(int msec) { struct itimerval t; struct sigaction sa; - if (ProfilerOn!=-1) { - if (Yap_OffLineProfiler) { - return FALSE; /* have to go through profinit */ - } else { - CACHE_REGS - if (!do_profinit( PASS_REGS1 )) - return FALSE; - } + if (LOCAL_ProfilerOn!=-1) { + return FALSE; /* have to go through profinit */ } sa.sa_sigaction=prof_alrm; sigemptyset(&sa.sa_mask); @@ -1156,15 +1066,15 @@ static Int start_profilers(int msec) t.it_value.tv_usec=msec; setitimer(ITIMER_PROF,&t,NULL); - ProfilerOn = msec; + LOCAL_ProfilerOn = msec; return TRUE; } static Int profoff( USES_REGS1 ) { - if (ProfilerOn>0) { + if (LOCAL_ProfilerOn>0) { setitimer(ITIMER_PROF,NULL,NULL); - ProfilerOn = -1; + LOCAL_ProfilerOn = -1; return TRUE; } return FALSE; @@ -1183,23 +1093,22 @@ static Int ProfOn0( USES_REGS1 ) { } static Int profison( USES_REGS1 ) { - return (ProfilerOn > 0); + return (LOCAL_ProfilerOn > 0); } static Int profalt( USES_REGS1 ) { - if (ProfilerOn==0) return(FALSE); - if (ProfilerOn==-1) return ProfOn( PASS_REGS1 ); + if (LOCAL_ProfilerOn==0) return(FALSE); + if (LOCAL_ProfilerOn==-1) return ProfOn( PASS_REGS1 ); return profoff( PASS_REGS1 ); } static Int profend( USES_REGS1 ) { - if (ProfilerOn==0) return(FALSE); + if (LOCAL_ProfilerOn==0) return(FALSE); profoff( PASS_REGS1 ); /* Make sure profiler is off */ - ProfilerOn=0; - if (Yap_OffLineProfiler) { - fclose(FProf); - } + LOCAL_ProfilerOn=0; + fclose(LOCAL_FProf); + LOCAL_FPreds = NULL; return TRUE; } @@ -1249,23 +1158,19 @@ void Yap_InitLowProf(void) { #if LOW_PROF - GLOBAL_ProfCalls = 0; - ProfilerOn = FALSE; - Yap_OffLineProfiler = FALSE; + LOCAL_ProfCalls = 0; + LOCAL_ProfilerOn = FALSE; + Yap_InitCPred("profinit",0, profinit, SafePredFlag); - Yap_InitCPred("profinit",1, profinit1, SafePredFlag); - Yap_InitCPred("$proftype",1, proftype, SafePredFlag); Yap_InitCPred("profend" ,0, profend, SafePredFlag); - Yap_InitCPred("ProfOn" , 0, ProfOn0, SafePredFlag); - Yap_InitCPred("ProfOn" , 1, ProfOn, SafePredFlag); + Yap_InitCPred("profon" , 0, ProfOn0, SafePredFlag); Yap_InitCPred("profoff", 0, profoff, SafePredFlag); Yap_InitCPred("profalt", 0, profalt, SafePredFlag); Yap_InitCPred("$offline_showprofres", 0, profres0, SafePredFlag); Yap_InitCPred("$profnode", 6, profnode, SafePredFlag); - Yap_InitCPred("$profglobs", 6, profglobs, SafePredFlag); + Yap_InitCPred("$profglobs", 7, profglobs, SafePredFlag); Yap_InitCPred("$profison",0 , profison, SafePredFlag); Yap_InitCPred("$get_pred_pinfo", 4, getpredinfo, SafePredFlag); Yap_InitCPred("showprofres", 4, getpredinfo, SafePredFlag); - Yap_InitCPred("prof_test", 0, p_test, 0); #endif } diff --git a/C/index.c b/C/index.c index 933ffbe5d..0396d98e8 100644 --- a/C/index.c +++ b/C/index.c @@ -1592,12 +1592,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_ cl->ClSize = sz; cl->ClPred = cint->CurrentPred; /* insert into code chain */ -#ifdef LOW_PROF - if (ProfilerOn && - Yap_OffLineProfiler) { - Yap_inform_profiler_of_clause(cl->ClCode, (yamop*)((CODEADDR)cl+sz), ap, 1); - } -#endif /* LOW_PROF */ + Yap_inform_profiler_of_clause(cl, (CODEADDR)cl+sz, ap, GPROF_NEW_LU_SWITCH); return cl->ClCode; } else { UInt sz = sizeof(StaticIndex)+n*item_size; @@ -1612,12 +1607,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_ cl->ClFlags = SwitchTableMask; cl->ClSize = sz; cl->ClPred = cint->CurrentPred; -#ifdef LOW_PROF - if (ProfilerOn && - Yap_OffLineProfiler) { - Yap_inform_profiler_of_clause(cl->ClCode, (yamop*)((CODEADDR)cl+sz), ap, 1); - } -#endif /* LOW_PROF */ + Yap_inform_profiler_of_clause(cl, (CODEADDR)cl+sz, ap, GPROF_NEW_STATIC_SWITCH); return cl->ClCode; /* insert into code chain */ } @@ -1933,12 +1923,7 @@ suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermedi } else { Yap_IndexSpace_EXT += sz; } -#ifdef LOW_PROF - if (ProfilerOn && - Yap_OffLineProfiler) { - Yap_inform_profiler_of_clause(ncode, NEXTOP(ncode,sssllp), ap, 1); - } -#endif /* LOW_PROF */ + Yap_inform_profiler_of_clause(ncode, (CODEADDR)ncode+sz, ap, GPROF_NEW_EXPAND_BLOCK); /* create an expand_block */ ncode->opc = Yap_opcode(_expand_clauses); ncode->u.sssllp.p = ap; @@ -1991,7 +1976,7 @@ recover_ecls_block(yamop *ipc) Yap_expand_clauses_sz -= (UInt)(NEXTOP((yamop *)NULL,sssllp))+ipc->u.sssllp.s1*sizeof(yamop *); #endif /* no dangling pointers for gprof */ - Yap_InformOfRemoval((CODEADDR)ipc); + Yap_InformOfRemoval(ipc); if (ipc->u.sssllp.p->PredFlags & LogUpdatePredFlag) { Yap_LUIndexSpace_EXT -= (UInt)NEXTOP((yamop *)NULL,sssllp)+ipc->u.sssllp.s1*sizeof(yamop *); } else @@ -4259,7 +4244,7 @@ replace_index_block(ClauseUnion *parent_block, yamop *cod, yamop *ncod, PredEntr c->ParentIndex = ncl; c = c->SiblingIndex; } - Yap_InformOfRemoval((CODEADDR)cl); + Yap_InformOfRemoval(cl); Yap_LUIndexSpace_SW -= cl->ClSize; Yap_FreeCodeSpace((char *)cl); } else { @@ -4277,7 +4262,7 @@ replace_index_block(ClauseUnion *parent_block, yamop *cod, yamop *ncod, PredEntr } c->SiblingIndex = ncl; } - Yap_InformOfRemoval((CODEADDR)cl); + Yap_InformOfRemoval(cl); Yap_IndexSpace_SW -= cl->ClSize; Yap_FreeCodeSpace((char *)cl); } diff --git a/H/Yap.h b/H/Yap.h index 020543f97..2bb178339 100644 --- a/H/Yap.h +++ b/H/Yap.h @@ -503,6 +503,33 @@ typedef enum #define NUMBER_OF_YAP_FLAGS LAST_FLAG +typedef enum +{ + GPROF_NO_EVENT, + GPROF_NEW_PRED_FUNC, + GPROF_NEW_PRED_THREAD, + GPROF_NEW_PRED_ATOM, + GPROF_INDEX, + GPROF_INDEX_EXPAND, + GPROF_CLAUSE, + GPROF_MEGA, + GPROF_LU_INDEX, + GPROF_STATIC_INDEX, + GPROF_INIT_OPCODE, + GPROF_INIT_SYSTEM_CODE, + GPROF_INIT_EXPAND, + GPROF_INIT_LOG_UPD_CLAUSE, + GPROF_INIT_DYNAMIC_CLAUSE, + GPROF_INIT_STATIC_CLAUSE, + GPROF_INIT_COMMA, + GPROF_INIT_FAIL, + GPROF_NEW_LU_CLAUSE, + GPROF_NEW_LU_SWITCH, + GPROF_NEW_STATIC_SWITCH, + GPROF_NEW_EXPAND_BLOCK +} gprof_info; + + /************************************************************************************************* prototypes *************************************************************************************************/ diff --git a/H/Yapproto.h b/H/Yapproto.h index 54e86774f..81a853da3 100644 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -185,10 +185,12 @@ Term STD_PROTO(Yap_GetException,(void)); /* gprof.c */ void STD_PROTO(Yap_InitLowProf,(void)); #if LOW_PROF -void STD_PROTO(Yap_inform_profiler_of_clause,(struct yami *,struct yami *,struct pred_entry *,int)); +void STD_PROTO(Yap_inform_profiler_of_clause__,(void *,void *,struct pred_entry *, gprof_info)); +#define Yap_inform_profiler_of_clause(CODE0,CODEF,AP,MODE) {if (LOCAL_FPreds) Yap_inform_profiler_of_clause__(CODE0,CODEF,AP,MODE);} #else -#define Yap_inform_profiler_of_clause(A,B,C,D) +#define Yap_inform_profiler_of_clause(CODE0,CODEF,AP,MODE) #endif +void STD_PROTO(Yap_tell_gprof,(yamop *)); /* globals.c */ Term STD_PROTO(Yap_NewArena,(UInt,CELL *)); diff --git a/H/absmi.h b/H/absmi.h index a5e6eda21..83e5304e7 100644 --- a/H/absmi.h +++ b/H/absmi.h @@ -1596,3 +1596,4 @@ void SET_ASP__(CELL *yreg, Int sz USES_REGS) { } +#define CHECK_ALARM(CONT) diff --git a/H/clause.h b/H/clause.h index a4a5212e6..8c02130bd 100644 --- a/H/clause.h +++ b/H/clause.h @@ -339,7 +339,7 @@ void STD_PROTO(Yap_bug_location,(yamop *)); #endif #if LOW_PROF -void STD_PROTO(Yap_InformOfRemoval,(CODEADDR)); +void STD_PROTO(Yap_InformOfRemoval,(void *)); void STD_PROTO(Yap_dump_code_area_for_profiler,(void)); #else #define Yap_InformOfRemoval(X) diff --git a/H/dglobals.h b/H/dglobals.h index e10fa9b36..5f243d8f4 100644 --- a/H/dglobals.h +++ b/H/dglobals.h @@ -1,112 +1,101 @@ - - /* This file, dglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/GLOBALS instead */ - - - - - - - - - - - - - - - - - - - -#define GLOBAL_Initialised Yap_global->Initialised_ -#define GLOBAL_InitialisedFromPL Yap_global->InitialisedFromPL_ -#define GLOBAL_PL_Argc Yap_global->PL_Argc_ -#define GLOBAL_PL_Argv Yap_global->PL_Argv_ - -#define GLOBAL_HaltHooks Yap_global->HaltHooks_ - -#define GLOBAL_AllowLocalExpansion Yap_global->AllowLocalExpansion_ -#define GLOBAL_AllowGlobalExpansion Yap_global->AllowGlobalExpansion_ -#define GLOBAL_AllowTrailExpansion Yap_global->AllowTrailExpansion_ -#define GLOBAL_SizeOfOverflow Yap_global->SizeOfOverflow_ - -#define GLOBAL_AGcThreshold Yap_global->AGcThreshold_ -#define GLOBAL_AGCHook Yap_global->AGCHook_ - -#if THREADS - -#define GLOBAL_NOfThreads Yap_global->NOfThreads_ - -#define GLOBAL_NOfThreadsCreated Yap_global->NOfThreadsCreated_ - -#define GLOBAL_ThreadsTotalTime Yap_global->ThreadsTotalTime_ - -#define GLOBAL_ThreadHandlesLock Yap_global->ThreadHandlesLock_ -#endif -#if defined(YAPOR) || defined(THREADS) - -#define GLOBAL_BGL Yap_global->BGL_ -#endif -#if defined(YAPOR) || defined(TABLING) -#define GLOBAL_optyap_data Yap_global->optyap_data_ -#endif /* YAPOR || TABLING */ - -#define GLOBAL_PrologShouldHandleInterrupts Yap_global->PrologShouldHandleInterrupts_ - -#if defined(THREADS) -#define GLOBAL_master_thread Yap_global->master_thread_ -#endif /* THREADS */ - -#define GLOBAL_stdout Yap_global->stdout_ -#define GLOBAL_stderr Yap_global->stderr_ - -#define GLOBAL_argv Yap_global->argv_ -#define GLOBAL_argc Yap_global->argc_ - -#ifdef COROUTINING - -#define GLOBAL_attas Yap_global->attas_ -#endif - -#define GLOBAL_agc_calls Yap_global->agc_calls_ -#define GLOBAL_agc_collected Yap_global->agc_collected_ - -#define GLOBAL_tot_agc_time Yap_global->tot_agc_time_ - -#define GLOBAL_tot_agc_recovered Yap_global->tot_agc_recovered_ - -#if HAVE_MMAP -#define GLOBAL_mmap_arrays Yap_global->mmap_arrays_ -#endif -#ifdef DEBUG - -#define GLOBAL_Option Yap_global->Option_ -#define GLOBAL_logfile Yap_global->logfile_ - - -#endif - -#define GLOBAL_ProfCalls Yap_global->ProfCalls_ -#define GLOBAL_ProfGCs Yap_global->ProfGCs_ -#define GLOBAL_ProfHGrows Yap_global->ProfHGrows_ -#define GLOBAL_ProfSGrows Yap_global->ProfSGrows_ -#define GLOBAL_ProfMallocs Yap_global->ProfMallocs_ -#define GLOBAL_ProfOn Yap_global->ProfOn_ -#define GLOBAL_ProfOns Yap_global->ProfOns_ -#define GLOBAL_ProfilerRoot Yap_global->ProfilerRoot_ -#define GLOBAL_ProfilerNil Yap_global->ProfilerNil_ -#define GLOBAL_DIRNAME Yap_global->DIRNAME_ -#if defined(COFF) || defined(A_OUT) - -#define GLOBAL_Executable Yap_global->Executable_ -#endif -#define GLOBAL_OpaqueHandlersCount Yap_global->OpaqueHandlersCount_ -#define GLOBAL_OpaqueHandlers Yap_global->OpaqueHandlers_ -#if __simplescalar__ -#define GLOBAL_pwd Yap_global->pwd_ -#endif - - - + + /* This file, dglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/GLOBALS instead */ + + + + + + + + + + + + + + + + + + + +#define GLOBAL_Initialised Yap_global->Initialised_ +#define GLOBAL_InitialisedFromPL Yap_global->InitialisedFromPL_ +#define GLOBAL_PL_Argc Yap_global->PL_Argc_ +#define GLOBAL_PL_Argv Yap_global->PL_Argv_ + +#define GLOBAL_HaltHooks Yap_global->HaltHooks_ + +#define GLOBAL_AllowLocalExpansion Yap_global->AllowLocalExpansion_ +#define GLOBAL_AllowGlobalExpansion Yap_global->AllowGlobalExpansion_ +#define GLOBAL_AllowTrailExpansion Yap_global->AllowTrailExpansion_ +#define GLOBAL_SizeOfOverflow Yap_global->SizeOfOverflow_ + +#define GLOBAL_AGcThreshold Yap_global->AGcThreshold_ +#define GLOBAL_AGCHook Yap_global->AGCHook_ + +#if THREADS + +#define GLOBAL_NOfThreads Yap_global->NOfThreads_ + +#define GLOBAL_NOfThreadsCreated Yap_global->NOfThreadsCreated_ + +#define GLOBAL_ThreadsTotalTime Yap_global->ThreadsTotalTime_ + +#define GLOBAL_ThreadHandlesLock Yap_global->ThreadHandlesLock_ +#endif +#if defined(YAPOR) || defined(THREADS) + +#define GLOBAL_BGL Yap_global->BGL_ +#endif +#if defined(YAPOR) || defined(TABLING) +#define GLOBAL_optyap_data Yap_global->optyap_data_ +#endif /* YAPOR || TABLING */ + +#define GLOBAL_PrologShouldHandleInterrupts Yap_global->PrologShouldHandleInterrupts_ + +#if defined(THREADS) +#define GLOBAL_master_thread Yap_global->master_thread_ +#endif /* THREADS */ + +#define GLOBAL_stdout Yap_global->stdout_ +#define GLOBAL_stderr Yap_global->stderr_ + +#define GLOBAL_argv Yap_global->argv_ +#define GLOBAL_argc Yap_global->argc_ + +#ifdef COROUTINING + +#define GLOBAL_attas Yap_global->attas_ +#endif + +#define GLOBAL_agc_calls Yap_global->agc_calls_ +#define GLOBAL_agc_collected Yap_global->agc_collected_ + +#define GLOBAL_tot_agc_time Yap_global->tot_agc_time_ + +#define GLOBAL_tot_agc_recovered Yap_global->tot_agc_recovered_ + +#if HAVE_MMAP +#define GLOBAL_mmap_arrays Yap_global->mmap_arrays_ +#endif +#ifdef DEBUG + +#define GLOBAL_Option Yap_global->Option_ +#define GLOBAL_logfile Yap_global->logfile_ + + +#endif +#if defined(COFF) || defined(A_OUT) + +#define GLOBAL_Executable Yap_global->Executable_ +#endif +#define GLOBAL_OpaqueHandlersCount Yap_global->OpaqueHandlersCount_ +#define GLOBAL_OpaqueHandlers Yap_global->OpaqueHandlers_ +#if __simplescalar__ +#define GLOBAL_pwd Yap_global->pwd_ +#endif + + + diff --git a/H/dhstruct.h b/H/dhstruct.h index 6721de99b..e2d2ea78b 100644 --- a/H/dhstruct.h +++ b/H/dhstruct.h @@ -283,15 +283,6 @@ #define LastWtimePtr Yap_heap_regs->last_wtime -#define output_msg Yap_heap_regs->debugger_output_msg -#if LOW_PROF -#define ProfilerOn Yap_heap_regs->profiler_on -#define Yap_OffLineProfiler Yap_heap_regs->offline_profiler -#define FProf Yap_heap_regs->f_prof -#define FPreds Yap_heap_regs->f_preds -#define ProfPreds Yap_heap_regs->prof_preds -#endif /* LOW_PROF */ - #define ForeignCodeLoaded Yap_heap_regs->foreign_code_loaded #define ForeignCodeBase Yap_heap_regs->foreign_code_base #define ForeignCodeTop Yap_heap_regs->foreign_code_top diff --git a/H/dlocals.h b/H/dlocals.h index 2ec0fdb5a..2ddd91f16 100644 --- a/H/dlocals.h +++ b/H/dlocals.h @@ -1,399 +1,430 @@ - - /* This file, dlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/LOCALS instead */ - - - - -#define LOCAL_c_input_stream LOCAL->c_input_stream_ -#define REMOTE_c_input_stream(wid) REMOTE(wid)->c_input_stream_ -#define LOCAL_c_output_stream LOCAL->c_output_stream_ -#define REMOTE_c_output_stream(wid) REMOTE(wid)->c_output_stream_ -#define LOCAL_c_error_stream LOCAL->c_error_stream_ -#define REMOTE_c_error_stream(wid) REMOTE(wid)->c_error_stream_ - -#define LOCAL_OldASP LOCAL->OldASP_ -#define REMOTE_OldASP(wid) REMOTE(wid)->OldASP_ -#define LOCAL_OldLCL0 LOCAL->OldLCL0_ -#define REMOTE_OldLCL0(wid) REMOTE(wid)->OldLCL0_ -#define LOCAL_OldTR LOCAL->OldTR_ -#define REMOTE_OldTR(wid) REMOTE(wid)->OldTR_ -#define LOCAL_OldGlobalBase LOCAL->OldGlobalBase_ -#define REMOTE_OldGlobalBase(wid) REMOTE(wid)->OldGlobalBase_ -#define LOCAL_OldH LOCAL->OldH_ -#define REMOTE_OldH(wid) REMOTE(wid)->OldH_ -#define LOCAL_OldH0 LOCAL->OldH0_ -#define REMOTE_OldH0(wid) REMOTE(wid)->OldH0_ -#define LOCAL_OldTrailBase LOCAL->OldTrailBase_ -#define REMOTE_OldTrailBase(wid) REMOTE(wid)->OldTrailBase_ -#define LOCAL_OldTrailTop LOCAL->OldTrailTop_ -#define REMOTE_OldTrailTop(wid) REMOTE(wid)->OldTrailTop_ -#define LOCAL_OldHeapBase LOCAL->OldHeapBase_ -#define REMOTE_OldHeapBase(wid) REMOTE(wid)->OldHeapBase_ -#define LOCAL_OldHeapTop LOCAL->OldHeapTop_ -#define REMOTE_OldHeapTop(wid) REMOTE(wid)->OldHeapTop_ -#define LOCAL_ClDiff LOCAL->ClDiff_ -#define REMOTE_ClDiff(wid) REMOTE(wid)->ClDiff_ -#define LOCAL_GDiff LOCAL->GDiff_ -#define REMOTE_GDiff(wid) REMOTE(wid)->GDiff_ -#define LOCAL_HDiff LOCAL->HDiff_ -#define REMOTE_HDiff(wid) REMOTE(wid)->HDiff_ -#define LOCAL_GDiff0 LOCAL->GDiff0_ -#define REMOTE_GDiff0(wid) REMOTE(wid)->GDiff0_ -#define LOCAL_GSplit LOCAL->GSplit_ -#define REMOTE_GSplit(wid) REMOTE(wid)->GSplit_ -#define LOCAL_LDiff LOCAL->LDiff_ -#define REMOTE_LDiff(wid) REMOTE(wid)->LDiff_ -#define LOCAL_TrDiff LOCAL->TrDiff_ -#define REMOTE_TrDiff(wid) REMOTE(wid)->TrDiff_ -#define LOCAL_XDiff LOCAL->XDiff_ -#define REMOTE_XDiff(wid) REMOTE(wid)->XDiff_ -#define LOCAL_DelayDiff LOCAL->DelayDiff_ -#define REMOTE_DelayDiff(wid) REMOTE(wid)->DelayDiff_ -#define LOCAL_BaseDiff LOCAL->BaseDiff_ -#define REMOTE_BaseDiff(wid) REMOTE(wid)->BaseDiff_ - -#define LOCAL_ReductionsCounter LOCAL->ReductionsCounter_ -#define REMOTE_ReductionsCounter(wid) REMOTE(wid)->ReductionsCounter_ -#define LOCAL_PredEntriesCounter LOCAL->PredEntriesCounter_ -#define REMOTE_PredEntriesCounter(wid) REMOTE(wid)->PredEntriesCounter_ -#define LOCAL_RetriesCounter LOCAL->RetriesCounter_ -#define REMOTE_RetriesCounter(wid) REMOTE(wid)->RetriesCounter_ -#define LOCAL_ReductionsCounterOn LOCAL->ReductionsCounterOn_ -#define REMOTE_ReductionsCounterOn(wid) REMOTE(wid)->ReductionsCounterOn_ -#define LOCAL_PredEntriesCounterOn LOCAL->PredEntriesCounterOn_ -#define REMOTE_PredEntriesCounterOn(wid) REMOTE(wid)->PredEntriesCounterOn_ -#define LOCAL_RetriesCounterOn LOCAL->RetriesCounterOn_ -#define REMOTE_RetriesCounterOn(wid) REMOTE(wid)->RetriesCounterOn_ - - -#define LOCAL_ConsultSp LOCAL->ConsultSp_ -#define REMOTE_ConsultSp(wid) REMOTE(wid)->ConsultSp_ - -#define LOCAL_ConsultCapacity LOCAL->ConsultCapacity_ -#define REMOTE_ConsultCapacity(wid) REMOTE(wid)->ConsultCapacity_ - -#define LOCAL_ConsultBase LOCAL->ConsultBase_ -#define REMOTE_ConsultBase(wid) REMOTE(wid)->ConsultBase_ - -#define LOCAL_ConsultLow LOCAL->ConsultLow_ -#define REMOTE_ConsultLow(wid) REMOTE(wid)->ConsultLow_ - -#define LOCAL_GlobalArena LOCAL->GlobalArena_ -#define REMOTE_GlobalArena(wid) REMOTE(wid)->GlobalArena_ -#define LOCAL_GlobalArenaOverflows LOCAL->GlobalArenaOverflows_ -#define REMOTE_GlobalArenaOverflows(wid) REMOTE(wid)->GlobalArenaOverflows_ -#define LOCAL_ArenaOverflows LOCAL->ArenaOverflows_ -#define REMOTE_ArenaOverflows(wid) REMOTE(wid)->ArenaOverflows_ -#define LOCAL_DepthArenas LOCAL->DepthArenas_ -#define REMOTE_DepthArenas(wid) REMOTE(wid)->DepthArenas_ -#define LOCAL_ArithError LOCAL->ArithError_ -#define REMOTE_ArithError(wid) REMOTE(wid)->ArithError_ -#define LOCAL_LastAssertedPred LOCAL->LastAssertedPred_ -#define REMOTE_LastAssertedPred(wid) REMOTE(wid)->LastAssertedPred_ -#define LOCAL_DebugOn LOCAL->DebugOn_ -#define REMOTE_DebugOn(wid) REMOTE(wid)->DebugOn_ -#define LOCAL_ScannerStack LOCAL->ScannerStack_ -#define REMOTE_ScannerStack(wid) REMOTE(wid)->ScannerStack_ -#define LOCAL_ScannerExtraBlocks LOCAL->ScannerExtraBlocks_ -#define REMOTE_ScannerExtraBlocks(wid) REMOTE(wid)->ScannerExtraBlocks_ -#define LOCAL_BallTerm LOCAL->BallTerm_ -#define REMOTE_BallTerm(wid) REMOTE(wid)->BallTerm_ -#define LOCAL_ActiveSignals LOCAL->ActiveSignals_ -#define REMOTE_ActiveSignals(wid) REMOTE(wid)->ActiveSignals_ -#define LOCAL_IPredArity LOCAL->IPredArity_ -#define REMOTE_IPredArity(wid) REMOTE(wid)->IPredArity_ -#define LOCAL_ProfEnd LOCAL->ProfEnd_ -#define REMOTE_ProfEnd(wid) REMOTE(wid)->ProfEnd_ -#define LOCAL_UncaughtThrow LOCAL->UncaughtThrow_ -#define REMOTE_UncaughtThrow(wid) REMOTE(wid)->UncaughtThrow_ -#define LOCAL_DoingUndefp LOCAL->DoingUndefp_ -#define REMOTE_DoingUndefp(wid) REMOTE(wid)->DoingUndefp_ -#define LOCAL_StartLine LOCAL->StartLine_ -#define REMOTE_StartLine(wid) REMOTE(wid)->StartLine_ -#define LOCAL_ScratchPad LOCAL->ScratchPad_ -#define REMOTE_ScratchPad(wid) REMOTE(wid)->ScratchPad_ -#ifdef COROUTINING -#define LOCAL_WokenGoals LOCAL->WokenGoals_ -#define REMOTE_WokenGoals(wid) REMOTE(wid)->WokenGoals_ -#define LOCAL_AttsMutableList LOCAL->AttsMutableList_ -#define REMOTE_AttsMutableList(wid) REMOTE(wid)->AttsMutableList_ -#endif - -#define LOCAL_GcGeneration LOCAL->GcGeneration_ -#define REMOTE_GcGeneration(wid) REMOTE(wid)->GcGeneration_ -#define LOCAL_GcPhase LOCAL->GcPhase_ -#define REMOTE_GcPhase(wid) REMOTE(wid)->GcPhase_ -#define LOCAL_GcCurrentPhase LOCAL->GcCurrentPhase_ -#define REMOTE_GcCurrentPhase(wid) REMOTE(wid)->GcCurrentPhase_ -#define LOCAL_GcCalls LOCAL->GcCalls_ -#define REMOTE_GcCalls(wid) REMOTE(wid)->GcCalls_ -#define LOCAL_TotGcTime LOCAL->TotGcTime_ -#define REMOTE_TotGcTime(wid) REMOTE(wid)->TotGcTime_ -#define LOCAL_TotGcRecovered LOCAL->TotGcRecovered_ -#define REMOTE_TotGcRecovered(wid) REMOTE(wid)->TotGcRecovered_ -#define LOCAL_LastGcTime LOCAL->LastGcTime_ -#define REMOTE_LastGcTime(wid) REMOTE(wid)->LastGcTime_ -#define LOCAL_LastSSTime LOCAL->LastSSTime_ -#define REMOTE_LastSSTime(wid) REMOTE(wid)->LastSSTime_ -#define LOCAL_OpenArray LOCAL->OpenArray_ -#define REMOTE_OpenArray(wid) REMOTE(wid)->OpenArray_ - -#define LOCAL_total_marked LOCAL->total_marked_ -#define REMOTE_total_marked(wid) REMOTE(wid)->total_marked_ -#define LOCAL_total_oldies LOCAL->total_oldies_ -#define REMOTE_total_oldies(wid) REMOTE(wid)->total_oldies_ -#define LOCAL_current_B LOCAL->current_B_ -#define REMOTE_current_B(wid) REMOTE(wid)->current_B_ -#define LOCAL_prev_HB LOCAL->prev_HB_ -#define REMOTE_prev_HB(wid) REMOTE(wid)->prev_HB_ -#define LOCAL_HGEN LOCAL->HGEN_ -#define REMOTE_HGEN(wid) REMOTE(wid)->HGEN_ -#define LOCAL_iptop LOCAL->iptop_ -#define REMOTE_iptop(wid) REMOTE(wid)->iptop_ -#if defined(GC_NO_TAGS) -#define LOCAL_bp LOCAL->bp_ -#define REMOTE_bp(wid) REMOTE(wid)->bp_ -#endif -#define LOCAL_sTR LOCAL->sTR_ -#define REMOTE_sTR(wid) REMOTE(wid)->sTR_ -#define LOCAL_sTR0 LOCAL->sTR0_ -#define REMOTE_sTR0(wid) REMOTE(wid)->sTR0_ -#define LOCAL_new_TR LOCAL->new_TR_ -#define REMOTE_new_TR(wid) REMOTE(wid)->new_TR_ -#define LOCAL_cont_top0 LOCAL->cont_top0_ -#define REMOTE_cont_top0(wid) REMOTE(wid)->cont_top0_ -#define LOCAL_cont_top LOCAL->cont_top_ -#define REMOTE_cont_top(wid) REMOTE(wid)->cont_top_ -#define LOCAL_discard_trail_entries LOCAL->discard_trail_entries_ -#define REMOTE_discard_trail_entries(wid) REMOTE(wid)->discard_trail_entries_ -#define LOCAL_gc_ma_hash_table LOCAL->gc_ma_hash_table_ -#define REMOTE_gc_ma_hash_table(wid) REMOTE(wid)->gc_ma_hash_table_ -#define LOCAL_gc_ma_h_top LOCAL->gc_ma_h_top_ -#define REMOTE_gc_ma_h_top(wid) REMOTE(wid)->gc_ma_h_top_ -#define LOCAL_gc_ma_h_list LOCAL->gc_ma_h_list_ -#define REMOTE_gc_ma_h_list(wid) REMOTE(wid)->gc_ma_h_list_ -#define LOCAL_gc_timestamp LOCAL->gc_timestamp_ -#define REMOTE_gc_timestamp(wid) REMOTE(wid)->gc_timestamp_ -#define LOCAL_db_vec LOCAL->db_vec_ -#define REMOTE_db_vec(wid) REMOTE(wid)->db_vec_ -#define LOCAL_db_vec0 LOCAL->db_vec0_ -#define REMOTE_db_vec0(wid) REMOTE(wid)->db_vec0_ -#define LOCAL_db_root LOCAL->db_root_ -#define REMOTE_db_root(wid) REMOTE(wid)->db_root_ -#define LOCAL_db_nil LOCAL->db_nil_ -#define REMOTE_db_nil(wid) REMOTE(wid)->db_nil_ -#define LOCAL_gc_restore LOCAL->gc_restore_ -#define REMOTE_gc_restore(wid) REMOTE(wid)->gc_restore_ -#define LOCAL_extra_gc_cells LOCAL->extra_gc_cells_ -#define REMOTE_extra_gc_cells(wid) REMOTE(wid)->extra_gc_cells_ -#define LOCAL_extra_gc_cells_base LOCAL->extra_gc_cells_base_ -#define REMOTE_extra_gc_cells_base(wid) REMOTE(wid)->extra_gc_cells_base_ -#define LOCAL_extra_gc_cells_top LOCAL->extra_gc_cells_top_ -#define REMOTE_extra_gc_cells_top(wid) REMOTE(wid)->extra_gc_cells_top_ -#define LOCAL_extra_gc_cells_size LOCAL->extra_gc_cells_size_ -#define REMOTE_extra_gc_cells_size(wid) REMOTE(wid)->extra_gc_cells_size_ -#define LOCAL_DynamicArrays LOCAL->DynamicArrays_ -#define REMOTE_DynamicArrays(wid) REMOTE(wid)->DynamicArrays_ -#define LOCAL_StaticArrays LOCAL->StaticArrays_ -#define REMOTE_StaticArrays(wid) REMOTE(wid)->StaticArrays_ -#define LOCAL_GlobalVariables LOCAL->GlobalVariables_ -#define REMOTE_GlobalVariables(wid) REMOTE(wid)->GlobalVariables_ -#define LOCAL_AllowRestart LOCAL->AllowRestart_ -#define REMOTE_AllowRestart(wid) REMOTE(wid)->AllowRestart_ - -#define LOCAL_CMemFirstBlock LOCAL->CMemFirstBlock_ -#define REMOTE_CMemFirstBlock(wid) REMOTE(wid)->CMemFirstBlock_ -#define LOCAL_CMemFirstBlockSz LOCAL->CMemFirstBlockSz_ -#define REMOTE_CMemFirstBlockSz(wid) REMOTE(wid)->CMemFirstBlockSz_ - -#define LOCAL_nperm LOCAL->nperm_ -#define REMOTE_nperm(wid) REMOTE(wid)->nperm_ - -#define LOCAL_LabelFirstArray LOCAL->LabelFirstArray_ -#define REMOTE_LabelFirstArray(wid) REMOTE(wid)->LabelFirstArray_ -#define LOCAL_LabelFirstArraySz LOCAL->LabelFirstArraySz_ -#define REMOTE_LabelFirstArraySz(wid) REMOTE(wid)->LabelFirstArraySz_ - -#define LOCAL_PL_local_data_p LOCAL->PL_local_data_p_ -#define REMOTE_PL_local_data_p(wid) REMOTE(wid)->PL_local_data_p_ -#ifdef THREADS -#define LOCAL_ThreadHandle LOCAL->ThreadHandle_ -#define REMOTE_ThreadHandle(wid) REMOTE(wid)->ThreadHandle_ -#endif /* THREADS */ -#if defined(YAPOR) || defined(TABLING) -#define LOCAL_optyap_data LOCAL->optyap_data_ -#define REMOTE_optyap_data(wid) REMOTE(wid)->optyap_data_ -#endif /* YAPOR || TABLING */ -#define LOCAL_InterruptsDisabled LOCAL->InterruptsDisabled_ -#define REMOTE_InterruptsDisabled(wid) REMOTE(wid)->InterruptsDisabled_ -#define LOCAL_execution LOCAL->execution_ -#define REMOTE_execution(wid) REMOTE(wid)->execution_ -#if LOW_LEVEL_TRACER -#define LOCAL_total_choicepoints LOCAL->total_choicepoints_ -#define REMOTE_total_choicepoints(wid) REMOTE(wid)->total_choicepoints_ -#endif -#define LOCAL_consult_level LOCAL->consult_level_ -#define REMOTE_consult_level(wid) REMOTE(wid)->consult_level_ -#if defined(YAPOR) || defined(THREADS) -#define LOCAL_SignalLock LOCAL->SignalLock_ -#define REMOTE_SignalLock(wid) REMOTE(wid)->SignalLock_ -#endif - -#define LOCAL_LocalBase LOCAL->LocalBase_ -#define REMOTE_LocalBase(wid) REMOTE(wid)->LocalBase_ -#define LOCAL_GlobalBase LOCAL->GlobalBase_ -#define REMOTE_GlobalBase(wid) REMOTE(wid)->GlobalBase_ -#define LOCAL_TrailBase LOCAL->TrailBase_ -#define REMOTE_TrailBase(wid) REMOTE(wid)->TrailBase_ -#define LOCAL_TrailTop LOCAL->TrailTop_ -#define REMOTE_TrailTop(wid) REMOTE(wid)->TrailTop_ -#define LOCAL_ErrorMessage LOCAL->ErrorMessage_ -#define REMOTE_ErrorMessage(wid) REMOTE(wid)->ErrorMessage_ -#define LOCAL_Error_Term LOCAL->Error_Term_ -#define REMOTE_Error_Term(wid) REMOTE(wid)->Error_Term_ -#ifdef THREADS -#define LOCAL_Error_TYPE LOCAL->Error_TYPE_ -#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_ -#else -#define LOCAL_Error_TYPE LOCAL->Error_TYPE_ -#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_ -#endif -#define LOCAL_Error_Size LOCAL->Error_Size_ -#define REMOTE_Error_Size(wid) REMOTE(wid)->Error_Size_ -#define LOCAL_ErrorSay LOCAL->ErrorSay_ -#define REMOTE_ErrorSay(wid) REMOTE(wid)->ErrorSay_ -#define LOCAL_IOBotch LOCAL->IOBotch_ -#define REMOTE_IOBotch(wid) REMOTE(wid)->IOBotch_ -#define LOCAL_tokptr LOCAL->tokptr_ -#define REMOTE_tokptr(wid) REMOTE(wid)->tokptr_ -#define LOCAL_toktide LOCAL->toktide_ -#define REMOTE_toktide(wid) REMOTE(wid)->toktide_ -#define LOCAL_VarTable LOCAL->VarTable_ -#define REMOTE_VarTable(wid) REMOTE(wid)->VarTable_ -#define LOCAL_AnonVarTable LOCAL->AnonVarTable_ -#define REMOTE_AnonVarTable(wid) REMOTE(wid)->AnonVarTable_ -#define LOCAL_Comments LOCAL->Comments_ -#define REMOTE_Comments(wid) REMOTE(wid)->Comments_ -#define LOCAL_CommentsTail LOCAL->CommentsTail_ -#define REMOTE_CommentsTail(wid) REMOTE(wid)->CommentsTail_ -#define LOCAL_CommentsNextChar LOCAL->CommentsNextChar_ -#define REMOTE_CommentsNextChar(wid) REMOTE(wid)->CommentsNextChar_ -#define LOCAL_CommentsBuff LOCAL->CommentsBuff_ -#define REMOTE_CommentsBuff(wid) REMOTE(wid)->CommentsBuff_ -#define LOCAL_CommentsBuffPos LOCAL->CommentsBuffPos_ -#define REMOTE_CommentsBuffPos(wid) REMOTE(wid)->CommentsBuffPos_ -#define LOCAL_CommentsBuffLim LOCAL->CommentsBuffLim_ -#define REMOTE_CommentsBuffLim(wid) REMOTE(wid)->CommentsBuffLim_ -#define LOCAL_RestartEnv LOCAL->RestartEnv_ -#define REMOTE_RestartEnv(wid) REMOTE(wid)->RestartEnv_ -#define LOCAL_FileNameBuf LOCAL->FileNameBuf_ -#define REMOTE_FileNameBuf(wid) REMOTE(wid)->FileNameBuf_ -#define LOCAL_FileNameBuf2 LOCAL->FileNameBuf2_ -#define REMOTE_FileNameBuf2(wid) REMOTE(wid)->FileNameBuf2_ - -#define LOCAL_PrologMode LOCAL->PrologMode_ -#define REMOTE_PrologMode(wid) REMOTE(wid)->PrologMode_ -#define LOCAL_CritLocks LOCAL->CritLocks_ -#define REMOTE_CritLocks(wid) REMOTE(wid)->CritLocks_ - - -#ifdef ANALYST -#define LOCAL_opcount LOCAL->opcount_ -#define REMOTE_opcount(wid) REMOTE(wid)->opcount_ -#define LOCAL_2opcount LOCAL->2opcount_ -#define REMOTE_2opcount(wid) REMOTE(wid)->2opcount_ -#endif /* ANALYST */ - -#define LOCAL_s_dbg LOCAL->s_dbg_ -#define REMOTE_s_dbg(wid) REMOTE(wid)->s_dbg_ - -#define LOCAL_matherror LOCAL->matherror_ -#define REMOTE_matherror(wid) REMOTE(wid)->matherror_ - -#define LOCAL_heap_overflows LOCAL->heap_overflows_ -#define REMOTE_heap_overflows(wid) REMOTE(wid)->heap_overflows_ -#define LOCAL_total_heap_overflow_time LOCAL->total_heap_overflow_time_ -#define REMOTE_total_heap_overflow_time(wid) REMOTE(wid)->total_heap_overflow_time_ -#define LOCAL_stack_overflows LOCAL->stack_overflows_ -#define REMOTE_stack_overflows(wid) REMOTE(wid)->stack_overflows_ -#define LOCAL_total_stack_overflow_time LOCAL->total_stack_overflow_time_ -#define REMOTE_total_stack_overflow_time(wid) REMOTE(wid)->total_stack_overflow_time_ -#define LOCAL_delay_overflows LOCAL->delay_overflows_ -#define REMOTE_delay_overflows(wid) REMOTE(wid)->delay_overflows_ -#define LOCAL_total_delay_overflow_time LOCAL->total_delay_overflow_time_ -#define REMOTE_total_delay_overflow_time(wid) REMOTE(wid)->total_delay_overflow_time_ -#define LOCAL_trail_overflows LOCAL->trail_overflows_ -#define REMOTE_trail_overflows(wid) REMOTE(wid)->trail_overflows_ -#define LOCAL_total_trail_overflow_time LOCAL->total_trail_overflow_time_ -#define REMOTE_total_trail_overflow_time(wid) REMOTE(wid)->total_trail_overflow_time_ -#define LOCAL_atom_table_overflows LOCAL->atom_table_overflows_ -#define REMOTE_atom_table_overflows(wid) REMOTE(wid)->atom_table_overflows_ -#define LOCAL_total_atom_table_overflow_time LOCAL->total_atom_table_overflow_time_ -#define REMOTE_total_atom_table_overflow_time(wid) REMOTE(wid)->total_atom_table_overflow_time_ - -#ifdef LOAD_DYLD -#define LOCAL_dl_errno LOCAL->dl_errno_ -#define REMOTE_dl_errno(wid) REMOTE(wid)->dl_errno_ -#endif - -#ifdef LOW_LEVEL_TRACER -#define LOCAL_do_trace_primitives LOCAL->do_trace_primitives_ -#define REMOTE_do_trace_primitives(wid) REMOTE(wid)->do_trace_primitives_ -#endif - -#define LOCAL_ExportAtomHashChain LOCAL->ExportAtomHashChain_ -#define REMOTE_ExportAtomHashChain(wid) REMOTE(wid)->ExportAtomHashChain_ -#define LOCAL_ExportAtomHashTableSize LOCAL->ExportAtomHashTableSize_ -#define REMOTE_ExportAtomHashTableSize(wid) REMOTE(wid)->ExportAtomHashTableSize_ -#define LOCAL_ExportAtomHashTableNum LOCAL->ExportAtomHashTableNum_ -#define REMOTE_ExportAtomHashTableNum(wid) REMOTE(wid)->ExportAtomHashTableNum_ -#define LOCAL_ExportFunctorHashChain LOCAL->ExportFunctorHashChain_ -#define REMOTE_ExportFunctorHashChain(wid) REMOTE(wid)->ExportFunctorHashChain_ -#define LOCAL_ExportFunctorHashTableSize LOCAL->ExportFunctorHashTableSize_ -#define REMOTE_ExportFunctorHashTableSize(wid) REMOTE(wid)->ExportFunctorHashTableSize_ -#define LOCAL_ExportFunctorHashTableNum LOCAL->ExportFunctorHashTableNum_ -#define REMOTE_ExportFunctorHashTableNum(wid) REMOTE(wid)->ExportFunctorHashTableNum_ -#define LOCAL_ExportPredEntryHashChain LOCAL->ExportPredEntryHashChain_ -#define REMOTE_ExportPredEntryHashChain(wid) REMOTE(wid)->ExportPredEntryHashChain_ -#define LOCAL_ExportPredEntryHashTableSize LOCAL->ExportPredEntryHashTableSize_ -#define REMOTE_ExportPredEntryHashTableSize(wid) REMOTE(wid)->ExportPredEntryHashTableSize_ -#define LOCAL_ExportPredEntryHashTableNum LOCAL->ExportPredEntryHashTableNum_ -#define REMOTE_ExportPredEntryHashTableNum(wid) REMOTE(wid)->ExportPredEntryHashTableNum_ -#define LOCAL_ExportDBRefHashChain LOCAL->ExportDBRefHashChain_ -#define REMOTE_ExportDBRefHashChain(wid) REMOTE(wid)->ExportDBRefHashChain_ -#define LOCAL_ExportDBRefHashTableSize LOCAL->ExportDBRefHashTableSize_ -#define REMOTE_ExportDBRefHashTableSize(wid) REMOTE(wid)->ExportDBRefHashTableSize_ -#define LOCAL_ExportDBRefHashTableNum LOCAL->ExportDBRefHashTableNum_ -#define REMOTE_ExportDBRefHashTableNum(wid) REMOTE(wid)->ExportDBRefHashTableNum_ -#define LOCAL_ImportAtomHashChain LOCAL->ImportAtomHashChain_ -#define REMOTE_ImportAtomHashChain(wid) REMOTE(wid)->ImportAtomHashChain_ -#define LOCAL_ImportAtomHashTableSize LOCAL->ImportAtomHashTableSize_ -#define REMOTE_ImportAtomHashTableSize(wid) REMOTE(wid)->ImportAtomHashTableSize_ -#define LOCAL_ImportAtomHashTableNum LOCAL->ImportAtomHashTableNum_ -#define REMOTE_ImportAtomHashTableNum(wid) REMOTE(wid)->ImportAtomHashTableNum_ -#define LOCAL_ImportFunctorHashChain LOCAL->ImportFunctorHashChain_ -#define REMOTE_ImportFunctorHashChain(wid) REMOTE(wid)->ImportFunctorHashChain_ -#define LOCAL_ImportFunctorHashTableSize LOCAL->ImportFunctorHashTableSize_ -#define REMOTE_ImportFunctorHashTableSize(wid) REMOTE(wid)->ImportFunctorHashTableSize_ -#define LOCAL_ImportFunctorHashTableNum LOCAL->ImportFunctorHashTableNum_ -#define REMOTE_ImportFunctorHashTableNum(wid) REMOTE(wid)->ImportFunctorHashTableNum_ -#define LOCAL_ImportOPCODEHashChain LOCAL->ImportOPCODEHashChain_ -#define REMOTE_ImportOPCODEHashChain(wid) REMOTE(wid)->ImportOPCODEHashChain_ -#define LOCAL_ImportOPCODEHashTableSize LOCAL->ImportOPCODEHashTableSize_ -#define REMOTE_ImportOPCODEHashTableSize(wid) REMOTE(wid)->ImportOPCODEHashTableSize_ -#define LOCAL_ImportPredEntryHashChain LOCAL->ImportPredEntryHashChain_ -#define REMOTE_ImportPredEntryHashChain(wid) REMOTE(wid)->ImportPredEntryHashChain_ -#define LOCAL_ImportPredEntryHashTableSize LOCAL->ImportPredEntryHashTableSize_ -#define REMOTE_ImportPredEntryHashTableSize(wid) REMOTE(wid)->ImportPredEntryHashTableSize_ -#define LOCAL_ImportPredEntryHashTableNum LOCAL->ImportPredEntryHashTableNum_ -#define REMOTE_ImportPredEntryHashTableNum(wid) REMOTE(wid)->ImportPredEntryHashTableNum_ -#define LOCAL_ImportDBRefHashChain LOCAL->ImportDBRefHashChain_ -#define REMOTE_ImportDBRefHashChain(wid) REMOTE(wid)->ImportDBRefHashChain_ -#define LOCAL_ImportDBRefHashTableSize LOCAL->ImportDBRefHashTableSize_ -#define REMOTE_ImportDBRefHashTableSize(wid) REMOTE(wid)->ImportDBRefHashTableSize_ -#define LOCAL_ImportDBRefHashTableNum LOCAL->ImportDBRefHashTableNum_ -#define REMOTE_ImportDBRefHashTableNum(wid) REMOTE(wid)->ImportDBRefHashTableNum_ -#define LOCAL_ImportFAILCODE LOCAL->ImportFAILCODE_ -#define REMOTE_ImportFAILCODE(wid) REMOTE(wid)->ImportFAILCODE_ - + + /* This file, dlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/LOCALS instead */ + + + + +#define LOCAL_c_input_stream LOCAL->c_input_stream_ +#define REMOTE_c_input_stream(wid) REMOTE(wid)->c_input_stream_ +#define LOCAL_c_output_stream LOCAL->c_output_stream_ +#define REMOTE_c_output_stream(wid) REMOTE(wid)->c_output_stream_ +#define LOCAL_c_error_stream LOCAL->c_error_stream_ +#define REMOTE_c_error_stream(wid) REMOTE(wid)->c_error_stream_ + +#define LOCAL_OldASP LOCAL->OldASP_ +#define REMOTE_OldASP(wid) REMOTE(wid)->OldASP_ +#define LOCAL_OldLCL0 LOCAL->OldLCL0_ +#define REMOTE_OldLCL0(wid) REMOTE(wid)->OldLCL0_ +#define LOCAL_OldTR LOCAL->OldTR_ +#define REMOTE_OldTR(wid) REMOTE(wid)->OldTR_ +#define LOCAL_OldGlobalBase LOCAL->OldGlobalBase_ +#define REMOTE_OldGlobalBase(wid) REMOTE(wid)->OldGlobalBase_ +#define LOCAL_OldH LOCAL->OldH_ +#define REMOTE_OldH(wid) REMOTE(wid)->OldH_ +#define LOCAL_OldH0 LOCAL->OldH0_ +#define REMOTE_OldH0(wid) REMOTE(wid)->OldH0_ +#define LOCAL_OldTrailBase LOCAL->OldTrailBase_ +#define REMOTE_OldTrailBase(wid) REMOTE(wid)->OldTrailBase_ +#define LOCAL_OldTrailTop LOCAL->OldTrailTop_ +#define REMOTE_OldTrailTop(wid) REMOTE(wid)->OldTrailTop_ +#define LOCAL_OldHeapBase LOCAL->OldHeapBase_ +#define REMOTE_OldHeapBase(wid) REMOTE(wid)->OldHeapBase_ +#define LOCAL_OldHeapTop LOCAL->OldHeapTop_ +#define REMOTE_OldHeapTop(wid) REMOTE(wid)->OldHeapTop_ +#define LOCAL_ClDiff LOCAL->ClDiff_ +#define REMOTE_ClDiff(wid) REMOTE(wid)->ClDiff_ +#define LOCAL_GDiff LOCAL->GDiff_ +#define REMOTE_GDiff(wid) REMOTE(wid)->GDiff_ +#define LOCAL_HDiff LOCAL->HDiff_ +#define REMOTE_HDiff(wid) REMOTE(wid)->HDiff_ +#define LOCAL_GDiff0 LOCAL->GDiff0_ +#define REMOTE_GDiff0(wid) REMOTE(wid)->GDiff0_ +#define LOCAL_GSplit LOCAL->GSplit_ +#define REMOTE_GSplit(wid) REMOTE(wid)->GSplit_ +#define LOCAL_LDiff LOCAL->LDiff_ +#define REMOTE_LDiff(wid) REMOTE(wid)->LDiff_ +#define LOCAL_TrDiff LOCAL->TrDiff_ +#define REMOTE_TrDiff(wid) REMOTE(wid)->TrDiff_ +#define LOCAL_XDiff LOCAL->XDiff_ +#define REMOTE_XDiff(wid) REMOTE(wid)->XDiff_ +#define LOCAL_DelayDiff LOCAL->DelayDiff_ +#define REMOTE_DelayDiff(wid) REMOTE(wid)->DelayDiff_ +#define LOCAL_BaseDiff LOCAL->BaseDiff_ +#define REMOTE_BaseDiff(wid) REMOTE(wid)->BaseDiff_ + +#define LOCAL_ReductionsCounter LOCAL->ReductionsCounter_ +#define REMOTE_ReductionsCounter(wid) REMOTE(wid)->ReductionsCounter_ +#define LOCAL_PredEntriesCounter LOCAL->PredEntriesCounter_ +#define REMOTE_PredEntriesCounter(wid) REMOTE(wid)->PredEntriesCounter_ +#define LOCAL_RetriesCounter LOCAL->RetriesCounter_ +#define REMOTE_RetriesCounter(wid) REMOTE(wid)->RetriesCounter_ +#define LOCAL_ReductionsCounterOn LOCAL->ReductionsCounterOn_ +#define REMOTE_ReductionsCounterOn(wid) REMOTE(wid)->ReductionsCounterOn_ +#define LOCAL_PredEntriesCounterOn LOCAL->PredEntriesCounterOn_ +#define REMOTE_PredEntriesCounterOn(wid) REMOTE(wid)->PredEntriesCounterOn_ +#define LOCAL_RetriesCounterOn LOCAL->RetriesCounterOn_ +#define REMOTE_RetriesCounterOn(wid) REMOTE(wid)->RetriesCounterOn_ + + +#define LOCAL_ConsultSp LOCAL->ConsultSp_ +#define REMOTE_ConsultSp(wid) REMOTE(wid)->ConsultSp_ + +#define LOCAL_ConsultCapacity LOCAL->ConsultCapacity_ +#define REMOTE_ConsultCapacity(wid) REMOTE(wid)->ConsultCapacity_ + +#define LOCAL_ConsultBase LOCAL->ConsultBase_ +#define REMOTE_ConsultBase(wid) REMOTE(wid)->ConsultBase_ + +#define LOCAL_ConsultLow LOCAL->ConsultLow_ +#define REMOTE_ConsultLow(wid) REMOTE(wid)->ConsultLow_ + +#define LOCAL_GlobalArena LOCAL->GlobalArena_ +#define REMOTE_GlobalArena(wid) REMOTE(wid)->GlobalArena_ +#define LOCAL_GlobalArenaOverflows LOCAL->GlobalArenaOverflows_ +#define REMOTE_GlobalArenaOverflows(wid) REMOTE(wid)->GlobalArenaOverflows_ +#define LOCAL_ArenaOverflows LOCAL->ArenaOverflows_ +#define REMOTE_ArenaOverflows(wid) REMOTE(wid)->ArenaOverflows_ +#define LOCAL_DepthArenas LOCAL->DepthArenas_ +#define REMOTE_DepthArenas(wid) REMOTE(wid)->DepthArenas_ +#define LOCAL_ArithError LOCAL->ArithError_ +#define REMOTE_ArithError(wid) REMOTE(wid)->ArithError_ +#define LOCAL_LastAssertedPred LOCAL->LastAssertedPred_ +#define REMOTE_LastAssertedPred(wid) REMOTE(wid)->LastAssertedPred_ +#define LOCAL_DebugOn LOCAL->DebugOn_ +#define REMOTE_DebugOn(wid) REMOTE(wid)->DebugOn_ +#define LOCAL_ScannerStack LOCAL->ScannerStack_ +#define REMOTE_ScannerStack(wid) REMOTE(wid)->ScannerStack_ +#define LOCAL_ScannerExtraBlocks LOCAL->ScannerExtraBlocks_ +#define REMOTE_ScannerExtraBlocks(wid) REMOTE(wid)->ScannerExtraBlocks_ +#define LOCAL_BallTerm LOCAL->BallTerm_ +#define REMOTE_BallTerm(wid) REMOTE(wid)->BallTerm_ +#define LOCAL_ActiveSignals LOCAL->ActiveSignals_ +#define REMOTE_ActiveSignals(wid) REMOTE(wid)->ActiveSignals_ +#define LOCAL_IPredArity LOCAL->IPredArity_ +#define REMOTE_IPredArity(wid) REMOTE(wid)->IPredArity_ +#define LOCAL_ProfEnd LOCAL->ProfEnd_ +#define REMOTE_ProfEnd(wid) REMOTE(wid)->ProfEnd_ +#define LOCAL_UncaughtThrow LOCAL->UncaughtThrow_ +#define REMOTE_UncaughtThrow(wid) REMOTE(wid)->UncaughtThrow_ +#define LOCAL_DoingUndefp LOCAL->DoingUndefp_ +#define REMOTE_DoingUndefp(wid) REMOTE(wid)->DoingUndefp_ +#define LOCAL_StartLine LOCAL->StartLine_ +#define REMOTE_StartLine(wid) REMOTE(wid)->StartLine_ +#define LOCAL_ScratchPad LOCAL->ScratchPad_ +#define REMOTE_ScratchPad(wid) REMOTE(wid)->ScratchPad_ +#ifdef COROUTINING +#define LOCAL_WokenGoals LOCAL->WokenGoals_ +#define REMOTE_WokenGoals(wid) REMOTE(wid)->WokenGoals_ +#define LOCAL_AttsMutableList LOCAL->AttsMutableList_ +#define REMOTE_AttsMutableList(wid) REMOTE(wid)->AttsMutableList_ +#endif + +#define LOCAL_GcGeneration LOCAL->GcGeneration_ +#define REMOTE_GcGeneration(wid) REMOTE(wid)->GcGeneration_ +#define LOCAL_GcPhase LOCAL->GcPhase_ +#define REMOTE_GcPhase(wid) REMOTE(wid)->GcPhase_ +#define LOCAL_GcCurrentPhase LOCAL->GcCurrentPhase_ +#define REMOTE_GcCurrentPhase(wid) REMOTE(wid)->GcCurrentPhase_ +#define LOCAL_GcCalls LOCAL->GcCalls_ +#define REMOTE_GcCalls(wid) REMOTE(wid)->GcCalls_ +#define LOCAL_TotGcTime LOCAL->TotGcTime_ +#define REMOTE_TotGcTime(wid) REMOTE(wid)->TotGcTime_ +#define LOCAL_TotGcRecovered LOCAL->TotGcRecovered_ +#define REMOTE_TotGcRecovered(wid) REMOTE(wid)->TotGcRecovered_ +#define LOCAL_LastGcTime LOCAL->LastGcTime_ +#define REMOTE_LastGcTime(wid) REMOTE(wid)->LastGcTime_ +#define LOCAL_LastSSTime LOCAL->LastSSTime_ +#define REMOTE_LastSSTime(wid) REMOTE(wid)->LastSSTime_ +#define LOCAL_OpenArray LOCAL->OpenArray_ +#define REMOTE_OpenArray(wid) REMOTE(wid)->OpenArray_ + +#define LOCAL_total_marked LOCAL->total_marked_ +#define REMOTE_total_marked(wid) REMOTE(wid)->total_marked_ +#define LOCAL_total_oldies LOCAL->total_oldies_ +#define REMOTE_total_oldies(wid) REMOTE(wid)->total_oldies_ +#define LOCAL_current_B LOCAL->current_B_ +#define REMOTE_current_B(wid) REMOTE(wid)->current_B_ +#define LOCAL_prev_HB LOCAL->prev_HB_ +#define REMOTE_prev_HB(wid) REMOTE(wid)->prev_HB_ +#define LOCAL_HGEN LOCAL->HGEN_ +#define REMOTE_HGEN(wid) REMOTE(wid)->HGEN_ +#define LOCAL_iptop LOCAL->iptop_ +#define REMOTE_iptop(wid) REMOTE(wid)->iptop_ +#if defined(GC_NO_TAGS) +#define LOCAL_bp LOCAL->bp_ +#define REMOTE_bp(wid) REMOTE(wid)->bp_ +#endif +#define LOCAL_sTR LOCAL->sTR_ +#define REMOTE_sTR(wid) REMOTE(wid)->sTR_ +#define LOCAL_sTR0 LOCAL->sTR0_ +#define REMOTE_sTR0(wid) REMOTE(wid)->sTR0_ +#define LOCAL_new_TR LOCAL->new_TR_ +#define REMOTE_new_TR(wid) REMOTE(wid)->new_TR_ +#define LOCAL_cont_top0 LOCAL->cont_top0_ +#define REMOTE_cont_top0(wid) REMOTE(wid)->cont_top0_ +#define LOCAL_cont_top LOCAL->cont_top_ +#define REMOTE_cont_top(wid) REMOTE(wid)->cont_top_ +#define LOCAL_discard_trail_entries LOCAL->discard_trail_entries_ +#define REMOTE_discard_trail_entries(wid) REMOTE(wid)->discard_trail_entries_ +#define LOCAL_gc_ma_hash_table LOCAL->gc_ma_hash_table_ +#define REMOTE_gc_ma_hash_table(wid) REMOTE(wid)->gc_ma_hash_table_ +#define LOCAL_gc_ma_h_top LOCAL->gc_ma_h_top_ +#define REMOTE_gc_ma_h_top(wid) REMOTE(wid)->gc_ma_h_top_ +#define LOCAL_gc_ma_h_list LOCAL->gc_ma_h_list_ +#define REMOTE_gc_ma_h_list(wid) REMOTE(wid)->gc_ma_h_list_ +#define LOCAL_gc_timestamp LOCAL->gc_timestamp_ +#define REMOTE_gc_timestamp(wid) REMOTE(wid)->gc_timestamp_ +#define LOCAL_db_vec LOCAL->db_vec_ +#define REMOTE_db_vec(wid) REMOTE(wid)->db_vec_ +#define LOCAL_db_vec0 LOCAL->db_vec0_ +#define REMOTE_db_vec0(wid) REMOTE(wid)->db_vec0_ +#define LOCAL_db_root LOCAL->db_root_ +#define REMOTE_db_root(wid) REMOTE(wid)->db_root_ +#define LOCAL_db_nil LOCAL->db_nil_ +#define REMOTE_db_nil(wid) REMOTE(wid)->db_nil_ +#define LOCAL_gc_restore LOCAL->gc_restore_ +#define REMOTE_gc_restore(wid) REMOTE(wid)->gc_restore_ +#define LOCAL_extra_gc_cells LOCAL->extra_gc_cells_ +#define REMOTE_extra_gc_cells(wid) REMOTE(wid)->extra_gc_cells_ +#define LOCAL_extra_gc_cells_base LOCAL->extra_gc_cells_base_ +#define REMOTE_extra_gc_cells_base(wid) REMOTE(wid)->extra_gc_cells_base_ +#define LOCAL_extra_gc_cells_top LOCAL->extra_gc_cells_top_ +#define REMOTE_extra_gc_cells_top(wid) REMOTE(wid)->extra_gc_cells_top_ +#define LOCAL_extra_gc_cells_size LOCAL->extra_gc_cells_size_ +#define REMOTE_extra_gc_cells_size(wid) REMOTE(wid)->extra_gc_cells_size_ +#define LOCAL_DynamicArrays LOCAL->DynamicArrays_ +#define REMOTE_DynamicArrays(wid) REMOTE(wid)->DynamicArrays_ +#define LOCAL_StaticArrays LOCAL->StaticArrays_ +#define REMOTE_StaticArrays(wid) REMOTE(wid)->StaticArrays_ +#define LOCAL_GlobalVariables LOCAL->GlobalVariables_ +#define REMOTE_GlobalVariables(wid) REMOTE(wid)->GlobalVariables_ +#define LOCAL_AllowRestart LOCAL->AllowRestart_ +#define REMOTE_AllowRestart(wid) REMOTE(wid)->AllowRestart_ + +#define LOCAL_CMemFirstBlock LOCAL->CMemFirstBlock_ +#define REMOTE_CMemFirstBlock(wid) REMOTE(wid)->CMemFirstBlock_ +#define LOCAL_CMemFirstBlockSz LOCAL->CMemFirstBlockSz_ +#define REMOTE_CMemFirstBlockSz(wid) REMOTE(wid)->CMemFirstBlockSz_ + +#define LOCAL_nperm LOCAL->nperm_ +#define REMOTE_nperm(wid) REMOTE(wid)->nperm_ + +#define LOCAL_LabelFirstArray LOCAL->LabelFirstArray_ +#define REMOTE_LabelFirstArray(wid) REMOTE(wid)->LabelFirstArray_ +#define LOCAL_LabelFirstArraySz LOCAL->LabelFirstArraySz_ +#define REMOTE_LabelFirstArraySz(wid) REMOTE(wid)->LabelFirstArraySz_ + +#define LOCAL_PL_local_data_p LOCAL->PL_local_data_p_ +#define REMOTE_PL_local_data_p(wid) REMOTE(wid)->PL_local_data_p_ +#ifdef THREADS +#define LOCAL_ThreadHandle LOCAL->ThreadHandle_ +#define REMOTE_ThreadHandle(wid) REMOTE(wid)->ThreadHandle_ +#endif /* THREADS */ +#if defined(YAPOR) || defined(TABLING) +#define LOCAL_optyap_data LOCAL->optyap_data_ +#define REMOTE_optyap_data(wid) REMOTE(wid)->optyap_data_ +#endif /* YAPOR || TABLING */ +#define LOCAL_InterruptsDisabled LOCAL->InterruptsDisabled_ +#define REMOTE_InterruptsDisabled(wid) REMOTE(wid)->InterruptsDisabled_ +#define LOCAL_execution LOCAL->execution_ +#define REMOTE_execution(wid) REMOTE(wid)->execution_ +#if LOW_LEVEL_TRACER +#define LOCAL_total_choicepoints LOCAL->total_choicepoints_ +#define REMOTE_total_choicepoints(wid) REMOTE(wid)->total_choicepoints_ +#endif +#define LOCAL_consult_level LOCAL->consult_level_ +#define REMOTE_consult_level(wid) REMOTE(wid)->consult_level_ +#if defined(YAPOR) || defined(THREADS) +#define LOCAL_SignalLock LOCAL->SignalLock_ +#define REMOTE_SignalLock(wid) REMOTE(wid)->SignalLock_ +#endif + +#define LOCAL_LocalBase LOCAL->LocalBase_ +#define REMOTE_LocalBase(wid) REMOTE(wid)->LocalBase_ +#define LOCAL_GlobalBase LOCAL->GlobalBase_ +#define REMOTE_GlobalBase(wid) REMOTE(wid)->GlobalBase_ +#define LOCAL_TrailBase LOCAL->TrailBase_ +#define REMOTE_TrailBase(wid) REMOTE(wid)->TrailBase_ +#define LOCAL_TrailTop LOCAL->TrailTop_ +#define REMOTE_TrailTop(wid) REMOTE(wid)->TrailTop_ +#define LOCAL_ErrorMessage LOCAL->ErrorMessage_ +#define REMOTE_ErrorMessage(wid) REMOTE(wid)->ErrorMessage_ +#define LOCAL_Error_Term LOCAL->Error_Term_ +#define REMOTE_Error_Term(wid) REMOTE(wid)->Error_Term_ +#ifdef THREADS +#define LOCAL_Error_TYPE LOCAL->Error_TYPE_ +#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_ +#else +#define LOCAL_Error_TYPE LOCAL->Error_TYPE_ +#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_ +#endif +#define LOCAL_Error_Size LOCAL->Error_Size_ +#define REMOTE_Error_Size(wid) REMOTE(wid)->Error_Size_ +#define LOCAL_ErrorSay LOCAL->ErrorSay_ +#define REMOTE_ErrorSay(wid) REMOTE(wid)->ErrorSay_ +#define LOCAL_IOBotch LOCAL->IOBotch_ +#define REMOTE_IOBotch(wid) REMOTE(wid)->IOBotch_ +#define LOCAL_tokptr LOCAL->tokptr_ +#define REMOTE_tokptr(wid) REMOTE(wid)->tokptr_ +#define LOCAL_toktide LOCAL->toktide_ +#define REMOTE_toktide(wid) REMOTE(wid)->toktide_ +#define LOCAL_VarTable LOCAL->VarTable_ +#define REMOTE_VarTable(wid) REMOTE(wid)->VarTable_ +#define LOCAL_AnonVarTable LOCAL->AnonVarTable_ +#define REMOTE_AnonVarTable(wid) REMOTE(wid)->AnonVarTable_ +#define LOCAL_Comments LOCAL->Comments_ +#define REMOTE_Comments(wid) REMOTE(wid)->Comments_ +#define LOCAL_CommentsTail LOCAL->CommentsTail_ +#define REMOTE_CommentsTail(wid) REMOTE(wid)->CommentsTail_ +#define LOCAL_CommentsNextChar LOCAL->CommentsNextChar_ +#define REMOTE_CommentsNextChar(wid) REMOTE(wid)->CommentsNextChar_ +#define LOCAL_CommentsBuff LOCAL->CommentsBuff_ +#define REMOTE_CommentsBuff(wid) REMOTE(wid)->CommentsBuff_ +#define LOCAL_CommentsBuffPos LOCAL->CommentsBuffPos_ +#define REMOTE_CommentsBuffPos(wid) REMOTE(wid)->CommentsBuffPos_ +#define LOCAL_CommentsBuffLim LOCAL->CommentsBuffLim_ +#define REMOTE_CommentsBuffLim(wid) REMOTE(wid)->CommentsBuffLim_ +#define LOCAL_RestartEnv LOCAL->RestartEnv_ +#define REMOTE_RestartEnv(wid) REMOTE(wid)->RestartEnv_ +#define LOCAL_FileNameBuf LOCAL->FileNameBuf_ +#define REMOTE_FileNameBuf(wid) REMOTE(wid)->FileNameBuf_ +#define LOCAL_FileNameBuf2 LOCAL->FileNameBuf2_ +#define REMOTE_FileNameBuf2(wid) REMOTE(wid)->FileNameBuf2_ + +#define LOCAL_PrologMode LOCAL->PrologMode_ +#define REMOTE_PrologMode(wid) REMOTE(wid)->PrologMode_ +#define LOCAL_CritLocks LOCAL->CritLocks_ +#define REMOTE_CritLocks(wid) REMOTE(wid)->CritLocks_ + + +#ifdef ANALYST +#define LOCAL_opcount LOCAL->opcount_ +#define REMOTE_opcount(wid) REMOTE(wid)->opcount_ +#define LOCAL_2opcount LOCAL->2opcount_ +#define REMOTE_2opcount(wid) REMOTE(wid)->2opcount_ +#endif /* ANALYST */ + +#define LOCAL_s_dbg LOCAL->s_dbg_ +#define REMOTE_s_dbg(wid) REMOTE(wid)->s_dbg_ + +#define LOCAL_matherror LOCAL->matherror_ +#define REMOTE_matherror(wid) REMOTE(wid)->matherror_ + +#define LOCAL_heap_overflows LOCAL->heap_overflows_ +#define REMOTE_heap_overflows(wid) REMOTE(wid)->heap_overflows_ +#define LOCAL_total_heap_overflow_time LOCAL->total_heap_overflow_time_ +#define REMOTE_total_heap_overflow_time(wid) REMOTE(wid)->total_heap_overflow_time_ +#define LOCAL_stack_overflows LOCAL->stack_overflows_ +#define REMOTE_stack_overflows(wid) REMOTE(wid)->stack_overflows_ +#define LOCAL_total_stack_overflow_time LOCAL->total_stack_overflow_time_ +#define REMOTE_total_stack_overflow_time(wid) REMOTE(wid)->total_stack_overflow_time_ +#define LOCAL_delay_overflows LOCAL->delay_overflows_ +#define REMOTE_delay_overflows(wid) REMOTE(wid)->delay_overflows_ +#define LOCAL_total_delay_overflow_time LOCAL->total_delay_overflow_time_ +#define REMOTE_total_delay_overflow_time(wid) REMOTE(wid)->total_delay_overflow_time_ +#define LOCAL_trail_overflows LOCAL->trail_overflows_ +#define REMOTE_trail_overflows(wid) REMOTE(wid)->trail_overflows_ +#define LOCAL_total_trail_overflow_time LOCAL->total_trail_overflow_time_ +#define REMOTE_total_trail_overflow_time(wid) REMOTE(wid)->total_trail_overflow_time_ +#define LOCAL_atom_table_overflows LOCAL->atom_table_overflows_ +#define REMOTE_atom_table_overflows(wid) REMOTE(wid)->atom_table_overflows_ +#define LOCAL_total_atom_table_overflow_time LOCAL->total_atom_table_overflow_time_ +#define REMOTE_total_atom_table_overflow_time(wid) REMOTE(wid)->total_atom_table_overflow_time_ + +#ifdef LOAD_DYLD +#define LOCAL_dl_errno LOCAL->dl_errno_ +#define REMOTE_dl_errno(wid) REMOTE(wid)->dl_errno_ +#endif + +#ifdef LOW_LEVEL_TRACER +#define LOCAL_do_trace_primitives LOCAL->do_trace_primitives_ +#define REMOTE_do_trace_primitives(wid) REMOTE(wid)->do_trace_primitives_ +#endif + +#define LOCAL_ExportAtomHashChain LOCAL->ExportAtomHashChain_ +#define REMOTE_ExportAtomHashChain(wid) REMOTE(wid)->ExportAtomHashChain_ +#define LOCAL_ExportAtomHashTableSize LOCAL->ExportAtomHashTableSize_ +#define REMOTE_ExportAtomHashTableSize(wid) REMOTE(wid)->ExportAtomHashTableSize_ +#define LOCAL_ExportAtomHashTableNum LOCAL->ExportAtomHashTableNum_ +#define REMOTE_ExportAtomHashTableNum(wid) REMOTE(wid)->ExportAtomHashTableNum_ +#define LOCAL_ExportFunctorHashChain LOCAL->ExportFunctorHashChain_ +#define REMOTE_ExportFunctorHashChain(wid) REMOTE(wid)->ExportFunctorHashChain_ +#define LOCAL_ExportFunctorHashTableSize LOCAL->ExportFunctorHashTableSize_ +#define REMOTE_ExportFunctorHashTableSize(wid) REMOTE(wid)->ExportFunctorHashTableSize_ +#define LOCAL_ExportFunctorHashTableNum LOCAL->ExportFunctorHashTableNum_ +#define REMOTE_ExportFunctorHashTableNum(wid) REMOTE(wid)->ExportFunctorHashTableNum_ +#define LOCAL_ExportPredEntryHashChain LOCAL->ExportPredEntryHashChain_ +#define REMOTE_ExportPredEntryHashChain(wid) REMOTE(wid)->ExportPredEntryHashChain_ +#define LOCAL_ExportPredEntryHashTableSize LOCAL->ExportPredEntryHashTableSize_ +#define REMOTE_ExportPredEntryHashTableSize(wid) REMOTE(wid)->ExportPredEntryHashTableSize_ +#define LOCAL_ExportPredEntryHashTableNum LOCAL->ExportPredEntryHashTableNum_ +#define REMOTE_ExportPredEntryHashTableNum(wid) REMOTE(wid)->ExportPredEntryHashTableNum_ +#define LOCAL_ExportDBRefHashChain LOCAL->ExportDBRefHashChain_ +#define REMOTE_ExportDBRefHashChain(wid) REMOTE(wid)->ExportDBRefHashChain_ +#define LOCAL_ExportDBRefHashTableSize LOCAL->ExportDBRefHashTableSize_ +#define REMOTE_ExportDBRefHashTableSize(wid) REMOTE(wid)->ExportDBRefHashTableSize_ +#define LOCAL_ExportDBRefHashTableNum LOCAL->ExportDBRefHashTableNum_ +#define REMOTE_ExportDBRefHashTableNum(wid) REMOTE(wid)->ExportDBRefHashTableNum_ +#define LOCAL_ImportAtomHashChain LOCAL->ImportAtomHashChain_ +#define REMOTE_ImportAtomHashChain(wid) REMOTE(wid)->ImportAtomHashChain_ +#define LOCAL_ImportAtomHashTableSize LOCAL->ImportAtomHashTableSize_ +#define REMOTE_ImportAtomHashTableSize(wid) REMOTE(wid)->ImportAtomHashTableSize_ +#define LOCAL_ImportAtomHashTableNum LOCAL->ImportAtomHashTableNum_ +#define REMOTE_ImportAtomHashTableNum(wid) REMOTE(wid)->ImportAtomHashTableNum_ +#define LOCAL_ImportFunctorHashChain LOCAL->ImportFunctorHashChain_ +#define REMOTE_ImportFunctorHashChain(wid) REMOTE(wid)->ImportFunctorHashChain_ +#define LOCAL_ImportFunctorHashTableSize LOCAL->ImportFunctorHashTableSize_ +#define REMOTE_ImportFunctorHashTableSize(wid) REMOTE(wid)->ImportFunctorHashTableSize_ +#define LOCAL_ImportFunctorHashTableNum LOCAL->ImportFunctorHashTableNum_ +#define REMOTE_ImportFunctorHashTableNum(wid) REMOTE(wid)->ImportFunctorHashTableNum_ +#define LOCAL_ImportOPCODEHashChain LOCAL->ImportOPCODEHashChain_ +#define REMOTE_ImportOPCODEHashChain(wid) REMOTE(wid)->ImportOPCODEHashChain_ +#define LOCAL_ImportOPCODEHashTableSize LOCAL->ImportOPCODEHashTableSize_ +#define REMOTE_ImportOPCODEHashTableSize(wid) REMOTE(wid)->ImportOPCODEHashTableSize_ +#define LOCAL_ImportPredEntryHashChain LOCAL->ImportPredEntryHashChain_ +#define REMOTE_ImportPredEntryHashChain(wid) REMOTE(wid)->ImportPredEntryHashChain_ +#define LOCAL_ImportPredEntryHashTableSize LOCAL->ImportPredEntryHashTableSize_ +#define REMOTE_ImportPredEntryHashTableSize(wid) REMOTE(wid)->ImportPredEntryHashTableSize_ +#define LOCAL_ImportPredEntryHashTableNum LOCAL->ImportPredEntryHashTableNum_ +#define REMOTE_ImportPredEntryHashTableNum(wid) REMOTE(wid)->ImportPredEntryHashTableNum_ +#define LOCAL_ImportDBRefHashChain LOCAL->ImportDBRefHashChain_ +#define REMOTE_ImportDBRefHashChain(wid) REMOTE(wid)->ImportDBRefHashChain_ +#define LOCAL_ImportDBRefHashTableSize LOCAL->ImportDBRefHashTableSize_ +#define REMOTE_ImportDBRefHashTableSize(wid) REMOTE(wid)->ImportDBRefHashTableSize_ +#define LOCAL_ImportDBRefHashTableNum LOCAL->ImportDBRefHashTableNum_ +#define REMOTE_ImportDBRefHashTableNum(wid) REMOTE(wid)->ImportDBRefHashTableNum_ +#define LOCAL_ImportFAILCODE LOCAL->ImportFAILCODE_ +#define REMOTE_ImportFAILCODE(wid) REMOTE(wid)->ImportFAILCODE_ + +#define LOCAL_ProfCalls LOCAL->ProfCalls_ +#define REMOTE_ProfCalls(wid) REMOTE(wid)->ProfCalls_ +#define LOCAL_ProfGCs LOCAL->ProfGCs_ +#define REMOTE_ProfGCs(wid) REMOTE(wid)->ProfGCs_ +#define LOCAL_ProfHGrows LOCAL->ProfHGrows_ +#define REMOTE_ProfHGrows(wid) REMOTE(wid)->ProfHGrows_ +#define LOCAL_ProfSGrows LOCAL->ProfSGrows_ +#define REMOTE_ProfSGrows(wid) REMOTE(wid)->ProfSGrows_ +#define LOCAL_ProfMallocs LOCAL->ProfMallocs_ +#define REMOTE_ProfMallocs(wid) REMOTE(wid)->ProfMallocs_ +#define LOCAL_ProfIndexing LOCAL->ProfIndexing_ +#define REMOTE_ProfIndexing(wid) REMOTE(wid)->ProfIndexing_ +#define LOCAL_ProfOn LOCAL->ProfOn_ +#define REMOTE_ProfOn(wid) REMOTE(wid)->ProfOn_ +#define LOCAL_ProfOns LOCAL->ProfOns_ +#define REMOTE_ProfOns(wid) REMOTE(wid)->ProfOns_ +#define LOCAL_ProfilerRoot LOCAL->ProfilerRoot_ +#define REMOTE_ProfilerRoot(wid) REMOTE(wid)->ProfilerRoot_ +#define LOCAL_ProfilerNil LOCAL->ProfilerNil_ +#define REMOTE_ProfilerNil(wid) REMOTE(wid)->ProfilerNil_ +#define LOCAL_DIRNAME LOCAL->DIRNAME_ +#define REMOTE_DIRNAME(wid) REMOTE(wid)->DIRNAME_ +#if LOW_PROF +#define LOCAL_ProfilerOn LOCAL->ProfilerOn_ +#define REMOTE_ProfilerOn(wid) REMOTE(wid)->ProfilerOn_ +#define LOCAL_FProf LOCAL->FProf_ +#define REMOTE_FProf(wid) REMOTE(wid)->FProf_ +#define LOCAL_FPreds LOCAL->FPreds_ +#define REMOTE_FPreds(wid) REMOTE(wid)->FPreds_ +#endif /* LOW_PROF */ + diff --git a/H/hglobals.h b/H/hglobals.h index 5937c4e88..02a1b39a7 100644 --- a/H/hglobals.h +++ b/H/hglobals.h @@ -1,112 +1,101 @@ - - /* This file, hglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/GLOBALS instead */ - - - - - - - - - - - - - - - - - -typedef struct global_data { - - int Initialised_; - int InitialisedFromPL_; - int PL_Argc_; - char** PL_Argv_; - - struct halt_hook* HaltHooks_; - - int AllowLocalExpansion_; - int AllowGlobalExpansion_; - int AllowTrailExpansion_; - UInt SizeOfOverflow_; - - UInt AGcThreshold_; - Agc_hook AGCHook_; - -#if THREADS - - UInt NOfThreads_; - - UInt NOfThreadsCreated_; - - UInt ThreadsTotalTime_; - - lockvar ThreadHandlesLock_; -#endif -#if defined(YAPOR) || defined(THREADS) - - lockvar BGL_; -#endif -#if defined(YAPOR) || defined(TABLING) - struct global_optyap_data optyap_data_; -#endif /* YAPOR || TABLING */ - - int PrologShouldHandleInterrupts_; - -#if defined(THREADS) - pthread_t master_thread_; -#endif /* THREADS */ - - YP_FILE* stdout_; - YP_FILE* stderr_; - - char** argv_; - int argc_; - -#ifdef COROUTINING - - ext_op attas_[attvars_ext+1]; -#endif - - int agc_calls_; - YAP_ULONG_LONG agc_collected_; - - Int tot_agc_time_; - - Int tot_agc_recovered_; - -#if HAVE_MMAP - struct MMAP_ARRAY_BLOCK* mmap_arrays_; -#endif -#ifdef DEBUG - - char Option_[20]; - YP_FILE* logfile_; - - -#endif - - Int ProfCalls_; - Int ProfGCs_; - Int ProfHGrows_; - Int ProfSGrows_; - Int ProfMallocs_; - Int ProfOn_; - Int ProfOns_; - struct RB_red_blk_node* ProfilerRoot_; - struct RB_red_blk_node* ProfilerNil_; - char* DIRNAME_; -#if defined(COFF) || defined(A_OUT) - - char Executable_[YAP_FILENAME_MAX]; -#endif - int OpaqueHandlersCount_; - struct opaque_handler_struct* OpaqueHandlers_; -#if __simplescalar__ - char pwd_[YAP_FILENAME_MAX]; -#endif - - -} w_shared; + + /* This file, hglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/GLOBALS instead */ + + + + + + + + + + + + + + + + + +typedef struct global_data { + + int Initialised_; + int InitialisedFromPL_; + int PL_Argc_; + char** PL_Argv_; + + struct halt_hook* HaltHooks_; + + int AllowLocalExpansion_; + int AllowGlobalExpansion_; + int AllowTrailExpansion_; + UInt SizeOfOverflow_; + + UInt AGcThreshold_; + Agc_hook AGCHook_; + +#if THREADS + + UInt NOfThreads_; + + UInt NOfThreadsCreated_; + + UInt ThreadsTotalTime_; + + lockvar ThreadHandlesLock_; +#endif +#if defined(YAPOR) || defined(THREADS) + + lockvar BGL_; +#endif +#if defined(YAPOR) || defined(TABLING) + struct global_optyap_data optyap_data_; +#endif /* YAPOR || TABLING */ + + int PrologShouldHandleInterrupts_; + +#if defined(THREADS) + pthread_t master_thread_; +#endif /* THREADS */ + + YP_FILE* stdout_; + YP_FILE* stderr_; + + char** argv_; + int argc_; + +#ifdef COROUTINING + + ext_op attas_[attvars_ext+1]; +#endif + + int agc_calls_; + YAP_ULONG_LONG agc_collected_; + + Int tot_agc_time_; + + Int tot_agc_recovered_; + +#if HAVE_MMAP + struct MMAP_ARRAY_BLOCK* mmap_arrays_; +#endif +#ifdef DEBUG + + char Option_[20]; + YP_FILE* logfile_; + + +#endif +#if defined(COFF) || defined(A_OUT) + + char Executable_[YAP_FILENAME_MAX]; +#endif + int OpaqueHandlersCount_; + struct opaque_handler_struct* OpaqueHandlers_; +#if __simplescalar__ + char pwd_[YAP_FILENAME_MAX]; +#endif + + +} w_shared; diff --git a/H/hlocals.h b/H/hlocals.h index d2000a731..c71a0355b 100644 --- a/H/hlocals.h +++ b/H/hlocals.h @@ -1,226 +1,243 @@ - - /* This file, hlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/LOCALS instead */ - - -typedef struct worker_local { - - int c_input_stream_; - int c_output_stream_; - int c_error_stream_; - - CELL* OldASP_; - CELL* OldLCL0_; - tr_fr_ptr OldTR_; - CELL* OldGlobalBase_; - CELL* OldH_; - CELL* OldH0_; - ADDR OldTrailBase_; - ADDR OldTrailTop_; - ADDR OldHeapBase_; - ADDR OldHeapTop_; - Int ClDiff_; - Int GDiff_; - Int HDiff_; - Int GDiff0_; - CELL* GSplit_; - Int LDiff_; - Int TrDiff_; - Int XDiff_; - Int DelayDiff_; - Int BaseDiff_; - - YAP_ULONG_LONG ReductionsCounter_; - YAP_ULONG_LONG PredEntriesCounter_; - YAP_ULONG_LONG RetriesCounter_; - int ReductionsCounterOn_; - int PredEntriesCounterOn_; - int RetriesCounterOn_; - - - union CONSULT_OBJ* ConsultSp_; - - UInt ConsultCapacity_; - - union CONSULT_OBJ* ConsultBase_; - - union CONSULT_OBJ* ConsultLow_; - - Term GlobalArena_; - UInt GlobalArenaOverflows_; - Int ArenaOverflows_; - Int DepthArenas_; - int ArithError_; - struct pred_entry* LastAssertedPred_; - int DebugOn_; - char* ScannerStack_; - struct scanner_extra_alloc* ScannerExtraBlocks_; - struct DB_TERM* BallTerm_; - UInt ActiveSignals_; - UInt IPredArity_; - yamop* ProfEnd_; - int UncaughtThrow_; - int DoingUndefp_; - Int StartLine_; - scratch_block ScratchPad_; -#ifdef COROUTINING - Term WokenGoals_; - Term AttsMutableList_; -#endif - - Term GcGeneration_; - Term GcPhase_; - UInt GcCurrentPhase_; - UInt GcCalls_; - Int TotGcTime_; - YAP_ULONG_LONG TotGcRecovered_; - Int LastGcTime_; - Int LastSSTime_; - CELL* OpenArray_; - - Int total_marked_; - Int total_oldies_; - struct choicept* current_B_; - CELL* prev_HB_; - CELL* HGEN_; - CELL** iptop_; -#if defined(GC_NO_TAGS) - char* bp_; -#endif - tr_fr_ptr sTR_; - tr_fr_ptr sTR0_; - tr_fr_ptr new_TR_; - struct gc_mark_continuation* cont_top0_; - struct gc_mark_continuation* cont_top_; - int discard_trail_entries_; - gc_ma_hash_entry gc_ma_hash_table_[GC_MAVARS_HASH_SIZE]; - gc_ma_hash_entry* gc_ma_h_top_; - gc_ma_hash_entry* gc_ma_h_list_; - UInt gc_timestamp_; - ADDR db_vec_; - ADDR db_vec0_; - struct RB_red_blk_node* db_root_; - struct RB_red_blk_node* db_nil_; - sigjmp_buf gc_restore_; - CELL* extra_gc_cells_; - CELL* extra_gc_cells_base_; - CELL* extra_gc_cells_top_; - UInt extra_gc_cells_size_; - struct array_entry* DynamicArrays_; - struct static_array_entry* StaticArrays_; - struct global_entry* GlobalVariables_; - int AllowRestart_; - - struct mem_blk* CMemFirstBlock_; - UInt CMemFirstBlockSz_; - - int nperm_; - - Int* LabelFirstArray_; - UInt LabelFirstArraySz_; - - struct PL_local_data* PL_local_data_p_; -#ifdef THREADS - struct thandle ThreadHandle_; -#endif /* THREADS */ -#if defined(YAPOR) || defined(TABLING) - struct local_optyap_data optyap_data_; -#endif /* YAPOR || TABLING */ - int InterruptsDisabled_; - struct open_query_struct* execution_; -#if LOW_LEVEL_TRACER - Int total_choicepoints_; -#endif - int consult_level_; -#if defined(YAPOR) || defined(THREADS) - lockvar SignalLock_; -#endif - - ADDR LocalBase_; - ADDR GlobalBase_; - ADDR TrailBase_; - ADDR TrailTop_; - char* ErrorMessage_; - Term Error_Term_; -#ifdef THREADS - Term Error_TYPE_; -#else - yap_error_number Error_TYPE_; -#endif - UInt Error_Size_; - char ErrorSay_[MAX_ERROR_MSG_SIZE]; - jmp_buf IOBotch_; - TokEntry* tokptr_; - TokEntry* toktide_; - VarEntry* VarTable_; - VarEntry* AnonVarTable_; - Term Comments_; - CELL* CommentsTail_; - CELL* CommentsNextChar_; - wchar_t* CommentsBuff_; - size_t CommentsBuffPos_; - size_t CommentsBuffLim_; - sigjmp_buf RestartEnv_; - char FileNameBuf_[YAP_FILENAME_MAX]; - char FileNameBuf2_[YAP_FILENAME_MAX]; - - Int PrologMode_; - int CritLocks_; - - -#ifdef ANALYST - YAP_ULONG_LONG opcount_[_std_top+1]; - YAP_ULONG_LONG 2opcount[_std_top+1][_std_top+1]_; -#endif /* ANALYST */ - - struct db_globs* s_dbg_; - - yap_error_number matherror_; - - int heap_overflows_; - Int total_heap_overflow_time_; - int stack_overflows_; - Int total_stack_overflow_time_; - int delay_overflows_; - Int total_delay_overflow_time_; - int trail_overflows_; - Int total_trail_overflow_time_; - int atom_table_overflows_; - Int total_atom_table_overflow_time_; - -#ifdef LOAD_DYLD - int dl_errno_; -#endif - -#ifdef LOW_LEVEL_TRACER - int do_trace_primitives_; -#endif - - struct export_atom_hash_entry_struct **ExportAtomHashChain_; - UInt ExportAtomHashTableSize_; - UInt ExportAtomHashTableNum_; - struct export_functor_hash_entry_struct **ExportFunctorHashChain_; - UInt ExportFunctorHashTableSize_; - UInt ExportFunctorHashTableNum_; - struct export_pred_entry_hash_entry_struct **ExportPredEntryHashChain_; - UInt ExportPredEntryHashTableSize_; - UInt ExportPredEntryHashTableNum_; - struct export_dbref_hash_entry_struct **ExportDBRefHashChain_; - UInt ExportDBRefHashTableSize_; - UInt ExportDBRefHashTableNum_; - struct import_atom_hash_entry_struct **ImportAtomHashChain_; - UInt ImportAtomHashTableSize_; - UInt ImportAtomHashTableNum_; - struct import_functor_hash_entry_struct **ImportFunctorHashChain_; - UInt ImportFunctorHashTableSize_; - UInt ImportFunctorHashTableNum_; - struct import_opcode_hash_entry_struct **ImportOPCODEHashChain_; - UInt ImportOPCODEHashTableSize_; - struct import_pred_entry_hash_entry_struct **ImportPredEntryHashChain_; - UInt ImportPredEntryHashTableSize_; - UInt ImportPredEntryHashTableNum_; - struct import_dbref_hash_entry_struct **ImportDBRefHashChain_; - UInt ImportDBRefHashTableSize_; - UInt ImportDBRefHashTableNum_; - yamop *ImportFAILCODE_; -} w_local; + + /* This file, hlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/LOCALS instead */ + + +typedef struct worker_local { + + int c_input_stream_; + int c_output_stream_; + int c_error_stream_; + + CELL* OldASP_; + CELL* OldLCL0_; + tr_fr_ptr OldTR_; + CELL* OldGlobalBase_; + CELL* OldH_; + CELL* OldH0_; + ADDR OldTrailBase_; + ADDR OldTrailTop_; + ADDR OldHeapBase_; + ADDR OldHeapTop_; + Int ClDiff_; + Int GDiff_; + Int HDiff_; + Int GDiff0_; + CELL* GSplit_; + Int LDiff_; + Int TrDiff_; + Int XDiff_; + Int DelayDiff_; + Int BaseDiff_; + + YAP_ULONG_LONG ReductionsCounter_; + YAP_ULONG_LONG PredEntriesCounter_; + YAP_ULONG_LONG RetriesCounter_; + int ReductionsCounterOn_; + int PredEntriesCounterOn_; + int RetriesCounterOn_; + + + union CONSULT_OBJ* ConsultSp_; + + UInt ConsultCapacity_; + + union CONSULT_OBJ* ConsultBase_; + + union CONSULT_OBJ* ConsultLow_; + + Term GlobalArena_; + UInt GlobalArenaOverflows_; + Int ArenaOverflows_; + Int DepthArenas_; + int ArithError_; + struct pred_entry* LastAssertedPred_; + int DebugOn_; + char* ScannerStack_; + struct scanner_extra_alloc* ScannerExtraBlocks_; + struct DB_TERM* BallTerm_; + UInt ActiveSignals_; + UInt IPredArity_; + yamop* ProfEnd_; + int UncaughtThrow_; + int DoingUndefp_; + Int StartLine_; + scratch_block ScratchPad_; +#ifdef COROUTINING + Term WokenGoals_; + Term AttsMutableList_; +#endif + + Term GcGeneration_; + Term GcPhase_; + UInt GcCurrentPhase_; + UInt GcCalls_; + Int TotGcTime_; + YAP_ULONG_LONG TotGcRecovered_; + Int LastGcTime_; + Int LastSSTime_; + CELL* OpenArray_; + + Int total_marked_; + Int total_oldies_; + struct choicept* current_B_; + CELL* prev_HB_; + CELL* HGEN_; + CELL** iptop_; +#if defined(GC_NO_TAGS) + char* bp_; +#endif + tr_fr_ptr sTR_; + tr_fr_ptr sTR0_; + tr_fr_ptr new_TR_; + struct gc_mark_continuation* cont_top0_; + struct gc_mark_continuation* cont_top_; + int discard_trail_entries_; + gc_ma_hash_entry gc_ma_hash_table_[GC_MAVARS_HASH_SIZE]; + gc_ma_hash_entry* gc_ma_h_top_; + gc_ma_hash_entry* gc_ma_h_list_; + UInt gc_timestamp_; + ADDR db_vec_; + ADDR db_vec0_; + struct RB_red_blk_node* db_root_; + struct RB_red_blk_node* db_nil_; + sigjmp_buf gc_restore_; + CELL* extra_gc_cells_; + CELL* extra_gc_cells_base_; + CELL* extra_gc_cells_top_; + UInt extra_gc_cells_size_; + struct array_entry* DynamicArrays_; + struct static_array_entry* StaticArrays_; + struct global_entry* GlobalVariables_; + int AllowRestart_; + + struct mem_blk* CMemFirstBlock_; + UInt CMemFirstBlockSz_; + + int nperm_; + + Int* LabelFirstArray_; + UInt LabelFirstArraySz_; + + struct PL_local_data* PL_local_data_p_; +#ifdef THREADS + struct thandle ThreadHandle_; +#endif /* THREADS */ +#if defined(YAPOR) || defined(TABLING) + struct local_optyap_data optyap_data_; +#endif /* YAPOR || TABLING */ + int InterruptsDisabled_; + struct open_query_struct* execution_; +#if LOW_LEVEL_TRACER + Int total_choicepoints_; +#endif + int consult_level_; +#if defined(YAPOR) || defined(THREADS) + lockvar SignalLock_; +#endif + + ADDR LocalBase_; + ADDR GlobalBase_; + ADDR TrailBase_; + ADDR TrailTop_; + char* ErrorMessage_; + Term Error_Term_; +#ifdef THREADS + Term Error_TYPE_; +#else + yap_error_number Error_TYPE_; +#endif + UInt Error_Size_; + char ErrorSay_[MAX_ERROR_MSG_SIZE]; + jmp_buf IOBotch_; + TokEntry* tokptr_; + TokEntry* toktide_; + VarEntry* VarTable_; + VarEntry* AnonVarTable_; + Term Comments_; + CELL* CommentsTail_; + CELL* CommentsNextChar_; + wchar_t* CommentsBuff_; + size_t CommentsBuffPos_; + size_t CommentsBuffLim_; + sigjmp_buf RestartEnv_; + char FileNameBuf_[YAP_FILENAME_MAX]; + char FileNameBuf2_[YAP_FILENAME_MAX]; + + Int PrologMode_; + int CritLocks_; + + +#ifdef ANALYST + YAP_ULONG_LONG opcount_[_std_top+1]; + YAP_ULONG_LONG 2opcount[_std_top+1][_std_top+1]_; +#endif /* ANALYST */ + + struct db_globs* s_dbg_; + + yap_error_number matherror_; + + int heap_overflows_; + Int total_heap_overflow_time_; + int stack_overflows_; + Int total_stack_overflow_time_; + int delay_overflows_; + Int total_delay_overflow_time_; + int trail_overflows_; + Int total_trail_overflow_time_; + int atom_table_overflows_; + Int total_atom_table_overflow_time_; + +#ifdef LOAD_DYLD + int dl_errno_; +#endif + +#ifdef LOW_LEVEL_TRACER + int do_trace_primitives_; +#endif + + struct export_atom_hash_entry_struct **ExportAtomHashChain_; + UInt ExportAtomHashTableSize_; + UInt ExportAtomHashTableNum_; + struct export_functor_hash_entry_struct **ExportFunctorHashChain_; + UInt ExportFunctorHashTableSize_; + UInt ExportFunctorHashTableNum_; + struct export_pred_entry_hash_entry_struct **ExportPredEntryHashChain_; + UInt ExportPredEntryHashTableSize_; + UInt ExportPredEntryHashTableNum_; + struct export_dbref_hash_entry_struct **ExportDBRefHashChain_; + UInt ExportDBRefHashTableSize_; + UInt ExportDBRefHashTableNum_; + struct import_atom_hash_entry_struct **ImportAtomHashChain_; + UInt ImportAtomHashTableSize_; + UInt ImportAtomHashTableNum_; + struct import_functor_hash_entry_struct **ImportFunctorHashChain_; + UInt ImportFunctorHashTableSize_; + UInt ImportFunctorHashTableNum_; + struct import_opcode_hash_entry_struct **ImportOPCODEHashChain_; + UInt ImportOPCODEHashTableSize_; + struct import_pred_entry_hash_entry_struct **ImportPredEntryHashChain_; + UInt ImportPredEntryHashTableSize_; + UInt ImportPredEntryHashTableNum_; + struct import_dbref_hash_entry_struct **ImportDBRefHashChain_; + UInt ImportDBRefHashTableSize_; + UInt ImportDBRefHashTableNum_; + yamop *ImportFAILCODE_; + + Int ProfCalls_; + Int ProfGCs_; + Int ProfHGrows_; + Int ProfSGrows_; + Int ProfMallocs_; + Int ProfIndexing_; + Int ProfOn_; + Int ProfOns_; + struct RB_red_blk_node* ProfilerRoot_; + struct RB_red_blk_node* ProfilerNil_; + char* DIRNAME_; +#if LOW_PROF + int ProfilerOn_; + FILE* FProf_; + FILE* FPreds_; +#endif /* LOW_PROF */ +} w_local; diff --git a/H/hstruct.h b/H/hstruct.h index ecaddb7c3..3fe895370 100644 --- a/H/hstruct.h +++ b/H/hstruct.h @@ -283,15 +283,6 @@ void *last_wtime; - int debugger_output_msg; -#if LOW_PROF - int profiler_on; - int offline_profiler; - FILE *f_prof; - FILE *f_preds; - UInt prof_preds; -#endif /* LOW_PROF */ - struct ForeignLoadItem *foreign_code_loaded; ADDR foreign_code_base; ADDR foreign_code_top; diff --git a/H/iglobals.h b/H/iglobals.h index fd86adc02..2d3a64428 100644 --- a/H/iglobals.h +++ b/H/iglobals.h @@ -1,112 +1,101 @@ - - /* This file, iglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/GLOBALS instead */ - - - - - - - - - - - - - - - - - -static void InitGlobal(void) { - - GLOBAL_Initialised = FALSE; - GLOBAL_InitialisedFromPL = FALSE; - GLOBAL_PL_Argc = 0; - GLOBAL_PL_Argv = NULL; - - GLOBAL_HaltHooks = NULL; - - GLOBAL_AllowLocalExpansion = TRUE; - GLOBAL_AllowGlobalExpansion = TRUE; - GLOBAL_AllowTrailExpansion = TRUE; - GLOBAL_SizeOfOverflow = 0; - - GLOBAL_AGcThreshold = 10000; - GLOBAL_AGCHook = NULL; - -#if THREADS - - GLOBAL_NOfThreads = 1; - - GLOBAL_NOfThreadsCreated = 1; - - GLOBAL_ThreadsTotalTime = 0L; - - INIT_LOCK(GLOBAL_ThreadHandlesLock); -#endif -#if defined(YAPOR) || defined(THREADS) - - INIT_LOCK(GLOBAL_BGL); -#endif -#if defined(YAPOR) || defined(TABLING) - -#endif /* YAPOR || TABLING */ - - - -#if defined(THREADS) - -#endif /* THREADS */ - - GLOBAL_stdout = stdout; - GLOBAL_stderr = stderr; - - - - -#ifdef COROUTINING - - -#endif - - - - - GLOBAL_tot_agc_time = 0; - - GLOBAL_tot_agc_recovered = 0; - -#if HAVE_MMAP - GLOBAL_mmap_arrays = NULL; -#endif -#ifdef DEBUG - - - - - -#endif - - - - - - - - - - - GLOBAL_DIRNAME = NULL; -#if defined(COFF) || defined(A_OUT) - - -#endif - GLOBAL_OpaqueHandlersCount = 0; - GLOBAL_OpaqueHandlers = NULL; -#if __simplescalar__ - -#endif - - -} + + /* This file, iglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/GLOBALS instead */ + + + + + + + + + + + + + + + + + +static void InitGlobal(void) { + + GLOBAL_Initialised = FALSE; + GLOBAL_InitialisedFromPL = FALSE; + GLOBAL_PL_Argc = 0; + GLOBAL_PL_Argv = NULL; + + GLOBAL_HaltHooks = NULL; + + GLOBAL_AllowLocalExpansion = TRUE; + GLOBAL_AllowGlobalExpansion = TRUE; + GLOBAL_AllowTrailExpansion = TRUE; + GLOBAL_SizeOfOverflow = 0; + + GLOBAL_AGcThreshold = 10000; + GLOBAL_AGCHook = NULL; + +#if THREADS + + GLOBAL_NOfThreads = 1; + + GLOBAL_NOfThreadsCreated = 1; + + GLOBAL_ThreadsTotalTime = 0L; + + INIT_LOCK(GLOBAL_ThreadHandlesLock); +#endif +#if defined(YAPOR) || defined(THREADS) + + INIT_LOCK(GLOBAL_BGL); +#endif +#if defined(YAPOR) || defined(TABLING) + +#endif /* YAPOR || TABLING */ + + + +#if defined(THREADS) + +#endif /* THREADS */ + + GLOBAL_stdout = stdout; + GLOBAL_stderr = stderr; + + + + +#ifdef COROUTINING + + +#endif + + + + + GLOBAL_tot_agc_time = 0; + + GLOBAL_tot_agc_recovered = 0; + +#if HAVE_MMAP + GLOBAL_mmap_arrays = NULL; +#endif +#ifdef DEBUG + + + + + +#endif +#if defined(COFF) || defined(A_OUT) + + +#endif + GLOBAL_OpaqueHandlersCount = 0; + GLOBAL_OpaqueHandlers = NULL; +#if __simplescalar__ + +#endif + + +} diff --git a/H/ihstruct.h b/H/ihstruct.h index 39eba5e8a..f2073956f 100644 --- a/H/ihstruct.h +++ b/H/ihstruct.h @@ -283,15 +283,6 @@ LastWtimePtr = NULL; - output_msg = 0L; -#if LOW_PROF - ProfilerOn = FALSE; - Yap_OffLineProfiler = FALSE; - FProf = NULL; - FPreds = NULL; - ProfPreds = 0L; -#endif /* LOW_PROF */ - ForeignCodeLoaded = NULL; ForeignCodeBase = NULL; ForeignCodeTop = NULL; diff --git a/H/ilocals.h b/H/ilocals.h index cb0f907cc..6c3ea292e 100644 --- a/H/ilocals.h +++ b/H/ilocals.h @@ -1,226 +1,243 @@ - - /* This file, ilocals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/LOCALS instead */ - - -static void InitWorker(int wid) { - - REMOTE_c_input_stream(wid) = 0; - REMOTE_c_output_stream(wid) = 1; - REMOTE_c_error_stream(wid) = 2; - - REMOTE_OldASP(wid) = NULL; - REMOTE_OldLCL0(wid) = NULL; - REMOTE_OldTR(wid) = NULL; - REMOTE_OldGlobalBase(wid) = NULL; - REMOTE_OldH(wid) = NULL; - REMOTE_OldH0(wid) = NULL; - REMOTE_OldTrailBase(wid) = NULL; - REMOTE_OldTrailTop(wid) = NULL; - REMOTE_OldHeapBase(wid) = NULL; - REMOTE_OldHeapTop(wid) = NULL; - REMOTE_ClDiff(wid) = 0L; - REMOTE_GDiff(wid) = 0L; - REMOTE_HDiff(wid) = 0L; - REMOTE_GDiff0(wid) = 0L; - REMOTE_GSplit(wid) = NULL; - REMOTE_LDiff(wid) = 0L; - REMOTE_TrDiff(wid) = 0L; - REMOTE_XDiff(wid) = 0L; - REMOTE_DelayDiff(wid) = 0L; - REMOTE_BaseDiff(wid) = 0L; - - REMOTE_ReductionsCounter(wid) = 0L; - REMOTE_PredEntriesCounter(wid) = 0L; - REMOTE_RetriesCounter(wid) = 0L; - REMOTE_ReductionsCounterOn(wid) = 0L; - REMOTE_PredEntriesCounterOn(wid) = 0L; - REMOTE_RetriesCounterOn(wid) = 0L; - - - REMOTE_ConsultSp(wid) = NULL; - - - - REMOTE_ConsultBase(wid) = NULL; - - REMOTE_ConsultLow(wid) = NULL; - - REMOTE_GlobalArena(wid) = 0L; - REMOTE_GlobalArenaOverflows(wid) = 0L; - REMOTE_ArenaOverflows(wid) = 0L; - REMOTE_DepthArenas(wid) = 0; - REMOTE_ArithError(wid) = FALSE; - REMOTE_LastAssertedPred(wid) = NULL; - REMOTE_DebugOn(wid) = FALSE; - REMOTE_ScannerStack(wid) = NULL; - REMOTE_ScannerExtraBlocks(wid) = NULL; - REMOTE_BallTerm(wid) = NULL; - REMOTE_ActiveSignals(wid) = 0L; - REMOTE_IPredArity(wid) = 0L; - REMOTE_ProfEnd(wid) = NULL; - REMOTE_UncaughtThrow(wid) = FALSE; - REMOTE_DoingUndefp(wid) = FALSE; - REMOTE_StartLine(wid) = 0L; - InitScratchPad(wid); -#ifdef COROUTINING - REMOTE_WokenGoals(wid) = 0L; - REMOTE_AttsMutableList(wid) = 0L; -#endif - - REMOTE_GcGeneration(wid) = 0L; - REMOTE_GcPhase(wid) = 0L; - REMOTE_GcCurrentPhase(wid) = 0L; - REMOTE_GcCalls(wid) = 0L; - REMOTE_TotGcTime(wid) = 0L; - REMOTE_TotGcRecovered(wid) = 0L; - REMOTE_LastGcTime(wid) = 0L; - REMOTE_LastSSTime(wid) = 0L; - REMOTE_OpenArray(wid) = NULL; - - REMOTE_total_marked(wid) = 0L; - REMOTE_total_oldies(wid) = 0L; - REMOTE_current_B(wid) = NULL; - REMOTE_prev_HB(wid) = NULL; - REMOTE_HGEN(wid) = NULL; - REMOTE_iptop(wid) = NULL; -#if defined(GC_NO_TAGS) - REMOTE_bp(wid) = NULL; -#endif - REMOTE_sTR(wid) = NULL; - REMOTE_sTR0(wid) = NULL; - REMOTE_new_TR(wid) = NULL; - REMOTE_cont_top0(wid) = NULL; - REMOTE_cont_top(wid) = NULL; - REMOTE_discard_trail_entries(wid) = 0; - - REMOTE_gc_ma_h_top(wid) = NULL; - REMOTE_gc_ma_h_list(wid) = NULL; - REMOTE_gc_timestamp(wid) = 0L; - REMOTE_db_vec(wid) = NULL; - REMOTE_db_vec0(wid) = NULL; - REMOTE_db_root(wid) = NULL; - REMOTE_db_nil(wid) = NULL; - - - - - REMOTE_extra_gc_cells_size(wid) = 256; - REMOTE_DynamicArrays(wid) = NULL; - REMOTE_StaticArrays(wid) = NULL; - REMOTE_GlobalVariables(wid) = NULL; - REMOTE_AllowRestart(wid) = FALSE; - - REMOTE_CMemFirstBlock(wid) = NULL; - REMOTE_CMemFirstBlockSz(wid) = 0L; - - REMOTE_nperm(wid) = 0L; - - REMOTE_LabelFirstArray(wid) = NULL; - REMOTE_LabelFirstArraySz(wid) = 0L; - - REMOTE_PL_local_data_p(wid) = Yap_InitThreadIO(wid); -#ifdef THREADS - InitThreadHandle(wid); -#endif /* THREADS */ -#if defined(YAPOR) || defined(TABLING) - Yap_init_local_optyap_data(wid); -#endif /* YAPOR || TABLING */ - REMOTE_InterruptsDisabled(wid) = FALSE; - REMOTE_execution(wid) = NULL; -#if LOW_LEVEL_TRACER - REMOTE_total_choicepoints(wid) = 0; -#endif - REMOTE_consult_level(wid) = 0; -#if defined(YAPOR) || defined(THREADS) - INIT_LOCK(REMOTE_SignalLock(wid)); -#endif - - - - - - - -#ifdef THREADS - -#else - -#endif - - - - - - - - - - - - - - - - - - REMOTE_PrologMode(wid) = BootMode; - REMOTE_CritLocks(wid) = 0; - - -#ifdef ANALYST - - -#endif /* ANALYST */ - - - - REMOTE_matherror(wid) = YAP_NO_ERROR; - - REMOTE_heap_overflows(wid) = 0; - REMOTE_total_heap_overflow_time(wid) = 0; - REMOTE_stack_overflows(wid) = 0; - REMOTE_total_stack_overflow_time(wid) = 0; - REMOTE_delay_overflows(wid) = 0; - REMOTE_total_delay_overflow_time(wid) = 0; - REMOTE_trail_overflows(wid) = 0; - REMOTE_total_trail_overflow_time(wid) = 0; - REMOTE_atom_table_overflows(wid) = 0; - REMOTE_total_atom_table_overflow_time(wid) = 0; - -#ifdef LOAD_DYLD - REMOTE_dl_errno(wid) = 0; -#endif - -#ifdef LOW_LEVEL_TRACER - REMOTE_do_trace_primitives(wid) = TRUE; -#endif - - REMOTE_ExportAtomHashChain(wid) = NULL; - REMOTE_ExportAtomHashTableSize(wid) = 0; - REMOTE_ExportAtomHashTableNum(wid) = 0; - REMOTE_ExportFunctorHashChain(wid) = NULL; - REMOTE_ExportFunctorHashTableSize(wid) = 0; - REMOTE_ExportFunctorHashTableNum(wid) = 0; - REMOTE_ExportPredEntryHashChain(wid) = NULL; - REMOTE_ExportPredEntryHashTableSize(wid) = 0; - REMOTE_ExportPredEntryHashTableNum(wid) = 0; - REMOTE_ExportDBRefHashChain(wid) = NULL; - REMOTE_ExportDBRefHashTableSize(wid) = 0; - REMOTE_ExportDBRefHashTableNum(wid) = 0; - REMOTE_ImportAtomHashChain(wid) = NULL; - REMOTE_ImportAtomHashTableSize(wid) = 0; - REMOTE_ImportAtomHashTableNum(wid) = 0; - REMOTE_ImportFunctorHashChain(wid) = NULL; - REMOTE_ImportFunctorHashTableSize(wid) = 0; - REMOTE_ImportFunctorHashTableNum(wid) = 0; - REMOTE_ImportOPCODEHashChain(wid) = NULL; - REMOTE_ImportOPCODEHashTableSize(wid) = 0; - REMOTE_ImportPredEntryHashChain(wid) = NULL; - REMOTE_ImportPredEntryHashTableSize(wid) = 0; - REMOTE_ImportPredEntryHashTableNum(wid) = 0; - REMOTE_ImportDBRefHashChain(wid) = NULL; - REMOTE_ImportDBRefHashTableSize(wid) = 0; - REMOTE_ImportDBRefHashTableNum(wid) = 0; - REMOTE_ImportFAILCODE(wid) = NULL; -} + + /* This file, ilocals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/LOCALS instead */ + + +static void InitWorker(int wid) { + + REMOTE_c_input_stream(wid) = 0; + REMOTE_c_output_stream(wid) = 1; + REMOTE_c_error_stream(wid) = 2; + + REMOTE_OldASP(wid) = NULL; + REMOTE_OldLCL0(wid) = NULL; + REMOTE_OldTR(wid) = NULL; + REMOTE_OldGlobalBase(wid) = NULL; + REMOTE_OldH(wid) = NULL; + REMOTE_OldH0(wid) = NULL; + REMOTE_OldTrailBase(wid) = NULL; + REMOTE_OldTrailTop(wid) = NULL; + REMOTE_OldHeapBase(wid) = NULL; + REMOTE_OldHeapTop(wid) = NULL; + REMOTE_ClDiff(wid) = 0L; + REMOTE_GDiff(wid) = 0L; + REMOTE_HDiff(wid) = 0L; + REMOTE_GDiff0(wid) = 0L; + REMOTE_GSplit(wid) = NULL; + REMOTE_LDiff(wid) = 0L; + REMOTE_TrDiff(wid) = 0L; + REMOTE_XDiff(wid) = 0L; + REMOTE_DelayDiff(wid) = 0L; + REMOTE_BaseDiff(wid) = 0L; + + REMOTE_ReductionsCounter(wid) = 0L; + REMOTE_PredEntriesCounter(wid) = 0L; + REMOTE_RetriesCounter(wid) = 0L; + REMOTE_ReductionsCounterOn(wid) = 0L; + REMOTE_PredEntriesCounterOn(wid) = 0L; + REMOTE_RetriesCounterOn(wid) = 0L; + + + REMOTE_ConsultSp(wid) = NULL; + + + + REMOTE_ConsultBase(wid) = NULL; + + REMOTE_ConsultLow(wid) = NULL; + + REMOTE_GlobalArena(wid) = 0L; + REMOTE_GlobalArenaOverflows(wid) = 0L; + REMOTE_ArenaOverflows(wid) = 0L; + REMOTE_DepthArenas(wid) = 0; + REMOTE_ArithError(wid) = FALSE; + REMOTE_LastAssertedPred(wid) = NULL; + REMOTE_DebugOn(wid) = FALSE; + REMOTE_ScannerStack(wid) = NULL; + REMOTE_ScannerExtraBlocks(wid) = NULL; + REMOTE_BallTerm(wid) = NULL; + REMOTE_ActiveSignals(wid) = 0L; + REMOTE_IPredArity(wid) = 0L; + REMOTE_ProfEnd(wid) = NULL; + REMOTE_UncaughtThrow(wid) = FALSE; + REMOTE_DoingUndefp(wid) = FALSE; + REMOTE_StartLine(wid) = 0L; + InitScratchPad(wid); +#ifdef COROUTINING + REMOTE_WokenGoals(wid) = 0L; + REMOTE_AttsMutableList(wid) = 0L; +#endif + + REMOTE_GcGeneration(wid) = 0L; + REMOTE_GcPhase(wid) = 0L; + REMOTE_GcCurrentPhase(wid) = 0L; + REMOTE_GcCalls(wid) = 0L; + REMOTE_TotGcTime(wid) = 0L; + REMOTE_TotGcRecovered(wid) = 0L; + REMOTE_LastGcTime(wid) = 0L; + REMOTE_LastSSTime(wid) = 0L; + REMOTE_OpenArray(wid) = NULL; + + REMOTE_total_marked(wid) = 0L; + REMOTE_total_oldies(wid) = 0L; + REMOTE_current_B(wid) = NULL; + REMOTE_prev_HB(wid) = NULL; + REMOTE_HGEN(wid) = NULL; + REMOTE_iptop(wid) = NULL; +#if defined(GC_NO_TAGS) + REMOTE_bp(wid) = NULL; +#endif + REMOTE_sTR(wid) = NULL; + REMOTE_sTR0(wid) = NULL; + REMOTE_new_TR(wid) = NULL; + REMOTE_cont_top0(wid) = NULL; + REMOTE_cont_top(wid) = NULL; + REMOTE_discard_trail_entries(wid) = 0; + + REMOTE_gc_ma_h_top(wid) = NULL; + REMOTE_gc_ma_h_list(wid) = NULL; + REMOTE_gc_timestamp(wid) = 0L; + REMOTE_db_vec(wid) = NULL; + REMOTE_db_vec0(wid) = NULL; + REMOTE_db_root(wid) = NULL; + REMOTE_db_nil(wid) = NULL; + + + + + REMOTE_extra_gc_cells_size(wid) = 256; + REMOTE_DynamicArrays(wid) = NULL; + REMOTE_StaticArrays(wid) = NULL; + REMOTE_GlobalVariables(wid) = NULL; + REMOTE_AllowRestart(wid) = FALSE; + + REMOTE_CMemFirstBlock(wid) = NULL; + REMOTE_CMemFirstBlockSz(wid) = 0L; + + REMOTE_nperm(wid) = 0L; + + REMOTE_LabelFirstArray(wid) = NULL; + REMOTE_LabelFirstArraySz(wid) = 0L; + + REMOTE_PL_local_data_p(wid) = Yap_InitThreadIO(wid); +#ifdef THREADS + InitThreadHandle(wid); +#endif /* THREADS */ +#if defined(YAPOR) || defined(TABLING) + Yap_init_local_optyap_data(wid); +#endif /* YAPOR || TABLING */ + REMOTE_InterruptsDisabled(wid) = FALSE; + REMOTE_execution(wid) = NULL; +#if LOW_LEVEL_TRACER + REMOTE_total_choicepoints(wid) = 0; +#endif + REMOTE_consult_level(wid) = 0; +#if defined(YAPOR) || defined(THREADS) + INIT_LOCK(REMOTE_SignalLock(wid)); +#endif + + + + + + + +#ifdef THREADS + +#else + +#endif + + + + + + + + + + + + + + + + + + REMOTE_PrologMode(wid) = BootMode; + REMOTE_CritLocks(wid) = 0; + + +#ifdef ANALYST + + +#endif /* ANALYST */ + + + + REMOTE_matherror(wid) = YAP_NO_ERROR; + + REMOTE_heap_overflows(wid) = 0; + REMOTE_total_heap_overflow_time(wid) = 0; + REMOTE_stack_overflows(wid) = 0; + REMOTE_total_stack_overflow_time(wid) = 0; + REMOTE_delay_overflows(wid) = 0; + REMOTE_total_delay_overflow_time(wid) = 0; + REMOTE_trail_overflows(wid) = 0; + REMOTE_total_trail_overflow_time(wid) = 0; + REMOTE_atom_table_overflows(wid) = 0; + REMOTE_total_atom_table_overflow_time(wid) = 0; + +#ifdef LOAD_DYLD + REMOTE_dl_errno(wid) = 0; +#endif + +#ifdef LOW_LEVEL_TRACER + REMOTE_do_trace_primitives(wid) = TRUE; +#endif + + REMOTE_ExportAtomHashChain(wid) = NULL; + REMOTE_ExportAtomHashTableSize(wid) = 0; + REMOTE_ExportAtomHashTableNum(wid) = 0; + REMOTE_ExportFunctorHashChain(wid) = NULL; + REMOTE_ExportFunctorHashTableSize(wid) = 0; + REMOTE_ExportFunctorHashTableNum(wid) = 0; + REMOTE_ExportPredEntryHashChain(wid) = NULL; + REMOTE_ExportPredEntryHashTableSize(wid) = 0; + REMOTE_ExportPredEntryHashTableNum(wid) = 0; + REMOTE_ExportDBRefHashChain(wid) = NULL; + REMOTE_ExportDBRefHashTableSize(wid) = 0; + REMOTE_ExportDBRefHashTableNum(wid) = 0; + REMOTE_ImportAtomHashChain(wid) = NULL; + REMOTE_ImportAtomHashTableSize(wid) = 0; + REMOTE_ImportAtomHashTableNum(wid) = 0; + REMOTE_ImportFunctorHashChain(wid) = NULL; + REMOTE_ImportFunctorHashTableSize(wid) = 0; + REMOTE_ImportFunctorHashTableNum(wid) = 0; + REMOTE_ImportOPCODEHashChain(wid) = NULL; + REMOTE_ImportOPCODEHashTableSize(wid) = 0; + REMOTE_ImportPredEntryHashChain(wid) = NULL; + REMOTE_ImportPredEntryHashTableSize(wid) = 0; + REMOTE_ImportPredEntryHashTableNum(wid) = 0; + REMOTE_ImportDBRefHashChain(wid) = NULL; + REMOTE_ImportDBRefHashTableSize(wid) = 0; + REMOTE_ImportDBRefHashTableNum(wid) = 0; + REMOTE_ImportFAILCODE(wid) = NULL; + + + + + + + + + + + + REMOTE_DIRNAME(wid) = NULL; +#if LOW_PROF + REMOTE_ProfilerOn(wid) = FALSE; + REMOTE_FProf(wid) = NULL; + REMOTE_FPreds(wid) = NULL; +#endif /* LOW_PROF */ +} diff --git a/H/rglobals.h b/H/rglobals.h index b8ce84702..2b184d7f8 100644 --- a/H/rglobals.h +++ b/H/rglobals.h @@ -1,112 +1,101 @@ - - /* This file, rglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/GLOBALS instead */ - - - - - - - - - - - - - - - - - -static void RestoreGlobal(void) { - - - - - - - - - - - - - - - - -#if THREADS - - - - - - - - REINIT_LOCK(GLOBAL_ThreadHandlesLock); -#endif -#if defined(YAPOR) || defined(THREADS) - - REINIT_LOCK(GLOBAL_BGL); -#endif -#if defined(YAPOR) || defined(TABLING) - -#endif /* YAPOR || TABLING */ - - - -#if defined(THREADS) - -#endif /* THREADS */ - - - - - - - -#ifdef COROUTINING - - -#endif - - - - - - - - -#if HAVE_MMAP - -#endif -#ifdef DEBUG - - - - - -#endif - - - - - - - - - - - -#if defined(COFF) || defined(A_OUT) - - -#endif - - -#if __simplescalar__ - -#endif - - -} + + /* This file, rglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/GLOBALS instead */ + + + + + + + + + + + + + + + + + +static void RestoreGlobal(void) { + + + + + + + + + + + + + + + + +#if THREADS + + + + + + + + REINIT_LOCK(GLOBAL_ThreadHandlesLock); +#endif +#if defined(YAPOR) || defined(THREADS) + + REINIT_LOCK(GLOBAL_BGL); +#endif +#if defined(YAPOR) || defined(TABLING) + +#endif /* YAPOR || TABLING */ + + + +#if defined(THREADS) + +#endif /* THREADS */ + + + + + + + +#ifdef COROUTINING + + +#endif + + + + + + + + +#if HAVE_MMAP + +#endif +#ifdef DEBUG + + + + + +#endif +#if defined(COFF) || defined(A_OUT) + + +#endif + + +#if __simplescalar__ + +#endif + + +} diff --git a/H/rhstruct.h b/H/rhstruct.h index 66751970d..41725804c 100644 --- a/H/rhstruct.h +++ b/H/rhstruct.h @@ -283,15 +283,6 @@ LastWtimePtr = CodeVoidPAdjust(LastWtimePtr); - -#if LOW_PROF - - - - - -#endif /* LOW_PROF */ - RestoreForeignCode(); diff --git a/H/rlocals.h b/H/rlocals.h index dccb128c8..a27432bda 100644 --- a/H/rlocals.h +++ b/H/rlocals.h @@ -1,226 +1,243 @@ - - /* This file, rlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/LOCALS instead */ - - -static void RestoreWorker(int wid USES_REGS) { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - REMOTE_GlobalArena(wid) = TermToGlobalOrAtomAdjust(REMOTE_GlobalArena(wid)); - - - - - - - - - RestoreBallTerm(wid); - - - - - - - -#ifdef COROUTINING - REMOTE_WokenGoals(wid) = TermToGlobalAdjust(REMOTE_WokenGoals(wid)); - REMOTE_AttsMutableList(wid) = TermToGlobalAdjust(REMOTE_AttsMutableList(wid)); -#endif - - REMOTE_GcGeneration(wid) = TermToGlobalAdjust(REMOTE_GcGeneration(wid)); - REMOTE_GcPhase(wid) = TermToGlobalAdjust(REMOTE_GcPhase(wid)); - - - - - - - - - - - - - - -#if defined(GC_NO_TAGS) - -#endif - - - - - - - - - - - - - - - - - - - - REMOTE_DynamicArrays(wid) = PtoArrayEAdjust(REMOTE_DynamicArrays(wid)); - REMOTE_StaticArrays(wid) = PtoArraySAdjust(REMOTE_StaticArrays(wid)); - REMOTE_GlobalVariables(wid) = PtoGlobalEAdjust(REMOTE_GlobalVariables(wid)); - - - - - - - - - - - -#ifdef THREADS - -#endif /* THREADS */ -#if defined(YAPOR) || defined(TABLING) - -#endif /* YAPOR || TABLING */ - - -#if LOW_LEVEL_TRACER - -#endif - -#if defined(YAPOR) || defined(THREADS) - REINIT_LOCK(REMOTE_SignalLock(wid)); -#endif - - - - - - - -#ifdef THREADS - -#else - -#endif - - - - - - - - - - - - - - - - - - - - - -#ifdef ANALYST - - -#endif /* ANALYST */ - - - - - - - - - - - - - - - - -#ifdef LOAD_DYLD - -#endif - -#ifdef LOW_LEVEL_TRACER - -#endif - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} + + /* This file, rlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/LOCALS instead */ + + +static void RestoreWorker(int wid USES_REGS) { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + REMOTE_GlobalArena(wid) = TermToGlobalOrAtomAdjust(REMOTE_GlobalArena(wid)); + + + + + + + + + RestoreBallTerm(wid); + + + + + + + +#ifdef COROUTINING + REMOTE_WokenGoals(wid) = TermToGlobalAdjust(REMOTE_WokenGoals(wid)); + REMOTE_AttsMutableList(wid) = TermToGlobalAdjust(REMOTE_AttsMutableList(wid)); +#endif + + REMOTE_GcGeneration(wid) = TermToGlobalAdjust(REMOTE_GcGeneration(wid)); + REMOTE_GcPhase(wid) = TermToGlobalAdjust(REMOTE_GcPhase(wid)); + + + + + + + + + + + + + + +#if defined(GC_NO_TAGS) + +#endif + + + + + + + + + + + + + + + + + + + + REMOTE_DynamicArrays(wid) = PtoArrayEAdjust(REMOTE_DynamicArrays(wid)); + REMOTE_StaticArrays(wid) = PtoArraySAdjust(REMOTE_StaticArrays(wid)); + REMOTE_GlobalVariables(wid) = PtoGlobalEAdjust(REMOTE_GlobalVariables(wid)); + + + + + + + + + + + +#ifdef THREADS + +#endif /* THREADS */ +#if defined(YAPOR) || defined(TABLING) + +#endif /* YAPOR || TABLING */ + + +#if LOW_LEVEL_TRACER + +#endif + +#if defined(YAPOR) || defined(THREADS) + REINIT_LOCK(REMOTE_SignalLock(wid)); +#endif + + + + + + + +#ifdef THREADS + +#else + +#endif + + + + + + + + + + + + + + + + + + + + + +#ifdef ANALYST + + +#endif /* ANALYST */ + + + + + + + + + + + + + + + + +#ifdef LOAD_DYLD + +#endif + +#ifdef LOW_LEVEL_TRACER + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#if LOW_PROF + + + +#endif /* LOW_PROF */ +} diff --git a/misc/GLOBALS b/misc/GLOBALS index 0ef92738c..aa69e10e6 100644 --- a/misc/GLOBALS +++ b/misc/GLOBALS @@ -103,18 +103,6 @@ YP_FILE* logfile void //int output_msg =FALSE #endif -//gprof.c -Int ProfCalls void -Int ProfGCs void -Int ProfHGrows void -Int ProfSGrows void -Int ProfMallocs void -Int ProfOn void -Int ProfOns void -struct RB_red_blk_node* ProfilerRoot void -struct RB_red_blk_node* ProfilerNil void -char* DIRNAME =NULL - #if defined(COFF) || defined(A_OUT) // loada_coff.c && load_aout.c char Executable[YAP_FILENAME_MAX] void diff --git a/misc/HEAPFIELDS b/misc/HEAPFIELDS index 24218fff7..cf47a0301 100644 --- a/misc/HEAPFIELDS +++ b/misc/HEAPFIELDS @@ -321,16 +321,6 @@ char *yap_lib_dir Yap_LibDir =NULL CodeCharPAdjust /* time */ void *last_wtime LastWtimePtr =NULL CodeVoidPAdjust -/* profiling */ -int debugger_output_msg output_msg =0L void -#if LOW_PROF -int profiler_on ProfilerOn =FALSE void -int offline_profiler Yap_OffLineProfiler =FALSE void -FILE *f_prof FProf =NULL void -FILE *f_preds FPreds =NULL void -UInt prof_preds ProfPreds =0L void -#endif /* LOW_PROF */ - /* foreign code loaded */ struct ForeignLoadItem *foreign_code_loaded ForeignCodeLoaded =NULL RestoreForeignCode() ADDR foreign_code_base ForeignCodeBase =NULL void diff --git a/misc/LOCALS b/misc/LOCALS index 12c519d8c..534da8de5 100644 --- a/misc/LOCALS +++ b/misc/LOCALS @@ -251,4 +251,22 @@ UInt ImportDBRefHashTableSize =0 UInt ImportDBRefHashTableNum =0 yamop *ImportFAILCODE =NULL +//gprof.c +Int ProfCalls void +Int ProfGCs void +Int ProfHGrows void +Int ProfSGrows void +Int ProfMallocs void +Int ProfIndexing void +Int ProfOn void +Int ProfOns void +struct RB_red_blk_node* ProfilerRoot void +struct RB_red_blk_node* ProfilerNil void +char* DIRNAME =NULL +#if LOW_PROF +int ProfilerOn =FALSE +FILE* FProf =NULL +FILE* FPreds =NULL +#endif /* LOW_PROF */ + END_WORKER_LOCAL diff --git a/pl/profile.yap b/pl/profile.yap index 5121b5619..16811dd65 100644 --- a/pl/profile.yap +++ b/pl/profile.yap @@ -68,9 +68,9 @@ showprofres :- showprofres(-1). showprofres(A) :- - ('$proftype'(offline) -> '$offline_showprofres' ; true), + '$offline_showprofres', ('$profison' -> profoff, Stop = true ; Stop = false), - '$profglobs'(Tot,GCs,HGrows,SGrows,Mallocs,ProfOns), + '$profglobs'(Tot,GCs,HGrows,SGrows,Mallocs,_Indexing,ProfOns), % root node has no useful info. '$get_all_profinfo'(0,[],ProfInfo0,0,_TotCode), msort(ProfInfo0,ProfInfo), @@ -84,6 +84,7 @@ showprofres(A) :- ; format(user_error,'~d ticks, ~d accounted for (~d overhead)~n',[Tot,Accounted,ProfOns]) ), +% format(user_error,' ~d ticks in indexing code~n',[Indexing]), A1 is A+1, '$display_preds'(Preds, Tot, 0, 1, A1), (Stop = true -> profon ; true). @@ -123,10 +124,11 @@ showprofres(A) :- '$display_preds'(_, _, _, N, N) :- !. '$display_preds'([], _, _, _, _). +'$display_preds'([0-_|_], _Tot, _SoFar, _I, N) :- !. '$display_preds'([NSum-P|Ps], Tot, SoFar, I, N) :- Sum is -NSum, Perc is (100*Sum)/Tot, - Next is SoFar+Sum, + Next is SoFar+Sum, NextP is (100*Next)/Tot, ( ( P = M:F/A -> G = M:H