mirror of
https://github.com/tweag/ormolu.git
synced 2024-08-17 00:40:27 +03:00
Improve ormolu live wasm size
This commit is contained in:
parent
fb5fcb3336
commit
82a46c275e
@ -1,9 +1,21 @@
|
||||
#include "Rts.h"
|
||||
|
||||
#include "Main_stub.h"
|
||||
#include <Rts.h>
|
||||
|
||||
void malloc_inspect_all(void (*handler)(void *start, void *end,
|
||||
size_t used_bytes, void *callback_arg),
|
||||
void *arg);
|
||||
|
||||
static void malloc_inspect_all_handler(void *start, void *end,
|
||||
size_t used_bytes, void *callback_arg) {
|
||||
if (used_bytes == 0) {
|
||||
memset(start, 0, (size_t)end - (size_t)start);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((export_name("wizer.initialize"))) void __wizer_initialize(void) {
|
||||
char *args[] = {
|
||||
"ormolu-live.wasm", "+RTS", "--nonmoving-gc", "-H64m", "-RTS", NULL};
|
||||
"ormolu-live.wasm", "+RTS", "-H64m", "-RTS", NULL};
|
||||
int argc = sizeof(args) / sizeof(args[0]) - 1;
|
||||
char **argv = args;
|
||||
hs_init_with_rtsopts(&argc, &argv);
|
||||
@ -11,4 +23,6 @@ __attribute__((export_name("wizer.initialize"))) void __wizer_initialize(void) {
|
||||
hs_perform_gc();
|
||||
hs_perform_gc();
|
||||
rts_clearMemory();
|
||||
malloc_inspect_all(malloc_inspect_all_handler, NULL);
|
||||
memset(0, 0, (size_t)__builtin_frame_address(0));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user