-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcompat.mimalloc.lua
More file actions
109 lines (107 loc) · 4.41 KB
/
Copy pathcompat.mimalloc.lua
File metadata and controls
109 lines (107 loc) · 4.41 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
-- compat.mimalloc — Microsoft's general-purpose allocator, built as a static lib.
--
-- Shape A (C-source compat): the user writes `#include <mimalloc.h>` and calls
-- mi_malloc / mi_free / mi_heap_* directly.
--
-- WHY THE SOURCE LIST IS ENUMERATED AND NOT A GLOB.
-- `src/*.c` would be wrong three times over, and each way is a link error
-- rather than a compile error:
--
-- src/static.c is an amalgamation -- it #includes the whole library
-- into one TU, so globbing it alongside the others
-- duplicates every symbol.
-- src/free.c is #included BY alloc.c (`#include "free.c"`, alloc.c:22),
-- src/alloc-override.c likewise (alloc.c:21). Neither is a standalone TU.
--
-- The list below is upstream's own `mi_sources` (CMakeLists.txt:75-93), which is
-- the only authoritative answer to "which files are TUs".
--
-- `src/prim/prim.c` is a dispatcher: it #includes the platform implementation
-- (prim/unix, prim/windows, prim/osx, …) for the host it is compiled on, so one
-- entry covers all three platforms with no per-platform source lists.
--
-- OVERRIDE IS OFF, which is the right default for a package. mimalloc can
-- replace the global malloc/free, but only when MI_MALLOC_OVERRIDE is defined
-- (alloc-override.c:13) -- and a dependency silently taking over the process
-- allocator is not something an index package should decide for its consumer.
-- The mi_* API is unaffected.
package = {
spec = "1",
namespace = "compat",
name = "mimalloc",
description = "mimalloc — compact general-purpose allocator with excellent performance",
licenses = {"MIT"},
repo = "https://github.com/microsoft/mimalloc",
type = "package",
xpm = {
linux = {
["3.4.5"] = {
url = {
GLOBAL = "https://github.com/microsoft/mimalloc/archive/refs/tags/v3.4.5.tar.gz",
CN = "https://gitcode.com/mcpp-res/mimalloc/releases/download/3.4.5/mimalloc-3.4.5.tar.gz",
},
sha256 = "19a43af0645c57d348e729d5b31e23e912582911bb1047f795790834d3416221",
},
},
macosx = {
["3.4.5"] = {
url = {
GLOBAL = "https://github.com/microsoft/mimalloc/archive/refs/tags/v3.4.5.tar.gz",
CN = "https://gitcode.com/mcpp-res/mimalloc/releases/download/3.4.5/mimalloc-3.4.5.tar.gz",
},
sha256 = "19a43af0645c57d348e729d5b31e23e912582911bb1047f795790834d3416221",
},
},
windows = {
["3.4.5"] = {
url = {
GLOBAL = "https://github.com/microsoft/mimalloc/archive/refs/tags/v3.4.5.tar.gz",
CN = "https://gitcode.com/mcpp-res/mimalloc/releases/download/3.4.5/mimalloc-3.4.5.tar.gz",
},
sha256 = "19a43af0645c57d348e729d5b31e23e912582911bb1047f795790834d3416221",
},
},
},
mcpp = {
language = "c++23",
import_std = false,
c_standard = "c11",
include_dirs = { "*/include" },
sources = {
"*/src/alloc.c",
"*/src/alloc-aligned.c",
"*/src/alloc-posix.c",
"*/src/arena.c",
"*/src/arena-meta.c",
"*/src/bitmap.c",
"*/src/heap.c",
"*/src/init.c",
"*/src/libc.c",
"*/src/options.c",
"*/src/os.c",
"*/src/page.c",
"*/src/page-map.c",
"*/src/random.c",
"*/src/stats.c",
"*/src/theap.c",
"*/src/threadlocal.c",
"*/src/prim/prim.c",
},
targets = { ["mimalloc"] = { kind = "lib" } },
deps = {},
linux = {
-- CMakeLists.txt:618-626 -- pthread for thread state, rt for
-- clock_gettime/shm, atomic for the 64-bit atomics on targets
-- where libatomic is not folded into libgcc.
ldflags = { "-lpthread", "-lrt", "-latomic" },
},
macosx = {
ldflags = { "-lpthread" },
},
windows = {
-- CMakeLists.txt:614 -- psapi/bcrypt for process memory info and
-- the RNG seed, the rest for the Win32 primitives.
ldflags = { "-lpsapi", "-lshell32", "-luser32", "-ladvapi32", "-lbcrypt" },
},
},
}