Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a nasty bug in selectgen.ml that I introduced last weel ( Print…

…f.fprintf stderr "QQQQQQQQ %s\n%!" s;)
  • Loading branch information...
commit 39c25833ad3ac23140c7fab594cade049c0f542c 1 parent 68c37b3
@lucasaiu authored
View
6 asmcomp/cmmgen.ml
@@ -655,18 +655,12 @@ let bigarray_set unsafe elt_kind layout b args newval dbg =
(* Simplification of some primitives into C calls *)
-(* ***** *)
-let _ = Config.multicontext_supported
-let _ = Config.multicontext_enabled
-(* ***** *)
-
(* FIXME: 2013-09: ask Fabrice: is this *only* used for reentrant primitives? I think so. --Luca Saiu *)
(* let default_prim name = *)
(* { prim_name = name ^ "_r"; *)
(* prim_arity = 0 (\*ignored*\); prim_ctx = true; *)
(* prim_alloc = true; prim_native_name = ""; prim_native_float = false } *)
-
(* VERY experimental: BEGIN ================================================== *)
let default_prim =
if Config.multicontext_supported then
View
9 asmcomp/selectgen.ml
@@ -218,9 +218,12 @@ method select_operation op args =
(Capply(ty, dbg), Cconst_symbol (s, _) :: rem) -> (Icall_imm s, rem)
| (Capply(ty, dbg), _) -> (Icall_ind, args)
| (Cextcall(s, ty, alloc, true, dbg), _) ->
- (* (Iextcall(s, alloc), Cconst_symbol("caml_global_context", Cconstant_kind) :: args) *)
- (* testing, as of 2013-09 --L.S. *)
- (Iextcall(s, alloc), Cconst_symbol("the_one_and_only_context_struct", Cconstant_kind) :: args)
+ (Iextcall(s, alloc),
+ Cconst_symbol((if Config.multicontext_supported then
+ "caml_global_context" (* a special case in emit.mlp *)
+ else
+ "the_one_and_only_context_struct"),
+ Cconstant_kind) :: args)
| (Cextcall(s, ty, alloc, false, dbg), _) -> (Iextcall(s, alloc), args)
| (Cload chunk, [arg]) ->
let (addr, eloc) = self#select_addressing chunk arg in
View
BIN  boot/myocamlbuild
Binary file not shown
View
BIN  boot/ocamlrun
Binary file not shown
View
BIN  boot/ocamlrun.boot
Binary file not shown
View
BIN  boot/ocamlyacc
Binary file not shown
View
BIN  boot/stdlib.cma
Binary file not shown
View
35 byterun/context.c
@@ -151,6 +151,7 @@ void caml_v_semaphore(sem_t* semaphore){
}
#ifdef HAS_MULTICONTEXT
+void caml_run_at_context_exit_functions_r(CAML_R);
void* caml_destructor_thread_function(void *ctx_as_void_star){
CAML_R = ctx_as_void_star;
//DUMP("Hello from the destructor thread for context %p (ctx is %p)", ctx_as_void_star, ctx);
@@ -171,11 +172,11 @@ void* caml_destructor_thread_function(void *ctx_as_void_star){
/* Initialize the given context structure, which has already been allocated elsewhere: */
void caml_initialize_first_global_context(CAML_R/* caml_global_context *this_ctx */)
{
-#ifndef HAS_MULTICONTEXT
- /* If we're working with some context different from the one and
- only, we're doing something wrong: */
+ //#ifndef HAS_MULTICONTEXT
+ // /* If we're working with some context different from the one and
+ // only, we're doing something wrong: */
//assert(ctx == &the_one_and_only_context_struct);
-#endif // #ifndef HAS_MULTICONTEXT
+ //#endif // #ifndef HAS_MULTICONTEXT
/* Maybe we should use partial contexts for specific tasks, that
will probably not be used by all threads. We should check the size of
@@ -266,7 +267,13 @@ section. */
ctx->caml_young_base = NULL;
ctx->caml_young_start = NULL;
ctx->caml_young_end = NULL;
+#if defined(SUPPORTS_MULTICONTEXT)
+ ctx->
+#endif
caml_young_ptr = NULL;
+#if defined(SUPPORTS_MULTICONTEXT)
+ ctx->
+#endif
caml_young_limit = NULL;
ctx->caml_ref_table.base = NULL;
@@ -313,9 +320,21 @@ section. */
/* caml_globals_scanned = 0; */
/* caml_dyn_globals = NULL; */
/* caml_top_of_stack; */
+#if defined(NATIVE_CODE) && defined(SUPPORTS_MULTICONTEXT)
+ ctx->
+#endif
caml_bottom_of_stack = NULL; /* no stack initially */
+#if defined(NATIVE_CODE) && defined(SUPPORTS_MULTICONTEXT)
+ ctx->
+#endif
caml_last_return_address = 1; /* not in OCaml code initially */
+#if defined(NATIVE_CODE) && defined(SUPPORTS_MULTICONTEXT)
+ ctx->
+#endif
caml_gc_regs = NULL;
+#if defined(NATIVE_CODE) && defined(SUPPORTS_MULTICONTEXT)
+ ctx->
+#endif
caml_globals_inited = 0;
ctx->caml_globals_scanned = 0;
ctx->caml_dyn_globals = NULL;
@@ -354,6 +373,9 @@ section. */
/* from fail.c */
#ifdef NATIVE_CODE
+#if defined(NATIVE_CODE) && defined(SUPPORTS_MULTICONTEXT)
+ ctx->
+#endif
caml_exception_pointer= NULL;
//array_bound_error_bucket_inited = 0;
#else
@@ -383,6 +405,9 @@ section. */
/* from backtrace.c */
#ifdef NATIVE_CODE
+#if defined(NATIVE_CODE) && defined(SUPPORTS_MULTICONTEXT)
+ ctx->
+#endif
caml_backtrace_active = 0;
ctx->caml_backtrace_pos = 0;
ctx->caml_backtrace_buffer = NULL;
@@ -941,7 +966,7 @@ void caml_context_initialize_global_stuff(void){
/* This is a thin wrapper over pthread_mutex_lock and pthread_mutex_unlock: */
static void caml_call_on_mutex(int(*function)(pthread_mutex_t *), pthread_mutex_t *mutex){
- INIT_CAML_R;
+ //INIT_CAML_R;
if(! caml_are_mutexes_already_initialized){
/* INIT_CAML_R; */ fprintf(stderr, "global mutexes aren't initialized yet. Bailing out"); fflush(stderr);
exit(EXIT_FAILURE);
View
2  byterun/context.h
@@ -841,7 +841,7 @@ extern library_context *caml_get_library_context_r(
#if defined(SUPPORTS_MULTICONTEXT)
#define caml_young_ptr ctx->caml_young_ptr
#define caml_young_limit ctx->caml_young_limit
-#endif // #if defined(NATIVE_CODE) && defined(SUPPORTS_MULTICONTEXT)
+#endif // defined(SUPPORTS_MULTICONTEXT)
#define caml_ref_table ctx->caml_ref_table
#define caml_weak_ref_table ctx->caml_weak_ref_table
#define caml_in_minor_collection ctx->caml_in_minor_collection
View
15 config/m.h
@@ -1,11 +1,14 @@
-#undef ARCH_SIXTYFOUR
+#ifndef __PIC__
+# define ARCH_CODE32
+#endif
+#define ARCH_SIXTYFOUR
#define SIZEOF_INT 4
-#define SIZEOF_LONG 4
-#define SIZEOF_PTR 4
+#define SIZEOF_LONG 8
+#define SIZEOF_PTR 8
#define SIZEOF_SHORT 2
-#define ARCH_INT64_TYPE long long
-#define ARCH_UINT64_TYPE unsigned long long
-#define ARCH_INT64_PRINTF_FORMAT "ll"
+#define ARCH_INT64_TYPE long
+#define ARCH_UINT64_TYPE unsigned long
+#define ARCH_INT64_PRINTF_FORMAT "l"
#undef ARCH_BIG_ENDIAN
#undef ARCH_ALIGN_DOUBLE
#undef ARCH_ALIGN_INT64
View
6 config/s.h
@@ -4,6 +4,7 @@
#define HAS_C99_FLOAT_OPS
#define HAS_GETRUSAGE
#define HAS_TIMES
+#define HAS_TERMCAP
#define HAS_SOCKETS
#define HAS_SOCKLEN_T
#define HAS_INET_ATON
@@ -48,5 +49,6 @@
#define HAS_STACK_OVERFLOW_DETECTION
#define HAS_PTHREAD
#define HAS_SIGWAIT
-// #define SUPPORTS_MULTICONTEXT /* not supported */
-// #define HAS_MULTICONTEXT /* disabled or not supported */
+#define SUPPORTS_MULTICONTEXT
+#define HAS_MULTICONTEXT
+#define HAS_LIBBFD
View
18 myocamlbuild_config.ml
@@ -1,4 +1,4 @@
-(* # generated by ./configure --with-debug-runtime --prefix /home/luca/usr-patched-ocaml *)
+(* # generated by ./configure --prefix /home/luca/usr-patched-ocaml --with-debug-runtime *)
let prefix = "/home/luca/usr-patched-ocaml";;
let bindir = prefix^"/bin";;
let libdir = prefix^"/lib/ocaml";;
@@ -9,18 +9,18 @@ let ranlib = "ranlib";;
let ranlibcmd = "ranlib";;
let arcmd = "ar";;
let sharpbangscripts = true;;
-let bng_arch = "ia32";;
-let bng_asm_level = "2";;
+let bng_arch = "amd64";;
+let bng_asm_level = "1";;
let pthread_link = "-cclib -lpthread";;
let x11_includes = "not found";;
let x11_link = "not found";;
let tk_defs = "";;
let tk_link = "";;
-let libbfd_link = "";;
+let libbfd_link = "-lbfd -ldl -liberty -lz";;
let bytecc = "gcc";;
let bytecccompopts = "-fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT";;
let bytecclinkopts = " -Wl,-E";;
-let bytecclibs = " -lm -ldl -lpthread";;
+let bytecclibs = " -lm -ldl -lcurses -lpthread";;
let byteccrpath = "-Wl,-rpath,";;
let exe = "";;
let supports_shared_libraries = true;;
@@ -33,9 +33,9 @@ let syslib x = "-l"^x;;
(* ## *)
(* MKLIB=ar rc "^1^" "^2^"; ranlib "^1^" *)
let mklib out files opts = Printf.sprintf "ar rc %s %s %s; ranlib %s" out opts files out;;
-let arch = "i386";;
+let arch = "amd64";;
let model = "default";;
-let system = "linux_elf";;
+let system = "linux";;
let nativecc = "gcc";;
let nativecccompopts = "-Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT";;
let nativeccprofopts = "-Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT";;
@@ -74,5 +74,5 @@ let mkmaindll = "gcc -shared";;
let runtimed = "runtimed";;
let camlp4 = "camlp4";;
let asm_cfi_supported = true;;
-let multicontext_supported = false;;
-let multicontext_enabled = false;;
+let multicontext_supported = true;;
+let multicontext_enabled = true;;
View
4 stdlib/pervasives.ml
@@ -447,9 +447,9 @@ let at_exit f =
exit_function := (fun () -> f(); g())
(* Unchanged code: *)
-(* let do_at_exit () = (!exit_function) () *)
+let do_at_exit () = (!exit_function) ()
-let do_at_exit () = prerr_string "[from do_at_exit]\n"; (!exit_function) ()
+(* let do_at_exit () = prerr_string "[from do_at_exit]\n"; (!exit_function) () *)
let exit retcode =
do_at_exit ();
View
18 tools/myocamlbuild_config.ml
@@ -1,4 +1,4 @@
-(* # generated by ./configure --with-debug-runtime --prefix /home/luca/usr-patched-ocaml *)
+(* # generated by ./configure --prefix /home/luca/usr-patched-ocaml --with-debug-runtime *)
let prefix = "/home/luca/usr-patched-ocaml";;
let bindir = prefix^"/bin";;
let libdir = prefix^"/lib/ocaml";;
@@ -9,18 +9,18 @@ let ranlib = "ranlib";;
let ranlibcmd = "ranlib";;
let arcmd = "ar";;
let sharpbangscripts = true;;
-let bng_arch = "ia32";;
-let bng_asm_level = "2";;
+let bng_arch = "amd64";;
+let bng_asm_level = "1";;
let pthread_link = "-cclib -lpthread";;
let x11_includes = "not found";;
let x11_link = "not found";;
let tk_defs = "";;
let tk_link = "";;
-let libbfd_link = "";;
+let libbfd_link = "-lbfd -ldl -liberty -lz";;
let bytecc = "gcc";;
let bytecccompopts = "-fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT";;
let bytecclinkopts = " -Wl,-E";;
-let bytecclibs = " -lm -ldl -lpthread";;
+let bytecclibs = " -lm -ldl -lcurses -lpthread";;
let byteccrpath = "-Wl,-rpath,";;
let exe = "";;
let supports_shared_libraries = true;;
@@ -33,9 +33,9 @@ let syslib x = "-l"^x;;
(* ## *)
(* MKLIB=ar rc "^1^" "^2^"; ranlib "^1^" *)
let mklib out files opts = Printf.sprintf "ar rc %s %s %s; ranlib %s" out opts files out;;
-let arch = "i386";;
+let arch = "amd64";;
let model = "default";;
-let system = "linux_elf";;
+let system = "linux";;
let nativecc = "gcc";;
let nativecccompopts = "-Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT";;
let nativeccprofopts = "-Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT";;
@@ -74,5 +74,5 @@ let mkmaindll = "gcc -shared";;
let runtimed = "runtimed";;
let camlp4 = "camlp4";;
let asm_cfi_supported = true;;
-let multicontext_supported = false;;
-let multicontext_enabled = false;;
+let multicontext_supported = true;;
+let multicontext_enabled = true;;
Please sign in to comment.
Something went wrong with that request. Please try again.