small orp fixes.
This commit is contained in:
parent
7da431fe00
commit
44a418bd04
@ -180,7 +180,7 @@ void Yap_init_local(void) {
|
|||||||
LOCAL_top_or_fr = GLOBAL_root_or_fr;
|
LOCAL_top_or_fr = GLOBAL_root_or_fr;
|
||||||
LOCAL_load = 0;
|
LOCAL_load = 0;
|
||||||
LOCAL_share_request = MAX_WORKERS;
|
LOCAL_share_request = MAX_WORKERS;
|
||||||
LOCAL_reply_signal = ready;
|
LOCAL_reply_signal = worker_ready;
|
||||||
#ifdef ENV_COPY
|
#ifdef ENV_COPY
|
||||||
INIT_LOCK(LOCAL_lock_signals);
|
INIT_LOCK(LOCAL_lock_signals);
|
||||||
#endif /* ENV_COPY */
|
#endif /* ENV_COPY */
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
** -------------------------------------- */
|
** -------------------------------------- */
|
||||||
|
|
||||||
#include "Yap.h"
|
#include "Yap.h"
|
||||||
#ifdef YAPOR
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -77,7 +77,6 @@ close_mapfile(void) {
|
|||||||
}
|
}
|
||||||
#endif /* MMAP_MEMORY_MAPPING_SCHEME */
|
#endif /* MMAP_MEMORY_MAPPING_SCHEME */
|
||||||
|
|
||||||
|
|
||||||
void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_workers) {
|
void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_workers) {
|
||||||
void *mmap_addr = (void *)MMAP_ADDR;
|
void *mmap_addr = (void *)MMAP_ADDR;
|
||||||
#ifdef ACOW
|
#ifdef ACOW
|
||||||
@ -275,4 +274,4 @@ void remap_memory(void) {
|
|||||||
}
|
}
|
||||||
#endif /* ENV_COPY */
|
#endif /* ENV_COPY */
|
||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR && !THREADS */
|
||||||
|
@ -129,7 +129,7 @@ struct global_locks {
|
|||||||
lockvar bitmap_pruning_workers;
|
lockvar bitmap_pruning_workers;
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
|
|
||||||
lockvar who_locked_heap;
|
int who_locked_heap;
|
||||||
lockvar heap_access;
|
lockvar heap_access;
|
||||||
lockvar alloc_block;
|
lockvar alloc_block;
|
||||||
#if defined(YAPOR_ERRORS) || defined(TABLING_ERRORS)
|
#if defined(YAPOR_ERRORS) || defined(TABLING_ERRORS)
|
||||||
|
@ -167,7 +167,7 @@ int get_work(void) {
|
|||||||
|
|
||||||
#ifndef TABLING
|
#ifndef TABLING
|
||||||
/* wait for incomplete installations */
|
/* wait for incomplete installations */
|
||||||
while (LOCAL_reply_signal != ready);
|
while (LOCAL_reply_signal != worker_ready);
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
|
||||||
if (or_fr_with_work) {
|
if (or_fr_with_work) {
|
||||||
|
@ -102,7 +102,7 @@ int p_share_work(void) {
|
|||||||
REMOTE_p_fase_signal(worker_q) = P_idle;
|
REMOTE_p_fase_signal(worker_q) = P_idle;
|
||||||
#ifndef TABLING
|
#ifndef TABLING
|
||||||
/* wait for incomplete installations */
|
/* wait for incomplete installations */
|
||||||
while (LOCAL_reply_signal != ready);
|
while (LOCAL_reply_signal != worker_ready);
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
LOCAL_reply_signal = sharing;
|
LOCAL_reply_signal = sharing;
|
||||||
REMOTE_reply_signal(worker_q) = sharing;
|
REMOTE_reply_signal(worker_q) = sharing;
|
||||||
@ -140,8 +140,8 @@ int q_share_work(int worker_p) {
|
|||||||
OPTYAP_ERROR_MESSAGE("YOUNGER_CP(B_FZ, LOCAL_top_cp) (q_share_work)");
|
OPTYAP_ERROR_MESSAGE("YOUNGER_CP(B_FZ, LOCAL_top_cp) (q_share_work)");
|
||||||
#endif /* OPTYAP_ERRORS */
|
#endif /* OPTYAP_ERRORS */
|
||||||
#ifdef YAPOR_ERRORS
|
#ifdef YAPOR_ERRORS
|
||||||
if (LOCAL_reply_signal != ready)
|
if (LOCAL_reply_signal != worker_ready)
|
||||||
YAPOR_ERROR_MESSAGE("LOCAL_reply_signal != ready (q_share_work)");
|
YAPOR_ERROR_MESSAGE("LOCAL_reply_signal != worker_ready (q_share_work)");
|
||||||
#endif /* YAPOR_ERRORS */
|
#endif /* YAPOR_ERRORS */
|
||||||
|
|
||||||
/* make sharing request */
|
/* make sharing request */
|
||||||
@ -156,10 +156,10 @@ int q_share_work(int worker_p) {
|
|||||||
UNLOCK_WORKER(worker_p);
|
UNLOCK_WORKER(worker_p);
|
||||||
|
|
||||||
/* wait for an answer */
|
/* wait for an answer */
|
||||||
while (LOCAL_reply_signal == ready);
|
while (LOCAL_reply_signal == worker_ready);
|
||||||
if (LOCAL_reply_signal == no_sharing) {
|
if (LOCAL_reply_signal == no_sharing) {
|
||||||
/* sharing request refused */
|
/* sharing request refused */
|
||||||
LOCAL_reply_signal = ready;
|
LOCAL_reply_signal = worker_ready;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
while (LOCAL_reply_signal == sharing);
|
while (LOCAL_reply_signal == sharing);
|
||||||
@ -168,9 +168,9 @@ int q_share_work(int worker_p) {
|
|||||||
|
|
||||||
/* update registers and return */
|
/* update registers and return */
|
||||||
#ifndef TABLING
|
#ifndef TABLING
|
||||||
REMOTE_reply_signal(worker_p) = ready;
|
REMOTE_reply_signal(worker_p) = worker_ready;
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
LOCAL_reply_signal = ready;
|
LOCAL_reply_signal = worker_ready;
|
||||||
PUT_IN_REQUESTABLE(worker_id);
|
PUT_IN_REQUESTABLE(worker_id);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,24 @@
|
|||||||
#define TRY_LOCK(LOCK_PTR) pthread_mutex_trylock(&(LOCK_VAR))
|
#define TRY_LOCK(LOCK_PTR) pthread_mutex_trylock(&(LOCK_VAR))
|
||||||
#define LOCK(LOCK_VAR) pthread_mutex_lock(&(LOCK_VAR))
|
#define LOCK(LOCK_VAR) pthread_mutex_lock(&(LOCK_VAR))
|
||||||
#define UNLOCK(LOCK_VAR) pthread_mutex_unlock(&(LOCK_VAR))
|
#define UNLOCK(LOCK_VAR) pthread_mutex_unlock(&(LOCK_VAR))
|
||||||
|
static inline int
|
||||||
|
xIS_LOCKED(pthread_mutex_t *LOCK_VAR) {
|
||||||
|
if (pthread_mutex_trylock(LOCK_VAR) == 0) {
|
||||||
|
pthread_mutex_unlock(LOCK_VAR);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
static inline int
|
||||||
|
xIS_UNLOCKED(pthread_mutex_t *LOCK_VAR) {
|
||||||
|
if (pthread_mutex_trylock(LOCK_VAR) == 0) {
|
||||||
|
pthread_mutex_unlock(LOCK_VAR);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#define IS_LOCKED(LOCK_VAR) xIS_LOCKED(&(LOCK_VAR))
|
||||||
|
#define IS_UNLOCKED(LOCK_VAR) xIS_UNLOCKED(&(LOCK_VAR))
|
||||||
|
|
||||||
#define INIT_RWLOCK(X) pthread_rwlock_init(&(X), NULL)
|
#define INIT_RWLOCK(X) pthread_rwlock_init(&(X), NULL)
|
||||||
#define DESTROY_RWLOCK(X) pthread_rwlock_destroy(&(X))
|
#define DESTROY_RWLOCK(X) pthread_rwlock_destroy(&(X))
|
||||||
|
Reference in New Issue
Block a user