summaryrefslogtreecommitdiffstats
path: root/byterun
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2006-01-04 16:55:50 +0000
committerDamien Doligez <damien.doligez-inria.fr>2006-01-04 16:55:50 +0000
commit125ea40d4c63e7bae69e30c2b6ba2b598b1bd5c2 (patch)
tree6884b9b9821851f7f57add043646b54fe4cc85f3 /byterun
parent3aaf0659a4c172c71cbf4828ed3bb6aa833c53e0 (diff)
fusion 3.09.0 -> 3.09.1
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7307 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun')
-rw-r--r--byterun/Makefile3
-rw-r--r--byterun/Makefile.nt2
-rw-r--r--byterun/callback.c6
-rw-r--r--byterun/extern.c9
-rw-r--r--byterun/sys.c38
-rw-r--r--byterun/weak.c7
6 files changed, 48 insertions, 17 deletions
diff --git a/byterun/Makefile b/byterun/Makefile
index 6165e725d..d6e4a6340 100644
--- a/byterun/Makefile
+++ b/byterun/Makefile
@@ -57,7 +57,7 @@ install:
done
cp ld.conf $(LIBDIR)/ld.conf
-ld.conf:
+ld.conf: ../config/Makefile
echo "$(STUBLIBDIR)" >ld.conf
echo "$(LIBDIR)" >>ld.conf
@@ -72,6 +72,7 @@ libcamlrund.a: $(DOBJS)
clean:
rm -f ocamlrun$(EXE) ocamlrund$(EXE) *.o lib*.a
rm -f primitives prims.c opnames.h jumptbl.h ld.conf
+ rm -f version.h
primitives : $(PRIMS)
sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
diff --git a/byterun/Makefile.nt b/byterun/Makefile.nt
index 93fe717fc..b6ec01da7 100644
--- a/byterun/Makefile.nt
+++ b/byterun/Makefile.nt
@@ -104,7 +104,7 @@ main.$(DO): main.c
$(CC) $(CFLAGS) $(BYTECCCOMPOPTS) -c $<
mv $*.$(O) $*.$(SO)
-.depend.nt:
+.depend.nt: .depend
sed -e '/\.d\.o/q' -e 's/^\(.*\)\.o:/\1.$$(DO) \1.$$(SO):/' .depend > .depend.nt
include .depend.nt
diff --git a/byterun/callback.c b/byterun/callback.c
index a960df544..bfafd349d 100644
--- a/byterun/callback.c
+++ b/byterun/callback.c
@@ -220,6 +220,12 @@ CAMLprim value caml_register_named_value(value vname, value val)
char * name = String_val(vname);
unsigned int h = hash_value_name(name);
+ for (nv = named_value_table[h]; nv != NULL; nv = nv->next) {
+ if (strcmp(name, nv->name) == 0) {
+ nv->val = val;
+ return Val_unit;
+ }
+ }
nv = (struct named_value *)
caml_stat_alloc(sizeof(struct named_value) + strlen(name));
strcpy(nv->name, name);
diff --git a/byterun/extern.c b/byterun/extern.c
index a8e367f18..f27a95844 100644
--- a/byterun/extern.c
+++ b/byterun/extern.c
@@ -144,6 +144,13 @@ static void init_extern_output(void)
extern_limit = extern_output_block->data + SIZE_EXTERN_OUTPUT_BLOCK;
}
+static void close_extern_output(void)
+{
+ if (extern_userprovided_output == NULL){
+ extern_output_block->end = extern_ptr;
+ }
+}
+
static void free_extern_output(void)
{
struct output_block * blk, * nextblk;
@@ -465,7 +472,7 @@ static intnat extern_value(value v, value flags)
/* Marshal the object */
extern_rec(v);
/* Record end of output */
- extern_output_block->end = extern_ptr;
+ close_extern_output();
/* Undo the modifications done on externed blocks */
extern_replay_trail();
/* Write the sizes */
diff --git a/byterun/sys.c b/byterun/sys.c
index 2dd20312a..7e130c065 100644
--- a/byterun/sys.c
+++ b/byterun/sys.c
@@ -34,6 +34,10 @@
#ifdef HAS_TIMES
#include <sys/times.h>
#endif
+#ifdef HAS_GETRUSAGE
+#include <sys/time.h>
+#include <sys/resource.h>
+#endif
#ifdef HAS_GETTIMEOFDAY
#include <sys/time.h>
#endif
@@ -247,20 +251,28 @@ CAMLprim value caml_sys_system_command(value command)
CAMLprim value caml_sys_time(value unit)
{
-#ifdef HAS_TIMES
-#ifndef CLK_TCK
-#ifdef HZ
-#define CLK_TCK HZ
-#else
-#define CLK_TCK 60
-#endif
-#endif
- struct tms t;
- times(&t);
- return caml_copy_double((double)(t.tms_utime + t.tms_stime) / CLK_TCK);
+#ifdef HAS_GETRUSAGE
+ struct rusage ru;
+
+ getrusage (RUSAGE_SELF, &ru);
+ return caml_copy_double (ru.ru_utime.tv_sec + ru.ru_utime.tv_usec / 1e6
+ + ru.ru_stime.tv_sec + ru.ru_stime.tv_usec / 1e6);
#else
- /* clock() is standard ANSI C */
- return caml_copy_double((double)clock() / CLOCKS_PER_SEC);
+ #ifdef HAS_TIMES
+ #ifndef CLK_TCK
+ #ifdef HZ
+ #define CLK_TCK HZ
+ #else
+ #define CLK_TCK 60
+ #endif
+ #endif
+ struct tms t;
+ times(&t);
+ return caml_copy_double((double)(t.tms_utime + t.tms_stime) / CLK_TCK);
+ #else
+ /* clock() is standard ANSI C */
+ return caml_copy_double((double)clock() / CLOCKS_PER_SEC);
+ #endif
#endif
}
diff --git a/byterun/weak.c b/byterun/weak.c
index efd23c465..0cea2a6dc 100644
--- a/byterun/weak.c
+++ b/byterun/weak.c
@@ -19,6 +19,7 @@
#include "alloc.h"
#include "fail.h"
+#include "major_gc.h"
#include "memory.h"
#include "mlvalues.h"
@@ -113,7 +114,11 @@ CAMLprim value caml_weak_get_copy (value ar, value n)
if (Tag_val (v) < No_scan_tag){
mlsize_t i;
for (i = 0; i < Wosize_val (v); i++){
- Modify (&Field (elt, i), Field (v, i));
+ value f = Field (v, i);
+ if (caml_gc_phase == Phase_mark && Is_block (f) && Is_in_heap (f)){
+ caml_darken (f, NULL);
+ }
+ Modify (&Field (elt, i), f);
}
}else{
memmove (Bp_val (elt), Bp_val (v), Bosize_val (v));