malloc and android
This commit is contained in:
parent
d5ce45f09f
commit
a8f101cbcf
@ -38,12 +38,6 @@ UInt SizeOfOverflow =0
|
||||
UInt AGcThreshold =10000
|
||||
Agc_hook AGCHook =NULL
|
||||
|
||||
#if __ANDROID__
|
||||
// no need to perform initialization, it is done before we start the Prolog engine.
|
||||
struct AAssetManager* assetManager =NULL
|
||||
char* AssetsWD =NULL
|
||||
#endif
|
||||
|
||||
/* multi-thread support */
|
||||
#if THREADS
|
||||
/* number of threads and processes in system */
|
||||
@ -173,5 +167,6 @@ struct AliasDescS* FileAliases =Yap_InitStandardAliases()
|
||||
int NOfFileAliases void
|
||||
int SzOfFileAliases void
|
||||
|
||||
struct vfs* VFS =Yap_InitAssetManager()
|
||||
|
||||
END_GLOBAL_DATA
|
||||
|
@ -28,11 +28,11 @@
|
||||
START_HEAP
|
||||
|
||||
/* memory management */
|
||||
UInt Yap_HoleSize void void
|
||||
struct malloc_state *Yap_av void void
|
||||
UInt Yap_HoleSize
|
||||
#if USE_DL_MALLOC
|
||||
struct Yap_MemoryHoles[MAX_DLMALLOC_HOLES] void void
|
||||
UInt Yap_NOfMemoryHoles void void
|
||||
struct malloc_state *Yap_av
|
||||
struct memory_hole Yap_MemoryHoles[MAX_DLMALLOC_HOLES]
|
||||
UInt Yap_NOfMemoryHoles
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar DLMallocLock MkLock
|
||||
#endif
|
||||
|
14
H/LOCALS
14
H/LOCALS
@ -11,6 +11,7 @@ bool sockets_io =false
|
||||
bool within_print_message =false
|
||||
|
||||
//
|
||||
|
||||
// Used by the prompts to check if they are after a newline, and then a
|
||||
// prompt should be output, or if we are in the middle of a line.
|
||||
//
|
||||
@ -215,8 +216,8 @@ wchar_t* CommentsBuff void
|
||||
size_t CommentsBuffPos void
|
||||
size_t CommentsBuffLim void
|
||||
sigjmp_buf RestartEnv void
|
||||
char FileNameBuf[YAP_FILENAME_MAX] void
|
||||
char FileNameBuf2[YAP_FILENAME_MAX] void
|
||||
char FileNameBuf[YAP_FILENAME_MAX+1] void
|
||||
char FileNameBuf2[YAP_FILENAME_MAX+1] void
|
||||
|
||||
// Prolog State
|
||||
UInt BreakLevel =0
|
||||
@ -294,14 +295,6 @@ UInt ImportDBRefHashTableSize =0
|
||||
UInt ImportDBRefHashTableNum =0
|
||||
yamop *ImportFAILCODE =NULL
|
||||
|
||||
|
||||
#if __ANDROID__
|
||||
// current virtual directory.
|
||||
struct AAssetManager* assetManager =GLOBAL_assetManager
|
||||
char* InAssetDir =NULL
|
||||
#endif
|
||||
|
||||
|
||||
// exo indexing
|
||||
|
||||
UInt ibnds[256] void
|
||||
@ -316,6 +309,7 @@ struct pred_entry* SearchPreds void
|
||||
|
||||
// Slots
|
||||
yhandle_t CurSlot =0
|
||||
yhandle_t FrozenHandles =0
|
||||
yhandle_t NSlots =0
|
||||
CELL* SlotBase =InitHandles(wid)
|
||||
|
||||
|
@ -36,11 +36,6 @@
|
||||
|
||||
#define GLOBAL_AGcThreshold Yap_global->AGcThreshold_
|
||||
#define GLOBAL_AGCHook Yap_global->AGCHook_
|
||||
#if __ANDROID__
|
||||
|
||||
#define GLOBAL_assetManager Yap_global->assetManager_
|
||||
#define GLOBAL_AssetsWD Yap_global->AssetsWD_
|
||||
#endif
|
||||
|
||||
#if THREADS
|
||||
|
||||
@ -145,4 +140,5 @@
|
||||
#define GLOBAL_FileAliases Yap_global->FileAliases_
|
||||
#define GLOBAL_NOfFileAliases Yap_global->NOfFileAliases_
|
||||
#define GLOBAL_SzOfFileAliases Yap_global->SzOfFileAliases_
|
||||
#define GLOBAL_VFS Yap_global->VFS_
|
||||
|
||||
|
@ -30,11 +30,7 @@
|
||||
|
||||
|
||||
|
||||
#define Yap_HoleSize Yap_heap_regs->Yap_HoleSize_
|
||||
#define Yap_av Yap_heap_regs->Yap_av_
|
||||
#if USE_DL_MALLOC
|
||||
#define void Yap_heap_regs->void_
|
||||
#define Yap_NOfMemoryHoles Yap_heap_regs->Yap_NOfMemoryHoles_
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define DLMallocLock Yap_heap_regs->DLMallocLock_
|
||||
#endif
|
||||
@ -52,7 +48,7 @@
|
||||
#define HeapLim Yap_heap_regs->HeapLim_
|
||||
#define FreeBlocks Yap_heap_regs->FreeBlocks_
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define FreeBlocksLock Yap_heap_regs->FreeBlocksLock_
|
||||
#define fFreeBlocksLock Yap_heap_regs->FreeBlocksLock_
|
||||
#define HeapUsedLock Yap_heap_regs->HeapUsedLock_
|
||||
#define HeapTopLock Yap_heap_regs->HeapTopLock_
|
||||
#define HeapTopOwner Yap_heap_regs->HeapTopOwner_
|
||||
|
@ -453,13 +453,6 @@
|
||||
#define REMOTE_ImportDBRefHashTableNum(wid) REMOTE(wid)->ImportDBRefHashTableNum_
|
||||
#define LOCAL_ImportFAILCODE LOCAL->ImportFAILCODE_
|
||||
#define REMOTE_ImportFAILCODE(wid) REMOTE(wid)->ImportFAILCODE_
|
||||
#if __ANDROID__
|
||||
|
||||
#define LOCAL_assetManager LOCAL->assetManager_
|
||||
#define REMOTE_assetManager(wid) REMOTE(wid)->assetManager_
|
||||
#define LOCAL_InAssetDir LOCAL->InAssetDir_
|
||||
#define REMOTE_InAssetDir(wid) REMOTE(wid)->InAssetDir_
|
||||
#endif
|
||||
|
||||
#define LOCAL_ibnds LOCAL->ibnds_
|
||||
#define REMOTE_ibnds(wid) REMOTE(wid)->ibnds_
|
||||
@ -479,6 +472,8 @@
|
||||
|
||||
#define LOCAL_CurSlot LOCAL->CurSlot_
|
||||
#define REMOTE_CurSlot(wid) REMOTE(wid)->CurSlot_
|
||||
#define LOCAL_FrozenHandles LOCAL->FrozenHandles_
|
||||
#define REMOTE_FrozenHandles(wid) REMOTE(wid)->FrozenHandles_
|
||||
#define LOCAL_NSlots LOCAL->NSlots_
|
||||
#define REMOTE_NSlots(wid) REMOTE(wid)->NSlots_
|
||||
#define LOCAL_SlotBase LOCAL->SlotBase_
|
||||
|
@ -36,11 +36,6 @@ EXTERNAL UInt GLOBAL_SizeOfOverflow;
|
||||
// amount of space recovered in all garbage collections
|
||||
EXTERNAL UInt GLOBAL_AGcThreshold;
|
||||
EXTERNAL Agc_hook GLOBAL_AGCHook;
|
||||
#if __ANDROID__
|
||||
// no need to perform initialization, it is done before we start the Prolog engine.
|
||||
EXTERNAL struct AAssetManager* GLOBAL_assetManager;
|
||||
EXTERNAL char* GLOBAL_AssetsWD;
|
||||
#endif
|
||||
/* multi-thread support */
|
||||
#if THREADS
|
||||
/* number of threads and processes in system */
|
||||
@ -145,4 +140,5 @@ EXTERNAL int GLOBAL_MaxPriority;
|
||||
EXTERNAL struct AliasDescS* GLOBAL_FileAliases;
|
||||
EXTERNAL int GLOBAL_NOfFileAliases;
|
||||
EXTERNAL int GLOBAL_SzOfFileAliases;
|
||||
EXTERNAL struct vfs* GLOBAL_VFS;
|
||||
|
||||
|
@ -31,9 +31,9 @@
|
||||
|
||||
/* memory management */
|
||||
EXTERNAL UInt Yap_HoleSize;
|
||||
EXTERNAL struct malloc_state *Yap_av;
|
||||
#if USE_DL_MALLOC
|
||||
EXTERNAL struct Yap_MemoryHoles[MAX_DLMALLOC_HOLES] void;
|
||||
EXTERNAL struct malloc_state *Yap_av;
|
||||
EXTERNAL struct memory_hole Yap_MemoryHoles[MAX_DLMALLOC_HOLES];
|
||||
EXTERNAL UInt Yap_NOfMemoryHoles;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
EXTERNAL lockvar DLMallocLock;
|
||||
|
@ -36,11 +36,6 @@ typedef struct global_data {
|
||||
// amount of space recovered in all garbage collections
|
||||
UInt AGcThreshold_;
|
||||
Agc_hook AGCHook_;
|
||||
#if __ANDROID__
|
||||
// no need to perform initialization, it is done before we start the Prolog engine.
|
||||
struct AAssetManager* assetManager_;
|
||||
char* AssetsWD_;
|
||||
#endif
|
||||
/* multi-thread support */
|
||||
#if THREADS
|
||||
/* number of threads and processes in system */
|
||||
@ -145,4 +140,5 @@ const char* RestoreFile_;
|
||||
struct AliasDescS* FileAliases_;
|
||||
int NOfFileAliases_;
|
||||
int SzOfFileAliases_;
|
||||
struct vfs* VFS_;
|
||||
} w_shared;
|
||||
|
@ -255,11 +255,6 @@ const char* Error_Function_;
|
||||
UInt ImportDBRefHashTableSize_;
|
||||
UInt ImportDBRefHashTableNum_;
|
||||
yamop *ImportFAILCODE_;
|
||||
#if __ANDROID__
|
||||
// current virtual directory.
|
||||
struct AAssetManager* assetManager_;
|
||||
char* InAssetDir_;
|
||||
#endif
|
||||
// exo indexing
|
||||
UInt ibnds_[256];
|
||||
struct index_t* exo_it_;
|
||||
@ -271,6 +266,7 @@ const char* Error_Function_;
|
||||
struct pred_entry* SearchPreds_;
|
||||
// Slots
|
||||
yhandle_t CurSlot_;
|
||||
yhandle_t FrozenHandles_;
|
||||
yhandle_t NSlots_;
|
||||
CELL* SlotBase_;
|
||||
// Mutexes
|
||||
|
@ -31,9 +31,9 @@
|
||||
|
||||
/* memory management */
|
||||
UInt Yap_HoleSize_;
|
||||
struct malloc_state *Yap_av_;
|
||||
#if USE_DL_MALLOC
|
||||
struct Yap_MemoryHoles[MAX_DLMALLOC_HOLES] void_;
|
||||
struct malloc_state *Yap_av_;
|
||||
struct memory_hole Yap_MemoryHoles[MAX_DLMALLOC_HOLES]_;
|
||||
UInt Yap_NOfMemoryHoles_;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar DLMallocLock_;
|
||||
|
@ -36,11 +36,6 @@ static void InitGlobal(void) {
|
||||
|
||||
GLOBAL_AGcThreshold = 10000;
|
||||
GLOBAL_AGCHook = NULL;
|
||||
#if __ANDROID__
|
||||
|
||||
GLOBAL_assetManager = NULL;
|
||||
GLOBAL_AssetsWD = NULL;
|
||||
#endif
|
||||
|
||||
#if THREADS
|
||||
|
||||
@ -145,4 +140,5 @@ static void InitGlobal(void) {
|
||||
GLOBAL_FileAliases = Yap_InitStandardAliases();
|
||||
|
||||
|
||||
GLOBAL_VFS = Yap_InitAssetManager();
|
||||
}
|
||||
|
@ -27,14 +27,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if USE_DL_MALLOC
|
||||
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(DLMallocLock);
|
||||
#endif
|
||||
|
@ -255,11 +255,6 @@ static void InitWorker(int wid) {
|
||||
REMOTE_ImportDBRefHashTableSize(wid) = 0;
|
||||
REMOTE_ImportDBRefHashTableNum(wid) = 0;
|
||||
REMOTE_ImportFAILCODE(wid) = NULL;
|
||||
#if __ANDROID__
|
||||
|
||||
REMOTE_assetManager(wid) = GLOBAL_assetManager;
|
||||
REMOTE_InAssetDir(wid) = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
REMOTE_exo_it(wid) = NULL;
|
||||
@ -271,6 +266,7 @@ static void InitWorker(int wid) {
|
||||
|
||||
|
||||
REMOTE_CurSlot(wid) = 0;
|
||||
REMOTE_FrozenHandles(wid) = 0;
|
||||
REMOTE_NSlots(wid) = 0;
|
||||
REMOTE_SlotBase(wid) = InitHandles(wid);
|
||||
|
||||
|
@ -27,14 +27,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if USE_DL_MALLOC
|
||||
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(DLMallocLock);
|
||||
#endif
|
||||
|
@ -255,13 +255,9 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
|
||||
#if __ANDROID__
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user