-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathtranslmode.ml
46 lines (39 loc) · 1.8 KB
/
translmode.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(**************************************************************************)
(* *)
(* OCaml *)
(* *)
(* Zesen Qian, Jane Street, London *)
(* *)
(* Copyright 2024 Jane Street Group LLC *)
(* *)
(* All rights reserved. This file is distributed under the terms of *)
(* the GNU Lesser General Public License version 2.1, with the *)
(* special exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)
open Lambda
open Mode
let transl_locality_mode = function
| Locality.Const.Global -> alloc_heap
| Locality.Const.Local -> alloc_local
let transl_locality_mode_l locality =
Locality.zap_to_floor locality
|> transl_locality_mode
let transl_locality_mode_r locality =
(* r mode are for allocations; [optimise_allocations] should have pushed it
to ceil and determined. *)
Locality.check_const locality
|> Option.get
|> transl_locality_mode
let transl_alloc_mode_l mode =
(* we only take the locality axis *)
Alloc.locality mode
|> transl_locality_mode_l
let transl_alloc_mode_r mode =
(* we only take the locality axis *)
Alloc.locality mode
|> transl_locality_mode_r
let transl_modify_mode locality =
match Locality.zap_to_floor locality with
| Global -> modify_heap
| Local -> modify_maybe_stack