CACHE_REGS
This commit is contained in:
parent
9e50de9efc
commit
cc80efbff0
@ -2145,7 +2145,7 @@ Yap_absmi(int inp)
|
|||||||
|
|
||||||
PELOCK(9,ap);
|
PELOCK(9,ap);
|
||||||
DEC_CLREF_COUNT(cl);
|
DEC_CLREF_COUNT(cl);
|
||||||
fprintf(stderr,"%d %p=%lx\n",worker_id, cl, cl->ClRefCount);
|
// fprintf(stderr,"%d %p=%lx\n",worker_id, cl, cl->ClRefCount);
|
||||||
erase = (cl->ClFlags & ErasedMask) && !(cl->ClRefCount);
|
erase = (cl->ClFlags & ErasedMask) && !(cl->ClRefCount);
|
||||||
if (erase) {
|
if (erase) {
|
||||||
saveregs();
|
saveregs();
|
||||||
|
24
C/qlyr.c
24
C/qlyr.c
@ -69,7 +69,8 @@ ERROR(qlfr_err_t my_err)
|
|||||||
static Atom
|
static Atom
|
||||||
LookupAtom(Atom oat)
|
LookupAtom(Atom oat)
|
||||||
{
|
{
|
||||||
CELL hash = (CELL)(oat) % LOCAL_ImportAtomHashTableSize;
|
CACHE_REGS
|
||||||
|
CELL hash = (CELL)(oat) % LOCAL_ImportAtomHashTableSize;
|
||||||
import_atom_hash_entry_t *a;
|
import_atom_hash_entry_t *a;
|
||||||
|
|
||||||
a = LOCAL_ImportAtomHashChain[hash];
|
a = LOCAL_ImportAtomHashChain[hash];
|
||||||
@ -86,6 +87,7 @@ LookupAtom(Atom oat)
|
|||||||
static void
|
static void
|
||||||
InsertAtom(Atom oat, Atom at)
|
InsertAtom(Atom oat, Atom at)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(oat) % LOCAL_ImportAtomHashTableSize;
|
CELL hash = (CELL)(oat) % LOCAL_ImportAtomHashTableSize;
|
||||||
import_atom_hash_entry_t *a;
|
import_atom_hash_entry_t *a;
|
||||||
|
|
||||||
@ -109,6 +111,7 @@ InsertAtom(Atom oat, Atom at)
|
|||||||
static Functor
|
static Functor
|
||||||
LookupFunctor(Functor ofun)
|
LookupFunctor(Functor ofun)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(ofun) % LOCAL_ImportFunctorHashTableSize;
|
CELL hash = (CELL)(ofun) % LOCAL_ImportFunctorHashTableSize;
|
||||||
import_functor_hash_entry_t *f;
|
import_functor_hash_entry_t *f;
|
||||||
|
|
||||||
@ -126,6 +129,7 @@ LookupFunctor(Functor ofun)
|
|||||||
static void
|
static void
|
||||||
InsertFunctor(Functor ofun, Functor fun)
|
InsertFunctor(Functor ofun, Functor fun)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(ofun) % LOCAL_ImportFunctorHashTableSize;
|
CELL hash = (CELL)(ofun) % LOCAL_ImportFunctorHashTableSize;
|
||||||
import_functor_hash_entry_t *f;
|
import_functor_hash_entry_t *f;
|
||||||
|
|
||||||
@ -149,6 +153,7 @@ InsertFunctor(Functor ofun, Functor fun)
|
|||||||
static PredEntry *
|
static PredEntry *
|
||||||
LookupPredEntry(PredEntry *op)
|
LookupPredEntry(PredEntry *op)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(op) % LOCAL_ImportPredEntryHashTableSize;
|
CELL hash = (CELL)(op) % LOCAL_ImportPredEntryHashTableSize;
|
||||||
import_pred_entry_hash_entry_t *p;
|
import_pred_entry_hash_entry_t *p;
|
||||||
|
|
||||||
@ -166,6 +171,7 @@ LookupPredEntry(PredEntry *op)
|
|||||||
static void
|
static void
|
||||||
InsertPredEntry(PredEntry *op, PredEntry *pe)
|
InsertPredEntry(PredEntry *op, PredEntry *pe)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(op) % LOCAL_ImportPredEntryHashTableSize;
|
CELL hash = (CELL)(op) % LOCAL_ImportPredEntryHashTableSize;
|
||||||
import_pred_entry_hash_entry_t *p;
|
import_pred_entry_hash_entry_t *p;
|
||||||
|
|
||||||
@ -189,6 +195,7 @@ InsertPredEntry(PredEntry *op, PredEntry *pe)
|
|||||||
static OPCODE
|
static OPCODE
|
||||||
LookupOPCODE(OPCODE op)
|
LookupOPCODE(OPCODE op)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(op) % LOCAL_ImportOPCODEHashTableSize;
|
CELL hash = (CELL)(op) % LOCAL_ImportOPCODEHashTableSize;
|
||||||
import_opcode_hash_entry_t *f;
|
import_opcode_hash_entry_t *f;
|
||||||
|
|
||||||
@ -206,6 +213,7 @@ LookupOPCODE(OPCODE op)
|
|||||||
static int
|
static int
|
||||||
OpcodeID(OPCODE op)
|
OpcodeID(OPCODE op)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(op) % LOCAL_ImportOPCODEHashTableSize;
|
CELL hash = (CELL)(op) % LOCAL_ImportOPCODEHashTableSize;
|
||||||
import_opcode_hash_entry_t *f;
|
import_opcode_hash_entry_t *f;
|
||||||
|
|
||||||
@ -223,6 +231,7 @@ OpcodeID(OPCODE op)
|
|||||||
static void
|
static void
|
||||||
InsertOPCODE(OPCODE op0, int i, OPCODE op)
|
InsertOPCODE(OPCODE op0, int i, OPCODE op)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(op0) % LOCAL_ImportOPCODEHashTableSize;
|
CELL hash = (CELL)(op0) % LOCAL_ImportOPCODEHashTableSize;
|
||||||
import_opcode_hash_entry_t *f;
|
import_opcode_hash_entry_t *f;
|
||||||
f = LOCAL_ImportOPCODEHashChain[hash];
|
f = LOCAL_ImportOPCODEHashChain[hash];
|
||||||
@ -246,6 +255,7 @@ InsertOPCODE(OPCODE op0, int i, OPCODE op)
|
|||||||
static DBRef
|
static DBRef
|
||||||
LookupDBRef(DBRef dbr)
|
LookupDBRef(DBRef dbr)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
CELL hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
||||||
import_dbref_hash_entry_t *p;
|
import_dbref_hash_entry_t *p;
|
||||||
|
|
||||||
@ -264,6 +274,7 @@ LookupDBRef(DBRef dbr)
|
|||||||
static LogUpdClause *
|
static LogUpdClause *
|
||||||
LookupMayFailDBRef(DBRef dbr)
|
LookupMayFailDBRef(DBRef dbr)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
CELL hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
||||||
import_dbref_hash_entry_t *p;
|
import_dbref_hash_entry_t *p;
|
||||||
|
|
||||||
@ -281,6 +292,7 @@ LookupMayFailDBRef(DBRef dbr)
|
|||||||
static void
|
static void
|
||||||
InsertDBRef(DBRef dbr0, DBRef dbr)
|
InsertDBRef(DBRef dbr0, DBRef dbr)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(dbr0) % LOCAL_ImportDBRefHashTableSize;
|
CELL hash = (CELL)(dbr0) % LOCAL_ImportDBRefHashTableSize;
|
||||||
import_dbref_hash_entry_t *p;
|
import_dbref_hash_entry_t *p;
|
||||||
|
|
||||||
@ -305,6 +317,7 @@ InsertDBRef(DBRef dbr0, DBRef dbr)
|
|||||||
static void
|
static void
|
||||||
InitHash(void)
|
InitHash(void)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
LOCAL_ImportFunctorHashTableSize = EXPORT_FUNCTOR_TABLE_SIZE;
|
LOCAL_ImportFunctorHashTableSize = EXPORT_FUNCTOR_TABLE_SIZE;
|
||||||
LOCAL_ImportFunctorHashChain = (import_functor_hash_entry_t **)calloc(1, sizeof(import_functor_hash_entry_t *)* LOCAL_ImportFunctorHashTableSize);
|
LOCAL_ImportFunctorHashChain = (import_functor_hash_entry_t **)calloc(1, sizeof(import_functor_hash_entry_t *)* LOCAL_ImportFunctorHashTableSize);
|
||||||
LOCAL_ImportAtomHashTableSize = EXPORT_ATOM_TABLE_SIZE;
|
LOCAL_ImportAtomHashTableSize = EXPORT_ATOM_TABLE_SIZE;
|
||||||
@ -320,6 +333,7 @@ InitHash(void)
|
|||||||
static void
|
static void
|
||||||
CloseHash(void)
|
CloseHash(void)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
UInt i;
|
UInt i;
|
||||||
for (i=0; i < LOCAL_ImportFunctorHashTableSize; i++) {
|
for (i=0; i < LOCAL_ImportFunctorHashTableSize; i++) {
|
||||||
import_functor_hash_entry_t *a = LOCAL_ImportFunctorHashChain[i];
|
import_functor_hash_entry_t *a = LOCAL_ImportFunctorHashChain[i];
|
||||||
@ -667,6 +681,7 @@ read_header(IOSTREAM *stream)
|
|||||||
static void
|
static void
|
||||||
ReadHash(IOSTREAM *stream)
|
ReadHash(IOSTREAM *stream)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
UInt i;
|
UInt i;
|
||||||
RCHECK(read_tag(stream) == QLY_START_X);
|
RCHECK(read_tag(stream) == QLY_START_X);
|
||||||
LOCAL_XDiff = (char *)(&ARG1) - (char *)read_uint(stream);
|
LOCAL_XDiff = (char *)(&ARG1) - (char *)read_uint(stream);
|
||||||
@ -791,6 +806,7 @@ ReadHash(IOSTREAM *stream)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
read_clauses(IOSTREAM *stream, PredEntry *pp, UInt nclauses, UInt flags) {
|
read_clauses(IOSTREAM *stream, PredEntry *pp, UInt nclauses, UInt flags) {
|
||||||
|
CACHE_REGS
|
||||||
if (pp->PredFlags & LogUpdatePredFlag) {
|
if (pp->PredFlags & LogUpdatePredFlag) {
|
||||||
pp->TimeStampOfPred = 0L;
|
pp->TimeStampOfPred = 0L;
|
||||||
/* first, clean up whatever was there */
|
/* first, clean up whatever was there */
|
||||||
@ -821,7 +837,7 @@ read_clauses(IOSTREAM *stream, PredEntry *pp, UInt nclauses, UInt flags) {
|
|||||||
cl->ClFlags &= ~InUseMask;
|
cl->ClFlags &= ~InUseMask;
|
||||||
cl->ClRefCount = nrefs;
|
cl->ClRefCount = nrefs;
|
||||||
LOCAL_HDiff = (char *)cl-base;
|
LOCAL_HDiff = (char *)cl-base;
|
||||||
RestoreLUClause(cl, pp);
|
RestoreLUClause(cl, pp PASS_REGS);
|
||||||
Yap_AssertzClause(pp, cl->ClCode);
|
Yap_AssertzClause(pp, cl->ClCode);
|
||||||
}
|
}
|
||||||
} else if (pp->PredFlags & MegaClausePredFlag) {
|
} else if (pp->PredFlags & MegaClausePredFlag) {
|
||||||
@ -856,7 +872,7 @@ read_clauses(IOSTREAM *stream, PredEntry *pp, UInt nclauses, UInt flags) {
|
|||||||
LOCAL_HDiff = (char *)cl-base;
|
LOCAL_HDiff = (char *)cl-base;
|
||||||
read_bytes(stream, cl, size);
|
read_bytes(stream, cl, size);
|
||||||
INIT_LOCK(cl->ClLock);
|
INIT_LOCK(cl->ClLock);
|
||||||
RestoreDynamicClause(cl, pp);
|
RestoreDynamicClause(cl, pp PASS_REGS);
|
||||||
Yap_AssertzClause(pp, cl->ClCode);
|
Yap_AssertzClause(pp, cl->ClCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -979,7 +995,7 @@ p_read_program( USES_REGS1 )
|
|||||||
read_module(stream);
|
read_module(stream);
|
||||||
Sclose( stream );
|
Sclose( stream );
|
||||||
/* back to the top level we go */
|
/* back to the top level we go */
|
||||||
Yap_CloseSlots();
|
Yap_CloseSlots(PASS_REGS1);
|
||||||
|
|
||||||
siglongjmp(LOCAL_RestartEnv, 3);
|
siglongjmp(LOCAL_RestartEnv, 3);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
8
C/qlyw.c
8
C/qlyw.c
@ -35,6 +35,7 @@ STATIC_PROTO(void CleanCode, (PredEntry * USES_REGS));
|
|||||||
static void
|
static void
|
||||||
LookupAtom(Atom at)
|
LookupAtom(Atom at)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
char *p = RepAtom(at)->StrOfAE;
|
char *p = RepAtom(at)->StrOfAE;
|
||||||
CELL hash = HashFunction((unsigned char *)p) % LOCAL_ExportAtomHashTableSize;
|
CELL hash = HashFunction((unsigned char *)p) % LOCAL_ExportAtomHashTableSize;
|
||||||
export_atom_hash_entry_t *a;
|
export_atom_hash_entry_t *a;
|
||||||
@ -59,6 +60,7 @@ LookupAtom(Atom at)
|
|||||||
static void
|
static void
|
||||||
LookupFunctor(Functor fun)
|
LookupFunctor(Functor fun)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(fun) % LOCAL_ExportFunctorHashTableSize;
|
CELL hash = (CELL)(fun) % LOCAL_ExportFunctorHashTableSize;
|
||||||
export_functor_hash_entry_t *f;
|
export_functor_hash_entry_t *f;
|
||||||
Atom name = NameOfFunctor(fun);
|
Atom name = NameOfFunctor(fun);
|
||||||
@ -87,6 +89,7 @@ LookupFunctor(Functor fun)
|
|||||||
static void
|
static void
|
||||||
LookupPredEntry(PredEntry *pe)
|
LookupPredEntry(PredEntry *pe)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = (CELL)(pe) % LOCAL_ExportPredEntryHashTableSize;
|
CELL hash = (CELL)(pe) % LOCAL_ExportPredEntryHashTableSize;
|
||||||
export_pred_entry_hash_entry_t *p;
|
export_pred_entry_hash_entry_t *p;
|
||||||
UInt arity = pe->ArityOfPE;
|
UInt arity = pe->ArityOfPE;
|
||||||
@ -139,6 +142,7 @@ LookupPredEntry(PredEntry *pe)
|
|||||||
static void
|
static void
|
||||||
LookupDBRef(DBRef ref)
|
LookupDBRef(DBRef ref)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
CELL hash = Unsigned(ref) % LOCAL_ExportDBRefHashTableSize;
|
CELL hash = Unsigned(ref) % LOCAL_ExportDBRefHashTableSize;
|
||||||
export_dbref_hash_entry_t *a;
|
export_dbref_hash_entry_t *a;
|
||||||
|
|
||||||
@ -165,6 +169,7 @@ LookupDBRef(DBRef ref)
|
|||||||
static void
|
static void
|
||||||
InitHash(void)
|
InitHash(void)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
LOCAL_ExportFunctorHashTableNum = 0;
|
LOCAL_ExportFunctorHashTableNum = 0;
|
||||||
LOCAL_ExportFunctorHashTableSize = EXPORT_FUNCTOR_TABLE_SIZE;
|
LOCAL_ExportFunctorHashTableSize = EXPORT_FUNCTOR_TABLE_SIZE;
|
||||||
LOCAL_ExportFunctorHashChain = (export_functor_hash_entry_t **)calloc(1, sizeof(export_functor_hash_entry_t *)* LOCAL_ExportFunctorHashTableSize);
|
LOCAL_ExportFunctorHashChain = (export_functor_hash_entry_t **)calloc(1, sizeof(export_functor_hash_entry_t *)* LOCAL_ExportFunctorHashTableSize);
|
||||||
@ -182,6 +187,7 @@ InitHash(void)
|
|||||||
static void
|
static void
|
||||||
CloseHash(void)
|
CloseHash(void)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
LOCAL_ExportFunctorHashTableNum = 0;
|
LOCAL_ExportFunctorHashTableNum = 0;
|
||||||
LOCAL_ExportFunctorHashTableSize = 0L;
|
LOCAL_ExportFunctorHashTableSize = 0L;
|
||||||
free(LOCAL_ExportFunctorHashChain);
|
free(LOCAL_ExportFunctorHashChain);
|
||||||
@ -391,6 +397,7 @@ static size_t save_tag(IOSTREAM *stream, qlf_tag_t tag)
|
|||||||
static int
|
static int
|
||||||
SaveHash(IOSTREAM *stream)
|
SaveHash(IOSTREAM *stream)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
UInt i;
|
UInt i;
|
||||||
/* first, current opcodes */
|
/* first, current opcodes */
|
||||||
CHECK(save_tag(stream, QLY_START_X));
|
CHECK(save_tag(stream, QLY_START_X));
|
||||||
@ -554,6 +561,7 @@ clean_pred(PredEntry *pp USES_REGS) {
|
|||||||
static size_t
|
static size_t
|
||||||
mark_pred(PredEntry *ap)
|
mark_pred(PredEntry *ap)
|
||||||
{
|
{
|
||||||
|
CACHE_REGS
|
||||||
if (ap->ModuleOfPred != IDB_MODULE) {
|
if (ap->ModuleOfPred != IDB_MODULE) {
|
||||||
if (ap->ArityOfPE) {
|
if (ap->ArityOfPE) {
|
||||||
FuncAdjust(ap->FunctorOfPred);
|
FuncAdjust(ap->FunctorOfPred);
|
||||||
|
Reference in New Issue
Block a user