Idris-dev/rts/idris_main.c

37 lines
761 B
C
Raw Normal View History

2013-03-14 15:04:45 +04:00
#include "idris_opts.h"
2013-03-15 21:01:55 +04:00
#include "idris_stats.h"
#include "idris_rts.h"
2013-03-14 15:04:45 +04:00
// The default options should give satisfactory results under many circumstances.
RTSOpts opts = {
.init_heap_size = 4096000,
.max_stack_size = 4096000,
.show_summary = 0
};
2012-08-31 14:13:02 +04:00
int main(int argc, char* argv[]) {
2013-03-14 15:04:45 +04:00
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);
initNullaries();
2012-09-08 03:49:02 +04:00
_idris__123_runMain0_125_(vm, NULL);
2013-03-14 15:04:45 +04:00
2013-03-15 21:01:55 +04:00
#ifdef IDRIS_DEBUG
2013-03-14 15:04:45 +04:00
if (opts.show_summary) {
idris_gcInfo(vm, 1);
}
2013-03-15 21:01:55 +04:00
#endif
Stats stats = terminate(vm);
if (opts.show_summary) {
print_stats(&stats);
}
2013-03-14 15:04:45 +04:00
freeNullaries();
2013-03-15 21:01:55 +04:00
return EXIT_SUCCESS;
2012-08-31 14:13:02 +04:00
}