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"
|
2014-12-18 03:09:25 +03:00
|
|
|
#include "idris_gmp.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);
|
2013-11-14 07:50:40 +04:00
|
|
|
|
|
|
|
__idris_argc = argc;
|
|
|
|
__idris_argv = argv;
|
|
|
|
|
|
|
|
VM* vm = init_vm(opts.max_stack_size, opts.init_heap_size, 1);
|
2014-12-18 03:09:25 +03:00
|
|
|
init_threadkeys();
|
|
|
|
init_threaddata(vm);
|
|
|
|
init_gmpalloc();
|
|
|
|
|
|
|
|
init_nullaries();
|
2014-08-19 23:06:33 +04:00
|
|
|
|
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
|
|
|
|
2014-12-18 03:09:25 +03:00
|
|
|
free_nullaries();
|
2013-03-15 21:01:55 +04:00
|
|
|
return EXIT_SUCCESS;
|
2012-08-31 14:13:02 +04:00
|
|
|
}
|