summaryrefslogtreecommitdiff
path: root/byterun
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2013-09-04 15:12:37 +0000
committerDamien Doligez <damien.doligez-inria.fr>2013-09-04 15:12:37 +0000
commit7844495624be79259e613182e6a615319b2f4376 (patch)
tree8656b9339174ab9061b42be2b50c2d9563401c8a /byterun
parente9723139769a4df610fadba0fdeecab298c1c17e (diff)
downloadocaml-7844495624be79259e613182e6a615319b2f4376.tar.gz
Merge branch 4.01 from branching point to 4.01.0+rc1
Command line used: svn merge --accept postpone -r 13776:14055 $REPO/version/4.01 . git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14060 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun')
-rwxr-xr-xbyterun/Makefile.common9
-rw-r--r--byterun/backtrace.c11
-rw-r--r--byterun/extern.c2
-rw-r--r--byterun/gc_ctrl.c2
-rw-r--r--byterun/memory.c2
-rw-r--r--byterun/minor_gc.c5
-rw-r--r--byterun/minor_gc.h2
7 files changed, 20 insertions, 13 deletions
diff --git a/byterun/Makefile.common b/byterun/Makefile.common
index bfc5573802..35e6650665 100755
--- a/byterun/Makefile.common
+++ b/byterun/Makefile.common
@@ -80,11 +80,12 @@ install-runtimed:
# the bytecode interpreter is confused).
# We sort the primitive file and remove duplicates to avoid this problem.
+# Warning: we use "sort | uniq" instead of "sort -u" because in the MSVC
+# port, the "sort" program in the path is Microsoft's and not cygwin's
+
primitives : $(PRIMS)
- sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
- $(PRIMS) > primitives.tmp
- sort primitives.tmp | uniq > primitives
- rm primitives.tmp
+ sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" $(PRIMS) \
+ | sort | uniq > primitives
prims.c : primitives
(echo '#include "mlvalues.h"'; \
diff --git a/byterun/backtrace.c b/byterun/backtrace.c
index 40f54a4d3b..4098e47e20 100644
--- a/byterun/backtrace.c
+++ b/byterun/backtrace.c
@@ -195,6 +195,7 @@ CAMLprim value caml_get_current_callstack(value max_frames_value) {
#define O_BINARY 0
#endif
+static char *read_debug_info_error = "";
static value read_debug_info(void)
{
CAMLparam0();
@@ -212,10 +213,14 @@ static value read_debug_info(void)
exec_name = caml_exe_name;
}
fd = caml_attempt_open(&exec_name, &trail, 1);
- if (fd < 0) CAMLreturn(Val_false);
+ if (fd < 0){
+ read_debug_info_error = "executable program file not found";
+ CAMLreturn(Val_false);
+ }
caml_read_section_descriptors(fd, &trail);
if (caml_seek_optional_section(fd, &trail, "DBUG") == -1) {
close(fd);
+ read_debug_info_error = "program not linked with -g";
CAMLreturn(Val_false);
}
chan = caml_open_descriptor_in(fd);
@@ -334,8 +339,8 @@ CAMLexport void caml_print_exception_backtrace(void)
events = read_debug_info();
if (events == Val_false) {
- fprintf(stderr,
- "(Program not linked with -g, cannot print stack backtrace)\n");
+ fprintf(stderr, "(Cannot print stack backtrace: %s)\n",
+ read_debug_info_error);
return;
}
for (i = 0; i < caml_backtrace_pos; i++) {
diff --git a/byterun/extern.c b/byterun/extern.c
index 1e2789b864..33fa89a913 100644
--- a/byterun/extern.c
+++ b/byterun/extern.c
@@ -34,7 +34,7 @@ static uintnat size_64; /* Size in words of 64-bit block for struct. */
/* Flags affecting marshaling */
-enum {
+enum {
NO_SHARING = 1, /* Flag to ignore sharing */
CLOSURES = 2, /* Flag to allow marshaling code pointers */
COMPAT_32 = 4 /* Flag to ensure that output can safely
diff --git a/byterun/gc_ctrl.c b/byterun/gc_ctrl.c
index 07cfc26d2a..84327fa289 100644
--- a/byterun/gc_ctrl.c
+++ b/byterun/gc_ctrl.c
@@ -401,7 +401,7 @@ CAMLprim value caml_gc_set(value v)
/* Minor heap size comes last because it will trigger a minor collection
(thus invalidating [v]) and it can raise [Out_of_memory]. */
- newminsize = norm_minsize (Bsize_wsize (Long_val (Field (v, 0))));
+ newminsize = Bsize_wsize (norm_minsize (Long_val (Field (v, 0))));
if (newminsize != caml_minor_heap_size){
caml_gc_message (0x20, "New minor heap size: %luk bytes\n",
newminsize/1024);
diff --git a/byterun/memory.c b/byterun/memory.c
index 7da6b459ff..54d91c96da 100644
--- a/byterun/memory.c
+++ b/byterun/memory.c
@@ -528,7 +528,7 @@ CAMLexport CAMLweakdef void caml_initialize (value *fp, value val)
CAMLexport CAMLweakdef void caml_modify (value *fp, value val)
{
- /* The write barrier implemented by [caml_modify] checks for the
+ /* The write barrier implemented by [caml_modify] checks for the
following two conditions and takes appropriate action:
1- a pointer from the major heap to the minor heap is created
--> add [fp] to the remembered set
diff --git a/byterun/minor_gc.c b/byterun/minor_gc.c
index 3e0dd4e21e..b15d1e4469 100644
--- a/byterun/minor_gc.c
+++ b/byterun/minor_gc.c
@@ -71,13 +71,14 @@ static void clear_table (struct caml_ref_table *tbl)
tbl->limit = tbl->threshold;
}
+/* size in bytes */
void caml_set_minor_heap_size (asize_t size)
{
char *new_heap;
void *new_heap_base;
- Assert (size >= Minor_heap_min);
- Assert (size <= Minor_heap_max);
+ Assert (size >= Bsize_wsize(Minor_heap_min));
+ Assert (size <= Bsize_wsize(Minor_heap_max));
Assert (size % sizeof (value) == 0);
if (caml_young_ptr != caml_young_end) caml_minor_collection ();
Assert (caml_young_ptr == caml_young_end);
diff --git a/byterun/minor_gc.h b/byterun/minor_gc.h
index 0258f4faa2..4727826d70 100644
--- a/byterun/minor_gc.h
+++ b/byterun/minor_gc.h
@@ -37,7 +37,7 @@ CAMLextern struct caml_ref_table caml_ref_table, caml_weak_ref_table;
(Assert (Is_block (val)), \
(addr)(val) < (addr)caml_young_end && (addr)(val) > (addr)caml_young_start)
-extern void caml_set_minor_heap_size (asize_t);
+extern void caml_set_minor_heap_size (asize_t); /* size in bytes */
extern void caml_empty_minor_heap (void);
CAMLextern void caml_minor_collection (void);
CAMLextern void garbage_collection (void); /* def in asmrun/signals.c */