summaryrefslogtreecommitdiff
path: root/byterun/startup.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1996-10-17 09:57:49 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1996-10-17 09:57:49 +0000
commitb379e9a69157fcb8902ac222ab2692d5fb860cf3 (patch)
tree97eab779dc1ce3b37a44c4c359ce3a3df2ada098 /byterun/startup.c
parentbc96b0f934117b6d21105c6c97caf19ae3ee3ec3 (diff)
downloadocaml-b379e9a69157fcb8902ac222ab2692d5fb860cf3.tar.gz
interp.c: retour a la division et au modulo de C (non specifies sur
les arguments negatifs) io, startup: allocation des buffers d'I/O dans le tas majeur, comme objets finalises. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1077 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/startup.c')
-rw-r--r--byterun/startup.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/byterun/startup.c b/byterun/startup.c
index aba2bf7826..1388c4a48b 100644
--- a/byterun/startup.c
+++ b/byterun/startup.c
@@ -209,30 +209,32 @@ void caml_main(argc, argv)
if (sigsetjmp(raise_buf.buf, 1) == 0) {
external_raise = &raise_buf;
-
init_gc (minor_heap_init, heap_chunk_init, percent_free_init,
verbose_init);
init_stack();
init_atoms();
-
+ /* Load the code */
lseek(fd, - (long) (TRAILER_SIZE + trail.code_size + trail.data_size
+ trail.symbol_size + trail.debug_size), 2);
-
code_size = trail.code_size;
start_code = (code_t) stat_alloc(code_size);
if (read(fd, (char *) start_code, code_size) != code_size)
fatal_error("Fatal error: truncated bytecode file.\n");
-
#ifdef ARCH_BIG_ENDIAN
fixup_endianness(start_code, code_size);
#endif
-
- chan = open_descr(fd);
- global_data = input_value(chan);
- close_channel(chan);
+ /* Load the globals */
+ { struct channel * chan;
+ Push_roots(r, 1);
+ chan = open_descr(fd);
+ r[0] = (value) chan;
+ global_data = input_value(chan);
+ close_channel(chan);
+ Pop_roots();
+ }
/* Ensure that the globals are in the major heap. */
oldify(global_data, &global_data);
-
+ /* Run the code */
sys_init(argv + i);
interprete(start_code, code_size);