forked from miking-lang/miking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatomic.ext-ocaml.mc
46 lines (39 loc) · 1.11 KB
/
atomic.ext-ocaml.mc
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
include "map.mc"
include "ocaml/ast.mc"
let impl = lam arg : { expr : String, ty : Type }.
{ expr = arg.expr, ty = arg.ty, libraries = [], cLibraries = [] }
let tyaref_ = lam. tyunknown_
let tygeneric_ = lam. tyunknown_
let atomicExtMap =
use OCamlTypeAst in
mapFromSeq cmpString
[ ("externalAtomicMake", [
impl
{ expr = "Atomic.make"
, ty = tyarrow_ (tygeneric_ "a") (tyaref_ "a")
}]),
("externalAtomicGet", [
impl
{ expr = "Atomic.get"
, ty = tyarrow_ (tyaref_ "a") (tygeneric_ "a")
}]),
("externalAtomicExchange", [
impl
{ expr = "Atomic.exchange"
, ty = tyarrows_ [tyaref_ "a", tygeneric_ "a", tygeneric_ "a"]
}]),
("externalAtomicCAS", [
impl
{ expr = "Atomic.compare_and_set"
, ty = tyarrows_ [ tyaref_ "a"
, tygeneric_ "a"
, tygeneric_ "a"
, tybool_
]
}]),
("externalAtomicFetchAndAdd", [
impl
{ expr = "Atomic.fetch_and_add"
, ty = tyarrows_ [tyaref_ "Int", tyint_, tyint_]
}])
]