fix thread compilation.
This commit is contained in:
parent
bc2364c5dc
commit
c08178a57c
@ -490,7 +490,6 @@ Yap_HasOp(Atom a)
|
|||||||
OpEntry *
|
OpEntry *
|
||||||
Yap_OpPropForModule(Atom a, Term mod)
|
Yap_OpPropForModule(Atom a, Term mod)
|
||||||
{ /* look property list of atom a for kind */
|
{ /* look property list of atom a for kind */
|
||||||
CACHE_REGS
|
|
||||||
AtomEntry *ae = RepAtom(a);
|
AtomEntry *ae = RepAtom(a);
|
||||||
PropEntry *pp;
|
PropEntry *pp;
|
||||||
OpEntry *info = NULL;
|
OpEntry *info = NULL;
|
||||||
@ -767,6 +766,7 @@ ExpandPredHash(void)
|
|||||||
Prop
|
Prop
|
||||||
Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
|
Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
||||||
|
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
@ -902,6 +902,7 @@ Yap_NewThreadPred(PredEntry *ap USES_REGS)
|
|||||||
Prop
|
Prop
|
||||||
Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
Prop p0;
|
Prop p0;
|
||||||
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
||||||
|
|
||||||
|
@ -2053,6 +2053,7 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
|
|||||||
yamop *newcp;
|
yamop *newcp;
|
||||||
/* emit a special instruction and then a label for backpatching */
|
/* emit a special instruction and then a label for backpatching */
|
||||||
if (pass_no) {
|
if (pass_no) {
|
||||||
|
CACHE_REGS
|
||||||
UInt size = (UInt)NEXTOP((yamop *)NULL,OtaLl);
|
UInt size = (UInt)NEXTOP((yamop *)NULL,OtaLl);
|
||||||
if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) {
|
if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) {
|
||||||
/* OOOPS, got in trouble, must do a longjmp and recover space */
|
/* OOOPS, got in trouble, must do a longjmp and recover space */
|
||||||
|
@ -2706,7 +2706,6 @@ YAP_InitConsult(int mode, char *filename)
|
|||||||
X_API IOSTREAM *
|
X_API IOSTREAM *
|
||||||
YAP_TermToStream(Term t)
|
YAP_TermToStream(Term t)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
|
||||||
IOSTREAM *s;
|
IOSTREAM *s;
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
|
|
||||||
@ -4122,6 +4121,8 @@ YAP_ImportTerm(char * buf) {
|
|||||||
|
|
||||||
X_API int
|
X_API int
|
||||||
YAP_RequiresExtraStack(size_t sz) {
|
YAP_RequiresExtraStack(size_t sz) {
|
||||||
|
CACHE_REGS
|
||||||
|
|
||||||
if (sz < 16*1024)
|
if (sz < 16*1024)
|
||||||
sz = 16*1024;
|
sz = 16*1024;
|
||||||
if (H <= ASP-sz) {
|
if (H <= ASP-sz) {
|
||||||
|
@ -5107,6 +5107,8 @@ p_continue_static_clause( USES_REGS1 )
|
|||||||
static void
|
static void
|
||||||
add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp)
|
add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
|
|
||||||
char *code_end = (char *)cl + cl->ClSize;
|
char *code_end = (char *)cl + cl->ClSize;
|
||||||
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_LU_INDEX);
|
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_LU_INDEX);
|
||||||
cl = cl->ChildIndex;
|
cl = cl->ChildIndex;
|
||||||
@ -5119,6 +5121,7 @@ add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp)
|
|||||||
static void
|
static void
|
||||||
add_code_in_static_index(StaticIndex *cl, PredEntry *pp)
|
add_code_in_static_index(StaticIndex *cl, PredEntry *pp)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
char *code_end = (char *)cl + cl->ClSize;
|
char *code_end = (char *)cl + cl->ClSize;
|
||||||
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_STATIC_INDEX);
|
Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_STATIC_INDEX);
|
||||||
cl = cl->ChildIndex;
|
cl = cl->ChildIndex;
|
||||||
@ -5131,6 +5134,7 @@ add_code_in_static_index(StaticIndex *cl, PredEntry *pp)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
add_code_in_pred(PredEntry *pp) {
|
add_code_in_pred(PredEntry *pp) {
|
||||||
|
CACHE_REGS
|
||||||
yamop *clcode;
|
yamop *clcode;
|
||||||
|
|
||||||
PELOCK(49,pp);
|
PELOCK(49,pp);
|
||||||
@ -5202,6 +5206,7 @@ add_code_in_pred(PredEntry *pp) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
Yap_dump_code_area_for_profiler(void) {
|
Yap_dump_code_area_for_profiler(void) {
|
||||||
|
CACHE_REGS
|
||||||
ModEntry *me = CurrentModules;
|
ModEntry *me = CurrentModules;
|
||||||
|
|
||||||
while (me) {
|
while (me) {
|
||||||
|
@ -1887,6 +1887,7 @@ Yap_new_ludbe(Term t, PredEntry *pe, UInt nargs)
|
|||||||
static LogUpdClause *
|
static LogUpdClause *
|
||||||
record_lu(PredEntry *pe, Term t, int position)
|
record_lu(PredEntry *pe, Term t, int position)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
LogUpdClause *cl;
|
LogUpdClause *cl;
|
||||||
|
|
||||||
if ((cl = new_lu_db_entry(t, pe)) == NULL) {
|
if ((cl = new_lu_db_entry(t, pe)) == NULL) {
|
||||||
|
27
C/gprof.c
27
C/gprof.c
@ -168,6 +168,7 @@ RBfree(rb_red_blk_node *ptr)
|
|||||||
|
|
||||||
static rb_red_blk_node *
|
static rb_red_blk_node *
|
||||||
RBTreeCreate(void) {
|
RBTreeCreate(void) {
|
||||||
|
CACHE_REGS
|
||||||
rb_red_blk_node* temp;
|
rb_red_blk_node* temp;
|
||||||
|
|
||||||
/* see the comment in the rb_red_blk_tree structure in red_black_tree.h */
|
/* see the comment in the rb_red_blk_tree structure in red_black_tree.h */
|
||||||
@ -210,6 +211,7 @@ RBTreeCreate(void) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
LeftRotate(rb_red_blk_node* x) {
|
LeftRotate(rb_red_blk_node* x) {
|
||||||
|
CACHE_REGS
|
||||||
rb_red_blk_node* y;
|
rb_red_blk_node* y;
|
||||||
rb_red_blk_node* nil=LOCAL_ProfilerNil;
|
rb_red_blk_node* nil=LOCAL_ProfilerNil;
|
||||||
|
|
||||||
@ -266,6 +268,7 @@ LeftRotate(rb_red_blk_node* x) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
RightRotate(rb_red_blk_node* y) {
|
RightRotate(rb_red_blk_node* y) {
|
||||||
|
CACHE_REGS
|
||||||
rb_red_blk_node* x;
|
rb_red_blk_node* x;
|
||||||
rb_red_blk_node* nil=LOCAL_ProfilerNil;
|
rb_red_blk_node* nil=LOCAL_ProfilerNil;
|
||||||
|
|
||||||
@ -318,6 +321,7 @@ RightRotate(rb_red_blk_node* y) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
TreeInsertHelp(rb_red_blk_node* z) {
|
TreeInsertHelp(rb_red_blk_node* z) {
|
||||||
|
CACHE_REGS
|
||||||
/* This function should only be called by InsertRBTree (see above) */
|
/* This function should only be called by InsertRBTree (see above) */
|
||||||
rb_red_blk_node* x;
|
rb_red_blk_node* x;
|
||||||
rb_red_blk_node* y;
|
rb_red_blk_node* y;
|
||||||
@ -369,6 +373,7 @@ TreeInsertHelp(rb_red_blk_node* z) {
|
|||||||
|
|
||||||
static rb_red_blk_node *
|
static rb_red_blk_node *
|
||||||
RBTreeInsert(yamop *key, yamop *lim) {
|
RBTreeInsert(yamop *key, yamop *lim) {
|
||||||
|
CACHE_REGS
|
||||||
rb_red_blk_node * y;
|
rb_red_blk_node * y;
|
||||||
rb_red_blk_node * x;
|
rb_red_blk_node * x;
|
||||||
rb_red_blk_node * newNode;
|
rb_red_blk_node * newNode;
|
||||||
@ -440,6 +445,7 @@ RBTreeInsert(yamop *key, yamop *lim) {
|
|||||||
|
|
||||||
static rb_red_blk_node*
|
static rb_red_blk_node*
|
||||||
RBExactQuery(yamop* q) {
|
RBExactQuery(yamop* q) {
|
||||||
|
CACHE_REGS
|
||||||
rb_red_blk_node* x;
|
rb_red_blk_node* x;
|
||||||
rb_red_blk_node* nil=LOCAL_ProfilerNil;
|
rb_red_blk_node* nil=LOCAL_ProfilerNil;
|
||||||
|
|
||||||
@ -460,6 +466,7 @@ RBExactQuery(yamop* q) {
|
|||||||
|
|
||||||
static rb_red_blk_node*
|
static rb_red_blk_node*
|
||||||
RBLookup(yamop *entry) {
|
RBLookup(yamop *entry) {
|
||||||
|
CACHE_REGS
|
||||||
rb_red_blk_node *current;
|
rb_red_blk_node *current;
|
||||||
|
|
||||||
if (!LOCAL_ProfilerRoot)
|
if (!LOCAL_ProfilerRoot)
|
||||||
@ -495,6 +502,7 @@ RBLookup(yamop *entry) {
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
static void RBDeleteFixUp(rb_red_blk_node* x) {
|
static void RBDeleteFixUp(rb_red_blk_node* x) {
|
||||||
|
CACHE_REGS
|
||||||
rb_red_blk_node* root=LOCAL_ProfilerRoot->left;
|
rb_red_blk_node* root=LOCAL_ProfilerRoot->left;
|
||||||
rb_red_blk_node *w;
|
rb_red_blk_node *w;
|
||||||
|
|
||||||
@ -574,6 +582,7 @@ static void RBDeleteFixUp(rb_red_blk_node* x) {
|
|||||||
|
|
||||||
static rb_red_blk_node*
|
static rb_red_blk_node*
|
||||||
TreeSuccessor(rb_red_blk_node* x) {
|
TreeSuccessor(rb_red_blk_node* x) {
|
||||||
|
CACHE_REGS
|
||||||
rb_red_blk_node* y;
|
rb_red_blk_node* y;
|
||||||
rb_red_blk_node* nil=LOCAL_ProfilerNil;
|
rb_red_blk_node* nil=LOCAL_ProfilerNil;
|
||||||
rb_red_blk_node* root=LOCAL_ProfilerRoot;
|
rb_red_blk_node* root=LOCAL_ProfilerRoot;
|
||||||
@ -612,6 +621,7 @@ TreeSuccessor(rb_red_blk_node* x) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
RBDelete(rb_red_blk_node* z){
|
RBDelete(rb_red_blk_node* z){
|
||||||
|
CACHE_REGS
|
||||||
rb_red_blk_node* y;
|
rb_red_blk_node* y;
|
||||||
rb_red_blk_node* x;
|
rb_red_blk_node* x;
|
||||||
rb_red_blk_node* nil=LOCAL_ProfilerNil;
|
rb_red_blk_node* nil=LOCAL_ProfilerNil;
|
||||||
@ -664,7 +674,8 @@ RBDelete(rb_red_blk_node* z){
|
|||||||
|
|
||||||
char *set_profile_dir(char *);
|
char *set_profile_dir(char *);
|
||||||
char *set_profile_dir(char *name){
|
char *set_profile_dir(char *name){
|
||||||
int size=0;
|
CACHE_REGS
|
||||||
|
int size=0;
|
||||||
|
|
||||||
if (name!=NULL) {
|
if (name!=NULL) {
|
||||||
size=strlen(name)+1;
|
size=strlen(name)+1;
|
||||||
@ -687,8 +698,9 @@ return LOCAL_DIRNAME;
|
|||||||
|
|
||||||
char *profile_names(int);
|
char *profile_names(int);
|
||||||
char *profile_names(int k) {
|
char *profile_names(int k) {
|
||||||
static char *FNAME=NULL;
|
CACHE_REGS
|
||||||
int size=200;
|
static char *FNAME=NULL;
|
||||||
|
int size=200;
|
||||||
|
|
||||||
if (LOCAL_DIRNAME==NULL) set_profile_dir(NULL);
|
if (LOCAL_DIRNAME==NULL) set_profile_dir(NULL);
|
||||||
size=strlen(LOCAL_DIRNAME)+40;
|
size=strlen(LOCAL_DIRNAME)+40;
|
||||||
@ -709,6 +721,7 @@ int size=200;
|
|||||||
|
|
||||||
void del_profile_files(void);
|
void del_profile_files(void);
|
||||||
void del_profile_files() {
|
void del_profile_files() {
|
||||||
|
CACHE_REGS
|
||||||
if (LOCAL_DIRNAME!=NULL) {
|
if (LOCAL_DIRNAME!=NULL) {
|
||||||
remove(profile_names(PROFPREDS_FILE));
|
remove(profile_names(PROFPREDS_FILE));
|
||||||
remove(profile_names(PROFILING_FILE));
|
remove(profile_names(PROFILING_FILE));
|
||||||
@ -717,6 +730,7 @@ void del_profile_files() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
Yap_inform_profiler_of_clause__(void *code_start, void *code_end, PredEntry *pe,gprof_info index_code) {
|
Yap_inform_profiler_of_clause__(void *code_start, void *code_end, PredEntry *pe,gprof_info index_code) {
|
||||||
|
CACHE_REGS
|
||||||
buf_ptr b;
|
buf_ptr b;
|
||||||
buf_extra e;
|
buf_extra e;
|
||||||
LOCAL_ProfOn = TRUE;
|
LOCAL_ProfOn = TRUE;
|
||||||
@ -742,6 +756,7 @@ static Int profend( USES_REGS1 );
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
clean_tree(rb_red_blk_node* node) {
|
clean_tree(rb_red_blk_node* node) {
|
||||||
|
CACHE_REGS
|
||||||
if (node == LOCAL_ProfilerNil)
|
if (node == LOCAL_ProfilerNil)
|
||||||
return;
|
return;
|
||||||
clean_tree(node->left);
|
clean_tree(node->left);
|
||||||
@ -751,6 +766,7 @@ clean_tree(rb_red_blk_node* node) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
reset_tree(void) {
|
reset_tree(void) {
|
||||||
|
CACHE_REGS
|
||||||
clean_tree(LOCAL_ProfilerRoot);
|
clean_tree(LOCAL_ProfilerRoot);
|
||||||
Yap_FreeCodeSpace((char *)LOCAL_ProfilerNil);
|
Yap_FreeCodeSpace((char *)LOCAL_ProfilerNil);
|
||||||
LOCAL_ProfilerNil = LOCAL_ProfilerRoot = NULL;
|
LOCAL_ProfilerNil = LOCAL_ProfilerRoot = NULL;
|
||||||
@ -760,6 +776,7 @@ reset_tree(void) {
|
|||||||
static int
|
static int
|
||||||
InitProfTree(void)
|
InitProfTree(void)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
if (LOCAL_ProfilerRoot)
|
if (LOCAL_ProfilerRoot)
|
||||||
reset_tree();
|
reset_tree();
|
||||||
while (!(LOCAL_ProfilerRoot = RBTreeCreate())) {
|
while (!(LOCAL_ProfilerRoot = RBTreeCreate())) {
|
||||||
@ -773,6 +790,7 @@ InitProfTree(void)
|
|||||||
|
|
||||||
static void RemoveCode(CODEADDR clau)
|
static void RemoveCode(CODEADDR clau)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
rb_red_blk_node* x, *node;
|
rb_red_blk_node* x, *node;
|
||||||
PredEntry *pp;
|
PredEntry *pp;
|
||||||
UInt count;
|
UInt count;
|
||||||
@ -958,6 +976,7 @@ prof_alrm(int signo, siginfo_t *si, void *scv)
|
|||||||
void
|
void
|
||||||
Yap_InformOfRemoval(void *clau)
|
Yap_InformOfRemoval(void *clau)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
LOCAL_ProfOn = TRUE;
|
LOCAL_ProfOn = TRUE;
|
||||||
if (LOCAL_FPreds != NULL) {
|
if (LOCAL_FPreds != NULL) {
|
||||||
/* just store info about what is going on */
|
/* just store info about what is going on */
|
||||||
@ -1048,6 +1067,7 @@ static Int profinit( USES_REGS1 )
|
|||||||
|
|
||||||
static Int start_profilers(int msec)
|
static Int start_profilers(int msec)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
struct itimerval t;
|
struct itimerval t;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
@ -1157,6 +1177,7 @@ static Int profres0( USES_REGS1 ) {
|
|||||||
void
|
void
|
||||||
Yap_InitLowProf(void)
|
Yap_InitLowProf(void)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
#if LOW_PROF
|
#if LOW_PROF
|
||||||
LOCAL_ProfCalls = 0;
|
LOCAL_ProfCalls = 0;
|
||||||
LOCAL_ProfilerOn = FALSE;
|
LOCAL_ProfilerOn = FALSE;
|
||||||
|
@ -1888,6 +1888,7 @@ emit_single_switch_case(ClauseDef *min, struct intermediates *cint, int first, i
|
|||||||
static UInt
|
static UInt
|
||||||
suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermediates *cint)
|
suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermediates *cint)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
UInt tcls = ap->cs.p_code.NOfClauses;
|
UInt tcls = ap->cs.p_code.NOfClauses;
|
||||||
UInt cls = (max-min)+1;
|
UInt cls = (max-min)+1;
|
||||||
|
|
||||||
|
@ -1619,6 +1619,7 @@ InteractSIGINT(int ch) {
|
|||||||
static int
|
static int
|
||||||
ProcessSIGINT(void)
|
ProcessSIGINT(void)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
int ch, out;
|
int ch, out;
|
||||||
|
|
||||||
LOCAL_PrologMode |= AsyncIntMode;
|
LOCAL_PrologMode |= AsyncIntMode;
|
||||||
|
@ -4255,7 +4255,7 @@ p_is_list_or_partial_list( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Term
|
static Term
|
||||||
numbervar(Int id)
|
numbervar(Int id USES_REGS)
|
||||||
{
|
{
|
||||||
Term ts[1];
|
Term ts[1];
|
||||||
ts[0] = MkIntegerTerm(id);
|
ts[0] = MkIntegerTerm(id);
|
||||||
@ -4263,7 +4263,7 @@ numbervar(Int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Term
|
static Term
|
||||||
numbervar_singleton(void)
|
numbervar_singleton(USES_REGS1)
|
||||||
{
|
{
|
||||||
Term ts[1];
|
Term ts[1];
|
||||||
ts[0] = MkIntegerTerm(-1);
|
ts[0] = MkIntegerTerm(-1);
|
||||||
@ -4356,9 +4356,9 @@ static Int numbervars_in_complex_term(register CELL *pt0, register CELL *pt0_end
|
|||||||
derefa_body(d0, ptd0, vars_in_term_unk, vars_in_term_nvar);
|
derefa_body(d0, ptd0, vars_in_term_unk, vars_in_term_nvar);
|
||||||
/* do or pt2 are unbound */
|
/* do or pt2 are unbound */
|
||||||
if (singles)
|
if (singles)
|
||||||
*ptd0 = numbervar_singleton();
|
*ptd0 = numbervar_singleton( PASS_REGS1 );
|
||||||
else
|
else
|
||||||
*ptd0 = numbervar(numbv++);
|
*ptd0 = numbervar(numbv++ PASS_REGS);
|
||||||
/* leave an empty slot to fill in later */
|
/* leave an empty slot to fill in later */
|
||||||
if (H+1024 > ASP) {
|
if (H+1024 > ASP) {
|
||||||
goto global_overflow;
|
goto global_overflow;
|
||||||
@ -4450,10 +4450,10 @@ Yap_NumberVars( Term inp, Int numbv, int handle_singles ) /* numbervariables in
|
|||||||
CELL *ptd0 = VarOfTerm(t);
|
CELL *ptd0 = VarOfTerm(t);
|
||||||
TrailTerm(TR++) = (CELL)ptd0;
|
TrailTerm(TR++) = (CELL)ptd0;
|
||||||
if (handle_singles) {
|
if (handle_singles) {
|
||||||
*ptd0 = numbervar_singleton();
|
*ptd0 = numbervar_singleton( PASS_REGS1 );
|
||||||
return numbv;
|
return numbv;
|
||||||
} else {
|
} else {
|
||||||
*ptd0 = numbervar(numbv);
|
*ptd0 = numbervar(numbv PASS_REGS);
|
||||||
return numbv+1;
|
return numbv+1;
|
||||||
}
|
}
|
||||||
} else if (IsPrimitiveTerm(t)) {
|
} else if (IsPrimitiveTerm(t)) {
|
||||||
|
Reference in New Issue
Block a user