Skip to content

Commit

Permalink
pass bool to meaning mandatory alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif committed Nov 29, 2021
1 parent 140e93d commit 52da308
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions rts/motoko-rts/src/memory/ic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ pub(crate) unsafe fn get_aligned_heap_base() -> u32 {
}

#[no_mangle]
unsafe extern "C" fn init() {
HP = get_aligned_heap_base();
unsafe extern "C" fn init(align: bool) {
HP = if align {
get_aligned_heap_base()
} else {
get_heap_base()
};
LAST_HP = HP;
}

Expand Down
3 changes: 2 additions & 1 deletion src/codegen/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ module RTS = struct
E.add_func_import env "rts" "alloc_words" [I32Type] [I32Type];
E.add_func_import env "rts" "get_total_allocations" [] [I64Type];
E.add_func_import env "rts" "get_heap_size" [] [I32Type];
E.add_func_import env "rts" "init" [] [];
E.add_func_import env "rts" "init" [I32Type] [];
E.add_func_import env "rts" "alloc_blob" [I32Type] [I32Type];
E.add_func_import env "rts" "alloc_array" [I32Type] [I32Type];
()
Expand Down Expand Up @@ -8846,6 +8846,7 @@ and conclude_module env start_fi_o =

(* Wrap the start function with the RTS initialization *)
let rts_start_fi = E.add_fun env "rts_start" (Func.of_body env [] [] (fun env1 ->
Bool.lit (!Flags.gc_strategy = Mo_config.Flags.MarkCompact) ^^
E.call_import env "rts" "init" ^^
match start_fi_o with
| Some fi ->
Expand Down

0 comments on commit 52da308

Please sign in to comment.