Skip to content

Commit d1e061f

Browse files
compat.mimalloc 3.6.1 (#658)
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent cdd6578 commit d1e061f

3 files changed

Lines changed: 71 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
### Added
1111

12+
- **compat.mimalloc 3.6.1。** 与 3.4.5 并存;同一份源文件列表同时写出两个版本的目录布局(3.6.1 分为 `alloc/`、`arena/`、
13+
`heap/`、`prim/`、`profile/`、`util/` 七个目录,新增 `profile/` 三个单元),列表中某版本没有的名字在该版本下不选中任何文件。
14+
按 c11 编译时补上 `_DEFAULT_SOURCE`(上游以 gnu11 编译;3.6.1 的 `prim/prim.c` 在 `prim/unix/prim.c` 声明它之前已包含头文件)。
15+
测试成员 `mimalloc` 随之移动。openkal-musl 0.26 将它嵌入为默认分配器。GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res`
16+
镜像,sha256 两处一致。
1217
- **openkal-platform 0.20.2。** openkal-musl 0.25.0、openkal-llvm-runtime 0.16.15:线程一起分配,`memcmp` 与 `strlen` 按字或向量。
1318
GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res` 镜像,sha256 两处一致。
1419
- **openkal-musl 0.25.0;openkal-llvm-runtime 0.16.15。** 有第二个线程后,每个线程保留它释放的小尺寸类槽(≤ 2032 B),

‎pkgs/c/compat.mimalloc.lua‎

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
-- src/free.c is #included BY alloc.c (`#include "free.c"`, alloc.c:22),
1414
-- src/alloc-override.c likewise (alloc.c:21). Neither is a standalone TU.
1515
--
16-
-- The list below is upstream's own `mi_sources` (CMakeLists.txt:75-93), which is
17-
-- the only authoritative answer to "which files are TUs".
16+
-- The list below is upstream's own `mi_sources` (CMakeLists.txt:75-93 in 3.4.5,
17+
-- 107-135 in 3.6.1), which is the only authoritative answer to "which files are
18+
-- TUs". The two releases lay the same library out differently, and one list
19+
-- names both layouts: a name that is not in a release's tree selects nothing
20+
-- there.
1821
--
1922
-- `src/prim/prim.c` is a dispatcher: it #includes the platform implementation
2023
-- (prim/unix, prim/windows, prim/osx, …) for the host it is compiled on, so one
@@ -43,6 +46,13 @@ package = {
4346
},
4447
sha256 = "19a43af0645c57d348e729d5b31e23e912582911bb1047f795790834d3416221",
4548
},
49+
["3.6.1"] = {
50+
url = {
51+
GLOBAL = "https://github.com/microsoft/mimalloc/archive/refs/tags/v3.6.1.tar.gz",
52+
CN = "https://gitcode.com/mcpp-res/mimalloc/releases/download/3.6.1/mimalloc-3.6.1.tar.gz",
53+
},
54+
sha256 = "2672e6a99d4579fb4bb32d9de0d63aa424ce600d31fbfaf06eb74d940d2e07a6",
55+
},
4656
},
4757
macosx = {
4858
["3.4.5"] = {
@@ -52,6 +62,13 @@ package = {
5262
},
5363
sha256 = "19a43af0645c57d348e729d5b31e23e912582911bb1047f795790834d3416221",
5464
},
65+
["3.6.1"] = {
66+
url = {
67+
GLOBAL = "https://github.com/microsoft/mimalloc/archive/refs/tags/v3.6.1.tar.gz",
68+
CN = "https://gitcode.com/mcpp-res/mimalloc/releases/download/3.6.1/mimalloc-3.6.1.tar.gz",
69+
},
70+
sha256 = "2672e6a99d4579fb4bb32d9de0d63aa424ce600d31fbfaf06eb74d940d2e07a6",
71+
},
5572
},
5673
windows = {
5774
["3.4.5"] = {
@@ -61,6 +78,13 @@ package = {
6178
},
6279
sha256 = "19a43af0645c57d348e729d5b31e23e912582911bb1047f795790834d3416221",
6380
},
81+
["3.6.1"] = {
82+
url = {
83+
GLOBAL = "https://github.com/microsoft/mimalloc/archive/refs/tags/v3.6.1.tar.gz",
84+
CN = "https://gitcode.com/mcpp-res/mimalloc/releases/download/3.6.1/mimalloc-3.6.1.tar.gz",
85+
},
86+
sha256 = "2672e6a99d4579fb4bb32d9de0d63aa424ce600d31fbfaf06eb74d940d2e07a6",
87+
},
6488
},
6589
},
6690

