This commit is contained in:
Vitor Santos Costa 2018-06-15 16:44:16 +01:00
parent f0343fc62c
commit 8ab005480f
5 changed files with 28 additions and 34 deletions

View File

@ -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) { static bool do_goal(yamop *CodeAdr, int arity, CELL *pt, bool top USES_REGS) {
choiceptr saved_b = B; choiceptr saved_b = B;
bool out; bool out;
Yap_PrepGoal(arity, pt, saved_b PASS_REGS); Yap_PrepGoal(arity, pt, saved_b PASS_REGS);
CACHE_A1(); CACHE_S();
CACHE_A1();
P = (yamop *)CodeAdr; P = (yamop *)CodeAdr;
// S = CellPtr(RepPredProp( // S = CellPtr(RepPredProp(
// PredPropByFunc(Yap_MkFunctor(AtomCall, 1), 0))); /* A1 mishaps */ // PredPropByFunc(Yap_MkFunctor(AtomCall, 1), 0))); /* A1 mishaps */
out = exec_absmi(top, YAP_EXEC_ABSMI PASS_REGS); out = exec_absmi(top, YAP_EXEC_ABSMI PASS_REGS);
ENDCACHE_S();
// if (out) { // if (out) {
// out = Yap_GetFromSlot(sl); // out = Yap_GetFromSlot(sl);
// } // }

View File

@ -6,6 +6,8 @@
#ifndef _YAPDB_H #ifndef _YAPDB_H
#define _YAPDB_H #define _YAPDB_H
#include <YapInterface.h>
#define YAP_CPP_DB_INTERFACE 1 #define YAP_CPP_DB_INTERFACE 1
@ -70,7 +72,7 @@ class X_API YAPModuleProp : public YAPProp {
public: public:
YAPModuleProp(YAPModule tmod) { m = Yap_GetModuleEntry(tmod.gt()); }; 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); }; virtual YAPModule module() { return YAPModule(m->AtomOfME); };
}; };

View File

@ -24,7 +24,7 @@
#define MaxTemps 512 #define MaxTemps 512
#define MaxArithms 32 #define MaxArithms 32
#ifdef i386 #if defined(i386) && CELLSIZE == 4
#define PUSH_REGS 1 #define PUSH_REGS 1
#undef PUSH_X #undef PUSH_X
#endif #endif
@ -34,7 +34,7 @@
#undef PUSH_X #undef PUSH_X
#endif #endif
#ifdef __x86_64__ #if defined(__x86_64__) && CELLSIZE == 8
#define PUSH_REGS 1 #define PUSH_REGS 1
#undef PUSH_X #undef PUSH_X
#endif #endif

View File

@ -58,7 +58,7 @@
#define USE_PREFETCH 1 #define USE_PREFETCH 1
#endif #endif
#ifdef i386 #if defined(i386) && CELLSIZE == 4
#define Y_IN_MEM 1 #define Y_IN_MEM 1
#define S_IN_MEM 1 #define S_IN_MEM 1
#define TR_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 #define TR_IN_MEM 1
#endif /* sparc_ */ #endif /* sparc_ */
#ifdef __x86_64__ #if defined(__x86_64__) && CELLSIZE == 8
#define SHADOW_P 1 #define SHADOW_P 1
#ifdef BP_FREE #ifdef BP_FREE
#undef 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__ */ #endif /* __x86_64__ */
#if defined(__arm__) || defined(__thumb__) || defined(mips) || \ #if defined(__arm__) || defined(__thumb__) || defined(mips) || \
defined(__mips64) || defined(__aarch64__) defined(__mips64) || defined(__arch64__)
#define Y_IN_MEM 1 #define Y_IN_MEM 1
#define S_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 #define SHADOW_S 1
#endif #endif
#ifdef i386 #if defined(i386) && CELLSIZE == 4
#define Y_IN_MEM 1 #define Y_IN_MEM 1
#define S_IN_MEM 1 #define S_IN_MEM 1
#define TR_IN_MEM 1 #define TR_IN_MEM 1
@ -305,30 +305,6 @@ INLINE_ONLY inline EXTERN void restore_absmi_regs(REGSTORE *old_regs) {
#endif #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 * * TR is usually, but not always, a register. This affects *
* backtracking * * backtracking *
@ -374,11 +350,19 @@ INLINE_ONLY inline EXTERN void restore_absmi_regs(REGSTORE *old_regs) {
#define READ_IN_S() S_SREG = SREG #define READ_IN_S() S_SREG = SREG
#define CACHE_A1() (SREG = (CELL *)ARG1)
#define CACHED_A1() ((CELL)SREG)
#else #else
#define READ_IN_S() S_SREG = *_SREG #define READ_IN_S() S_SREG = *_SREG
#endif #define CACHE_A1() ((*_SREG) = (CELL *)ARG1)
#define CACHED_A1() ((CELL)(*_SREG))
#endif
#else #else
@ -390,6 +374,10 @@ INLINE_ONLY inline EXTERN void restore_absmi_regs(REGSTORE *old_regs) {
#define READ_IN_S() #define READ_IN_S()
#define CACHE_A1()
#define CACHED_A1() (ARG1)
#define S_SREG SREG #define S_SREG SREG
#endif #endif

View File

@ -78,6 +78,9 @@ open_asset(VFS_t *me, const char *fname, const char *io_mode, int sno) {
// strcpy(dir, fname); // strcpy(dir, fname);
// char *d = basename(dir); // char *d = basename(dir);
am = AAssetManager_open(Yap_assetManager(), fname, mode); 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 ); __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s <%s>", fname, io_mode );
// while (dp) { // while (dp) {
// char *f = AAssetDir_getNextFileName(dp); // char *f = AAssetDir_getNextFileName(dp);