make sure wide property is always the first property.
This commit is contained in:
parent
cd4d55be9b
commit
5f3df98069
11
C/adtdefs.c
11
C/adtdefs.c
@ -69,9 +69,9 @@ InlinedUnlockedMkFunctor(AtomEntry *ae, unsigned int arity)
|
||||
p->NameOfFE = AbsAtom(ae);
|
||||
p->ArityOfFE = arity;
|
||||
p->PropsOfFE = NIL;
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
INIT_RWLOCK(p->FRWLock);
|
||||
ae->PropsOfAE = AbsProp((PropEntry *) p);
|
||||
/* respect the first property, in case this is a wide atom */
|
||||
AddPropToAtom(ae, (PropEntry *)p);
|
||||
return ((Functor) p);
|
||||
}
|
||||
|
||||
@ -104,8 +104,7 @@ Yap_MkFunctorWithAddress(Atom ap, unsigned int arity, FunctorEntry *p)
|
||||
p->KindOfPE = FunctorProperty;
|
||||
p->NameOfFE = ap;
|
||||
p->ArityOfFE = arity;
|
||||
p->NextOfPE = RepAtom(ap)->PropsOfAE;
|
||||
ae->PropsOfAE = AbsProp((PropEntry *) p);
|
||||
AddPropToAtom(ae, (PropEntry *)p);
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
}
|
||||
|
||||
@ -898,7 +897,6 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
||||
p->beamTable = NULL;
|
||||
#endif
|
||||
/* careful that they don't cross MkFunctor */
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
if (PRED_GOAL_EXPANSION_FUNC) {
|
||||
Prop p1 = ae->PropsOfAE;
|
||||
|
||||
@ -914,7 +912,8 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
||||
p1 = pe->NextOfPE;
|
||||
}
|
||||
}
|
||||
ae->PropsOfAE = p0 = AbsPredProp(p);
|
||||
AddPropToAtom(ae, (PropEntry *)p);
|
||||
p0 = AbsPredProp(p);
|
||||
p->FunctorOfPred = (Functor)AbsAtom(ae);
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
#ifdef LOW_PROF
|
||||
|
@ -198,8 +198,7 @@ Yap_InitConstExps(void)
|
||||
p->ArityOfEE = 0;
|
||||
p->ENoOfEE = 0;
|
||||
p->FOfEE = InitConstTab[i].f;
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
ae->PropsOfAE = AbsExpProp(p);
|
||||
AddPropToAtom(ae, (PropEntry *)p);
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
}
|
||||
}
|
||||
|
@ -835,8 +835,7 @@ Yap_InitUnaryExps(void)
|
||||
p->ArityOfEE = 1;
|
||||
p->ENoOfEE = 1;
|
||||
p->FOfEE = InitUnTab[i].f;
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
ae->PropsOfAE = AbsExpProp(p);
|
||||
AddPropToAtom(ae, (PropEntry *)p);
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
}
|
||||
Yap_InitCPred("is", 3, p_unary_is, TestPredFlag | SafePredFlag);
|
||||
|
@ -1217,8 +1217,7 @@ Yap_InitBinaryExps(void)
|
||||
p->ArityOfEE = 2;
|
||||
p->ENoOfEE = 2;
|
||||
p->FOfEE = InitBinTab[i].f;
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
ae->PropsOfAE = AbsExpProp(p);
|
||||
AddPropToAtom(ae, (PropEntry *)p);
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
}
|
||||
Yap_InitCPred("is", 4, p_binary_is, TestPredFlag | SafePredFlag);
|
||||
|
@ -566,9 +566,8 @@ CreateNamedArray(PropEntry * pp, Int dim, AtomEntry *ae USES_REGS)
|
||||
|
||||
p = (ArrayEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
||||
p->KindOfPE = ArrayProperty;
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
AddPropToAtom(ae, (PropEntry *)p);
|
||||
INIT_RWLOCK(p->ArRWLock);
|
||||
ae->PropsOfAE = AbsArrayProp(p);
|
||||
#if THREADS
|
||||
p->owner_id = worker_id;
|
||||
#endif
|
||||
@ -629,15 +628,14 @@ CreateStaticArray(AtomEntry *ae, Int dim, static_array_types type, CODEADDR star
|
||||
}
|
||||
}
|
||||
p->KindOfPE = ArrayProperty;
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
INIT_RWLOCK(p->ArRWLock);
|
||||
AddPropToAtom(ae, (PropEntry *)p);
|
||||
p->NextAE = LOCAL_StaticArrays;
|
||||
LOCAL_StaticArrays = p;
|
||||
}
|
||||
WRITE_LOCK(p->ArRWLock);
|
||||
p->ArrayEArity = -dim;
|
||||
p->ArrayType = type;
|
||||
ae->PropsOfAE = AbsArrayProp((ArrayEntry *)p);
|
||||
if (start_addr == NULL) {
|
||||
int i;
|
||||
|
||||
|
3
C/bb.c
3
C/bb.c
@ -43,8 +43,7 @@ PutBBProp(AtomEntry *ae, Term mod USES_REGS) /* get BBentry for at; */
|
||||
Yap_Error(OUT_OF_HEAP_ERROR,ARG1,"could not allocate space in bb_put/2");
|
||||
return(NULL);
|
||||
}
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
ae->PropsOfAE = AbsBBProp(p);
|
||||
AddPropToAtom(ae, (PropEntry *)p);
|
||||
p->ModuleOfBB = mod;
|
||||
p->Element = 0L;
|
||||
p->KeyOfBB = AbsAtom(ae);
|
||||
|
@ -2896,8 +2896,7 @@ FetchDBPropFromKey(Term twork, int flag, int new, char *error_mssg)
|
||||
p->FunctorOfDB = (Functor) At;
|
||||
else
|
||||
p->FunctorOfDB = Yap_UnlockedMkFunctor(ae,arity);
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
ae->PropsOfAE = AbsDBProp(p);
|
||||
AddPropToAtom(ae, (PropEntry *)p);
|
||||
}
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
return
|
||||
|
@ -858,8 +858,7 @@ GetGlobalEntry(Atom at USES_REGS)
|
||||
new->NextGE = LOCAL_GlobalVariables;
|
||||
LOCAL_GlobalVariables = new;
|
||||
new->AtomOfGE = ae;
|
||||
new->NextOfPE = ae->PropsOfAE;
|
||||
ae->PropsOfAE = AbsGlobalProp(new);
|
||||
AddPropToAtom(ae, (PropEntry *)new);
|
||||
RESET_VARIABLE(&new->global);
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
return new;
|
||||
|
3
C/init.c
3
C/init.c
@ -151,14 +151,13 @@ OpDec(int p, char *type, Atom a, Term m)
|
||||
if (EndOfPAEntr(info)) {
|
||||
info = (OpEntry *) Yap_AllocAtomSpace(sizeof(OpEntry));
|
||||
info->KindOfPE = Ord(OpProperty);
|
||||
info->NextOfPE = RepAtom(a)->PropsOfAE;
|
||||
info->OpModule = m;
|
||||
info->OpName = a;
|
||||
LOCK(OpListLock);
|
||||
info->OpNext = OpList;
|
||||
OpList = info;
|
||||
UNLOCK(OpListLock);
|
||||
RepAtom(a)->PropsOfAE = AbsOpProp(info);
|
||||
AddPropToAtom(ae, (PropEntry *)info);
|
||||
INIT_RWLOCK(info->OpRWLock);
|
||||
WRITE_LOCK(info->OpRWLock);
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
|
@ -72,8 +72,7 @@ GetModuleEntry(Atom at)
|
||||
new->NextME = CurrentModules;
|
||||
CurrentModules = new;
|
||||
new->AtomOfME = ae;
|
||||
new->NextOfPE = ae->PropsOfAE;
|
||||
ae->PropsOfAE = AbsModProp(new);
|
||||
AddPropToAtom(ae, (PropEntry *)new);
|
||||
return new;
|
||||
}
|
||||
|
||||
|
12
H/Yatom.h
12
H/Yatom.h
@ -1608,3 +1608,15 @@ PredPropByAtom (Atom at, Term cur_mod)
|
||||
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
AddPropToAtom(AtomEntry *ae, PropEntry *p)
|
||||
{
|
||||
if (ae->PropsOfAE != NIL) {
|
||||
PropEntry *pp = RepProp(ae->PropsOfAE);
|
||||
p->NextOfPE = pp->NextOfPE;
|
||||
pp->NextOfPE = AbsProp( p);
|
||||
} else {
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
ae->PropsOfAE = AbsProp(p);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user