From 0c7aecb88dc696f66f49f3bed54a037361a26b8d Mon Sep 17 00:00:00 2001 From: Damien Doligez Date: Fri, 2 Jan 2004 19:23:29 +0000 Subject: [PATCH] depollution suite (et fin?) (PR#1914 et PR#1956) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6047 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- asmrun/alpha.S | 4 +- asmrun/amd64.S | 2 +- asmrun/arm.S | 6 +- asmrun/fail.c | 4 +- asmrun/hppa.S | 12 +-- asmrun/i386.S | 4 +- asmrun/ia64.S | 4 +- asmrun/m68k.S | 4 +- asmrun/mips.s | 4 +- asmrun/roots.c | 4 +- asmrun/signals.c | 20 ++--- asmrun/startup.c | 17 ++-- boot/ocamlc | Bin 948137 -> 948680 bytes boot/ocamllex | Bin 145685 -> 145919 bytes bytecomp/bytegen.ml | 28 +++--- bytecomp/translcore.ml | 2 +- byterun/alloc.h | 2 +- byterun/array.c | 8 +- byterun/backtrace.c | 14 +-- byterun/callback.c | 4 +- byterun/compact.c | 35 ++++---- byterun/compatibility.h | 128 ++++++++++++++++++++++++--- byterun/debugger.c | 20 ++--- byterun/extern.c | 4 +- byterun/fail.c | 4 +- byterun/fail.h | 2 +- byterun/finalise.c | 14 +-- byterun/finalise.h | 14 +-- byterun/fix_code.c | 46 +++++----- byterun/fix_code.h | 22 ++--- byterun/floats.c | 148 ++++++++++++++++---------------- byterun/freelist.c | 78 ++++++++--------- byterun/freelist.h | 14 +-- byterun/gc_ctrl.c | 89 +++++++++---------- byterun/gc_ctrl.h | 24 +++--- byterun/globroots.c | 4 +- byterun/hash.c | 5 +- byterun/instrtrace.c | 12 +-- byterun/instrtrace.h | 8 +- byterun/intern.c | 12 +-- byterun/interp.c | 14 +-- byterun/intext.h | 6 +- byterun/ints.c | 10 +-- byterun/major_gc.c | 57 ++++++------ byterun/memory.c | 26 +++--- byterun/memory.h | 12 +-- byterun/meta.c | 4 +- byterun/minor_gc.c | 10 +-- byterun/mlvalues.h | 15 ++-- byterun/obj.c | 4 +- byterun/roots.c | 4 +- byterun/signals.c | 2 +- byterun/startup.c | 28 +++--- byterun/str.c | 4 +- byterun/sys.c | 4 +- otherlibs/threads/pervasives.ml | 67 ++++++++------- stdlib/gc.ml | 20 ++--- stdlib/gc.mli | 18 ++-- stdlib/hashtbl.ml | 2 +- stdlib/hashtbl.mli | 2 +- stdlib/moreLabels.mli | 2 +- stdlib/pervasives.ml | 48 +++++------ stdlib/pervasives.mli | 46 +++++----- stdlib/printf.ml | 2 +- stdlib/sys.ml | 2 +- 65 files changed, 675 insertions(+), 560 deletions(-) diff --git a/asmrun/alpha.S b/asmrun/alpha.S index 595ad60a3..c6240fc3b 100644 --- a/asmrun/alpha.S +++ b/asmrun/alpha.S @@ -414,7 +414,7 @@ caml_callback3_exn: br $107 .end caml_callback3_exn -/* Glue code to call [array_bound_error] */ +/* Glue code to call [caml_array_bound_error] */ .globl caml_ml_array_bound_error .ent caml_ml_array_bound_error @@ -422,7 +422,7 @@ caml_callback3_exn: caml_ml_array_bound_error: br $27, $111 $111: ldgp $gp, 0($27) - lda $25, array_bound_error + lda $25, caml_array_bound_error br caml_c_call /* never returns */ .end caml_ml_array_bound_error diff --git a/asmrun/amd64.S b/asmrun/amd64.S index 34b1ea415..1ea435213 100644 --- a/asmrun/amd64.S +++ b/asmrun/amd64.S @@ -310,7 +310,7 @@ FUNCTION(caml_ml_array_bound_error) /* Make the exception handler and alloc ptr available to the C code */ movq %r15, caml_young_ptr(%rip) movq %r14, caml_exception_pointer(%rip) - jmp array_bound_error + jmp caml_array_bound_error .data .globl system__frametable diff --git a/asmrun/arm.S b/asmrun/arm.S index 11e2b50fc..e02e04ed4 100644 --- a/asmrun/arm.S +++ b/asmrun/arm.S @@ -306,8 +306,8 @@ caml_callback3_exn: .global caml_ml_array_bound_error caml_ml_array_bound_error: - /* Load address of array_bound_error in r10 */ - ldr r10, .Larray_bound_error + /* Load address of [caml_array_bound_error] in r10 */ + ldr r10, .Lcaml_array_bound_error /* Call that function */ b caml_c_call @@ -324,7 +324,7 @@ caml_ml_array_bound_error: .Lcaml_apply2: .word caml_apply2 .Lcaml_apply3: .word caml_apply3 .Lcaml_requested_size: .word 0 -.Larray_bound_error: .word array_bound_error +.Lcaml_array_bound_error: .word caml_array_bound_error /* GC roots for callback */ diff --git a/asmrun/fail.c b/asmrun/fail.c index 20e9b0d27..a2e2b7d00 100644 --- a/asmrun/fail.c +++ b/asmrun/fail.c @@ -143,7 +143,7 @@ void caml_raise_sys_blocked_io(void) /* We allocate statically the bucket for the exception because we can't do a GC before the exception is raised (lack of stack descriptors - for the ccall to [array_bound_error]. */ + for the ccall to [caml_array_bound_error]. */ #define BOUND_MSG "index out of bounds" #define BOUND_MSG_LEN (sizeof(BOUND_MSG) - 1) @@ -159,7 +159,7 @@ static struct { char data[BOUND_MSG_LEN + sizeof(value)]; } array_bound_error_msg = { 0, BOUND_MSG }; -void array_bound_error(void) +void caml_array_bound_error(void) { mlsize_t wosize = (BOUND_MSG_LEN + sizeof(value)) / sizeof(value); mlsize_t offset_index = Bsize_wsize(wosize) - 1; diff --git a/asmrun/hppa.S b/asmrun/hppa.S index f547bbe50..5e6a83599 100644 --- a/asmrun/hppa.S +++ b/asmrun/hppa.S @@ -58,7 +58,7 @@ .import caml_raise, code .import caml_apply2, code .import caml_apply3, code - .import array_bound_error, code + .import caml_array_bound_error, code caml_young_limit .comm 8 caml_young_ptr .comm 8 @@ -528,13 +528,13 @@ G(caml_callback3_exn): EXPORT_CODE(G(caml_ml_array_bound_error)) G(caml_ml_array_bound_error): STARTPROC -; Load address of array_bound_error in %r22 +; Load address of [caml_array_bound_error] in %r22 #ifdef SYS_hpux - ldil LR%array_bound_error, %r22 - ldo RR%array_bound_error(%r22), %r22 + ldil LR%caml_array_bound_error, %r22 + ldo RR%caml_array_bound_error(%r22), %r22 #else - ldil L`_array_bound_error, %r22 - ldo R`_array_bound_error(%r22), %r22 + ldil L`_caml_array_bound_error, %r22 + ldo R`_caml_array_bound_error(%r22), %r22 #endif ; Reserve 48 bytes of stack space and jump to caml_c_call b G(caml_c_call) diff --git a/asmrun/i386.S b/asmrun/i386.S index 9ed177326..f386d739f 100644 --- a/asmrun/i386.S +++ b/asmrun/i386.S @@ -309,8 +309,8 @@ G(caml_ml_array_bound_error): ffree %st(5) ffree %st(6) ffree %st(7) - /* Branch to array_bound_error */ - jmp G(array_bound_error) + /* Branch to [caml_array_bound_error] */ + jmp G(caml_array_bound_error) .data .globl G(system__frametable) diff --git a/asmrun/ia64.S b/asmrun/ia64.S index b007ef06b..7fc256ac0 100644 --- a/asmrun/ia64.S +++ b/asmrun/ia64.S @@ -503,13 +503,13 @@ caml_callback3_exn: .endp caml_callback3_exn# -/* Glue code to call array_bound_error */ +/* Glue code to call [caml_array_bound_error] */ .global caml_ml_array_bound_error# .proc caml_ml_array_bound_error# .align 16 caml_ml_array_bound_error: - ADDRGLOBAL(r2, @fptr(array_bound_error#)) + ADDRGLOBAL(r2, @fptr(caml_array_bound_error#)) br.sptk caml_c_call /* never returns */ .rodata diff --git a/asmrun/m68k.S b/asmrun/m68k.S index ce0917372..fdcc44ef2 100644 --- a/asmrun/m68k.S +++ b/asmrun/m68k.S @@ -231,8 +231,8 @@ _caml_callback3_exn: .globl _caml_ml_array_bound_error _caml_ml_array_bound_error: - | Load address of array_bound_error in a0 and call it - lea _array_bound_error, a0 + | Load address of [caml_array_bound_error] in a0 and call it + lea _caml_array_bound_error, a0 bra _caml_c_call .data diff --git a/asmrun/mips.s b/asmrun/mips.s index deba5cb03..99d4fa47f 100644 --- a/asmrun/mips.s +++ b/asmrun/mips.s @@ -364,7 +364,7 @@ caml_callback3_exn: .end caml_callback3_exn -/* Glue code to call array_bound_error */ +/* Glue code to call [caml_array_bound_error] */ .globl caml_ml_array_bound_error .ent caml_ml_array_bound_error @@ -372,7 +372,7 @@ caml_callback3_exn: caml_ml_array_bound_error: /* Setup $gp, discarding caller's $gp (we won't return) */ .cpsetup $25, $24, caml_ml_array_bound_error - la $24, array_bound_error + la $24, caml_array_bound_error jal caml_c_call /* never returns */ .end caml_ml_array_bound_error diff --git a/asmrun/roots.c b/asmrun/roots.c index 1ff7a4ab3..76d85a0ad 100644 --- a/asmrun/roots.c +++ b/asmrun/roots.c @@ -188,7 +188,7 @@ void caml_oldify_local_roots (void) Oldify (gr->root); } /* Finalised values */ - final_do_young_roots (&caml_oldify_one); + caml_final_do_young_roots (&caml_oldify_one); /* Hook */ if (caml_scan_roots_hook != NULL) (*caml_scan_roots_hook)(caml_oldify_one); } @@ -221,7 +221,7 @@ void caml_do_roots (scanning_action f) f(*(gr->root), gr->root); } /* Finalised values */ - final_do_strong_roots (f); + caml_final_do_strong_roots (f); /* Hook */ if (caml_scan_roots_hook != NULL) (*caml_scan_roots_hook)(f); } diff --git a/asmrun/signals.c b/asmrun/signals.c index 14b80a903..1074ec3ac 100644 --- a/asmrun/signals.c +++ b/asmrun/signals.c @@ -33,10 +33,10 @@ #include #endif -extern char * code_area_start, * code_area_end; +extern char * caml_code_area_start, * caml_code_area_end; #define In_code_area(pc) \ - ((char *)(pc) >= code_area_start && (char *)(pc) <= code_area_end) + ((char *)(pc) >= caml_code_area_start && (char *)(pc) <= caml_code_area_end) #ifdef _WIN32 typedef void (*sighandler)(int sig); @@ -463,7 +463,7 @@ value caml_install_signal_handler(value signal_number, value action) /* ML */ if (Is_block(action)) { if (caml_signal_handlers == 0) { caml_signal_handlers = caml_alloc(NSIG, 0); - register_global_root(&caml_signal_handlers); + caml_register_global_root(&caml_signal_handlers); } caml_modify(&Field(caml_signal_handlers, sig), Field(action, 0)); } @@ -491,7 +491,7 @@ static void trap_handler(int sig, int code, sp = (int *) context->sc_sp; caml_exception_pointer = (char *) sp[5]; caml_young_ptr = (char *) sp[6]; - array_bound_error(); + caml_array_bound_error(); } #endif @@ -510,14 +510,14 @@ static void trap_handler(int sig, siginfo_t * info, void * context) sp = (long *) (((ucontext_t *)context)->uc_mcontext.gregs[REG_SP]); caml_exception_pointer = (char *) sp[5]; caml_young_ptr = (char *) sp[6]; - array_bound_error(); + caml_array_bound_error(); } #endif #if defined(TARGET_sparc) && (defined(SYS_bsd) || defined(SYS_linux)) static void trap_handler(int sig) { - /* TODO: recover registers from context and call array_bound_error */ + /* TODO: recover registers from context and call [caml_array_bound_error] */ caml_fatal_error("Fatal error: out-of-bound access in array or string\n"); } #endif @@ -534,7 +534,7 @@ static void trap_handler(int sig, int code, STRUCT_SIGCONTEXT * context) from registers 31 and 29 */ caml_exception_pointer = (char *) CONTEXT_GPR(context, 29); caml_young_ptr = (char *) CONTEXT_GPR(context, 31); - array_bound_error(); + caml_array_bound_error(); } #endif @@ -545,7 +545,7 @@ static void trap_handler(int sig, struct sigcontext * context) from registers 31 and 29 */ caml_exception_pointer = (char *) context->regs->gpr[29]; caml_young_ptr = (char *) context->regs->gpr[31]; - array_bound_error(); + caml_array_bound_error(); } #endif @@ -561,7 +561,7 @@ static void trap_handler(int sig, int code, STRUCT_SIGCONTEXT * context) from registers 31 and 29 */ caml_exception_pointer = (char *) CONTEXT_GPR(context, 29); caml_young_ptr = (char *) CONTEXT_GPR(context, 31); - array_bound_error(); + caml_array_bound_error(); } #endif @@ -572,7 +572,7 @@ static void trap_handler(int sig, int code, struct sigcontext * context) from registers 31 and 29 */ caml_exception_pointer = (char *) context->sc_frame.fixreg[29]; caml_young_ptr = (char *) context->sc_frame.fixreg[31]; - array_bound_error(); + caml_array_bound_error(); } #endif diff --git a/asmrun/startup.c b/asmrun/startup.c index 117a5c9e4..2c4c20ec3 100644 --- a/asmrun/startup.c +++ b/asmrun/startup.c @@ -33,8 +33,8 @@ extern int caml_parser_trace; header_t caml_atom_table[256]; -char * static_data_start, * static_data_end; -char * code_area_start, * code_area_end; +char * caml_static_data_start, * caml_static_data_end; +char * caml_code_area_start, * caml_code_area_end; /* Initialize the atom table and the static data and code area limits. */ @@ -57,8 +57,9 @@ static void init_atoms(void) extern struct segment caml_data_segments[], caml_code_segments[]; for (i = 0; i < 256; i++) caml_atom_table[i] = Make_header(0, i, Caml_white); - minmax_table(caml_data_segments, &static_data_start, &static_data_end); - minmax_table(caml_code_segments, &code_area_start, &code_area_end); + minmax_table(caml_data_segments, + &caml_static_data_start, &caml_static_data_end); + minmax_table(caml_code_segments, &caml_code_area_start, &caml_code_area_end); } /* Configuration parameters and flags */ @@ -116,7 +117,7 @@ struct longjmp_buffer caml_termination_jmpbuf; void (*caml_termination_hook)(void *) = NULL; extern value caml_start_program (void); -extern void init_ieee_floats (void); +extern void caml_init_ieee_floats (void); extern void caml_init_signals (void); void caml_main(char **argv) @@ -127,14 +128,14 @@ void caml_main(char **argv) #endif value res; - init_ieee_floats(); + caml_init_ieee_floats(); caml_init_custom_operations(); #ifdef DEBUG caml_verb_gc = 63; #endif parse_camlrunparam(); - init_gc (minor_heap_init, heap_size_init, heap_chunk_init, - percent_free_init, max_percent_free_init); + caml_init_gc (minor_heap_init, heap_size_init, heap_chunk_init, + percent_free_init, max_percent_free_init); init_atoms(); caml_init_signals(); exe_name = argv[0]; diff --git a/boot/ocamlc b/boot/ocamlc index 57a4862878851cea70060a4307bfe3a63136e25f..32a5bfd528531d2be92b73864e776d1da57f05bd 100755 GIT binary patch delta 8029 zcmZ`-4|o(+lBcFK)01@P4Ds`cKi_s27dt95G_VzXDPK z(*Z7k23QK{G(5>om$ag#1MUEDJ1I<8g!|fzfn+yKQ&T*2AefypV5gJ8^o-i;M}Ghb z*3J5sN2P5Wg zw}1|a&>_Vo-r7v#jCXxHdb?}f#@D_{)NOc{&k56;myd%V>X*C6M=YBNy$Jw*%o%}s zFS*@j^ex98isti5#50}}7j=u~UpZXCMJ3PK#=iqGAAr@^!fhUU1i%jBc3;r5GH+bi zf{N|eqSds$K1{EuSxK$I?wXL3+KrY+^AU?xPb%4ob1{&kt=;hFyN#QS%V2kzfmkwX zjoH!mfRTr`XID0?Og&F7W9crAmxf*4Bik^z9KdE-i>cn74_?de1$b+Fa`2w9Cy4jJ z9%M|gNX${`zk>BoHch4W;DQgU2&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Y^5Ls_QkPb*5*8Cn13s5G0Sl2=dbP!T4f zR&1}Q2T`+LPkxNU<$4~6^E&|AMHF~ zzeroR#?t+it<#6#UXBk%>Wr^|pS*cD)9Z|BZM&O%;@)9$iPrn@7}9#zeKePgL)$vY zizR?%>FgV=_$$!<-=DqO(v@ZF#E2PX(pdDF4jO*}--?kF)P~q|C-?}x=p@Zo(>dMw z4eicNb<4?~P+zb+E{FPZ3>uWXgGygAmWbxW5`Db;of6WVL?mj7Lt7P_3x_RE*}2u? zdUnPwE*#rsagir`Ev`GBlI5hm>5*;!?&KAlcsPrf?Nj4&^p+OO5q@@#$`eVumR`9( zVuw~@3CkATHj9;HB%U(r25U?ELbfS5TNt_$AY`~1UZE?t%(mKbBQd+?$P<<20P#6cy#A|^%5NH|OCi^+)`eb0|nS5O)cJ^fTLh8D@m{!lWk zzx^vc=+u8E$GFqoQq$Pl(sJufEw|uLKbh=uj&B^KAr{-MC4ti4KshO9>nL8Z= k%fI|&?SD5#UzIPs^sfW|t_~a*k+qIq$2Aq=+*(KDZ)cK5yZ`_I diff --git a/bytecomp/bytegen.ml b/bytecomp/bytegen.ml index adaf9a56d..cdc4c9e28 100644 --- a/bytecomp/bytegen.ml +++ b/bytecomp/bytegen.ml @@ -290,20 +290,20 @@ let comp_primitive p args = | Pasrint -> Kasrint | Poffsetint n -> Koffsetint n | Poffsetref n -> Koffsetref n - | Pintoffloat -> Kccall("int_of_float", 1) - | Pfloatofint -> Kccall("float_of_int", 1) - | Pnegfloat -> Kccall("neg_float", 1) - | Pabsfloat -> Kccall("abs_float", 1) - | Paddfloat -> Kccall("add_float", 2) - | Psubfloat -> Kccall("sub_float", 2) - | Pmulfloat -> Kccall("mul_float", 2) - | Pdivfloat -> Kccall("div_float", 2) - | Pfloatcomp Ceq -> Kccall("eq_float", 2) - | Pfloatcomp Cneq -> Kccall("neq_float", 2) - | Pfloatcomp Clt -> Kccall("lt_float", 2) - | Pfloatcomp Cgt -> Kccall("gt_float", 2) - | Pfloatcomp Cle -> Kccall("le_float", 2) - | Pfloatcomp Cge -> Kccall("ge_float", 2) + | Pintoffloat -> Kccall("caml_int_of_float", 1) + | Pfloatofint -> Kccall("caml_float_of_int", 1) + | Pnegfloat -> Kccall("caml_neg_float", 1) + | Pabsfloat -> Kccall("caml_abs_float", 1) + | Paddfloat -> Kccall("caml_add_float", 2) + | Psubfloat -> Kccall("caml_sub_float", 2) + | Pmulfloat -> Kccall("caml_mul_float", 2) + | Pdivfloat -> Kccall("caml_div_float", 2) + | Pfloatcomp Ceq -> Kccall("caml_eq_float", 2) + | Pfloatcomp Cneq -> Kccall("caml_neq_float", 2) + | Pfloatcomp Clt -> Kccall("caml_lt_float", 2) + | Pfloatcomp Cgt -> Kccall("caml_gt_float", 2) + | Pfloatcomp Cle -> Kccall("caml_le_float", 2) + | Pfloatcomp Cge -> Kccall("caml_ge_float", 2) | Pstringlength -> Kccall("caml_ml_string_length", 1) | Pstringrefs -> Kccall("caml_string_get", 2) | Pstringsets -> Kccall("caml_string_set", 3) diff --git a/bytecomp/translcore.ml b/bytecomp/translcore.ml index ff778b726..abb6fa914 100644 --- a/bytecomp/translcore.ml +++ b/bytecomp/translcore.ml @@ -116,7 +116,7 @@ let comparisons_table = create_hashtable 11 [ Pccall{prim_name = "caml_int_compare"; prim_arity = 2; prim_alloc = false; prim_native_name = ""; prim_native_float = false}, - Pccall{prim_name = "float_compare"; prim_arity = 2; + Pccall{prim_name = "caml_float_compare"; prim_arity = 2; prim_alloc = false; prim_native_name = ""; prim_native_float = false}, Pccall{prim_name = "caml_string_compare"; prim_arity = 2; diff --git a/byterun/alloc.h b/byterun/alloc.h index 203ff091a..1cf70c224 100644 --- a/byterun/alloc.h +++ b/byterun/alloc.h @@ -29,7 +29,7 @@ CAMLextern value caml_alloc_tuple (mlsize_t); CAMLextern value caml_alloc_string (mlsize_t); /* size in bytes */ CAMLextern value caml_copy_string (char const *); CAMLextern value caml_copy_string_array (char const **); -CAMLextern value copy_double (double); +CAMLextern value caml_copy_double (double); CAMLextern value caml_copy_int32 (int32); /* defined in [ints.c] */ CAMLextern value caml_copy_int64 (int64); /* defined in [ints.c] */ CAMLextern value caml_copy_nativeint (long); /* defined in [ints.c] */ diff --git a/byterun/array.c b/byterun/array.c index 29847c3b5..c13c0fed7 100644 --- a/byterun/array.c +++ b/byterun/array.c @@ -26,7 +26,7 @@ CAMLprim value caml_array_get_addr(value array, value index) { long idx = Long_val(index); - if (idx < 0 || idx >= Wosize_val(array)) array_bound_error(); + if (idx < 0 || idx >= Wosize_val(array)) caml_array_bound_error(); return Field(array, idx); } @@ -37,7 +37,7 @@ CAMLprim value caml_array_get_float(value array, value index) value res; if (idx < 0 || idx >= Wosize_val(array) / Double_wosize) - array_bound_error(); + caml_array_bound_error(); d = Double_field(array, idx); #define Setup_for_gc #define Restore_after_gc @@ -59,7 +59,7 @@ CAMLprim value caml_array_get(value array, value index) CAMLprim value caml_array_set_addr(value array, value index, value newval) { long idx = Long_val(index); - if (idx < 0 || idx >= Wosize_val(array)) array_bound_error(); + if (idx < 0 || idx >= Wosize_val(array)) caml_array_bound_error(); Modify(&Field(array, idx), newval); return Val_unit; } @@ -68,7 +68,7 @@ CAMLprim value caml_array_set_float(value array, value index, value newval) { long idx = Long_val(index); if (idx < 0 || idx >= Wosize_val(array) / Double_wosize) - array_bound_error(); + caml_array_bound_error(); Store_double_field(array, idx, Double_val(newval)); return Val_unit; } diff --git a/byterun/backtrace.c b/byterun/backtrace.c index dd60f993c..52b51ce28 100644 --- a/byterun/backtrace.c +++ b/byterun/backtrace.c @@ -59,7 +59,7 @@ enum { void caml_init_backtrace(void) { caml_backtrace_active = 1; - register_global_root(&caml_backtrace_last_exn); + caml_register_global_root(&caml_backtrace_last_exn); /* Note: lazy initialization of caml_backtrace_buffer in caml_stash_backtrace to simplify the interface with the thread libraries */ } @@ -69,7 +69,7 @@ void caml_init_backtrace(void) void caml_stash_backtrace(value exn, code_t pc, value * sp) { - code_t end_code = (code_t) ((char *) start_code + code_size); + code_t end_code = (code_t) ((char *) caml_start_code + caml_code_size); if (pc != NULL) pc = pc - 1; if (exn != caml_backtrace_last_exn) { caml_backtrace_pos = 0; @@ -80,12 +80,12 @@ void caml_stash_backtrace(value exn, code_t pc, value * sp) if (caml_backtrace_buffer == NULL) return; } if (caml_backtrace_pos >= BACKTRACE_BUFFER_SIZE) return; - if (pc >= start_code && pc < end_code){ + if (pc >= caml_start_code && pc < end_code){ caml_backtrace_buffer[caml_backtrace_pos++] = pc; } for (/*nothing*/; sp < caml_trapsp; sp++) { code_t p = (code_t) *sp; - if (p >= start_code && p < end_code) { + if (p >= caml_start_code && p < end_code) { if (caml_backtrace_pos >= BACKTRACE_BUFFER_SIZE) break; caml_backtrace_buffer[caml_backtrace_pos++] = p; } @@ -144,8 +144,8 @@ static value event_for_location(value events, code_t pc) mlsize_t i; value pos, l, ev, ev_pos; - Assert(pc >= start_code && pc < start_code + code_size); - pos = Val_long((char *) pc - (char *) start_code); + Assert(pc >= caml_start_code && pc < caml_start_code + caml_code_size); + pos = Val_long((char *) pc - (char *) caml_start_code); for (i = 0; i < Wosize_val(events); i++) { for (l = Field(events, i); l != Val_int(0); l = Field(l, 1)) { ev = Field(l, 0); @@ -167,7 +167,7 @@ static void print_location(value events, int index) value ev; ev = event_for_location(events, pc); - if (is_instruction(*pc, RAISE)) { + if (caml_is_instruction(*pc, RAISE)) { /* Ignore compiler-inserted raise */ if (ev == Val_false) return; /* Initial raise if index == 0, re-raise otherwise */ diff --git a/byterun/callback.c b/byterun/callback.c index 6e1d8efbb..84e0c4116 100644 --- a/byterun/callback.c +++ b/byterun/callback.c @@ -40,7 +40,7 @@ static int callback_code_threaded = 0; static void thread_callback(void) { - thread_code(callback_code, sizeof(callback_code)); + caml_thread_code(callback_code, sizeof(callback_code)); callback_code_threaded = 1; } @@ -196,7 +196,7 @@ CAMLprim value caml_register_named_value(value vname, value val) nv->val = val; nv->next = named_value_table[h]; named_value_table[h] = nv; - register_global_root(&nv->val); + caml_register_global_root(&nv->val); return Val_unit; } diff --git a/byterun/compact.c b/byterun/compact.c index a72db880d..b0b39b601 100644 --- a/byterun/compact.c +++ b/byterun/compact.c @@ -42,7 +42,7 @@ extern void caml_shrink_heap (char *); /* memory.c */ XXX Should be fixed: XXX The above assumes that all roots are aligned on a 4-byte boundary, XXX which is not always guaranteed by C. - XXX (see [register_global_roots] and [caml_init_exceptions]) + XXX (see [caml_register_global_roots] and [caml_init_exceptions]) XXX Should be able to fix it to only assume 2-byte alignment. */ #define Make_ehd(s,t,c) (((s) << 10) | (t) << 2 | (c)) @@ -151,7 +151,7 @@ void caml_compact_heap (void) caml_gc_message (0x10, "Compacting heap...\n", 0); #ifdef DEBUG - heap_check (); + caml_heap_check (); #endif /* First pass: encode all noninfix headers. */ @@ -187,7 +187,7 @@ void caml_compact_heap (void) data structures to find its roots. Fortunately, it doesn't need the headers (see above). */ caml_do_roots (invert_root); - final_do_weak_roots (invert_root); + caml_final_do_weak_roots (invert_root); ch = caml_heap_start; while (ch != NULL){ @@ -380,16 +380,16 @@ void caml_compact_heap (void) /* Rebuild the free list. */ { ch = caml_heap_start; - fl_reset (); + caml_fl_reset (); while (ch != NULL){ if (Chunk_size (ch) > Chunk_alloc (ch)){ - make_free_blocks ((value *) (ch + Chunk_alloc (ch)), - Wsize_bsize (Chunk_size (ch) - Chunk_alloc (ch)), 1); + caml_make_free_blocks ((value *) (ch + Chunk_alloc (ch)), + Wsize_bsize (Chunk_size(ch)-Chunk_alloc(ch)), 1); } ch = Chunk_next (ch); } } - ++ stat_compactions; + ++ caml_stat_compactions; caml_gc_message (0x10, "done.\n", 0); } @@ -398,24 +398,25 @@ unsigned long caml_percent_max; /* used in gc_ctrl.c */ void caml_compact_heap_maybe (void) { /* Estimated free words in the heap: - FW = fl_size_at_change + 3 * (fl_cur_size - fl_size_at_change) - FW = 3 * fl_cur_size - 2 * fl_size_at_change - Estimated live words: LW = stat_heap_size - FW + FW = fl_size_at_change + 3 * (caml_fl_cur_size + - caml_fl_size_at_phase_change) + FW = 3 * caml_fl_cur_size - 2 * caml_fl_size_at_phase_change + Estimated live words: LW = caml_stat_heap_size - FW Estimated free percentage: FP = 100 * FW / LW We compact the heap if FP > caml_percent_max */ float fw, fp; Assert (caml_gc_phase == Phase_idle); if (caml_percent_max >= 1000000) return; - if (stat_major_collections < 5 || stat_heap_chunks < 5) return; + if (caml_stat_major_collections < 5 || caml_stat_heap_chunks < 5) return; - fw = 3.0 * fl_cur_size - 2.0 * caml_fl_size_at_phase_change; - if (fw < 0) fw = fl_cur_size; + fw = 3.0 * caml_fl_cur_size - 2.0 * caml_fl_size_at_phase_change; + if (fw < 0) fw = caml_fl_cur_size; - if (fw >= Wsize_bsize (stat_heap_size)){ + if (fw >= Wsize_bsize (caml_stat_heap_size)){ fp = 1000000.0; }else{ - fp = 100.0 * fw / (Wsize_bsize (stat_heap_size) - fw); + fp = 100.0 * fw / (Wsize_bsize (caml_stat_heap_size) - fw); if (fp > 1000000.0) fp = 1000000.0; } caml_gc_message (0x200, "FL size at phase change = %lu\n", @@ -426,8 +427,8 @@ void caml_compact_heap_maybe (void) caml_finish_major_cycle (); /* We just did a complete GC, so we can measure the overhead exactly. */ - fw = fl_cur_size; - fp = 100.0 * fw / (Wsize_bsize (stat_heap_size) - fw); + fw = caml_fl_cur_size; + fp = 100.0 * fw / (Wsize_bsize (caml_stat_heap_size) - fw); caml_gc_message (0x200, "Measured overhead: %lu%%\n", (unsigned long) fp); caml_compact_heap (); diff --git a/byterun/compatibility.h b/byterun/compatibility.h index 82f14303e..1ff7743ab 100644 --- a/byterun/compatibility.h +++ b/byterun/compatibility.h @@ -26,6 +26,11 @@ g --> ident global C */ +/* FIXME a faire: + system__frametable dans .s + supprimer lazy_is_forward dans obj.c +*/ + /* **** alloc.c */ #define alloc caml_alloc #define alloc_small caml_alloc_small @@ -144,7 +149,7 @@ #define raise_with_string caml_raise_with_string #define failwith caml_failwith #define invalid_argument caml_invalid_argument -/*#define array_bound_error caml_array_bound_error FIXME */ +#define array_bound_error caml_array_bound_error #define raise_out_of_memory caml_raise_out_of_memory #define raise_stack_overflow caml_raise_stack_overflow #define raise_sys_error caml_raise_sys_error @@ -154,30 +159,122 @@ #define raise_sys_blocked_io caml_raise_sys_blocked_io #define init_exceptions caml_init_exceptions /* **** asmrun/fail.c */ -/* g Out_of_memory -> caml_Out_of_memory FIXME a faire */ -/* g Sys_error -> caml_Sys_error FIXME a faire */ -/* g Failure -> caml_Failure FIXME a faire */ -/* g Invalid_argument -> caml_Invalid_argument FIXME a faire */ -/* g End_of_file -> caml_End_of_file FIXME a faire */ -/* g Division_by_zero -> caml_Division_by_zero FIXME a faire */ -/* g Not_found -> caml_Not_found FIXME a faire */ -/* g Match_failure -> caml_Match_failure FIXME a faire */ -/* g Sys_blocked_io -> caml_Sys_blocked_io FIXME a faire */ -/* g Stack_overflow -> caml_Stack_overflow FIXME a faire */ -/* g bucket_Out_of_memory -> caml_bucket_Out_of_memory FIXME pkoi extern? */ -/* g bucket_Stack_overflow -> caml_bucket_Stack_overflow FIXME idem */ /* g raise_caml_exception -> caml_raise_exception */ /* **** asmrun/.s */ /* g caml_array_bound_error -> caml_ml_array_bound_error */ /* **** finalise.c */ +/* g final_update -> caml_final_update */ +/* g final_do_calls -> caml_final_do_calls */ +/* g final_do_strong_roots -> caml_final_do_strong_roots */ +/* g final_do_weak_roots -> caml_final_do_weak_roots */ +/* g final_do_young_roots -> caml_final_do_young_roots */ +/* g final_empty_young -> caml_final_empty_young */ +/* final_register -> caml_final_register */ + /* **** fix_code.c */ +/* g start_code -> caml_start_code */ +/* g code_size -> caml_code_size */ +/* g saved_code -> caml_saved_code */ +/* g code_md5 -> caml_code_md5 */ +/* g load_code -> caml_load_code */ +/* g fixup_endianness -> caml_fixup_endianness */ +/* g instr_table -> caml_instr_table */ +/* g instr_base -> caml_instr_base */ +/* g thread_code -> caml_thread_code */ +/* g set_instruction -> caml_set_instruction */ +/* g is_instruction -> caml_is_instruction */ + /* **** floats.c */ +/*#define Double_val caml_Double_val done as needed in mlvalues.h */ +/*#define Store_double_val caml_Store_double_val done as needed in mlvalues.h */ +#define copy_double caml_copy_double +/* format_float -> caml_format_float */ +/* float_of_string -> caml_float_of_string */ +/* int_of_float -> caml_int_of_float */ +/* float_of_int -> caml_float_of_int */ +/* neg_float -> caml_neg_float */ +/* abs_float -> caml_abs_float */ +/* add_float -> caml_add_float */ +/* sub_float -> caml_sub_float */ +/* mul_float -> caml_mul_float */ +/* div_float -> caml_div_float */ +/* exp_float -> caml_exp_float */ +/* floor_float -> caml_floor_float */ +/* fmod_float -> caml_fmod_float */ +/* frexp_float -> caml_frexp_float */ +/* ldexp_float -> caml_ldexp_float */ +/* log_float -> caml_log_float */ +/* log10_float -> caml_log10_float */ +/* modf_float -> caml_modf_float */ +/* sqrt_float -> caml_sqrt_float */ +/* power_float -> caml_power_float */ +/* sin_float -> caml_sin_float */ +/* sinh_float -> caml_sinh_float */ +/* cos_float -> caml_cos_float */ +/* cosh_float -> caml_cosh_float */ +/* tan_float -> caml_tan_float */ +/* tanh_float -> caml_tanh_float */ +/* asin_float -> caml_asin_float */ +/* acos_float -> caml_acos_float */ +/* atan_float -> caml_atan_float */ +/* atan2_float -> caml_atan2_float */ +/* ceil_float -> caml_ceil_float */ +/* eq_float -> caml_eq_float */ +/* neq_float -> caml_neq_float */ +/* le_float -> caml_le_float */ +/* lt_float -> caml_lt_float */ +/* ge_float -> caml_ge_float */ +/* gt_float -> caml_gt_float */ +/* float_compare -> caml_float_compare */ +/* classify_float -> caml_classify_float */ +/* init_ieee_float -> caml_init_ieee_float */ + /* **** freelist.c */ +/* g fl_merge -> caml_fl_merge */ +/* g fl_cur_size -> caml_fl_cur_size */ +/* fl_check *** devient static */ +/* g fl_allocate -> caml_fl_allocate */ +/* g fl_init_merge -> caml_fl_init_merge */ +/* g fl_reset -> caml_fl_reset */ +/* g fl_merge_block -> caml_fl_merge_block */ +/* g fl_add_block -> caml_fl_add_block */ +/* g make_free_blocks -> caml_make_free_blocks */ + /* **** gc_ctrl.c */ +/* g stat_minor_words -> caml_stat_minor_words */ +/* g stat_promoted_words -> caml_stat_promoted_words */ +/* g stat_major-words -> caml_stat_major_words */ +/* g stat_minor_collections -> caml_stat_minor_collections */ +/* g stat_major_collections -> caml_stat_major_collections */ +/* g stat_heap_size -> caml_stat_heap_size */ +/* g stat_top_heap_size -> caml_stat_top_heap_size */ +/* g stat_compactions -> caml_stat_compactions */ +/* g stat_heap_chunks -> caml_stat_heap_chunks */ +/* g heap_check -> caml_heap_check */ +/* gc_stat -> caml_gc_stat */ +/* gc_counters -> caml_gc_counters */ +/* gc_get -> caml_gc_get */ +/* gc_set -> caml_gc_set */ +/* gc_minor -> caml_gc_minor */ +/* gc_major -> caml_gc_major */ +/* gc_full_major -> caml_gc_full_major */ +/* gc_major_slice -> caml_gc_major_slice */ +/* gc_compaction -> caml_gc_compaction */ + /* **** globroots.c */ +#define register_global_root caml_register_global_root /* FIXME extern/export */ +#define remove_global_root caml_remove_global_root /* FIXME extern sans export*/ + /* **** hash.c */ +/* hash_univ_param -> caml_hash_univ_param */ +#define hash_variant caml_hash_variant */ + /* **** instrtrace.c */ +/* g icount -> caml_icount */ +/* g stop_here -> caml_stop_here */ +/* g trace_flag -> caml_trace_flag */ +/* g disasm_instr -> caml_disasm_instr */ /* **** intern.c */ /* g input_val -> caml_input_val */ @@ -504,6 +601,11 @@ /* g read_section_descriptors -> caml_read_section_descriptors */ /* g seek_optional_section -> caml_seek_optional_section */ /* g seek_section -> caml_seek_section */ +/* **** asmrun/startup.c */ +/* g static_data_start -> caml_static_data_start */ +/* g static_data_end -> caml_static_data_end */ +/* g code_area_start -> caml_code_area_start */ +/* g code_area_end -> caml_code_area_end */ /* **** str.c */ #define string_length caml_string_length diff --git a/byterun/debugger.c b/byterun/debugger.c index 007078a7b..41ab84544 100644 --- a/byterun/debugger.c +++ b/byterun/debugger.c @@ -202,7 +202,7 @@ void caml_debugger(enum event_kind event) caml_putword(dbg_out, caml_event_count); if (event == EVENT_COUNT || event == BREAKPOINT) { caml_putword(dbg_out, caml_stack_high - frame); - caml_putword(dbg_out, (Pc(frame) - start_code) * sizeof(opcode_t)); + caml_putword(dbg_out, (Pc(frame) - caml_start_code) * sizeof(opcode_t)); } else { /* No PC and no stack frame associated with other events */ caml_putword(dbg_out, 0); @@ -218,21 +218,21 @@ void caml_debugger(enum event_kind event) case REQ_SET_EVENT: pos = caml_getword(dbg_in); Assert (pos >= 0); - Assert (pos < code_size); - set_instruction(start_code + pos / sizeof(opcode_t), EVENT); + Assert (pos < caml_code_size); + caml_set_instruction(caml_start_code + pos / sizeof(opcode_t), EVENT); break; case REQ_SET_BREAKPOINT: pos = caml_getword(dbg_in); Assert (pos >= 0); - Assert (pos < code_size); - set_instruction(start_code + pos / sizeof(opcode_t), BREAK); + Assert (pos < caml_code_size); + caml_set_instruction(caml_start_code + pos / sizeof(opcode_t), BREAK); break; case REQ_RESET_INSTR: pos = caml_getword(dbg_in); Assert (pos >= 0); - Assert (pos < code_size); + Assert (pos < caml_code_size); pos = pos / sizeof(opcode_t); - set_instruction(start_code + pos, saved_code[pos]); + caml_set_instruction(caml_start_code + pos, caml_saved_code[pos]); break; case REQ_CHECKPOINT: i = fork(); @@ -259,7 +259,7 @@ void caml_debugger(enum event_kind event) case REQ_GET_FRAME: caml_putword(dbg_out, caml_stack_high - frame); if (frame < caml_stack_high){ - caml_putword(dbg_out, (Pc(frame) - start_code) * sizeof(opcode_t)); + caml_putword(dbg_out, (Pc(frame) - caml_start_code) * sizeof(opcode_t)); }else{ caml_putword (dbg_out, 0); } @@ -276,7 +276,7 @@ void caml_debugger(enum event_kind event) } else { frame += Extra_args(frame) + i + 3; caml_putword(dbg_out, caml_stack_high - frame); - caml_putword(dbg_out, (Pc(frame) - start_code) * sizeof(opcode_t)); + caml_putword(dbg_out, (Pc(frame) - caml_start_code) * sizeof(opcode_t)); } caml_flush(dbg_out); break; @@ -328,7 +328,7 @@ void caml_debugger(enum event_kind event) break; case REQ_GET_CLOSURE_CODE: val = getval(dbg_in); - caml_putword(dbg_out, (Code_val(val) - start_code) * sizeof(opcode_t)); + caml_putword(dbg_out, (Code_val(val)-caml_start_code) * sizeof(opcode_t)); caml_flush(dbg_out); break; } diff --git a/byterun/extern.c b/byterun/extern.c index 434412b3d..2faeb9e85 100644 --- a/byterun/extern.c +++ b/byterun/extern.c @@ -376,10 +376,10 @@ static void extern_rec(value v) } return; } - if ((char *) v >= code_area_start && (char *) v < code_area_end) { + if ((char *) v >= caml_code_area_start && (char *) v < caml_code_area_end) { if (!extern_closures) extern_invalid_argument("output_value: functional value"); - writecode32(CODE_CODEPOINTER, (char *) v - code_area_start); + writecode32(CODE_CODEPOINTER, (char *) v - caml_code_area_start); writeblock((char *) caml_code_checksum(), 16); return; } diff --git a/byterun/fail.c b/byterun/fail.c index 67d53e9d0..a814b27f7 100644 --- a/byterun/fail.c +++ b/byterun/fail.c @@ -81,7 +81,7 @@ CAMLexport void caml_invalid_argument (char *msg) caml_raise_with_string(Field(caml_global_data, INVALID_EXN), msg); } -CAMLexport void array_bound_error(void) +CAMLexport void caml_array_bound_error(void) { caml_invalid_argument("index out of bounds"); } @@ -139,5 +139,5 @@ void caml_init_exceptions(void) { out_of_memory_bucket.hdr = Make_header(1, 0, Caml_white); out_of_memory_bucket.exn = Field(caml_global_data, OUT_OF_MEMORY_EXN); - register_global_root(&out_of_memory_bucket.exn); + caml_register_global_root(&out_of_memory_bucket.exn); } diff --git a/byterun/fail.h b/byterun/fail.h index 5317b3304..47df947c5 100644 --- a/byterun/fail.h +++ b/byterun/fail.h @@ -70,7 +70,7 @@ CAMLextern void caml_raise_end_of_file (void) Noreturn; CAMLextern void caml_raise_zero_divide (void) Noreturn; CAMLextern void caml_raise_not_found (void) Noreturn; CAMLextern void caml_init_exceptions (void); -CAMLextern void array_bound_error (void) Noreturn; +CAMLextern void caml_array_bound_error (void) Noreturn; CAMLextern void caml_raise_sys_blocked_io (void) Noreturn; #endif /* CAML_FAIL_H */ diff --git a/byterun/finalise.c b/byterun/finalise.c index ee8e5aea5..6b955d9c5 100644 --- a/byterun/finalise.c +++ b/byterun/finalise.c @@ -38,7 +38,7 @@ static unsigned long old = 0, young = 0, active = 0, size = 0; finalising set. The recent set is empty. */ -void final_update (void) +void caml_final_update (void) { unsigned long i; unsigned long oldactive = active; @@ -78,7 +78,7 @@ void final_update (void) /* Call the finalisation functions for the finalising set. Note that this function must be reentrant. */ -void final_do_calls (void) +void caml_final_do_calls (void) { struct final f; @@ -102,7 +102,7 @@ void final_do_calls (void) This is called by the major GC and the compactor through [caml_darken_all_roots]. */ -void final_do_strong_roots (scanning_action f) +void caml_final_do_strong_roots (scanning_action f) { unsigned long i; @@ -120,7 +120,7 @@ void final_do_strong_roots (scanning_action f) The recent set is empty. This is called directly by the compactor. */ -void final_do_weak_roots (scanning_action f) +void caml_final_do_weak_roots (scanning_action f) { unsigned long i; @@ -131,7 +131,7 @@ void final_do_weak_roots (scanning_action f) /* Call [*f] on the closures and values of the recent set. This is called by the minor GC through [caml_oldify_local_roots]. */ -void final_do_young_roots (scanning_action f) +void caml_final_do_young_roots (scanning_action f) { unsigned long i; @@ -146,13 +146,13 @@ void final_do_young_roots (scanning_action f) This is called at the end of each minor collection. The minor heap must be empty when this is called. */ -void final_empty_young (void) +void caml_final_empty_young (void) { old = young; } /* Put (f,v) in the recent set. */ -CAMLprim value final_register (value f, value v) +CAMLprim value caml_final_register (value f, value v) { if (!(Is_block (v) && (Is_in_heap (v) || Is_young (v)))){ caml_invalid_argument ("Gc.finalise"); diff --git a/byterun/finalise.h b/byterun/finalise.h index ca9cc2951..ec656f4f4 100644 --- a/byterun/finalise.h +++ b/byterun/finalise.h @@ -18,12 +18,12 @@ #include "roots.h" -void final_update (void); -void final_do_calls (void); -void final_do_strong_roots (scanning_action f); -void final_do_weak_roots (scanning_action f); -void final_do_young_roots (scanning_action f); -void final_empty_young (void); -value final_register (value f, value v); +void caml_final_update (void); +void caml_final_do_calls (void); +void caml_final_do_strong_roots (scanning_action f); +void caml_final_do_weak_roots (scanning_action f); +void caml_final_do_young_roots (scanning_action f); +void caml_final_empty_young (void); +value caml_final_register (value f, value v); #endif /* CAML_FINALISE_H */ diff --git a/byterun/fix_code.c b/byterun/fix_code.c index 19c54c7f1..470ae825e 100644 --- a/byterun/fix_code.c +++ b/byterun/fix_code.c @@ -30,38 +30,38 @@ #include "mlvalues.h" #include "reverse.h" -code_t start_code; -asize_t code_size; -unsigned char * saved_code; -unsigned char code_md5[16]; +code_t caml_start_code; +asize_t caml_code_size; +unsigned char * caml_saved_code; +unsigned char caml_code_md5[16]; /* Read the main bytecode block from a file */ -void load_code(int fd, asize_t len) +void caml_load_code(int fd, asize_t len) { int i; struct MD5Context ctx; - code_size = len; - start_code = (code_t) caml_stat_alloc(code_size); - if (read(fd, (char *) start_code, code_size) != code_size) + caml_code_size = len; + caml_start_code = (code_t) caml_stat_alloc(caml_code_size); + if (read(fd, (char *) caml_start_code, caml_code_size) != caml_code_size) caml_fatal_error("Fatal error: truncated bytecode file.\n"); caml_MD5Init(&ctx); - caml_MD5Update(&ctx, (unsigned char *) start_code, code_size); - caml_MD5Final(code_md5, &ctx); + caml_MD5Update(&ctx, (unsigned char *) caml_start_code, caml_code_size); + caml_MD5Final(caml_code_md5, &ctx); #ifdef ARCH_BIG_ENDIAN - fixup_endianness(start_code, code_size); + caml_fixup_endianness(caml_start_code, caml_code_size); #endif if (caml_debugger_in_use) { len /= sizeof(opcode_t); - saved_code = (unsigned char *) caml_stat_alloc(len); - for (i = 0; i < len; i++) saved_code[i] = start_code[i]; + caml_saved_code = (unsigned char *) caml_stat_alloc(len); + for (i = 0; i < len; i++) caml_saved_code[i] = caml_start_code[i]; } #ifdef THREADED_CODE /* Better to thread now than at the beginning of [caml_interprete], since the debugger interface needs to perform SET_EVENT requests on the code. */ - thread_code(start_code, code_size); + caml_thread_code(caml_start_code, caml_code_size); #endif } @@ -69,7 +69,7 @@ void load_code(int fd, asize_t len) #ifdef ARCH_BIG_ENDIAN -void fixup_endianness(code_t code, asize_t len) +void caml_fixup_endianness(code_t code, asize_t len) { code_t p; len /= sizeof(opcode_t); @@ -84,10 +84,10 @@ void fixup_endianness(code_t code, asize_t len) #ifdef THREADED_CODE -char ** instr_table; -char * instr_base; +char ** caml_instr_table; +char * caml_instr_base; -void thread_code (code_t code, asize_t len) +void caml_thread_code (code_t code, asize_t len) { code_t p; int l [STOP + 1]; @@ -124,7 +124,7 @@ void thread_code (code_t code, asize_t len) */ instr = STOP; } - *p++ = (opcode_t)(instr_table[instr] - instr_base); + *p++ = (opcode_t)(caml_instr_table[instr] - caml_instr_base); if (instr == SWITCH) { uint32 sizes = *p++; uint32 const_size = sizes & 0xFFFF; @@ -143,19 +143,19 @@ void thread_code (code_t code, asize_t len) #endif /* THREADED_CODE */ -void set_instruction(code_t pos, opcode_t instr) +void caml_set_instruction(code_t pos, opcode_t instr) { #ifdef THREADED_CODE - *pos = (opcode_t)(instr_table[instr] - instr_base); + *pos = (opcode_t)(caml_instr_table[instr] - caml_instr_base); #else *pos = instr; #endif } -int is_instruction(opcode_t instr1, opcode_t instr2) +int caml_is_instruction(opcode_t instr1, opcode_t instr2) { #ifdef THREADED_CODE - return instr1 == (opcode_t)(instr_table[instr2] - instr_base); + return instr1 == (opcode_t)(caml_instr_table[instr2] - caml_instr_base); #else return instr1 == instr2; #endif diff --git a/byterun/fix_code.h b/byterun/fix_code.h index 0caab959a..f6e9e3b77 100644 --- a/byterun/fix_code.h +++ b/byterun/fix_code.h @@ -23,20 +23,20 @@ #include "misc.h" #include "mlvalues.h" -extern code_t start_code; -extern asize_t code_size; -extern unsigned char * saved_code; -extern unsigned char code_md5[16]; +extern code_t caml_start_code; +extern asize_t caml_code_size; +extern unsigned char * caml_saved_code; +extern unsigned char caml_code_md5[16]; -void load_code (int fd, asize_t len); -void fixup_endianness (code_t code, asize_t len); -void set_instruction (code_t pos, opcode_t instr); -int is_instruction (opcode_t instr1, opcode_t instr2); +void caml_load_code (int fd, asize_t len); +void caml_fixup_endianness (code_t code, asize_t len); +void caml_set_instruction (code_t pos, opcode_t instr); +int caml_is_instruction (opcode_t instr1, opcode_t instr2); #ifdef THREADED_CODE -extern char ** instr_table; -extern char * instr_base; -void thread_code (code_t code, asize_t len); +extern char ** caml_instr_table; +extern char * caml_instr_base; +void caml_thread_code (code_t code, asize_t len); #endif #endif /* CAML_FIX_CODE_H */ diff --git a/byterun/floats.c b/byterun/floats.c index a81f83e1d..00270e4cb 100644 --- a/byterun/floats.c +++ b/byterun/floats.c @@ -30,7 +30,7 @@ #ifdef ARCH_ALIGN_DOUBLE -CAMLexport double Double_val(value val) +CAMLexport double caml_Double_val(value val) { union { value v[2]; double d; } buffer; @@ -40,7 +40,7 @@ CAMLexport double Double_val(value val) return buffer.d; } -CAMLexport void Store_double_val(value val, double dbl) +CAMLexport void caml_Store_double_val(value val, double dbl) { union { value v[2]; double d; } buffer; @@ -52,7 +52,7 @@ CAMLexport void Store_double_val(value val, double dbl) #endif -CAMLexport value copy_double(double d) +CAMLexport value caml_copy_double(double d) { value res; @@ -65,7 +65,7 @@ CAMLexport value copy_double(double d) return res; } -CAMLprim value format_float(value fmt, value arg) +CAMLprim value caml_format_float(value fmt, value arg) { #define MAX_DIGITS 350 /* Max number of decimal digits in a "natural" (not artificially padded) @@ -106,7 +106,7 @@ CAMLprim value format_float(value fmt, value arg) return res; } -CAMLprim value float_of_string(value vs) +CAMLprim value caml_float_of_string(value vs) { char parse_buffer[64]; char * buf, * src, * dst, * end; @@ -126,93 +126,93 @@ CAMLprim value float_of_string(value vs) d = strtod((const char *) buf, &end); if (buf != parse_buffer) caml_stat_free(buf); if (end != dst) caml_failwith("float_of_string"); - return copy_double(d); + return caml_copy_double(d); } -CAMLprim value int_of_float(value f) +CAMLprim value caml_int_of_float(value f) { return Val_long((long) Double_val(f)); } -CAMLprim value float_of_int(value n) +CAMLprim value caml_float_of_int(value n) { - return copy_double((double) Long_val(n)); + return caml_copy_double((double) Long_val(n)); } -CAMLprim value neg_float(value f) +CAMLprim value caml_neg_float(value f) { - return copy_double(- Double_val(f)); + return caml_copy_double(- Double_val(f)); } -CAMLprim value abs_float(value f) +CAMLprim value caml_abs_float(value f) { - return copy_double(fabs(Double_val(f))); + return caml_copy_double(fabs(Double_val(f))); } -CAMLprim value add_float(value f, value g) +CAMLprim value caml_add_float(value f, value g) { - return copy_double(Double_val(f) + Double_val(g)); + return caml_copy_double(Double_val(f) + Double_val(g)); } -CAMLprim value sub_float(value f, value g) +CAMLprim value caml_sub_float(value f, value g) { - return copy_double(Double_val(f) - Double_val(g)); + return caml_copy_double(Double_val(f) - Double_val(g)); } -CAMLprim value mul_float(value f, value g) +CAMLprim value caml_mul_float(value f, value g) { - return copy_double(Double_val(f) * Double_val(g)); + return caml_copy_double(Double_val(f) * Double_val(g)); } -CAMLprim value div_float(value f, value g) +CAMLprim value caml_div_float(value f, value g) { - return copy_double(Double_val(f) / Double_val(g)); + return caml_copy_double(Double_val(f) / Double_val(g)); } -CAMLprim value exp_float(value f) +CAMLprim value caml_exp_float(value f) { - return copy_double(exp(Double_val(f))); + return caml_copy_double(exp(Double_val(f))); } -CAMLprim value floor_float(value f) +CAMLprim value caml_floor_float(value f) { - return copy_double(floor(Double_val(f))); + return caml_copy_double(floor(Double_val(f))); } -CAMLprim value fmod_float(value f1, value f2) +CAMLprim value caml_fmod_float(value f1, value f2) { - return copy_double(fmod(Double_val(f1), Double_val(f2))); + return caml_copy_double(fmod(Double_val(f1), Double_val(f2))); } -CAMLprim value frexp_float(value f) +CAMLprim value caml_frexp_float(value f) { CAMLparam1 (f); CAMLlocal2 (res, mantissa); int exponent; - mantissa = copy_double(frexp (Double_val(f), &exponent)); + mantissa = caml_copy_double(frexp (Double_val(f), &exponent)); res = caml_alloc_tuple(2); Field(res, 0) = mantissa; Field(res, 1) = Val_int(exponent); CAMLreturn (res); } -CAMLprim value ldexp_float(value f, value i) +CAMLprim value caml_ldexp_float(value f, value i) { - return copy_double(ldexp(Double_val(f), Int_val(i))); + return caml_copy_double(ldexp(Double_val(f), Int_val(i))); } -CAMLprim value log_float(value f) +CAMLprim value caml_log_float(value f) { - return copy_double(log(Double_val(f))); + return caml_copy_double(log(Double_val(f))); } -CAMLprim value log10_float(value f) +CAMLprim value caml_log10_float(value f) { - return copy_double(log10(Double_val(f))); + return caml_copy_double(log10(Double_val(f))); } -CAMLprim value modf_float(value f) +CAMLprim value caml_modf_float(value f) { #if __SC__ _float_eval frem; /* Problem with Apple's */ @@ -222,110 +222,110 @@ CAMLprim value modf_float(value f) CAMLparam1 (f); CAMLlocal3 (res, quo, rem); - quo = copy_double(modf (Double_val(f), &frem)); - rem = copy_double(frem); + quo = caml_copy_double(modf (Double_val(f), &frem)); + rem = caml_copy_double(frem); res = caml_alloc_tuple(2); Field(res, 0) = quo; Field(res, 1) = rem; CAMLreturn (res); } -CAMLprim value sqrt_float(value f) +CAMLprim value caml_sqrt_float(value f) { - return copy_double(sqrt(Double_val(f))); + return caml_copy_double(sqrt(Double_val(f))); } -CAMLprim value power_float(value f, value g) +CAMLprim value caml_power_float(value f, value g) { - return copy_double(pow(Double_val(f), Double_val(g))); + return caml_copy_double(pow(Double_val(f), Double_val(g))); } -CAMLprim value sin_float(value f) +CAMLprim value caml_sin_float(value f) { - return copy_double(sin(Double_val(f))); + return caml_copy_double(sin(Double_val(f))); } -CAMLprim value sinh_float(value f) +CAMLprim value caml_sinh_float(value f) { - return copy_double(sinh(Double_val(f))); + return caml_copy_double(sinh(Double_val(f))); } -CAMLprim value cos_float(value f) +CAMLprim value caml_cos_float(value f) { - return copy_double(cos(Double_val(f))); + return caml_copy_double(cos(Double_val(f))); } -CAMLprim value cosh_float(value f) +CAMLprim value caml_cosh_float(value f) { - return copy_double(cosh(Double_val(f))); + return caml_copy_double(cosh(Double_val(f))); } -CAMLprim value tan_float(value f) +CAMLprim value caml_tan_float(value f) { - return copy_double(tan(Double_val(f))); + return caml_copy_double(tan(Double_val(f))); } -CAMLprim value tanh_float(value f) +CAMLprim value caml_tanh_float(value f) { - return copy_double(tanh(Double_val(f))); + return caml_copy_double(tanh(Double_val(f))); } -CAMLprim value asin_float(value f) +CAMLprim value caml_asin_float(value f) { - return copy_double(asin(Double_val(f))); + return caml_copy_double(asin(Double_val(f))); } -CAMLprim value acos_float(value f) +CAMLprim value caml_acos_float(value f) { - return copy_double(acos(Double_val(f))); + return caml_copy_double(acos(Double_val(f))); } -CAMLprim value atan_float(value f) +CAMLprim value caml_atan_float(value f) { - return copy_double(atan(Double_val(f))); + return caml_copy_double(atan(Double_val(f))); } -CAMLprim value atan2_float(value f, value g) +CAMLprim value caml_atan2_float(value f, value g) { - return copy_double(atan2(Double_val(f), Double_val(g))); + return caml_copy_double(atan2(Double_val(f), Double_val(g))); } -CAMLprim value ceil_float(value f) +CAMLprim value caml_ceil_float(value f) { - return copy_double(ceil(Double_val(f))); + return caml_copy_double(ceil(Double_val(f))); } -CAMLprim value eq_float(value f, value g) +CAMLprim value caml_eq_float(value f, value g) { return Val_bool(Double_val(f) == Double_val(g)); } -CAMLprim value neq_float(value f, value g) +CAMLprim value caml_neq_float(value f, value g) { return Val_bool(Double_val(f) != Double_val(g)); } -CAMLprim value le_float(value f, value g) +CAMLprim value caml_le_float(value f, value g) { return Val_bool(Double_val(f) <= Double_val(g)); } -CAMLprim value lt_float(value f, value g) +CAMLprim value caml_lt_float(value f, value g) { return Val_bool(Double_val(f) < Double_val(g)); } -CAMLprim value ge_float(value f, value g) +CAMLprim value caml_ge_float(value f, value g) { return Val_bool(Double_val(f) >= Double_val(g)); } -CAMLprim value gt_float(value f, value g) +CAMLprim value caml_gt_float(value f, value g) { return Val_bool(Double_val(f) > Double_val(g)); } -CAMLprim value float_compare(value vf, value vg) +CAMLprim value caml_float_compare(value vf, value vg) { double f = Double_val(vf); double g = Double_val(vg); @@ -341,7 +341,7 @@ CAMLprim value float_compare(value vf, value vg) enum { FP_normal, FP_subnormal, FP_zero, FP_infinite, FP_nan }; -CAMLprim value classify_float(value vd) +CAMLprim value caml_classify_float(value vd) { /* Cygwin 1.3 has problems with fpclassify (PR#1293), so don't use it */ #if defined(fpclassify) && !defined(__CYGWIN32__) && !defined(__MINGW32__) @@ -383,7 +383,7 @@ CAMLprim value classify_float(value vd) #endif } -/* The init_ieee_float function should initialize floating-point hardware +/* The [caml_init_ieee_float] function should initialize floating-point hardware so that it behaves as much as possible like the IEEE standard. In particular, return special numbers like Infinity and NaN instead of signalling exceptions. Currently, everyone is in IEEE mode @@ -396,7 +396,7 @@ CAMLprim value classify_float(value vd) #endif #endif -void init_ieee_floats(void) +void caml_init_ieee_floats(void) { #if defined(__FreeBSD__) && (__FreeBSD_version < 400017) fpsetmask(0); diff --git a/byterun/freelist.c b/byterun/freelist.c index d359db591..00b095e96 100644 --- a/byterun/freelist.c +++ b/byterun/freelist.c @@ -23,7 +23,7 @@ /* The free-list is kept sorted by increasing addresses. This makes the merging of adjacent free blocks possible. - (See [fl_merge_block].) + (See [caml_fl_merge_block].) */ typedef struct { @@ -42,16 +42,16 @@ static struct { #define Fl_head ((char *) (&(sentinel.first_bp))) static char *fl_prev = Fl_head; /* Current allocation pointer. */ static char *fl_last = NULL; /* Last block in the list. Only valid - just after fl_allocate returned NULL. */ -char *fl_merge = Fl_head; /* Current insertion pointer. Managed + just after [caml_fl_allocate] returns NULL. */ +char *caml_fl_merge = Fl_head; /* Current insertion pointer. Managed jointly with [sweep_slice]. */ -asize_t fl_cur_size = 0; /* Number of words in the free list, +asize_t caml_fl_cur_size = 0; /* Number of words in the free list, including headers but not fragments. */ #define Next(b) (((block *) (b))->next_bp) #ifdef DEBUG -void fl_check (void) +static void fl_check (void) { char *cur, *prev; int prev_found = 0, merge_found = 0; @@ -63,17 +63,17 @@ void fl_check (void) size_found += Whsize_bp (cur); Assert (Is_in_heap (cur)); if (cur == fl_prev) prev_found = 1; - if (cur == fl_merge) merge_found = 1; + if (cur == caml_fl_merge) merge_found = 1; prev = cur; cur = Next (prev); } Assert (prev_found || fl_prev == Fl_head); - Assert (merge_found || fl_merge == Fl_head); - Assert (size_found == fl_cur_size); + Assert (merge_found || caml_fl_merge == Fl_head); + Assert (size_found == caml_fl_cur_size); } #endif -/* [allocate_block] is called by [fl_allocate]. Given a suitable free +/* [allocate_block] is called by [caml_fl_allocate]. Given a suitable free block and the desired size, it allocates a new block from the free block. There are three cases: 0. The free block has the desired size. Detach the block from the @@ -92,30 +92,30 @@ static char *allocate_block (mlsize_t wh_sz, char *prev, char *cur) header_t h = Hd_bp (cur); Assert (Whsize_hd (h) >= wh_sz); if (Wosize_hd (h) < wh_sz + 1){ /* Cases 0 and 1. */ - fl_cur_size -= Whsize_hd (h); + caml_fl_cur_size -= Whsize_hd (h); Next (prev) = Next (cur); Assert (Is_in_heap (Next (prev)) || Next (prev) == NULL); - if (fl_merge == cur) fl_merge = prev; + if (caml_fl_merge == cur) caml_fl_merge = prev; #ifdef DEBUG fl_last = NULL; #endif /* In case 1, the following creates the empty block correctly. In case 0, it gives an invalid header to the block. The function - calling [fl_allocate] will overwrite it. */ + calling [caml_fl_allocate] will overwrite it. */ Hd_op (cur) = Make_header (0, 0, Caml_white); }else{ /* Case 2. */ - fl_cur_size -= wh_sz; + caml_fl_cur_size -= wh_sz; Hd_op (cur) = Make_header (Wosize_hd (h) - wh_sz, 0, Caml_blue); } fl_prev = prev; return cur + Bosize_hd (h) - Bsize_wsize (wh_sz); } -/* [fl_allocate] does not set the header of the newly allocated block. +/* [caml_fl_allocate] does not set the header of the newly allocated block. The calling function must do it before any GC function gets called. - [fl_allocate] returns a head pointer. + [caml_fl_allocate] returns a head pointer. */ -char *fl_allocate (mlsize_t wo_sz) +char *caml_fl_allocate (mlsize_t wo_sz) { char *cur, *prev; Assert (sizeof (char *) == sizeof (value)); @@ -148,33 +148,33 @@ char *fl_allocate (mlsize_t wo_sz) static char *last_fragment; -void fl_init_merge (void) +void caml_fl_init_merge (void) { last_fragment = NULL; - fl_merge = Fl_head; + caml_fl_merge = Fl_head; #ifdef DEBUG fl_check (); #endif } /* This is called by caml_compact_heap. */ -void fl_reset (void) +void caml_fl_reset (void) { Next (Fl_head) = 0; fl_prev = Fl_head; - fl_cur_size = 0; - fl_init_merge (); + caml_fl_cur_size = 0; + caml_fl_init_merge (); } -/* [fl_merge_block] returns the head pointer of the next block after [bp], +/* [caml_fl_merge_block] returns the head pointer of the next block after [bp], because merging blocks may change the size of [bp]. */ -char *fl_merge_block (char *bp) +char *caml_fl_merge_block (char *bp) { char *prev, *cur, *adj; header_t hd = Hd_bp (bp); mlsize_t prev_wosz; - fl_cur_size += Whsize_hd (hd); + caml_fl_cur_size += Whsize_hd (hd); #ifdef DEBUG { @@ -184,7 +184,7 @@ char *fl_merge_block (char *bp) } } #endif - prev = fl_merge; + prev = caml_fl_merge; cur = Next (prev); /* The sweep code makes sure that this is the right place to insert this block: */ @@ -198,7 +198,7 @@ char *fl_merge_block (char *bp) hd = Make_header (bp_whsz, 0, Caml_white); bp = last_fragment; Hd_bp (bp) = hd; - fl_cur_size += Whsize_wosize (0); + caml_fl_cur_size += Whsize_wosize (0); } } @@ -232,29 +232,29 @@ char *fl_merge_block (char *bp) #ifdef DEBUG Hd_bp (bp) = Debug_free_major; #endif - Assert (fl_merge == prev); + Assert (caml_fl_merge == prev); }else if (Wosize_hd (hd) != 0){ Hd_bp (bp) = Bluehd_hd (hd); Next (bp) = cur; Next (prev) = bp; - fl_merge = bp; + caml_fl_merge = bp; }else{ /* This is a fragment. Leave it in white but remember it for eventual merging with the next block. */ last_fragment = bp; - fl_cur_size -= Whsize_wosize (0); + caml_fl_cur_size -= Whsize_wosize (0); } return adj; } /* This is a heap extension. We have to insert it in the right place in the free-list. - [fl_add_block] can only be called just after a call to [fl_allocate] - that returned NULL. + [caml_fl_add_block] can only be called right after a call to + [caml_fl_allocate] that returned NULL. Most of the heap extensions are expected to be at the end of the free list. (This depends on the implementation of [malloc].) */ -void fl_add_block (char *bp) +void caml_fl_add_block (char *bp) { Assert (fl_last != NULL); Assert (Next (fl_last) == NULL); @@ -267,7 +267,7 @@ void fl_add_block (char *bp) } #endif - fl_cur_size += Whsize_bp (bp); + caml_fl_cur_size += Whsize_bp (bp); if (bp > fl_last){ Next (fl_last) = bp; @@ -284,10 +284,10 @@ void fl_add_block (char *bp) Assert (cur > bp || cur == NULL); Next (bp) = cur; Next (prev) = bp; - /* When inserting a block between fl_merge and caml_gc_sweep_hp, we must - advance fl_merge to the new block, so that fl_merge is always the - last free-list block before caml_gc_sweep_hp. */ - if (prev == fl_merge && bp <= caml_gc_sweep_hp) fl_merge = bp; + /* When inserting a block between [caml_fl_merge] and [caml_gc_sweep_hp], + we must advance [caml_fl_merge] to the new block, so that [caml_fl_merge] + is always the last free-list block before [caml_gc_sweep_hp]. */ + if (prev == caml_fl_merge && bp <= caml_gc_sweep_hp) caml_fl_merge = bp; } } @@ -298,7 +298,7 @@ void fl_add_block (char *bp) size: size of the block (in words) do_merge: 1 -> do merge; 0 -> do not merge */ -void make_free_blocks (value *p, mlsize_t size, int do_merge) +void caml_make_free_blocks (value *p, mlsize_t size, int do_merge) { mlsize_t sz; @@ -309,7 +309,7 @@ void make_free_blocks (value *p, mlsize_t size, int do_merge) sz = size; } *(header_t *)p = Make_header (Wosize_whsize (sz), 0, Caml_white); - if (do_merge) fl_merge_block (Bp_hp (p)); + if (do_merge) caml_fl_merge_block (Bp_hp (p)); size -= sz; p += sz; } diff --git a/byterun/freelist.h b/byterun/freelist.h index 3097575ac..ea03ad986 100644 --- a/byterun/freelist.h +++ b/byterun/freelist.h @@ -22,14 +22,14 @@ #include "misc.h" #include "mlvalues.h" -extern asize_t fl_cur_size; /* size in words */ +extern asize_t caml_fl_cur_size; /* size in words */ -char *fl_allocate (mlsize_t); -void fl_init_merge (void); -void fl_reset (void); -char *fl_merge_block (char *); -void fl_add_block (char *); -void make_free_blocks (value *, mlsize_t, int); +char *caml_fl_allocate (mlsize_t); +void caml_fl_init_merge (void); +void caml_fl_reset (void); +char *caml_fl_merge_block (char *); +void caml_fl_add_block (char *); +void caml_make_free_blocks (value *, mlsize_t, int); #endif /* CAML_FREELIST_H */ diff --git a/byterun/gc_ctrl.c b/byterun/gc_ctrl.c index 88a377ff6..6a657980b 100644 --- a/byterun/gc_ctrl.c +++ b/byterun/gc_ctrl.c @@ -29,16 +29,16 @@ extern unsigned long caml_max_stack_size; /* defined in stacks.c */ #endif -double stat_minor_words = 0.0, - stat_promoted_words = 0.0, - stat_major_words = 0.0; +double caml_stat_minor_words = 0.0, + caml_stat_promoted_words = 0.0, + caml_stat_major_words = 0.0; -long stat_minor_collections = 0, - stat_major_collections = 0, - stat_heap_size = 0, /* bytes */ - stat_top_heap_size = 0, /* bytes */ - stat_compactions = 0, - stat_heap_chunks = 0; +long caml_stat_minor_collections = 0, + caml_stat_major_collections = 0, + caml_stat_heap_size = 0, /* bytes */ + caml_stat_top_heap_size = 0, /* bytes */ + caml_stat_compactions = 0, + caml_stat_heap_chunks = 0; extern asize_t caml_major_heap_increment; /* bytes; see major_gc.c */ extern unsigned long caml_percent_free; /* see major_gc.c */ @@ -201,27 +201,28 @@ static value heap_stats (int returnstats) chunk = Chunk_next (chunk); } - Assert (heap_chunks == stat_heap_chunks); - Assert (live_words + free_words + fragments == Wsize_bsize (stat_heap_size)); + Assert (heap_chunks == caml_stat_heap_chunks); + Assert (live_words + free_words + fragments + == Wsize_bsize (caml_stat_heap_size)); if (returnstats){ CAMLlocal1 (res); /* get a copy of these before allocating anything... */ - double minwords = stat_minor_words + double minwords = caml_stat_minor_words + (double) Wsize_bsize (caml_young_end - caml_young_ptr); - double prowords = stat_promoted_words; - double majwords = stat_major_words + (double) caml_allocated_words; - long mincoll = stat_minor_collections; - long majcoll = stat_major_collections; - long heap_words = Wsize_bsize (stat_heap_size); - long cpct = stat_compactions; - long top_heap_words = Wsize_bsize (stat_top_heap_size); + double prowords = caml_stat_promoted_words; + double majwords = caml_stat_major_words + (double) caml_allocated_words; + long mincoll = caml_stat_minor_collections; + long majcoll = caml_stat_major_collections; + long heap_words = Wsize_bsize (caml_stat_heap_size); + long cpct = caml_stat_compactions; + long top_heap_words = Wsize_bsize (caml_stat_top_heap_size); res = caml_alloc_tuple (15); - Store_field (res, 0, copy_double (minwords)); - Store_field (res, 1, copy_double (prowords)); - Store_field (res, 2, copy_double (majwords)); + Store_field (res, 0, caml_copy_double (minwords)); + Store_field (res, 1, caml_copy_double (prowords)); + Store_field (res, 2, caml_copy_double (majwords)); Store_field (res, 3, Val_long (mincoll)); Store_field (res, 4, Val_long (majcoll)); Store_field (res, 5, Val_long (heap_words)); @@ -241,37 +242,37 @@ static value heap_stats (int returnstats) } #ifdef DEBUG -void heap_check (void) +void caml_heap_check (void) { heap_stats (0); } #endif -CAMLprim value gc_stat(value v) +CAMLprim value caml_gc_stat(value v) { Assert (v == Val_unit); return heap_stats (1); } -CAMLprim value gc_counters(value v) +CAMLprim value caml_gc_counters(value v) { CAMLparam0 (); /* v is ignored */ CAMLlocal1 (res); /* get a copy of these before allocating anything... */ - double minwords = stat_minor_words + double minwords = caml_stat_minor_words + (double) Wsize_bsize (caml_young_end - caml_young_ptr); - double prowords = stat_promoted_words; - double majwords = stat_major_words + (double) caml_allocated_words; + double prowords = caml_stat_promoted_words; + double majwords = caml_stat_major_words + (double) caml_allocated_words; res = caml_alloc_tuple (3); - Store_field (res, 0, copy_double (minwords)); - Store_field (res, 1, copy_double (prowords)); - Store_field (res, 2, copy_double (majwords)); + Store_field (res, 0, caml_copy_double (minwords)); + Store_field (res, 1, caml_copy_double (prowords)); + Store_field (res, 2, caml_copy_double (majwords)); CAMLreturn (res); } -CAMLprim value gc_get(value v) +CAMLprim value caml_gc_get(value v) { CAMLparam0 (); /* v is ignored */ CAMLlocal1 (res); @@ -317,7 +318,7 @@ static long norm_minsize (long int s) return s; } -CAMLprim value gc_set(value v) +CAMLprim value caml_gc_set(value v) { unsigned long newpf, newpm; asize_t newheapincr; @@ -359,39 +360,39 @@ CAMLprim value gc_set(value v) return Val_unit; } -CAMLprim value gc_minor(value v) +CAMLprim value caml_gc_minor(value v) { Assert (v == Val_unit); caml_minor_collection (); return Val_unit; } -CAMLprim value gc_major(value v) +CAMLprim value caml_gc_major(value v) { Assert (v == Val_unit); caml_empty_minor_heap (); caml_finish_major_cycle (); - final_do_calls (); + caml_final_do_calls (); return Val_unit; } -CAMLprim value gc_full_major(value v) +CAMLprim value caml_gc_full_major(value v) { Assert (v == Val_unit); caml_empty_minor_heap (); caml_finish_major_cycle (); - final_do_calls (); + caml_final_do_calls (); caml_empty_minor_heap (); caml_finish_major_cycle (); - final_do_calls (); + caml_final_do_calls (); return Val_unit; } -CAMLprim value gc_major_slice (value v) +CAMLprim value caml_gc_major_slice (value v) { Assert (Is_long (v)); caml_empty_minor_heap (); return Val_long (caml_major_collection_slice (Long_val (v))); } -CAMLprim value gc_compaction(value v) +CAMLprim value caml_gc_compaction(value v) { Assert (v == Val_unit); caml_empty_minor_heap (); caml_finish_major_cycle (); @@ -400,9 +401,9 @@ CAMLprim value gc_compaction(value v) return Val_unit; } -void init_gc (unsigned long minor_size, unsigned long major_size, - unsigned long major_incr, unsigned long percent_fr, - unsigned long percent_m) +void caml_init_gc (unsigned long minor_size, unsigned long major_size, + unsigned long major_incr, unsigned long percent_fr, + unsigned long percent_m) { unsigned long major_heap_size = Bsize_wsize (norm_heapincr (major_size)); diff --git a/byterun/gc_ctrl.h b/byterun/gc_ctrl.h index 8b8b89dae..b5a2e87f7 100644 --- a/byterun/gc_ctrl.h +++ b/byterun/gc_ctrl.h @@ -19,24 +19,24 @@ #include "misc.h" extern double - stat_minor_words, - stat_promoted_words, - stat_major_words; + caml_stat_minor_words, + caml_stat_promoted_words, + caml_stat_major_words; extern long - stat_minor_collections, - stat_major_collections, - stat_heap_size, - stat_top_heap_size, - stat_compactions, - stat_heap_chunks; + caml_stat_minor_collections, + caml_stat_major_collections, + caml_stat_heap_size, + caml_stat_top_heap_size, + caml_stat_compactions, + caml_stat_heap_chunks; -void init_gc (unsigned long, unsigned long, unsigned long, - unsigned long, unsigned long); +void caml_init_gc (unsigned long, unsigned long, unsigned long, + unsigned long, unsigned long); #ifdef DEBUG -void heap_check (void); +void caml_heap_check (void); #endif #endif /* CAML_GC_CTRL_H */ diff --git a/byterun/globroots.c b/byterun/globroots.c index 154cabef0..684dfed96 100644 --- a/byterun/globroots.c +++ b/byterun/globroots.c @@ -55,7 +55,7 @@ struct global_root_list caml_global_roots = { NULL, { NULL, }, 0 }; /* Register a global C root */ -void register_global_root(value *r) +void caml_register_global_root(value *r) { struct global_root * update[MAX_LEVEL]; struct global_root * e, * f; @@ -95,7 +95,7 @@ void register_global_root(value *r) /* Un-register a global C root */ -void remove_global_root(value *r) +void caml_remove_global_root(value *r) { struct global_root * update[MAX_LEVEL]; struct global_root * e, * f; diff --git a/byterun/hash.c b/byterun/hash.c index a6e3970fd..17748e393 100644 --- a/byterun/hash.c +++ b/byterun/hash.c @@ -26,7 +26,7 @@ static long hash_univ_limit, hash_univ_count; static void hash_aux(value obj); -CAMLprim value hash_univ_param(value count, value limit, value obj) +CAMLprim value caml_hash_univ_param(value count, value limit, value obj) { hash_univ_limit = Long_val(limit); hash_univ_count = Long_val(count); @@ -142,7 +142,7 @@ static void hash_aux(value obj) /* Hashing variant tags */ -CAMLexport value hash_variant(char * tag) +CAMLexport value caml_hash_variant(char * tag) { value accu; /* Same hashing algorithm as in ../typing/btype.ml, function hash_variant */ @@ -155,4 +155,3 @@ CAMLexport value hash_variant(char * tag) platforms */ return (int32) accu; } - diff --git a/byterun/instrtrace.c b/byterun/instrtrace.c index de96d5105..aba978749 100644 --- a/byterun/instrtrace.c +++ b/byterun/instrtrace.c @@ -24,19 +24,19 @@ #include "opnames.h" #include "prims.h" -extern code_t start_code; +extern code_t caml_start_code; -long icount = 0; +long caml_icount = 0; -void stop_here () {} +void caml_stop_here () {} -int trace_flag = 0; +int caml_trace_flag = 0; -void disasm_instr(pc) +void caml_disasm_instr(pc) code_t pc; { int instr = *pc; - printf("%6ld %s", (long) (pc - start_code), + printf("%6ld %s", (long) (pc - caml_start_code), instr < 0 || instr > STOP ? "???" : names_of_instructions[instr]); pc++; switch(instr) { diff --git a/byterun/instrtrace.h b/byterun/instrtrace.h index b65aca87b..6b899766b 100644 --- a/byterun/instrtrace.h +++ b/byterun/instrtrace.h @@ -22,10 +22,10 @@ #include "mlvalues.h" #include "misc.h" -extern int trace_flag; -extern long icount; -void stop_here (void); -void disasm_instr (code_t pc); +extern int caml_trace_flag; +extern long caml_icount; +void caml_stop_here (void); +void caml_disasm_instr (code_t pc); #endif diff --git a/byterun/intern.c b/byterun/intern.c index 1b4b67222..34b22340a 100644 --- a/byterun/intern.c +++ b/byterun/intern.c @@ -293,7 +293,7 @@ static void intern_rec(value *dest) intern_cleanup(); caml_failwith("input_value: code mismatch"); } - v = (value) (code_area_start + ofs); + v = (value) (caml_code_area_start + ofs); break; case CODE_INFIXPOINTER: ofs = read32u(); @@ -378,8 +378,8 @@ static void intern_add_to_heap(mlsize_t whsize) (header_t *) intern_extra_block + Wsize_bsize(request); Assert(intern_dest <= end_extra_block); if (intern_dest < end_extra_block){ - make_free_blocks ((value *) intern_dest, end_extra_block - intern_dest, - 0); + caml_make_free_blocks ((value *) intern_dest, + end_extra_block - intern_dest, 0); } caml_add_to_heap(intern_extra_block); } @@ -564,8 +564,8 @@ unsigned char * caml_code_checksum(void) struct MD5Context ctx; caml_MD5Init(&ctx); caml_MD5Update(&ctx, - (unsigned char *) code_area_start, - code_area_end - code_area_start); + (unsigned char *) caml_code_area_start, + caml_code_area_end - caml_code_area_start); caml_MD5Final(checksum, &ctx); checksum_computed = 1; } @@ -578,7 +578,7 @@ unsigned char * caml_code_checksum(void) unsigned char * caml_code_checksum(void) { - return code_md5; + return caml_code_md5; } #endif diff --git a/byterun/interp.c b/byterun/interp.c index 59a1a0720..146baa774 100644 --- a/byterun/interp.c +++ b/byterun/interp.c @@ -100,10 +100,10 @@ sp is a local copy of the global variable caml_extern_sp. */ #ifdef THREADED_CODE #define Restart_curr_instr \ - goto *(jumptable[saved_code[pc - 1 - start_code]]) + goto *(jumptable[caml_saved_code[pc - 1 - caml_start_code]]) #else #define Restart_curr_instr \ - curr_instr = saved_code[pc - 1 - start_code]; \ + curr_instr = caml_saved_code[pc - 1 - caml_start_code]; \ goto dispatch_instr #endif @@ -225,8 +225,8 @@ value caml_interprete(code_t prog, asize_t prog_size) if (prog == NULL) { /* Interpreter is initializing */ #ifdef THREADED_CODE - instr_table = (char **) jumptable; - instr_base = Jumptbl_base; + caml_instr_table = (char **) jumptable; + caml_instr_base = Jumptbl_base; #endif return Val_unit; } @@ -258,7 +258,7 @@ value caml_interprete(code_t prog, asize_t prog_size) #ifdef THREADED_CODE #ifdef DEBUG next_instr: - if (icount-- == 0) stop_here (); + if (caml_icount-- == 0) caml_stop_here (); Assert(sp >= caml_stack_low); Assert(sp <= caml_stack_high); #endif @@ -266,8 +266,8 @@ value caml_interprete(code_t prog, asize_t prog_size) #else while(1) { #ifdef DEBUG - if (icount-- == 0) stop_here (); - if (trace_flag) disasm_instr(pc); + if (caml_icount-- == 0) caml_stop_here (); + if (caml_trace_flag) caml_disasm_instr(pc); Assert(sp >= caml_stack_low); Assert(sp <= caml_stack_high); #endif diff --git a/byterun/intext.h b/byterun/intext.h index a36174522..5f831e1b6 100644 --- a/byterun/intext.h +++ b/byterun/intext.h @@ -165,10 +165,10 @@ unsigned char * caml_code_checksum (void); #ifndef NATIVE_CODE #include "fix_code.h" -#define code_area_start ((char *) start_code) -#define code_area_end ((char *) start_code + code_size) +#define caml_code_area_start ((char *) caml_start_code) +#define caml_code_area_end ((char *) caml_start_code + caml_code_size) #else -extern char * code_area_start, * code_area_end; +extern char * caml_code_area_start, * caml_code_area_end; #endif /* */ diff --git a/byterun/ints.c b/byterun/ints.c index 7e68b91bb..2106fbd66 100644 --- a/byterun/ints.c +++ b/byterun/ints.c @@ -295,7 +295,7 @@ CAMLprim value caml_int32_of_float(value v) { return caml_copy_int32((int32)(Double_val(v))); } CAMLprim value caml_int32_to_float(value v) -{ return copy_double((double)(Int32_val(v))); } +{ return caml_copy_double((double)(Int32_val(v))); } CAMLprim value caml_int32_compare(value v1, value v2) { @@ -336,7 +336,7 @@ CAMLprim value caml_int32_float_of_bits(value vi) { union { float d; int32 i; } u; u.i = Int32_val(vi); - return copy_double(u.d); + return caml_copy_double(u.d); } /* 64-bit integers */ @@ -470,7 +470,7 @@ CAMLprim value caml_int64_of_float(value v) CAMLprim value caml_int64_to_float(value v) { int64 i = Int64_val(v); - return copy_double(I64_to_double(i)); + return caml_copy_double(I64_to_double(i)); } CAMLprim value caml_int64_of_int32(value v) @@ -558,7 +558,7 @@ CAMLprim value caml_int64_float_of_bits(value vi) { union { double d; int64 i; } u; u.i = Int64_val(vi); - return copy_double(u.d); + return caml_copy_double(u.d); } /* Native integers */ @@ -692,7 +692,7 @@ CAMLprim value caml_nativeint_of_float(value v) { return caml_copy_nativeint((long)(Double_val(v))); } CAMLprim value caml_nativeint_to_float(value v) -{ return copy_double((double)(Nativeint_val(v))); } +{ return caml_copy_double((double)(Nativeint_val(v))); } CAMLprim value caml_nativeint_of_int32(value v) { return caml_copy_nativeint(Int32_val(v)); } diff --git a/byterun/major_gc.c b/byterun/major_gc.c index e2fbc83d2..4c9545e1d 100644 --- a/byterun/major_gc.c +++ b/byterun/major_gc.c @@ -45,7 +45,7 @@ unsigned long caml_allocated_words; double caml_extra_heap_memory; unsigned long caml_fl_size_at_phase_change = 0; -extern char *fl_merge; /* Defined in freelist.c. */ +extern char *caml_fl_merge; /* Defined in freelist.c. */ static char *markhp, *chunk, *limit; @@ -60,7 +60,7 @@ static void realloc_gray_vals (void) value *new; Assert (gray_vals_cur == gray_vals_end); - if (gray_vals_size < stat_heap_size / 128){ + if (gray_vals_size < caml_stat_heap_size / 128){ caml_gc_message (0x08, "Growing gray_vals to %luk bytes\n", (long) gray_vals_size * sizeof (value) / 512); new = (value *) realloc ((char *) gray_vals, @@ -103,7 +103,7 @@ static void start_cycle (void) gc_subphase = Subphase_main; markhp = NULL; #ifdef DEBUG - heap_check (); + caml_heap_check (); #endif } @@ -222,7 +222,7 @@ static void mark_slice (long work) }else{ /* Subphase_weak is done. Handle finalised values. */ gray_vals_cur = gray_vals_ptr; - final_update (); + caml_final_update (); gray_vals_ptr = gray_vals_cur; gc_subphase = Subphase_final; } @@ -231,13 +231,13 @@ static void mark_slice (long work) /* Initialise the sweep phase. */ gray_vals_cur = gray_vals_ptr; caml_gc_sweep_hp = caml_heap_start; - fl_init_merge (); + caml_fl_init_merge (); caml_gc_phase = Phase_sweep; chunk = caml_heap_start; caml_gc_sweep_hp = chunk; limit = chunk + Chunk_size (chunk); work = 0; - caml_fl_size_at_phase_change = fl_cur_size; + caml_fl_size_at_phase_change = caml_fl_cur_size; } } gray_vals_cur = gray_vals_ptr; @@ -261,11 +261,11 @@ static void sweep_slice (long work) void (*final_fun)(value) = Custom_ops_val(Val_hp(hp))->finalize; if (final_fun != NULL) final_fun(Val_hp(hp)); } - caml_gc_sweep_hp = fl_merge_block (Bp_hp (hp)); + caml_gc_sweep_hp = caml_fl_merge_block (Bp_hp (hp)); break; case Caml_blue: /* Only the blocks of the free-list are blue. See [freelist.c]. */ - fl_merge = Bp_hp (hp); + caml_fl_merge = Bp_hp (hp); break; default: /* gray or black */ Assert (Color_hd (hd) == Caml_black); @@ -277,7 +277,7 @@ static void sweep_slice (long work) chunk = Chunk_next (chunk); if (chunk == NULL){ /* Sweeping is done. */ - ++ stat_major_collections; + ++ caml_stat_major_collections; work = 0; caml_gc_phase = Phase_idle; }else{ @@ -298,7 +298,7 @@ long caml_major_collection_slice (long howmuch) long computed_work; /* Free memory at the start of the GC cycle (garbage + free list) (assumed): - FM = stat_heap_size * caml_percent_free + FM = caml_stat_heap_size * caml_percent_free / (100 + caml_percent_free) Assuming steady state and enforcing a constant allocation rate, then @@ -310,28 +310,28 @@ long caml_major_collection_slice (long howmuch) Proportion of G consumed since the previous slice: PH = caml_allocated_words / G = caml_allocated_words * 3 * (100 + caml_percent_free) - / (2 * stat_heap_size * caml_percent_free) + / (2 * caml_stat_heap_size * caml_percent_free) Proportion of extra-heap memory consumed since the previous slice: PE = caml_extra_heap_memory Proportion of total work to do in this slice: P = max (PH, PE) Amount of marking work for the GC cycle: - MW = stat_heap_size * 100 / (100 + caml_percent_free) + MW = caml_stat_heap_size * 100 / (100 + caml_percent_free) Amount of sweeping work for the GC cycle: - SW = stat_heap_size + SW = caml_stat_heap_size Amount of marking work for this slice: MS = P * MW - MS = P * stat_heap_size * 100 / (100 + caml_percent_free) + MS = P * caml_stat_heap_size * 100 / (100 + caml_percent_free) Amount of sweeping work for this slice: SS = P * SW - SS = P * stat_heap_size + SS = P * caml_stat_heap_size This slice will either mark 2*MS words or sweep 2*SS words. */ if (caml_gc_phase == Phase_idle) start_cycle (); p = (double) caml_allocated_words * 3.0 * (100 + caml_percent_free) - / Wsize_bsize (stat_heap_size) / caml_percent_free / 2.0; + / Wsize_bsize (caml_stat_heap_size) / caml_percent_free / 2.0; if (p < caml_extra_heap_memory) p = caml_extra_heap_memory; caml_gc_message (0x40, "allocated_words = %lu\n", caml_allocated_words); @@ -341,10 +341,10 @@ long caml_major_collection_slice (long howmuch) (unsigned long) (p * 1000000)); if (caml_gc_phase == Phase_mark){ - computed_work = 2 * (long) (p * Wsize_bsize (stat_heap_size) * 100 + computed_work = 2 * (long) (p * Wsize_bsize (caml_stat_heap_size) * 100 / (100 + caml_percent_free)); }else{ - computed_work = 2 * (long) (p * Wsize_bsize (stat_heap_size)); + computed_work = 2 * (long) (p * Wsize_bsize (caml_stat_heap_size)); } caml_gc_message (0x40, "ordered work = %ld words\n", howmuch); caml_gc_message (0x40, "computed work = %ld words\n", computed_work); @@ -360,7 +360,7 @@ long caml_major_collection_slice (long howmuch) if (caml_gc_phase == Phase_idle) caml_compact_heap_maybe (); - stat_major_words += caml_allocated_words; + caml_stat_major_words += caml_allocated_words; caml_allocated_words = 0; caml_extra_heap_memory = 0.0; return computed_work; @@ -380,7 +380,7 @@ void caml_finish_major_cycle (void) Assert (caml_gc_phase == Phase_sweep); while (caml_gc_phase == Phase_sweep) sweep_slice (LONG_MAX); Assert (caml_gc_phase == Phase_idle); - stat_major_words += caml_allocated_words; + caml_stat_major_words += caml_allocated_words; caml_allocated_words = 0; } @@ -421,17 +421,17 @@ void caml_init_major_heap (asize_t heap_size) asize_t page_table_size; page_table_entry *page_table_block; - stat_heap_size = clip_heap_chunk_size (heap_size); - stat_top_heap_size = stat_heap_size; - Assert (stat_heap_size % Page_size == 0); - caml_heap_start = (char *) caml_alloc_for_heap (stat_heap_size); + caml_stat_heap_size = clip_heap_chunk_size (heap_size); + caml_stat_top_heap_size = caml_stat_heap_size; + Assert (caml_stat_heap_size % Page_size == 0); + caml_heap_start = (char *) caml_alloc_for_heap (caml_stat_heap_size); if (caml_heap_start == NULL) caml_fatal_error ("Fatal error: not enough memory for the initial heap.\n"); Chunk_next (caml_heap_start) = NULL; - caml_heap_end = caml_heap_start + stat_heap_size; + caml_heap_end = caml_heap_start + caml_stat_heap_size; Assert ((unsigned long) caml_heap_end % Page_size == 0); - stat_heap_chunks = 1; + caml_stat_heap_chunks = 1; caml_page_low = Page (caml_heap_start); caml_page_high = Page (caml_heap_end); @@ -447,8 +447,9 @@ void caml_init_major_heap (asize_t heap_size) caml_page_table [i] = In_heap; } - fl_init_merge (); - make_free_blocks ((value *) caml_heap_start, Wsize_bsize (stat_heap_size), 1); + caml_fl_init_merge (); + caml_make_free_blocks ((value *) caml_heap_start, + Wsize_bsize (caml_stat_heap_size), 1); caml_gc_phase = Phase_idle; gray_vals_size = 2048; gray_vals = (value *) malloc (gray_vals_size * sizeof (value)); diff --git a/byterun/memory.c b/byterun/memory.c index af7837d75..702500a84 100644 --- a/byterun/memory.c +++ b/byterun/memory.c @@ -150,15 +150,17 @@ int caml_add_to_heap (char *m) Chunk_next (m) = cur; *last = m; - ++ stat_heap_chunks; + ++ caml_stat_heap_chunks; } /* Update the heap bounds as needed. */ /* already done: if (m < caml_heap_start) heap_start = m; */ if (m + Chunk_size (m) > caml_heap_end) caml_heap_end = m + Chunk_size (m); - stat_heap_size += Chunk_size (m); - if (stat_heap_size > stat_top_heap_size) stat_top_heap_size = stat_heap_size; + caml_stat_heap_size += Chunk_size (m); + if (caml_stat_heap_size > caml_stat_top_heap_size){ + caml_stat_top_heap_size = caml_stat_heap_size; + } return 0; } @@ -175,7 +177,7 @@ static char *expand_heap (mlsize_t request) malloc_request = caml_round_heap_chunk_size (Bhsize_wosize (request)); caml_gc_message (0x04, "Growing heap to %luk bytes\n", - (stat_heap_size + malloc_request) / 1024); + (caml_stat_heap_size + malloc_request) / 1024); mem = caml_alloc_for_heap (malloc_request); if (mem == NULL){ caml_gc_message (0x04, "No room for growing heap\n", 0); @@ -207,8 +209,9 @@ void caml_shrink_heap (char *chunk) */ if (chunk == caml_heap_start) return; - stat_heap_size -= Chunk_size (chunk); - caml_gc_message (0x04, "Shrinking heap to %luk bytes\n", stat_heap_size/1024); + caml_stat_heap_size -= Chunk_size (chunk); + caml_gc_message (0x04, "Shrinking heap to %luk bytes\n", + caml_stat_heap_size / 1024); #ifdef DEBUG { @@ -219,7 +222,7 @@ void caml_shrink_heap (char *chunk) } #endif - -- stat_heap_chunks; + -- caml_stat_heap_chunks; /* Remove [chunk] from the list of chunks. */ cp = &caml_heap_start; @@ -253,7 +256,7 @@ value caml_alloc_shr (mlsize_t wosize, tag_t tag) char *hp, *new_block; if (wosize > Max_wosize) caml_raise_out_of_memory (); - hp = fl_allocate (wosize); + hp = caml_fl_allocate (wosize); if (hp == NULL){ new_block = expand_heap (wosize); if (new_block == NULL) { @@ -262,8 +265,8 @@ value caml_alloc_shr (mlsize_t wosize, tag_t tag) else caml_raise_out_of_memory (); } - fl_add_block (new_block); - hp = fl_allocate (wosize); + caml_fl_add_block (new_block); + hp = caml_fl_allocate (wosize); } Assert (Is_in_heap (Val_hp (hp))); @@ -312,7 +315,8 @@ void caml_adjust_gc_speed (mlsize_t mem, mlsize_t max) caml_urge_major_slice (); } if (caml_extra_heap_memory > (double) Wsize_bsize (caml_minor_heap_size) - / 2.0 / (double) Wsize_bsize (stat_heap_size)) { + / 2.0 + / (double) Wsize_bsize (caml_stat_heap_size)) { caml_urge_major_slice (); } } diff --git a/byterun/memory.h b/byterun/memory.h index d73f49e13..f98e15152 100644 --- a/byterun/memory.h +++ b/byterun/memory.h @@ -363,16 +363,16 @@ CAMLextern struct caml__roots_block *caml_local_roots; /* defined in roots.c */ #define End_roots() caml_local_roots = caml__roots_block.next; } -/* [register_global_root] registers a global C variable as a memory root - for the duration of the program, or until [remove_global_root] is +/* [caml_register_global_root] registers a global C variable as a memory root + for the duration of the program, or until [caml_remove_global_root] is called. */ -CAMLextern void register_global_root (value *); +CAMLextern void caml_register_global_root (value *); -/* [remove_global_root] removes a memory root registered on a global C - variable with [register_global_root]. */ +/* [caml_remove_global_root] removes a memory root registered on a global C + variable with [caml_register_global_root]. */ -CAMLextern void remove_global_root (value *); +CAMLextern void caml_remove_global_root (value *); #endif /* CAML_MEMORY_H */ diff --git a/byterun/meta.c b/byterun/meta.c index 722de8c68..22fe00845 100644 --- a/byterun/meta.c +++ b/byterun/meta.c @@ -39,10 +39,10 @@ CAMLprim value caml_reify_bytecode(value prog, value len) { value clos; #ifdef ARCH_BIG_ENDIAN - fixup_endianness((code_t) prog, (asize_t) Long_val(len)); + caml_fixup_endianness((code_t) prog, (asize_t) Long_val(len)); #endif #ifdef THREADED_CODE - thread_code((code_t) prog, (asize_t) Long_val(len)); + caml_thread_code((code_t) prog, (asize_t) Long_val(len)); #endif clos = caml_alloc_small (1, Closure_tag); Code_val(clos) = (code_t) prog; diff --git a/byterun/minor_gc.c b/byterun/minor_gc.c index 25340d75f..4cf707779 100644 --- a/byterun/minor_gc.c +++ b/byterun/minor_gc.c @@ -192,7 +192,7 @@ void caml_empty_minor_heap (void) } caml_oldify_mopup (); if (caml_young_ptr < caml_young_start) caml_young_ptr = caml_young_start; - stat_minor_words += Wsize_bsize (caml_young_end - caml_young_ptr); + caml_stat_minor_words += Wsize_bsize (caml_young_end - caml_young_ptr); caml_young_ptr = caml_young_end; caml_young_limit = caml_young_start; caml_ref_table_ptr = ref_table; @@ -200,7 +200,7 @@ void caml_empty_minor_heap (void) caml_gc_message (0x02, ">", 0); caml_in_minor_collection = 0; } - final_empty_young (); + caml_final_empty_young (); #ifdef DEBUG { value *p; @@ -221,12 +221,12 @@ void caml_minor_collection (void) caml_empty_minor_heap (); - stat_promoted_words += caml_allocated_words - prev_alloc_words; - ++ stat_minor_collections; + caml_stat_promoted_words += caml_allocated_words - prev_alloc_words; + ++ caml_stat_minor_collections; caml_major_collection_slice (0); caml_force_major_slice = 0; - final_do_calls (); + caml_final_do_calls (); caml_empty_minor_heap (); } diff --git a/byterun/mlvalues.h b/byterun/mlvalues.h index 97bad2f53..c0712dbf0 100644 --- a/byterun/mlvalues.h +++ b/byterun/mlvalues.h @@ -197,7 +197,7 @@ typedef opcode_t * code_t; #define Lazy_tag 246 /* Another special case: variants */ -CAMLextern value hash_variant(char * tag); +CAMLextern value caml_hash_variant(char * tag); /* 2- If tag >= No_scan_tag : a sequence of bytes. */ @@ -225,8 +225,10 @@ CAMLextern mlsize_t caml_string_length (value); /* size in bytes */ #define Double_val(v) (* (double *)(v)) #define Store_double_val(v,d) (* (double *)(v) = (d)) #else -CAMLextern double Double_val (value); -CAMLextern void Store_double_val (value,double); +CAMLextern double caml_Double_val (value); +CAMLextern void caml_Store_double_val (value,double); +#define Double_val(v) caml_Double_val(v) +#define Store_double_val(v) caml_Store_double_val(v) #endif /* Arrays of floating-point numbers. */ @@ -272,10 +274,11 @@ CAMLextern header_t caml_atom_table[]; #ifndef NATIVE_CODE #define Is_atom(v) ((v) >= Atom(0) && (v) <= Atom(255)) #else -CAMLextern char * static_data_start, * static_data_end; +CAMLextern char * caml_static_data_start, * caml_static_data_end; #define Is_atom(v) \ - ((((char *)(v) >= static_data_start && (char *)(v) < static_data_end) || \ - ((v) >= Atom(0) && (v) <= Atom(255)))) + ((((char *)(v) >= caml_static_data_start \ + && (char *)(v) < caml_static_data_end) \ + || ((v) >= Atom(0) && (v) <= Atom(255)))) #endif /* Booleans are integers 0 or 1 */ diff --git a/byterun/obj.c b/byterun/obj.c index 3817f9f87..277c24180 100644 --- a/byterun/obj.c +++ b/byterun/obj.c @@ -155,10 +155,12 @@ CAMLprim value caml_obj_truncate (value v, value newsize) /* [lazy_is_forward] is obsolete. Stays here to make bootstrapping easier for patched versions of 3.07. To be removed before 3.08. FIXME */ -CAMLprim value lazy_is_forward (value v) +/* +CAMLxxprim value lazy_is_forward (value v) { return Val_bool (Is_block (v) && Tag_val (v) == Forward_tag); } +*/ CAMLprim value caml_lazy_follow_forward (value v) { diff --git a/byterun/roots.c b/byterun/roots.c index 3f66a1cac..31e2f9580 100644 --- a/byterun/roots.c +++ b/byterun/roots.c @@ -58,7 +58,7 @@ void caml_oldify_local_roots (void) caml_oldify_one(*(gr->root), gr->root); } /* Finalised values */ - final_do_young_roots (&caml_oldify_one); + caml_final_do_young_roots (&caml_oldify_one); /* Hook */ if (caml_scan_roots_hook != NULL) (*caml_scan_roots_hook)(&caml_oldify_one); } @@ -85,7 +85,7 @@ void caml_do_roots (scanning_action f) f(*(gr->root), gr->root); } /* Finalised values */ - final_do_strong_roots (f); + caml_final_do_strong_roots (f); /* Hook */ if (caml_scan_roots_hook != NULL) (*caml_scan_roots_hook)(f); } diff --git a/byterun/signals.c b/byterun/signals.c index a7e36148c..a76feb317 100644 --- a/byterun/signals.c +++ b/byterun/signals.c @@ -292,7 +292,7 @@ CAMLprim value caml_install_signal_handler(value signal_number, value action) if (Is_block(action)) { if (caml_signal_handlers == 0) { caml_signal_handlers = caml_alloc(NSIG, 0); - register_global_root(&caml_signal_handlers); + caml_register_global_root(&caml_signal_handlers); } caml_modify(&Field(caml_signal_handlers, sig), Field(action, 0)); } diff --git a/byterun/startup.c b/byterun/startup.c index b8bb79501..a2cf6181f 100644 --- a/byterun/startup.c +++ b/byterun/startup.c @@ -236,7 +236,7 @@ static int parse_command_line(char **argv) switch(argv[i][1]) { #ifdef DEBUG case 't': - trace_flag = 1; + caml_trace_flag = 1; break; #endif case 'v': @@ -304,7 +304,7 @@ static void parse_camlrunparam(void) } } -extern void init_ieee_floats (void); +extern void caml_init_ieee_floats (void); #ifdef _WIN32 extern void caml_signal_thread(void * lpParam); @@ -326,7 +326,7 @@ CAMLexport void caml_main(char **argv) /* Machine-dependent initialization of the floating-point hardware so that it behaves as much as possible as specified in IEEE */ - init_ieee_floats(); + caml_init_ieee_floats(); caml_init_custom_operations(); caml_ext_table_init(&caml_shared_libs_path, 8); caml_external_raise = NULL; @@ -362,8 +362,8 @@ CAMLexport void caml_main(char **argv) /* Read the table of contents (section descriptors) */ caml_read_section_descriptors(fd, &trail); /* Initialize the abstract machine */ - init_gc (minor_heap_init, heap_size_init, heap_chunk_init, - percent_free_init, max_percent_free_init); + caml_init_gc (minor_heap_init, heap_size_init, heap_chunk_init, + percent_free_init, max_percent_free_init); caml_init_stack (max_stack_init); init_atoms(); /* Initialize the interpreter */ @@ -371,8 +371,8 @@ CAMLexport void caml_main(char **argv) /* Initialize the debugger, if needed */ caml_debugger_init(); /* Load the code */ - code_size = caml_seek_section(fd, &trail, "CODE"); - load_code(fd, code_size); + caml_code_size = caml_seek_section(fd, &trail, "CODE"); + caml_load_code(fd, caml_code_size); /* Build the table of primitives */ shared_lib_path = read_section(fd, &trail, "DLPT"); shared_libs = read_section(fd, &trail, "DLLS"); @@ -401,7 +401,7 @@ CAMLexport void caml_main(char **argv) #endif /* Execute the program */ caml_debugger(PROGRAM_START); - res = caml_interprete(start_code, code_size); + res = caml_interprete(caml_start_code, caml_code_size); if (Is_exception_result(res)) { caml_exn_bucket = Extract_exception(res); if (caml_debugger_in_use) { @@ -420,7 +420,7 @@ CAMLexport void caml_startup_code(code_t code, asize_t code_size, { value res; - init_ieee_floats(); + caml_init_ieee_floats(); caml_init_custom_operations(); #ifdef DEBUG caml_verb_gc = 63; @@ -428,16 +428,16 @@ CAMLexport void caml_startup_code(code_t code, asize_t code_size, parse_camlrunparam(); caml_external_raise = NULL; /* Initialize the abstract machine */ - init_gc (minor_heap_init, heap_size_init, heap_chunk_init, - percent_free_init, max_percent_free_init); + caml_init_gc (minor_heap_init, heap_size_init, heap_chunk_init, + percent_free_init, max_percent_free_init); caml_init_stack (max_stack_init); init_atoms(); /* Initialize the interpreter */ caml_interprete(NULL, 0); /* Load the code */ - start_code = code; + caml_start_code = code; #ifdef THREADED_CODE - thread_code(start_code, code_size); + caml_thread_code(caml_start_code, code_size); #endif /* Use the builtin table of primitives */ caml_prim_table.size = caml_prim_table.capacity = -1; @@ -450,7 +450,7 @@ CAMLexport void caml_startup_code(code_t code, asize_t code_size, /* Run the code */ caml_init_exceptions(); caml_sys_init("", argv); - res = caml_interprete(start_code, code_size); + res = caml_interprete(caml_start_code, code_size); if (Is_exception_result(res)) caml_fatal_uncaught_exception(Extract_exception(res)); } diff --git a/byterun/str.c b/byterun/str.c index 6a61849e3..08bbf839e 100644 --- a/byterun/str.c +++ b/byterun/str.c @@ -53,14 +53,14 @@ CAMLprim value caml_create_string(value len) CAMLprim value caml_string_get(value str, value index) { long idx = Long_val(index); - if (idx < 0 || idx >= caml_string_length(str)) array_bound_error(); + if (idx < 0 || idx >= caml_string_length(str)) caml_array_bound_error(); return Val_int(Byte_u(str, idx)); } CAMLprim value caml_string_set(value str, value index, value newval) { long idx = Long_val(index); - if (idx < 0 || idx >= caml_string_length(str)) array_bound_error(); + if (idx < 0 || idx >= caml_string_length(str)) caml_array_bound_error(); Byte_u(str, idx) = Int_val(newval); return Val_unit; } diff --git a/byterun/sys.c b/byterun/sys.c index d3cf71a22..108a70670 100644 --- a/byterun/sys.c +++ b/byterun/sys.c @@ -299,10 +299,10 @@ CAMLprim value caml_sys_time(value unit) #endif struct tms t; times(&t); - return copy_double((double)(t.tms_utime + t.tms_stime) / CLK_TCK); + return caml_copy_double((double)(t.tms_utime + t.tms_stime) / CLK_TCK); #else /* clock() is standard ANSI C */ - return copy_double((double)clock() / CLOCKS_PER_SEC); + return caml_copy_double((double)clock() / CLOCKS_PER_SEC); #endif } diff --git a/otherlibs/threads/pervasives.ml b/otherlibs/threads/pervasives.ml index 655b7d51a..8c1f352f5 100644 --- a/otherlibs/threads/pervasives.ml +++ b/otherlibs/threads/pervasives.ml @@ -85,28 +85,28 @@ external (+.) : float -> float -> float = "%addfloat" external (-.) : float -> float -> float = "%subfloat" external ( *. ) : float -> float -> float = "%mulfloat" external (/.) : float -> float -> float = "%divfloat" -external ( ** ) : float -> float -> float = "power_float" "pow" "float" -external exp : float -> float = "exp_float" "exp" "float" -external acos : float -> float = "acos_float" "acos" "float" -external asin : float -> float = "asin_float" "asin" "float" -external atan : float -> float = "atan_float" "atan" "float" -external atan2 : float -> float -> float = "atan2_float" "atan2" "float" -external cos : float -> float = "cos_float" "cos" "float" -external cosh : float -> float = "cosh_float" "cosh" "float" -external log : float -> float = "log_float" "log" "float" -external log10 : float -> float = "log10_float" "log10" "float" -external sin : float -> float = "sin_float" "sin" "float" -external sinh : float -> float = "sinh_float" "sinh" "float" -external sqrt : float -> float = "sqrt_float" "sqrt" "float" -external tan : float -> float = "tan_float" "tan" "float" -external tanh : float -> float = "tanh_float" "tanh" "float" -external ceil : float -> float = "ceil_float" "ceil" "float" -external floor : float -> float = "floor_float" "floor" "float" +external ( ** ) : float -> float -> float = "caml_power_float" "pow" "float" +external exp : float -> float = "caml_exp_float" "exp" "float" +external acos : float -> float = "caml_acos_float" "acos" "float" +external asin : float -> float = "caml_asin_float" "asin" "float" +external atan : float -> float = "caml_atan_float" "atan" "float" +external atan2 : float -> float -> float = "caml_atan2_float" "atan2" "float" +external cos : float -> float = "caml_cos_float" "cos" "float" +external cosh : float -> float = "caml_cosh_float" "cosh" "float" +external log : float -> float = "caml_log_float" "log" "float" +external log10 : float -> float = "caml_log10_float" "log10" "float" +external sin : float -> float = "caml_sin_float" "sin" "float" +external sinh : float -> float = "caml_sinh_float" "sinh" "float" +external sqrt : float -> float = "caml_sqrt_float" "sqrt" "float" +external tan : float -> float = "caml_tan_float" "tan" "float" +external tanh : float -> float = "caml_tanh_float" "tanh" "float" +external ceil : float -> float = "caml_ceil_float" "ceil" "float" +external floor : float -> float = "caml_floor_float" "floor" "float" external abs_float : float -> float = "%absfloat" -external mod_float : float -> float -> float = "fmod_float" "fmod" "float" -external frexp : float -> float * int = "frexp_float" -external ldexp : float -> int -> float = "ldexp_float" -external modf : float -> float * float = "modf_float" +external mod_float : float -> float -> float = "caml_fmod_float" "fmod" "float" +external frexp : float -> float * int = "caml_frexp_float" +external ldexp : float -> int -> float = "caml_ldexp_float" +external modf : float -> float * float = "caml_modf_float" external float : int -> float = "%floatofint" external float_of_int : int -> float = "%floatofint" external truncate : float -> int = "%intoffloat" @@ -136,14 +136,14 @@ type fpclass = | FP_zero | FP_infinite | FP_nan -external classify_float: float -> fpclass = "classify_float" +external classify_float: float -> fpclass = "caml_classify_float" (* String operations -- more in module String *) external string_length : string -> int = "%string_length" -external string_create: int -> string = "create_string" +external string_create: int -> string = "caml_create_string" external string_blit : string -> int -> string -> int -> int -> unit - = "blit_string" "noalloc" + = "caml_blit_string" "noalloc" let (^) s1 s2 = let l1 = string_length s1 and l2 = string_length s2 in @@ -179,8 +179,8 @@ external decr: int ref -> unit = "%decr" (* String conversion functions *) -external format_int: string -> int -> string = "format_int" -external format_float: string -> float -> string = "format_float" +external format_int: string -> int -> string = "caml_format_int" +external format_float: string -> float -> string = "caml_format_float" let string_of_bool b = if b then "true" else "false" @@ -207,7 +207,7 @@ let valid_float_lexem s = let string_of_float f = valid_float_lexem (format_float "%.12g" f);; -external float_of_string : string -> float = "float_of_string" +external float_of_string : string -> float = "caml_float_of_string" (* List operations -- more in module List *) @@ -256,7 +256,7 @@ type open_flag = | Open_creat | Open_trunc | Open_excl | Open_binary | Open_text | Open_nonblock -external open_desc: string -> open_flag list -> int -> int = "sys_open" +external open_desc: string -> open_flag list -> int -> int = "caml_sys_open" let open_out_gen mode perm name = open_descriptor_out(open_desc name mode perm) @@ -339,7 +339,7 @@ let output_binary_int oc n = output_byte oc n external marshal_to_string : 'a -> unit list -> string - = "output_value_to_string" + = "caml_output_value_to_string" let output_value oc v = output_string oc (marshal_to_string v []) @@ -441,8 +441,8 @@ let input_binary_int ic = let b4 = input_byte ic in (n1 lsl 24) + (b2 lsl 16) + (b3 lsl 8) + b4 -external unmarshal : string -> int -> 'a = "input_value_from_string" -external marshal_data_size : string -> int -> int = "marshal_data_size" +external unmarshal : string -> int -> 'a = "caml_input_value_from_string" +external marshal_data_size : string -> int -> int = "caml_marshal_data_size" let input_value ic = let header = string_create 20 in @@ -512,7 +512,7 @@ let (( ^^ ) : ('a, 'b, 'c, 'd) format4 -> ('d, 'b, 'c, 'e) format4 -> (* Miscellaneous *) -external sys_exit : int -> 'a = "sys_exit" +external sys_exit : int -> 'a = "caml_sys_exit" let exit_function = ref flush_all @@ -526,6 +526,7 @@ let exit retcode = do_at_exit (); sys_exit retcode -external register_named_value: string -> 'a -> unit = "register_named_value" +external register_named_value : string -> 'a -> unit + = "caml_register_named_value" let _ = register_named_value "Pervasives.do_at_exit" do_at_exit diff --git a/stdlib/gc.ml b/stdlib/gc.ml index 86bf86da8..6e0436279 100644 --- a/stdlib/gc.ml +++ b/stdlib/gc.ml @@ -40,15 +40,15 @@ type control = { mutable stack_limit : int; };; -external stat : unit -> stat = "gc_stat";; -external counters : unit -> (float * float * float) = "gc_counters";; -external get : unit -> control = "gc_get";; -external set : control -> unit = "gc_set";; -external minor : unit -> unit = "gc_minor";; -external major_slice : int -> int = "gc_major_slice";; -external major : unit -> unit = "gc_major";; -external full_major : unit -> unit = "gc_full_major";; -external compact : unit -> unit = "gc_compaction";; +external stat : unit -> stat = "caml_gc_stat";; +external counters : unit -> (float * float * float) = "caml_gc_counters";; +external get : unit -> control = "caml_gc_get";; +external set : control -> unit = "caml_gc_set";; +external minor : unit -> unit = "caml_gc_minor";; +external major_slice : int -> int = "caml_gc_major_slice";; +external major : unit -> unit = "caml_gc_major";; +external full_major : unit -> unit = "caml_gc_full_major";; +external compact : unit -> unit = "caml_gc_compaction";; open Printf;; @@ -76,7 +76,7 @@ let allocated_bytes () = (mi +. ma -. pro) *. float_of_int (Sys.word_size / 8) ;; -external finalise : ('a -> unit) -> 'a -> unit = "final_register";; +external finalise : ('a -> unit) -> 'a -> unit = "caml_final_register";; type alarm = bool ref;; diff --git a/stdlib/gc.mli b/stdlib/gc.mli index 3a824c375..bfc8cf6d1 100644 --- a/stdlib/gc.mli +++ b/stdlib/gc.mli @@ -129,38 +129,38 @@ type control = } (** The GC parameters are given as a [control] record. *) -external stat : unit -> stat = "gc_stat" +external stat : unit -> stat = "caml_gc_stat" (** Return the current values of the memory management counters in a [stat] record. *) -external counters : unit -> float * float * float = "gc_counters" +external counters : unit -> float * float * float = "caml_gc_counters" (** Return [(minor_words, promoted_words, major_words)]. Much faster than [stat]. *) -external get : unit -> control = "gc_get" +external get : unit -> control = "caml_gc_get" (** Return the current values of the GC parameters in a [control] record. *) -external set : control -> unit = "gc_set" +external set : control -> unit = "caml_gc_set" (** [set r] changes the GC parameters according to the [control] record [r]. The normal usage is: [Gc.set { (Gc.get()) with Gc.verbose = 0x00d }] *) -external minor : unit -> unit = "gc_minor" +external minor : unit -> unit = "caml_gc_minor" (** Trigger a minor collection. *) -external major_slice : int -> int = "gc_major_slice";; +external major_slice : int -> int = "caml_gc_major_slice";; (** Do a minor collection and a slice of major collection. The argument is the size of the slice, 0 to use the automatically-computed slice size. In all cases, the result is the computed slice size. *) -external major : unit -> unit = "gc_major" +external major : unit -> unit = "caml_gc_major" (** Do a minor collection and finish the current major collection cycle. *) -external full_major : unit -> unit = "gc_full_major" +external full_major : unit -> unit = "caml_gc_full_major" (** Do a minor collection, finish the current major collection cycle, and perform a complete new cycle. This will collect all currently unreachable blocks. *) -external compact : unit -> unit = "gc_compaction" +external compact : unit -> unit = "caml_gc_compaction" (** Perform a full major collection and compact the heap. Note that heap compaction is a lengthy operation. *) diff --git a/stdlib/hashtbl.ml b/stdlib/hashtbl.ml index 872cf2a0f..0169f747a 100644 --- a/stdlib/hashtbl.ml +++ b/stdlib/hashtbl.ml @@ -15,7 +15,7 @@ (* Hash tables *) -external hash_param : int -> int -> 'a -> int = "hash_univ_param" "noalloc" +external hash_param : int -> int -> 'a -> int = "caml_hash_univ_param" "noalloc" let hash x = hash_param 10 100 x diff --git a/stdlib/hashtbl.mli b/stdlib/hashtbl.mli index 3a6b13401..fcb296a7c 100644 --- a/stdlib/hashtbl.mli +++ b/stdlib/hashtbl.mli @@ -154,7 +154,7 @@ val hash : 'a -> int Moreover, [hash] always terminates, even on cyclic structures. *) -external hash_param : int -> int -> 'a -> int = "hash_univ_param" "noalloc" +external hash_param : int -> int -> 'a -> int = "caml_hash_univ_param" "noalloc" (** [Hashtbl.hash_param n m x] computes a hash value for [x], with the same properties as for [hash]. The two extra parameters [n] and [m] give more precise control over hashing. Hashing performs a diff --git a/stdlib/moreLabels.mli b/stdlib/moreLabels.mli index 977893aec..6a690470c 100644 --- a/stdlib/moreLabels.mli +++ b/stdlib/moreLabels.mli @@ -60,7 +60,7 @@ module Hashtbl : sig module Make : functor (H : HashedType) -> S with type key = H.t val hash : 'a -> int external hash_param : int -> int -> 'a -> int - = "hash_univ_param" "noalloc" + = "caml_hash_univ_param" "noalloc" end module Map : sig diff --git a/stdlib/pervasives.ml b/stdlib/pervasives.ml index 0c6a26888..514adeee7 100644 --- a/stdlib/pervasives.ml +++ b/stdlib/pervasives.ml @@ -81,28 +81,28 @@ external (+.) : float -> float -> float = "%addfloat" external (-.) : float -> float -> float = "%subfloat" external ( *. ) : float -> float -> float = "%mulfloat" external (/.) : float -> float -> float = "%divfloat" -external ( ** ) : float -> float -> float = "power_float" "pow" "float" -external exp : float -> float = "exp_float" "exp" "float" -external acos : float -> float = "acos_float" "acos" "float" -external asin : float -> float = "asin_float" "asin" "float" -external atan : float -> float = "atan_float" "atan" "float" -external atan2 : float -> float -> float = "atan2_float" "atan2" "float" -external cos : float -> float = "cos_float" "cos" "float" -external cosh : float -> float = "cosh_float" "cosh" "float" -external log : float -> float = "log_float" "log" "float" -external log10 : float -> float = "log10_float" "log10" "float" -external sin : float -> float = "sin_float" "sin" "float" -external sinh : float -> float = "sinh_float" "sinh" "float" -external sqrt : float -> float = "sqrt_float" "sqrt" "float" -external tan : float -> float = "tan_float" "tan" "float" -external tanh : float -> float = "tanh_float" "tanh" "float" -external ceil : float -> float = "ceil_float" "ceil" "float" -external floor : float -> float = "floor_float" "floor" "float" +external ( ** ) : float -> float -> float = "caml_power_float" "pow" "float" +external exp : float -> float = "caml_exp_float" "exp" "float" +external acos : float -> float = "caml_acos_float" "acos" "float" +external asin : float -> float = "caml_asin_float" "asin" "float" +external atan : float -> float = "caml_atan_float" "atan" "float" +external atan2 : float -> float -> float = "caml_atan2_float" "atan2" "float" +external cos : float -> float = "caml_cos_float" "cos" "float" +external cosh : float -> float = "caml_cosh_float" "cosh" "float" +external log : float -> float = "caml_log_float" "log" "float" +external log10 : float -> float = "caml_log10_float" "log10" "float" +external sin : float -> float = "caml_sin_float" "sin" "float" +external sinh : float -> float = "caml_sinh_float" "sinh" "float" +external sqrt : float -> float = "caml_sqrt_float" "sqrt" "float" +external tan : float -> float = "caml_tan_float" "tan" "float" +external tanh : float -> float = "caml_tanh_float" "tanh" "float" +external ceil : float -> float = "caml_ceil_float" "ceil" "float" +external floor : float -> float = "caml_floor_float" "floor" "float" external abs_float : float -> float = "%absfloat" -external mod_float : float -> float -> float = "fmod_float" "fmod" "float" -external frexp : float -> float * int = "frexp_float" -external ldexp : float -> int -> float = "ldexp_float" -external modf : float -> float * float = "modf_float" +external mod_float : float -> float -> float = "caml_fmod_float" "fmod" "float" +external frexp : float -> float * int = "caml_frexp_float" +external ldexp : float -> int -> float = "caml_ldexp_float" +external modf : float -> float * float = "caml_modf_float" external float : int -> float = "%floatofint" external float_of_int : int -> float = "%floatofint" external truncate : float -> int = "%intoffloat" @@ -127,7 +127,7 @@ type fpclass = | FP_zero | FP_infinite | FP_nan -external classify_float: float -> fpclass = "classify_float" +external classify_float: float -> fpclass = "caml_classify_float" (* String operations -- more in module String *) @@ -162,7 +162,7 @@ external snd : 'a * 'b -> 'b = "%field1" (* String conversion functions *) external format_int: string -> int -> string = "caml_format_int" -external format_float: string -> float -> string = "format_float" +external format_float: string -> float -> string = "caml_format_float" let string_of_bool b = if b then "true" else "false" @@ -193,7 +193,7 @@ let valid_float_lexem s = let string_of_float f = valid_float_lexem (format_float "%.12g" f);; -external float_of_string : string -> float = "float_of_string" +external float_of_string : string -> float = "caml_float_of_string" (* List operations -- more in module List *) diff --git a/stdlib/pervasives.mli b/stdlib/pervasives.mli index 3788cd440..2561cc4ca 100644 --- a/stdlib/pervasives.mli +++ b/stdlib/pervasives.mli @@ -247,55 +247,55 @@ external ( *. ) : float -> float -> float = "%mulfloat" external ( /. ) : float -> float -> float = "%divfloat" (** Floating-point division. *) -external ( ** ) : float -> float -> float = "power_float" "pow" "float" +external ( ** ) : float -> float -> float = "caml_power_float" "pow" "float" (** Exponentiation *) -external sqrt : float -> float = "sqrt_float" "sqrt" "float" +external sqrt : float -> float = "caml_sqrt_float" "sqrt" "float" (** Square root *) -external exp : float -> float = "exp_float" "exp" "float" +external exp : float -> float = "caml_exp_float" "exp" "float" (** Exponential. *) -external log : float -> float = "log_float" "log" "float" +external log : float -> float = "caml_log_float" "log" "float" (** Natural logarithm. *) -external log10 : float -> float = "log10_float" "log10" "float" +external log10 : float -> float = "caml_log10_float" "log10" "float" (** Base 10 logarithm. *) -external cos : float -> float = "cos_float" "cos" "float" +external cos : float -> float = "caml_cos_float" "cos" "float" (** See {!Pervasives.atan2}. *) -external sin : float -> float = "sin_float" "sin" "float" +external sin : float -> float = "caml_sin_float" "sin" "float" (** See {!Pervasives.atan2}. *) -external tan : float -> float = "tan_float" "tan" "float" +external tan : float -> float = "caml_tan_float" "tan" "float" (** See {!Pervasives.atan2}. *) -external acos : float -> float = "acos_float" "acos" "float" +external acos : float -> float = "caml_acos_float" "acos" "float" (** See {!Pervasives.atan2}. *) -external asin : float -> float = "asin_float" "asin" "float" +external asin : float -> float = "caml_asin_float" "asin" "float" (** See {!Pervasives.atan2}. *) -external atan : float -> float = "atan_float" "atan" "float" +external atan : float -> float = "caml_atan_float" "atan" "float" (** See {!Pervasives.atan2}. *) -external atan2 : float -> float -> float = "atan2_float" "atan2" "float" +external atan2 : float -> float -> float = "caml_atan2_float" "atan2" "float" (** The usual trigonometric functions. *) -external cosh : float -> float = "cosh_float" "cosh" "float" +external cosh : float -> float = "caml_cosh_float" "cosh" "float" (** See {!Pervasives.tanh}. *) -external sinh : float -> float = "sinh_float" "sinh" "float" +external sinh : float -> float = "caml_sinh_float" "sinh" "float" (** See {!Pervasives.tanh}. *) -external tanh : float -> float = "tanh_float" "tanh" "float" +external tanh : float -> float = "caml_tanh_float" "tanh" "float" (** The usual hyperbolic trigonometric functions. *) -external ceil : float -> float = "ceil_float" "ceil" "float" +external ceil : float -> float = "caml_ceil_float" "ceil" "float" (** See {!Pervasives.floor}. *) -external floor : float -> float = "floor_float" "floor" "float" +external floor : float -> float = "caml_floor_float" "floor" "float" (** Round the given float to an integer value. [floor f] returns the greatest integer value less than or equal to [f]. @@ -305,22 +305,22 @@ external floor : float -> float = "floor_float" "floor" "float" external abs_float : float -> float = "%absfloat" (** Return the absolute value of the argument. *) -external mod_float : float -> float -> float = "fmod_float" "fmod" "float" +external mod_float : float -> float -> float = "caml_fmod_float" "fmod" "float" (** [mod_float a b] returns the remainder of [a] with respect to [b]. The returned value is [a -. n *. b], where [n] is the quotient [a /. b] rounded towards zero to an integer. *) -external frexp : float -> float * int = "frexp_float" +external frexp : float -> float * int = "caml_frexp_float" (** [frexp f] returns the pair of the significant and the exponent of [f]. When [f] is zero, the significant [x] and the exponent [n] of [f] are equal to zero. When [f] is non-zero, they are defined by [f = x *. 2 ** n] and [0.5 <= x < 1.0]. *) -external ldexp : float -> int -> float = "ldexp_float" +external ldexp : float -> int -> float = "caml_ldexp_float" (** [ldexp x n] returns [x *. 2 ** n]. *) -external modf : float -> float * float = "modf_float" +external modf : float -> float * float = "caml_modf_float" (** [modf f] returns the pair of the fractional and integral part of [f]. *) @@ -370,7 +370,7 @@ type fpclass = (** The five classes of floating-point numbers, as determined by the {!Pervasives.classify_float} function. *) -external classify_float : float -> fpclass = "classify_float" +external classify_float : float -> fpclass = "caml_classify_float" (** Return the class of the given floating-point number: normal, subnormal, zero, infinite, or not a number. *) @@ -434,7 +434,7 @@ external int_of_string : string -> int = "caml_int_of_string" val string_of_float : float -> string (** Return the string representation of a floating-point number. *) -external float_of_string : string -> float = "float_of_string" +external float_of_string : string -> float = "caml_float_of_string" (** Convert the given string to a float. Raise [Failure "float_of_string"] if the given string is not a valid representation of a float. *) diff --git a/stdlib/printf.ml b/stdlib/printf.ml index ff893e053..f29d2b431 100644 --- a/stdlib/printf.ml +++ b/stdlib/printf.ml @@ -18,7 +18,7 @@ external format_int32: string -> int32 -> string = "caml_int32_format" external format_nativeint: string -> nativeint -> string = "caml_nativeint_format" external format_int64: string -> int64 -> string = "caml_int64_format" -external format_float: string -> float -> string = "format_float" +external format_float: string -> float -> string = "caml_format_float" let bad_format fmt pos = invalid_arg diff --git a/stdlib/sys.ml b/stdlib/sys.ml index 117205176..f3f9333fa 100644 --- a/stdlib/sys.ml +++ b/stdlib/sys.ml @@ -78,4 +78,4 @@ let catch_break on = (* OCaml version string, must be in the format described in sys.mli. *) -let ocaml_version = "3.07+10 (2004-01-01)";; +let ocaml_version = "3.07+11 (2004-01-02)";;