more operator stuff.

This commit is contained in:
Vitor Santos Costa 2011-08-17 14:35:29 -07:00
parent 5f3df98069
commit 27299d432f
3 changed files with 11 additions and 8 deletions

View File

@ -1032,10 +1032,9 @@ Yap_PutValue(Atom a, Term v)
WRITE_UNLOCK(ae->ARWLock); WRITE_UNLOCK(ae->ARWLock);
return; return;
} }
p->NextOfPE = RepAtom(a)->PropsOfAE;
RepAtom(a)->PropsOfAE = AbsValProp(p);
p->KindOfPE = ValProperty; p->KindOfPE = ValProperty;
p->ValueOfVE = TermNil; p->ValueOfVE = TermNil;
AddPropToAtom(RepAtom(a), (PropEntry *)p);
/* take care that the lock for the property will be inited even /* take care that the lock for the property will be inited even
if someone else searches for the property */ if someone else searches for the property */
INIT_RWLOCK(p->VRWLock); INIT_RWLOCK(p->VRWLock);

View File

@ -686,9 +686,8 @@ p_softfunctor()
WRITE_LOCK(RepAtom(a)->ARWLock); WRITE_LOCK(RepAtom(a)->ARWLock);
if ((p0 = Yap_GetAProp(a, SFProperty)) == NIL) { if ((p0 = Yap_GetAProp(a, SFProperty)) == NIL) {
pe = (SFEntry *) Yap_AllocAtomSpace(sizeof(*pe)); pe = (SFEntry *) Yap_AllocAtomSpace(sizeof(*pe));
pe->NextOfPE = RepAtom(a)->PropsOfAE;
pe->KindOfPE = SFProperty; pe->KindOfPE = SFProperty;
RepAtom(a)->PropsOfAE = AbsSFProp(pe); AddPropToAtom(RepAtom(a), (PropEntry *)pe);
} else } else
pe = RepSFProp(p0); pe = RepSFProp(p0);
WRITE_UNLOCK(RepAtom(a)->ARWLock); WRITE_UNLOCK(RepAtom(a)->ARWLock);

View File

@ -1606,17 +1606,22 @@ PredPropByAtom (Atom at, Term cur_mod)
#define UNLOCKPE(I,Z) UNLOCK((Z)->PELock) #define UNLOCKPE(I,Z) UNLOCK((Z)->PELock)
#endif #endif
#endif EXTERN inline void STD_PROTO(AddPropToAtom, (AtomEntry *, PropEntry *p));
static inline void EXTERN inline void
AddPropToAtom(AtomEntry *ae, PropEntry *p) AddPropToAtom(AtomEntry *ae, PropEntry *p)
{ {
if (ae->PropsOfAE != NIL) { /* old properties should be always last, and wide atom properties
should always be first */
if (ae->PropsOfAE != NIL &&
RepProp(ae->PropsOfAE)->KindOfPE != HoldProperty) {
PropEntry *pp = RepProp(ae->PropsOfAE); PropEntry *pp = RepProp(ae->PropsOfAE);
p->NextOfPE = pp->NextOfPE; p->NextOfPE = pp->NextOfPE;
pp->NextOfPE = AbsProp( p); pp->NextOfPE = AbsProp(p);
} else { } else {
p->NextOfPE = ae->PropsOfAE; p->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsProp(p); ae->PropsOfAE = AbsProp(p);
} }
} }
#endif