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->NameOfFE = AbsAtom(ae);
|
||||||
p->ArityOfFE = arity;
|
p->ArityOfFE = arity;
|
||||||
p->PropsOfFE = NIL;
|
p->PropsOfFE = NIL;
|
||||||
p->NextOfPE = ae->PropsOfAE;
|
|
||||||
INIT_RWLOCK(p->FRWLock);
|
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);
|
return ((Functor) p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,8 +104,7 @@ Yap_MkFunctorWithAddress(Atom ap, unsigned int arity, FunctorEntry *p)
|
|||||||
p->KindOfPE = FunctorProperty;
|
p->KindOfPE = FunctorProperty;
|
||||||
p->NameOfFE = ap;
|
p->NameOfFE = ap;
|
||||||
p->ArityOfFE = arity;
|
p->ArityOfFE = arity;
|
||||||
p->NextOfPE = RepAtom(ap)->PropsOfAE;
|
AddPropToAtom(ae, (PropEntry *)p);
|
||||||
ae->PropsOfAE = AbsProp((PropEntry *) p);
|
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -898,7 +897,6 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
|||||||
p->beamTable = NULL;
|
p->beamTable = NULL;
|
||||||
#endif
|
#endif
|
||||||
/* careful that they don't cross MkFunctor */
|
/* careful that they don't cross MkFunctor */
|
||||||
p->NextOfPE = ae->PropsOfAE;
|
|
||||||
if (PRED_GOAL_EXPANSION_FUNC) {
|
if (PRED_GOAL_EXPANSION_FUNC) {
|
||||||
Prop p1 = ae->PropsOfAE;
|
Prop p1 = ae->PropsOfAE;
|
||||||
|
|
||||||
@ -914,7 +912,8 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
|||||||
p1 = pe->NextOfPE;
|
p1 = pe->NextOfPE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ae->PropsOfAE = p0 = AbsPredProp(p);
|
AddPropToAtom(ae, (PropEntry *)p);
|
||||||
|
p0 = AbsPredProp(p);
|
||||||
p->FunctorOfPred = (Functor)AbsAtom(ae);
|
p->FunctorOfPred = (Functor)AbsAtom(ae);
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
#ifdef LOW_PROF
|
#ifdef LOW_PROF
|
||||||
|
@ -198,8 +198,7 @@ Yap_InitConstExps(void)
|
|||||||
p->ArityOfEE = 0;
|
p->ArityOfEE = 0;
|
||||||
p->ENoOfEE = 0;
|
p->ENoOfEE = 0;
|
||||||
p->FOfEE = InitConstTab[i].f;
|
p->FOfEE = InitConstTab[i].f;
|
||||||
p->NextOfPE = ae->PropsOfAE;
|
AddPropToAtom(ae, (PropEntry *)p);
|
||||||
ae->PropsOfAE = AbsExpProp(p);
|
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -835,8 +835,7 @@ Yap_InitUnaryExps(void)
|
|||||||
p->ArityOfEE = 1;
|
p->ArityOfEE = 1;
|
||||||
p->ENoOfEE = 1;
|
p->ENoOfEE = 1;
|
||||||
p->FOfEE = InitUnTab[i].f;
|
p->FOfEE = InitUnTab[i].f;
|
||||||
p->NextOfPE = ae->PropsOfAE;
|
AddPropToAtom(ae, (PropEntry *)p);
|
||||||
ae->PropsOfAE = AbsExpProp(p);
|
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
}
|
}
|
||||||
Yap_InitCPred("is", 3, p_unary_is, TestPredFlag | SafePredFlag);
|
Yap_InitCPred("is", 3, p_unary_is, TestPredFlag | SafePredFlag);
|
||||||
|
@ -1217,8 +1217,7 @@ Yap_InitBinaryExps(void)
|
|||||||
p->ArityOfEE = 2;
|
p->ArityOfEE = 2;
|
||||||
p->ENoOfEE = 2;
|
p->ENoOfEE = 2;
|
||||||
p->FOfEE = InitBinTab[i].f;
|
p->FOfEE = InitBinTab[i].f;
|
||||||
p->NextOfPE = ae->PropsOfAE;
|
AddPropToAtom(ae, (PropEntry *)p);
|
||||||
ae->PropsOfAE = AbsExpProp(p);
|
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
}
|
}
|
||||||
Yap_InitCPred("is", 4, p_binary_is, TestPredFlag | SafePredFlag);
|
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 = (ArrayEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
||||||
p->KindOfPE = ArrayProperty;
|
p->KindOfPE = ArrayProperty;
|
||||||
p->NextOfPE = ae->PropsOfAE;
|
AddPropToAtom(ae, (PropEntry *)p);
|
||||||
INIT_RWLOCK(p->ArRWLock);
|
INIT_RWLOCK(p->ArRWLock);
|
||||||
ae->PropsOfAE = AbsArrayProp(p);
|
|
||||||
#if THREADS
|
#if THREADS
|
||||||
p->owner_id = worker_id;
|
p->owner_id = worker_id;
|
||||||
#endif
|
#endif
|
||||||
@ -629,15 +628,14 @@ CreateStaticArray(AtomEntry *ae, Int dim, static_array_types type, CODEADDR star
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
p->KindOfPE = ArrayProperty;
|
p->KindOfPE = ArrayProperty;
|
||||||
p->NextOfPE = ae->PropsOfAE;
|
|
||||||
INIT_RWLOCK(p->ArRWLock);
|
INIT_RWLOCK(p->ArRWLock);
|
||||||
|
AddPropToAtom(ae, (PropEntry *)p);
|
||||||
p->NextAE = LOCAL_StaticArrays;
|
p->NextAE = LOCAL_StaticArrays;
|
||||||
LOCAL_StaticArrays = p;
|
LOCAL_StaticArrays = p;
|
||||||
}
|
}
|
||||||
WRITE_LOCK(p->ArRWLock);
|
WRITE_LOCK(p->ArRWLock);
|
||||||
p->ArrayEArity = -dim;
|
p->ArrayEArity = -dim;
|
||||||
p->ArrayType = type;
|
p->ArrayType = type;
|
||||||
ae->PropsOfAE = AbsArrayProp((ArrayEntry *)p);
|
|
||||||
if (start_addr == NULL) {
|
if (start_addr == NULL) {
|
||||||
int i;
|
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");
|
Yap_Error(OUT_OF_HEAP_ERROR,ARG1,"could not allocate space in bb_put/2");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
p->NextOfPE = ae->PropsOfAE;
|
AddPropToAtom(ae, (PropEntry *)p);
|
||||||
ae->PropsOfAE = AbsBBProp(p);
|
|
||||||
p->ModuleOfBB = mod;
|
p->ModuleOfBB = mod;
|
||||||
p->Element = 0L;
|
p->Element = 0L;
|
||||||
p->KeyOfBB = AbsAtom(ae);
|
p->KeyOfBB = AbsAtom(ae);
|
||||||
|
@ -2896,8 +2896,7 @@ FetchDBPropFromKey(Term twork, int flag, int new, char *error_mssg)
|
|||||||
p->FunctorOfDB = (Functor) At;
|
p->FunctorOfDB = (Functor) At;
|
||||||
else
|
else
|
||||||
p->FunctorOfDB = Yap_UnlockedMkFunctor(ae,arity);
|
p->FunctorOfDB = Yap_UnlockedMkFunctor(ae,arity);
|
||||||
p->NextOfPE = ae->PropsOfAE;
|
AddPropToAtom(ae, (PropEntry *)p);
|
||||||
ae->PropsOfAE = AbsDBProp(p);
|
|
||||||
}
|
}
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
return
|
return
|
||||||
|
@ -858,8 +858,7 @@ GetGlobalEntry(Atom at USES_REGS)
|
|||||||
new->NextGE = LOCAL_GlobalVariables;
|
new->NextGE = LOCAL_GlobalVariables;
|
||||||
LOCAL_GlobalVariables = new;
|
LOCAL_GlobalVariables = new;
|
||||||
new->AtomOfGE = ae;
|
new->AtomOfGE = ae;
|
||||||
new->NextOfPE = ae->PropsOfAE;
|
AddPropToAtom(ae, (PropEntry *)new);
|
||||||
ae->PropsOfAE = AbsGlobalProp(new);
|
|
||||||
RESET_VARIABLE(&new->global);
|
RESET_VARIABLE(&new->global);
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
return new;
|
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)) {
|
if (EndOfPAEntr(info)) {
|
||||||
info = (OpEntry *) Yap_AllocAtomSpace(sizeof(OpEntry));
|
info = (OpEntry *) Yap_AllocAtomSpace(sizeof(OpEntry));
|
||||||
info->KindOfPE = Ord(OpProperty);
|
info->KindOfPE = Ord(OpProperty);
|
||||||
info->NextOfPE = RepAtom(a)->PropsOfAE;
|
|
||||||
info->OpModule = m;
|
info->OpModule = m;
|
||||||
info->OpName = a;
|
info->OpName = a;
|
||||||
LOCK(OpListLock);
|
LOCK(OpListLock);
|
||||||
info->OpNext = OpList;
|
info->OpNext = OpList;
|
||||||
OpList = info;
|
OpList = info;
|
||||||
UNLOCK(OpListLock);
|
UNLOCK(OpListLock);
|
||||||
RepAtom(a)->PropsOfAE = AbsOpProp(info);
|
AddPropToAtom(ae, (PropEntry *)info);
|
||||||
INIT_RWLOCK(info->OpRWLock);
|
INIT_RWLOCK(info->OpRWLock);
|
||||||
WRITE_LOCK(info->OpRWLock);
|
WRITE_LOCK(info->OpRWLock);
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
|
@ -72,8 +72,7 @@ GetModuleEntry(Atom at)
|
|||||||
new->NextME = CurrentModules;
|
new->NextME = CurrentModules;
|
||||||
CurrentModules = new;
|
CurrentModules = new;
|
||||||
new->AtomOfME = ae;
|
new->AtomOfME = ae;
|
||||||
new->NextOfPE = ae->PropsOfAE;
|
AddPropToAtom(ae, (PropEntry *)new);
|
||||||
ae->PropsOfAE = AbsModProp(new);
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
H/Yatom.h
12
H/Yatom.h
@ -1608,3 +1608,15 @@ PredPropByAtom (Atom at, Term cur_mod)
|
|||||||
|
|
||||||
#endif
|
#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