diff --git a/C/exec.c b/C/exec.c index cb55415f2..de29d74dd 100755 --- a/C/exec.c +++ b/C/exec.c @@ -1576,14 +1576,15 @@ void Yap_PrepGoal(arity_t arity, CELL *pt, choiceptr saved_b USES_REGS) { static bool do_goal(yamop *CodeAdr, int arity, CELL *pt, bool top USES_REGS) { choiceptr saved_b = B; bool out; - Yap_PrepGoal(arity, pt, saved_b PASS_REGS); - CACHE_A1(); + CACHE_S(); + CACHE_A1(); P = (yamop *)CodeAdr; // S = CellPtr(RepPredProp( // PredPropByFunc(Yap_MkFunctor(AtomCall, 1), 0))); /* A1 mishaps */ out = exec_absmi(top, YAP_EXEC_ABSMI PASS_REGS); + ENDCACHE_S(); // if (out) { // out = Yap_GetFromSlot(sl); // } diff --git a/CXX/yapdb.hh b/CXX/yapdb.hh index 3b306045e..2a62aef37 100644 --- a/CXX/yapdb.hh +++ b/CXX/yapdb.hh @@ -6,6 +6,8 @@ #ifndef _YAPDB_H #define _YAPDB_H +#include + #define YAP_CPP_DB_INTERFACE 1 @@ -70,7 +72,7 @@ class X_API YAPModuleProp : public YAPProp { public: YAPModuleProp(YAPModule tmod) { m = Yap_GetModuleEntry(tmod.gt()); }; - YAPModuleProp() { CACHE_REGS m = Yap_GetModuleEntry(Yap_CurrentModule()); }; + YAPModuleProp() { m = Yap_GetModuleEntry(YAP_CurrentModule()); }; virtual YAPModule module() { return YAPModule(m->AtomOfME); }; }; diff --git a/H/Regs.h b/H/Regs.h index 87a4f1357..6f98ca987 100755 --- a/H/Regs.h +++ b/H/Regs.h @@ -24,7 +24,7 @@ #define MaxTemps 512 #define MaxArithms 32 -#ifdef i386 +#if defined(i386) && CELLSIZE == 4 #define PUSH_REGS 1 #undef PUSH_X #endif @@ -34,7 +34,7 @@ #undef PUSH_X #endif -#ifdef __x86_64__ +#if defined(__x86_64__) && CELLSIZE == 8 #define PUSH_REGS 1 #undef PUSH_X #endif diff --git a/H/absmi.h b/H/absmi.h index deb0c78b6..3cf7bb28b 100755 --- a/H/absmi.h +++ b/H/absmi.h @@ -58,7 +58,7 @@ #define USE_PREFETCH 1 #endif -#ifdef i386 +#if defined(i386) && CELLSIZE == 4 #define Y_IN_MEM 1 #define S_IN_MEM 1 #define TR_IN_MEM 1 @@ -86,7 +86,7 @@ register struct yami *P1REG asm("bp"); /* can't use yamop before Yap.h */ #define TR_IN_MEM 1 #endif /* sparc_ */ -#ifdef __x86_64__ +#if defined(__x86_64__) && CELLSIZE == 8 #define SHADOW_P 1 #ifdef BP_FREE #undef BP_FREE @@ -100,7 +100,7 @@ register struct yami *P1REG asm("bp"); /* can't use yamop before Yap.h */ #endif /* __x86_64__ */ #if defined(__arm__) || defined(__thumb__) || defined(mips) || \ - defined(__mips64) || defined(__aarch64__) + defined(__mips64) || defined(__arch64__) #define Y_IN_MEM 1 #define S_IN_MEM 1 @@ -119,7 +119,7 @@ register struct yami *P1REG asm("bp"); /* can't use yamop before Yap.h */ #define SHADOW_S 1 #endif -#ifdef i386 +#if defined(i386) && CELLSIZE == 4 #define Y_IN_MEM 1 #define S_IN_MEM 1 #define TR_IN_MEM 1 @@ -305,30 +305,6 @@ INLINE_ONLY inline EXTERN void restore_absmi_regs(REGSTORE *old_regs) { #endif -#if S_IN_MEM - -#define CACHE_A1() - -#define CACHED_A1() ARG1 - -#else - -#ifndef _NATIVE - -#define CACHE_A1() (SREG = (CELL *)ARG1) - -#define CACHED_A1() ((CELL)SREG) - -#else - -#define CACHE_A1() ((*_SREG) = (CELL *)ARG1) - -#define CACHED_A1() ((CELL)(*_SREG)) - -#endif /* _NATIVE */ - -#endif /* S_IN_MEM */ - /*************************************************************** * TR is usually, but not always, a register. This affects * * backtracking * @@ -374,11 +350,19 @@ INLINE_ONLY inline EXTERN void restore_absmi_regs(REGSTORE *old_regs) { #define READ_IN_S() S_SREG = SREG +#define CACHE_A1() (SREG = (CELL *)ARG1) + +#define CACHED_A1() ((CELL)SREG) + #else #define READ_IN_S() S_SREG = *_SREG -#endif +#define CACHE_A1() ((*_SREG) = (CELL *)ARG1) + +#define CACHED_A1() ((CELL)(*_SREG)) + + #endif #else @@ -390,6 +374,10 @@ INLINE_ONLY inline EXTERN void restore_absmi_regs(REGSTORE *old_regs) { #define READ_IN_S() +#define CACHE_A1() + +#define CACHED_A1() (ARG1) + #define S_SREG SREG #endif diff --git a/os/assets.c b/os/assets.c index 0da26ffa5..4e8d501a0 100644 --- a/os/assets.c +++ b/os/assets.c @@ -78,6 +78,9 @@ open_asset(VFS_t *me, const char *fname, const char *io_mode, int sno) { // strcpy(dir, fname); // char *d = basename(dir); am = AAssetManager_open(Yap_assetManager(), fname, mode); + if (am==NULL) + __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "failed open %s <%s>", fname, strerror(errno) ); + __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s <%s>", fname, io_mode ); // while (dp) { // char *f = AAssetDir_getNextFileName(dp);