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