mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-11-15 01:25:05 +03:00
f7b72a6732
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).
42 lines
856 B
C
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;
|
|
}
|