diff --git a/H/Regs.h b/H/Regs.h index e5c4208a1..344c8dc2e 100644 --- a/H/Regs.h +++ b/H/Regs.h @@ -92,7 +92,6 @@ INLINE_ONLY inline EXTERN void save_B(void); typedef struct regstore_t { - Int CurSlot_; CELL CreepFlag_; /* 13 */ CELL *HB_; /* 4 heap (global) stack top at latest c.p. */ #if defined(YAPOR_SBA) || defined(TABLING) @@ -634,7 +633,6 @@ INLINE_ONLY EXTERN inline void restore_B(void) { #endif -#define CurSlot Yap_REGS.CurSlot_ #define AuxBase Yap_REGS.AuxBase_ #define AuxSp Yap_REGS.AuxSp_ #define AuxTop Yap_REGS.AuxTop_ diff --git a/H/Yap.h b/H/Yap.h index f315677be..36ead420b 100755 --- a/H/Yap.h +++ b/H/Yap.h @@ -747,81 +747,7 @@ extern struct worker_local Yap_local; #include "YapCompoundTerm.h" - - -/************************************************************************************************* - slots -*************************************************************************************************/ - - -static inline void -Yap_StartSlots( USES_REGS1 ) { - if (CurSlot == LCL0-ASP) - return; - *--ASP = MkIntegerTerm(CurSlot); - *--ASP = MkIntTerm(0); - CurSlot = LCL0-ASP; -} - -/* pop slots when pruning */ -static inline void -Yap_PopSlots( USES_REGS1 ) { - while (LCL0-CurSlot < ASP) { - Int old_slots; - CELL *ptr = LCL0-CurSlot; - old_slots = IntOfTerm(ptr[0]); - ptr += (old_slots+1); - CurSlot = IntOfTerm(*ptr); - } -} - -static inline void -Yap_CloseSlots( USES_REGS1 ) { - Int old_slots; - Yap_PopSlots( PASS_REGS1 ); - if (LCL0-CurSlot == ASP) { - old_slots = IntOfTerm(ASP[0]); - ASP += (old_slots+1); - CurSlot = IntOfTerm(*ASP); - ASP++; - } -} - -static inline Int -Yap_CurrentSlot( USES_REGS1 ) { - return IntOfTerm(ASP[0]); -} - -static inline Term -Yap_GetFromSlot(Int slot USES_REGS) -{ - return(Deref(LCL0[slot])); -} - -static inline Term -Yap_GetDerefedFromSlot(Int slot USES_REGS) -{ - return LCL0[slot];; -} - -static inline Term -Yap_GetPtrFromSlot(Int slot USES_REGS) -{ - return(LCL0[slot]); -} - -static inline Term * -Yap_AddressFromSlot(Int slot USES_REGS) -{ - return(LCL0+slot); -} - -static inline void -Yap_PutInSlot(Int slot, Term t USES_REGS) -{ - LCL0[slot] = t; -} - +#include "YapHandles.h" #endif /* YAP_H */ diff --git a/H/Yapproto.h b/H/Yapproto.h index 3f366fbe0..043dfbf52 100644 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -55,9 +55,6 @@ Term Yap_NWideStringToDiffListOfAtoms(wchar_t *, Term, size_t); int Yap_AtomIncreaseHold(Atom); int Yap_AtomDecreaseHold(Atom); struct operator_entry *Yap_OpPropForModule(Atom, Term); -Int Yap_InitSlot(Term CACHE_TYPE); -Int Yap_NewSlots(int CACHE_TYPE); -int Yap_RecoverSlots(int CACHE_TYPE); #ifdef SFUNC diff --git a/H/cut_c.h b/H/cut_c.h index 752f7b1fc..b1c7b0333 100644 --- a/H/cut_c.h +++ b/H/cut_c.h @@ -39,9 +39,7 @@ struct cut_c_str{ cut_c_str_ptr TOP = Yap_REGS.CUT_C_TOP; \ CPredicate func = (CPredicate)((yamop *)TOP->try_userc_cut_yamop)->u.OtapFs.f; \ PredEntry *pred = (PredEntry *)((yamop *)TOP->try_userc_cut_yamop)->u.OtapFs.p; \ - Yap_StartSlots( PASS_REGS1 ); \ YAP_ExecuteOnCut(pred, func, TOP); \ - Yap_CloseSlots( PASS_REGS1 ); \ cut_c_pop(); diff --git a/H/dhstruct.h b/H/dhstruct.h index 62452cc40..72b9bf919 100644 --- a/H/dhstruct.h +++ b/H/dhstruct.h @@ -71,6 +71,7 @@ #define LOCKPRED_OPCODE Yap_heap_regs->lockpred_op #define ORLAST_OPCODE Yap_heap_regs->orlast_op #define UNDEF_OPCODE Yap_heap_regs->undef_op +#define RETRY_USERC_OPCODE Yap_heap_regs->retry_userc_op #define NOfAtoms Yap_heap_regs->n_of_atoms #define AtomHashTableSize Yap_heap_regs->atom_hash_table_size diff --git a/H/dlocals.h b/H/dlocals.h index 418fe3d62..3162fdc16 100644 --- a/H/dlocals.h +++ b/H/dlocals.h @@ -412,6 +412,9 @@ #define LOCAL_search_atoms LOCAL->search_atoms_ #define REMOTE_search_atoms(wid) REMOTE(wid)->search_atoms_ + +#define LOCAL_CurSlot LOCAL->CurSlot_ +#define REMOTE_CurSlot(wid) REMOTE(wid)->CurSlot_ #define LOCAL_SourceModule LOCAL->SourceModule_ #define REMOTE_SourceModule(wid) REMOTE(wid)->SourceModule_ diff --git a/H/hlocals.h b/H/hlocals.h index 4486c3a07..426c20b44 100644 --- a/H/hlocals.h +++ b/H/hlocals.h @@ -232,5 +232,7 @@ typedef struct worker_local { UInt exo_arg_; struct scan_atoms* search_atoms_; + + Int CurSlot_; Term SourceModule_; } w_local; diff --git a/H/hstruct.h b/H/hstruct.h index d6a085603..be7d29a0b 100755 --- a/H/hstruct.h +++ b/H/hstruct.h @@ -71,6 +71,7 @@ OPCODE lockpred_op; OPCODE orlast_op; OPCODE undef_op; + OPCODE retry_userc_op; UInt n_of_atoms; UInt atom_hash_table_size; @@ -228,7 +229,6 @@ UInt dirty_cps; UInt freed_cps; #endif - UInt expand_clauses_sz; struct udi_info *udi_control_blocks; diff --git a/H/ihstruct.h b/H/ihstruct.h index 04d993f4e..b2d47aa5b 100644 --- a/H/ihstruct.h +++ b/H/ihstruct.h @@ -71,6 +71,7 @@ LOCKPRED_OPCODE = Yap_opcode(_lock_pred); ORLAST_OPCODE = Yap_opcode(_or_last); UNDEF_OPCODE = Yap_opcode(_undef_p); + RETRY_USERC_OPCODE = Yap_opcode(_retry_userc); diff --git a/H/ilocals.h b/H/ilocals.h index bbd21acc0..e02715073 100644 --- a/H/ilocals.h +++ b/H/ilocals.h @@ -232,5 +232,7 @@ static void InitWorker(int wid) { REMOTE_exo_arg(wid) = 0; + + REMOTE_CurSlot(wid) = 0; REMOTE_SourceModule(wid) = 0; } diff --git a/H/pl-yap.h b/H/pl-yap.h index e334cfcf6..14875b3bc 100644 --- a/H/pl-yap.h +++ b/H/pl-yap.h @@ -124,7 +124,7 @@ void PL_license(const char *license, const char *module); #define arityFunctor(f) YAP_PLArityOfSWIFunctor(f) -#define stringAtom(w) YAP_AtomName(YAP_AtomFromSWIAtom(w)) +#define stringAtom(w) (YAP_AtomFromSWIAtom(w)->StrOfAE) #define isInteger(A) (!IsVarTerm(A) && ( IsIntegerTerm((A)) || YAP_IsBigNumTerm((A)) )) #define isString(A) (!IsVarTerm(A) && Yap_IsStringTerm(A) ) #define isAtom(A) (!IsVarTerm(A) && IsAtomTerm((A)) ) diff --git a/H/rhstruct.h b/H/rhstruct.h index 43fe14b91..f6500dac7 100644 --- a/H/rhstruct.h +++ b/H/rhstruct.h @@ -71,6 +71,7 @@ LOCKPRED_OPCODE = Yap_opcode(_lock_pred); ORLAST_OPCODE = Yap_opcode(_or_last); UNDEF_OPCODE = Yap_opcode(_undef_p); + RETRY_USERC_OPCODE = Yap_opcode(_retry_userc); diff --git a/H/rlocals.h b/H/rlocals.h index df9184d10..742dfd5de 100644 --- a/H/rlocals.h +++ b/H/rlocals.h @@ -230,6 +230,8 @@ static void RestoreWorker(int wid USES_REGS) { + + diff --git a/misc/HEAPFIELDS b/misc/HEAPFIELDS index 48f8e9e24..77d8e417c 100644 --- a/misc/HEAPFIELDS +++ b/misc/HEAPFIELDS @@ -70,6 +70,7 @@ OPCODE index_op INDEX_OPCODE MkOp _index_pred OPCODE lockpred_op LOCKPRED_OPCODE MkOp _lock_pred OPCODE orlast_op ORLAST_OPCODE MkOp _or_last OPCODE undef_op UNDEF_OPCODE MkOp _undef_p +OPCODE retry_userc_op RETRY_USERC_OPCODE MkOp _retry_userc /* atom tables */ UInt n_of_atoms NOfAtoms void void diff --git a/misc/LOCALS b/misc/LOCALS index 9172055b8..668f7a5d6 100644 --- a/misc/LOCALS +++ b/misc/LOCALS @@ -265,6 +265,10 @@ UInt exo_arg =0 // atom completion struct scan_atoms* search_atoms void +// Slots +Int CurSlot =0 + + Term SourceModule =0 END_WORKER_LOCAL