fixes for threads to compile and boot.
This commit is contained in:
parent
0391b3ce25
commit
4b65b063ca
6
C/init.c
6
C/init.c
@ -963,6 +963,9 @@ InitFlags(void)
|
||||
static void
|
||||
InitCodes(void)
|
||||
{
|
||||
/* initialise invisible chain */
|
||||
Yap_heap_regs->invisiblechain.Entry = NIL;
|
||||
INIT_RWLOCK(Yap_heap_regs->invisiblechain.AERWLock);
|
||||
#include "iatoms.h"
|
||||
Yap_heap_regs->term_prolog = MkAtomTerm(AtomProlog);
|
||||
Yap_heap_regs->user_module = MkAtomTerm(AtomUser);
|
||||
@ -1136,9 +1139,6 @@ InitCodes(void)
|
||||
Yap_heap_regs->clausecode->clause = NULL;
|
||||
Yap_heap_regs->clausecode->func = NIL;
|
||||
|
||||
Yap_heap_regs->invisiblechain.Entry = NIL;
|
||||
INIT_RWLOCK(Yap_heap_regs->invisiblechain.AERWLock);
|
||||
|
||||
{
|
||||
Atom at;
|
||||
PredEntry *pred;
|
||||
|
24
H/Heap.h
24
H/Heap.h
@ -14,7 +14,6 @@
|
||||
*************************************************************************/
|
||||
|
||||
/* information that can be stored in Code Space */
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef HEAP_H
|
||||
#define HEAP_H 1
|
||||
@ -814,27 +813,4 @@ Yap_PreAllocCodeSpace(void)
|
||||
return Yap_InitPreAllocCodeSpace();
|
||||
}
|
||||
|
||||
#ifdef ATOMS_H
|
||||
#ifdef THREADS
|
||||
Prop STD_PROTO(Yap_NewThreadPred, (struct pred_entry *));
|
||||
Prop STD_PROTO(Yap_NewPredPropByFunctor, (Functor, Term));
|
||||
|
||||
EXTERN inline PredEntry *
|
||||
Yap_GetThreadPred(struct pred_entry *ap)
|
||||
{
|
||||
Functor f = ap->FunctorOfPred;
|
||||
Term mod = ap->ModuleOfPred;
|
||||
Prop p0 = AbsPredProp(Yap_heap_regs->thread_handle[worker_id].local_preds);
|
||||
|
||||
while(p0) {
|
||||
PredEntry *ap = RepPredProp(p0);
|
||||
if (ap->FunctorOfPred == f &&
|
||||
ap->ModuleOfPred == mod) return ap;
|
||||
p0 = ap->NextOfPE;
|
||||
}
|
||||
return RepPredProp(Yap_NewThreadPred(ap));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* HEAP_H */
|
||||
|
32
H/Yatom.h
32
H/Yatom.h
@ -17,6 +17,9 @@
|
||||
|
||||
/* This code can only be defined *after* including Regs.h!!! */
|
||||
|
||||
#ifndef YATOM_H
|
||||
#define YATOM_H 1
|
||||
|
||||
#ifdef USE_OFFSETS
|
||||
|
||||
inline EXTERN Atom AbsAtom (AtomEntry * p);
|
||||
@ -1369,10 +1372,6 @@ Atom STD_PROTO (Yap_GetOp, (OpEntry *, int *, int));
|
||||
Prop STD_PROTO (Yap_GetAProp, (Atom, PropFlags));
|
||||
Prop STD_PROTO (Yap_GetAPropHavingLock, (AtomEntry *, PropFlags));
|
||||
|
||||
#ifdef THREADS
|
||||
EXTERN inline PredEntry *STD_PROTO (Yap_GetThreadPred, (PredEntry *));
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PROLOG_MODULE = 0,
|
||||
@ -1395,6 +1394,30 @@ PRED_HASH(FunctorEntry *fe, Term cur_mod, UInt size)
|
||||
|
||||
EXTERN inline Prop STD_PROTO(GetPredPropByFuncHavingLock, (FunctorEntry *, Term));
|
||||
|
||||
#ifdef THREADS
|
||||
|
||||
Prop STD_PROTO(Yap_NewThreadPred, (struct pred_entry *));
|
||||
Prop STD_PROTO(Yap_NewPredPropByFunctor, (Functor, Term));
|
||||
EXTERN inline struct pred_entry *STD_PROTO(Yap_GetThreadPred, (struct pred_entry *));
|
||||
|
||||
EXTERN inline struct pred_entry *
|
||||
Yap_GetThreadPred(struct pred_entry *ap)
|
||||
{
|
||||
Functor f = ap->FunctorOfPred;
|
||||
Term mod = ap->ModuleOfPred;
|
||||
Prop p0 = AbsPredProp(Yap_heap_regs->thread_handle[worker_id].local_preds);
|
||||
|
||||
while(p0) {
|
||||
PredEntry *ap = RepPredProp(p0);
|
||||
if (ap->FunctorOfPred == f &&
|
||||
ap->ModuleOfPred == mod) return ap;
|
||||
p0 = ap->NextOfPE;
|
||||
}
|
||||
return RepPredProp(Yap_NewThreadPred(ap));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
EXTERN inline Prop
|
||||
GetPredPropByFuncHavingLock (FunctorEntry *fe, Term cur_mod)
|
||||
{
|
||||
@ -1484,3 +1507,4 @@ PredPropByAtom (Atom at, Term cur_mod)
|
||||
return Yap_NewPredPropByAtom (ae, cur_mod);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
10
H/threads.h
10
H/threads.h
@ -1,3 +1,10 @@
|
||||
|
||||
#ifndef THREADS_H
|
||||
|
||||
#define THREADS_H 1
|
||||
|
||||
#ifdef THREADS
|
||||
|
||||
typedef struct{
|
||||
UInt ssize;
|
||||
UInt tsize;
|
||||
@ -14,3 +21,6 @@ Int STD_PROTO(Yap_thread_attach_engine,(int));
|
||||
Int STD_PROTO(Yap_thread_detach_engine,(int));
|
||||
Int STD_PROTO(Yap_thread_destroy_engine,(int));
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user