Table of Contents

WARNING : this page has been deprecated

some information may still be relevant.





How to compile samples

Here is the installation documentation.
To quickly test ocaml4multicore with our Stop and Copy Garbage Collector and our samples, jump to the last item of this section.

It should be compiled if you have used our installation script.

We provide a Makefile which can compile ocaml sources with any compiled GC (compatible with ocaml4multicore) if it is in the right folder (ocaml4multicore/runtime/gcs/.

For instance, to use our Stop and Copy GC you can execute the following command:

export GC=sc_par
make test

With this command every .ml file in the tests directory is compiled using ocaml4multicore. It was made to be used with single-file source code but you can easily adapt our Makefile to your needs.

GC=sc_par make test

How to add a Garbage Collector

/*** functions to implement ***/
 
/*modifies a pointed value*/
void gc_modify (value*, value) ;
/*alloc n BYTES uninitialized*/
value* gc_alloc_local_raw (asize_t) ;
/*alloc n VALUES with tag*/
value* gc_alloc_local (mlsize_t, int) ;
/*alloc n VALUES with tag*/
value* gc_alloc_shared (mlsize_t, int) ;
/*alloc n BYTES uninitialized, uncollectable*/
void* gc_alloc_stat (asize_t) ;
void* gc_resize_stat (void*, asize_t);
void gc_free_stat (void*) ;
/*call gc*/
void gc_invoke_local () ;
void gc_invoke_full () ;
/*called at program start*/
void gc_init ();
/*predicate to know wether a pointer has been allocated*/
int gc_allocated (void*);
/* called at thread start to initialize local data*/
void gc_init_local ();
/*called at thread stop*/
void gc_terminate_local ();
/* protect roots modifications */
void gc_begin_roots ();
void gc_end_roots ();
/* thread join implementation*/
void gc_wait_termination (struct caml_thread_descr *);
/*tweak to use mutexes*/
void gc_set_interrupted();
void gc_unset_interrupted();
 
/*** functions to use */
 
extern void caml_do_roots (void (*) (value, value *));

You can see a description of these functions in the documentation.