Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Stuff

  • Loading branch information...
commit eb7bb8c48948b17361c0141057859834b0a77623 1 parent 0e626c0
Luca Saiu authored
BIN  boot/ocamlrun
View
Binary file not shown
14 byterun/context.c
View
@@ -282,9 +282,9 @@ section. */
/* ctx->caml_pending_signals */
ctx->caml_async_signal_mode = 0;
- ctx->caml_enter_blocking_section_hook = &caml_enter_blocking_section_default;
- ctx->caml_leave_blocking_section_hook = &caml_leave_blocking_section_default;
- ctx->caml_try_leave_blocking_section_hook = &caml_try_leave_blocking_section_default;
+ /* ctx->caml_enter_blocking_section_hook = &caml_enter_blocking_section_default; */
+ /* ctx->caml_leave_blocking_section_hook = &caml_leave_blocking_section_default; */
+ /* ctx->caml_try_leave_blocking_section_hook = &caml_try_leave_blocking_section_default; */
ctx->caml_force_major_slice = 0;
ctx->caml_signal_handlers = 0;
@@ -575,6 +575,10 @@ void caml_leave_lock_section_r(CAML_R)
caml_leave_blocking_section_r(ctx);
}
+void (*caml_enter_blocking_section_hook)(void);
+void (*caml_leave_blocking_section_hook)(void);
+int (*caml_try_leave_blocking_section_hook)(void);
+
/* the first other context (at pos 0) is always NULL, so that we are sure the first
line of caml_get_library_context_r is ok to execute. */
static int nbr_other_contexts = 0; // FIXME: I've never touched this, nor library contexts. Ask Fabrice
@@ -777,6 +781,10 @@ void caml_context_initialize_global_stuff(void){
}
already_initialized = 1;
+ caml_enter_blocking_section_hook = &caml_enter_blocking_section_default;
+ caml_leave_blocking_section_hook = &caml_leave_blocking_section_default;
+ caml_try_leave_blocking_section_hook = &caml_try_leave_blocking_section_default;
+
/* Create the global lock: */
caml_initialize_mutex(&caml_global_mutex);
}
13 byterun/context.h
View
@@ -408,9 +408,6 @@ struct caml_global_context {
#endif /* #ifndef NSIG */
intnat caml_pending_signals[NSIG];
intnat caml_async_signal_mode; /* = 0; */
- void (*caml_enter_blocking_section_hook)(void);
- void (*caml_leave_blocking_section_hook)(void);
- int (*caml_try_leave_blocking_section_hook)(void);
int caml_force_major_slice; /* = 0; */
value caml_signal_handlers; /* = 0; */
@@ -669,6 +666,10 @@ extern void caml_destroy_context(caml_global_context *c);
extern caml_global_context *caml_get_thread_local_context(void);
extern void caml_set_thread_local_context(caml_global_context *new_global_context);
+extern void (*caml_enter_blocking_section_hook)(void);
+extern void (*caml_leave_blocking_section_hook)(void);
+extern int (*caml_try_leave_blocking_section_hook)(void);
+
extern void (*caml_enter_lock_section_hook)(void);
extern void (*caml_leave_lock_section_hook)(void);
extern void caml_enter_lock_section_r(CAML_R);
@@ -785,9 +786,9 @@ extern library_context *caml_get_library_context_r(
#define caml_signals_are_pending ctx->caml_signals_are_pending
#define caml_pending_signals ctx->caml_pending_signals
#define caml_async_signal_mode ctx->caml_async_signal_mode
-#define caml_enter_blocking_section_hook ctx->caml_enter_blocking_section_hook
-#define caml_leave_blocking_section_hook ctx->caml_leave_blocking_section_hook
-#define caml_try_leave_blocking_section_hook ctx->caml_try_leave_blocking_section_hook
+/* #define caml_enter_blocking_section_hook ctx->caml_enter_blocking_section_hook */
+/* #define caml_leave_blocking_section_hook ctx->caml_leave_blocking_section_hook */
+/* #define caml_try_leave_blocking_section_hook ctx->caml_try_leave_blocking_section_hook */
#define caml_force_major_slice ctx->caml_force_major_slice
#define caml_signal_handlers ctx->caml_signal_handlers
#endif
2  byterun/gc_ctrl.c
View
@@ -118,7 +118,7 @@ static value heap_stats_r (CAML_R, int returnstats)
header_t cur_hd;
#ifdef DEBUG
- caml_gc_message (-1, "### OCaml runtime: heap check ###\n", 0);
+ //caml_gc_message (-1, "### OCaml runtime: heap check ###\n", 0);// !!!!!!!!!!!!!! FIXME: REENABLE --Luca Saiu REENTRANTRUNTIME
#endif
while (chunk != NULL){
21 otherlibs/systhreads/st_stubs.c
View
@@ -158,7 +158,7 @@ static void caml_thread_scan_roots(scanning_action action)
/* Hooks for enter_blocking_section and leave_blocking_section */
-static void caml_thread_enter_blocking_section_hook_default(void)
+static void caml_thread_enter_blocking_section_hook(void)
{
QB();
INIT_CAML_R;
@@ -168,8 +168,8 @@ static void caml_thread_enter_blocking_section_hook_default(void)
curr_thread->bottom_of_stack = caml_bottom_of_stack;
curr_thread->last_retaddr = caml_last_return_address;
- //fprintf(stderr, "caml_thread_enter_blocking_section_hook_default: ctx %p, thread %p: curr_thread->gc_regs, about to be overwritten, was %p\n", ctx, (void*)pthread_self(), curr_thread->gc_regs); fflush(stderr);
- //fprintf(stderr, "caml_thread_enter_blocking_section_hook_default: ctx %p, thread %p: caml_gc_regs is %p\n", ctx, (void*)pthread_self(), caml_gc_regs); fflush(stderr);
+ //fprintf(stderr, "caml_thread_enter_blocking_section_hook: ctx %p, thread %p: curr_thread->gc_regs, about to be overwritten, was %p\n", ctx, (void*)pthread_self(), curr_thread->gc_regs); fflush(stderr);
+ //fprintf(stderr, "caml_thread_enter_blocking_section_hook: ctx %p, thread %p: caml_gc_regs is %p\n", ctx, (void*)pthread_self(), caml_gc_regs); fflush(stderr);
curr_thread->gc_regs = caml_gc_regs;
curr_thread->exception_pointer = caml_exception_pointer;
@@ -492,15 +492,10 @@ static void caml_thread_initialize_for_current_context_r(CAML_R){
return;
}
- /* Set up the hooks */
- caml_enter_blocking_section_hook = caml_thread_enter_blocking_section_hook_default;
- caml_leave_blocking_section_hook = caml_thread_leave_blocking_section_hook_default;
- caml_try_leave_blocking_section_hook = caml_thread_try_leave_blocking_section;
-
/* Set up a thread info block for the current thread */
curr_thread =
(caml_thread_t) stat_alloc(sizeof(struct caml_thread_struct));
- memset(curr_thread, 0xaa, sizeof(struct caml_thread_struct)); // !!!!!!!!! FIXME: remove. This is for debugging only
+ memset(curr_thread, 0xbb, sizeof(struct caml_thread_struct)); // !!!!!!!!! FIXME: remove. This is for debugging only
//memset(curr_thread, 0x00, sizeof(struct caml_thread_struct)); // !!!!!!!!! FIXME: remove. This is for debugging only
curr_thread->descr = caml_thread_new_descriptor_r(ctx, Val_unit);
curr_thread->next = curr_thread;
@@ -512,7 +507,6 @@ static void caml_thread_initialize_for_current_context_r(CAML_R){
#endif
curr_thread->ctx = ctx;
- DUMP("*********************************************** caml_thread_initialize_for_current_context_r");
/* If this is not the main context, then we have to copy its signal
handlers (a Caml array, which can be cloned via a blob): */
if(ctx->descriptor->kind != caml_global_context_main){
@@ -555,10 +549,9 @@ CAMLprim value caml_thread_initialize_r(CAML_R, value unit) /* ML */
/* Set up the hooks */
prev_scan_roots_hook = caml_scan_roots_hook;
caml_scan_roots_hook = caml_thread_scan_roots;
- // ???? MOVED, TENTATIVELY
- //caml_enter_blocking_section_hook = caml_thread_enter_blocking_section_hook_default;
- //caml_leave_blocking_section_hook = caml_thread_leave_blocking_section_hook_default;
- //caml_try_leave_blocking_section_hook = caml_thread_try_leave_blocking_section;
+ caml_enter_blocking_section_hook = caml_thread_enter_blocking_section_hook;
+ caml_leave_blocking_section_hook = caml_thread_leave_blocking_section_hook_default;
+ caml_try_leave_blocking_section_hook = caml_thread_try_leave_blocking_section;
#ifdef NATIVE_CODE
caml_termination_hook = st_thread_exit;
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.