@@ -69,7 +93,14 @@ package = {
6993
import_std = false,
7094
c_standard = "c11",
7195
include_dirs = { "*/include" },
96+
-- Upstream builds as gnu11; this recipe builds as c11, under which a C
97+
-- library declares nothing beyond ISO C unless asked. 3.6.1's
98+
-- `prim/prim.c' includes headers before `prim/unix/prim.c' states
99+
-- `_DEFAULT_SOURCE' for itself, so `syscall' and `madvise' arrive
100+
-- undeclared; stating it for every unit is what gnu11 did.
101+
cflags = { "-D_DEFAULT_SOURCE" },
72102
sources = {
103+
-- 3.4.5: one directory.
73104
"*/src/alloc.c",
74105
"*/src/alloc-aligned.c",
75106
"*/src/alloc-posix.c",
@@ -87,6 +118,37 @@ package = {
87118
"*/src/stats.c",
88119
"*/src/theap.c",
89120
"*/src/threadlocal.c",
121+
-- 3.6.1: the same library in seven directories, and three units
122+
-- the earlier layout did not have (profile/). `alloc/free.c' and
123+
-- `alloc/alloc-override.c' are included by `alloc/alloc.c', as
124+
-- `free.c' was by `alloc.c'.
125+
"*/src/prim/os.c",
126+
"*/src/prim/prim-tls.c",
127+
"*/src/util/libc.c",
128+
"*/src/util/options.c",
129+
"*/src/util/random.c",
130+
"*/src/util/stats.c",
131+
"*/src/util/threadlocal.c",
132+
"*/src/arena/arena.c",
133+
"*/src/arena/arena-alloc.c",
134+
"*/src/arena/arena-page.c",
135+
"*/src/arena/bitmap.c",
136+
"*/src/arena/bitmap-chunk.c",
137+
"*/src/alloc/alloc.c",
138+
"*/src/alloc/alloc-generic.c",
139+
"*/src/alloc/alloc-aligned.c",
140+
"*/src/alloc/alloc-posix.c",
141+
"*/src/alloc/page.c",
142+
"*/src/alloc/page-queue.c",
143+
"*/src/heap/heap.c",
144+
"*/src/heap/process.c",
145+
"*/src/heap/page-map.c",
146+
"*/src/heap/subproc.c",
147+
"*/src/heap/theap.c",
148+
"*/src/profile/sample-guarded.c",
149+
"*/src/profile/sample-profile.c",
150+
"*/src/profile/pprof.c",
151+
-- Both.
90152
"*/src/prim/prim.c",
91153
},
92154
targets = { ["mimalloc"] = { kind = "lib" } },

‎tests/examples/mimalloc/mcpp.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
# Resolves compat.mimalloc from this repo's own index via the inherited
55
# workspace-root `[indices]`. The dependency is spelled QUALIFIED for the same
66
# reason every other member does it: the redirect is keyed by the REQUEST's
7-
# namespace, so a bare `mimalloc = "3.4.5"` would resolve from the published
7+
# namespace, so a bare `mimalloc = "3.6.1"` would resolve from the published
88
# remote index and quietly stop testing this checkout.
99
[package]
1010
name = "mimalloc-tests"
1111
version = "0.1.0"
1212

1313
[dependencies.compat]
14-
mimalloc = "3.4.5"
14+
mimalloc = "3.6.1"

0 commit comments

Comments
 (0)