Idris-dev/rts/idris_main.c
Edwin Brady f7b72a6732 Use idris_alloc for GMP allocation
Now storing VM in a pthread_key (in environments which support pthreads)
meaning that allocation doesn't need to be passed a VM pointer, and so
we can safely use the idris allocator from GMP (and indeed any C library
which wants to use it).
2014-12-18 00:09:25 +00:00

42 lines
856 B
C

#include "idris_opts.h"
#include "idris_stats.h"
#include "idris_rts.h"
#include "idris_gmp.h"
// The default options should give satisfactory results under many circumstances.
RTSOpts opts = {
.init_heap_size = 4096000,
.max_stack_size = 4096000,
.show_summary = 0
};
int main(int argc, char* argv[]) {
parse_shift_args(&opts, &argc, &argv);
__idris_argc = argc;
__idris_argv = argv;
VM* vm = init_vm(opts.max_stack_size, opts.init_heap_size, 1);
init_threadkeys();
init_threaddata(vm);
init_gmpalloc();
init_nullaries();
_idris__123_runMain0_125_(vm, NULL);
#ifdef IDRIS_DEBUG
if (opts.show_summary) {
idris_gcInfo(vm, 1);
}
#endif
Stats stats = terminate(vm);
if (opts.show_summary) {
print_stats(&stats);
}
free_nullaries();
return EXIT_SUCCESS;
}