diff --git a/CHANGELOG.md b/CHANGELOG.md index 07d85eae..5fe304da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ ### Added +- **compat.mimalloc 3.6.1。** 与 3.4.5 并存;同一份源文件列表同时写出两个版本的目录布局(3.6.1 分为 `alloc/`、`arena/`、 + `heap/`、`prim/`、`profile/`、`util/` 七个目录,新增 `profile/` 三个单元),列表中某版本没有的名字在该版本下不选中任何文件。 + 按 c11 编译时补上 `_DEFAULT_SOURCE`(上游以 gnu11 编译;3.6.1 的 `prim/prim.c` 在 `prim/unix/prim.c` 声明它之前已包含头文件)。 + 测试成员 `mimalloc` 随之移动。openkal-musl 0.26 将它嵌入为默认分配器。GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res` + 镜像,sha256 两处一致。 - **openkal-platform 0.20.2。** openkal-musl 0.25.0、openkal-llvm-runtime 0.16.15:线程一起分配,`memcmp` 与 `strlen` 按字或向量。 GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res` 镜像,sha256 两处一致。 - **openkal-musl 0.25.0;openkal-llvm-runtime 0.16.15。** 有第二个线程后,每个线程保留它释放的小尺寸类槽(≤ 2032 B), diff --git a/pkgs/c/compat.mimalloc.lua b/pkgs/c/compat.mimalloc.lua index c77bc5d5..8c515171 100644 --- a/pkgs/c/compat.mimalloc.lua +++ b/pkgs/c/compat.mimalloc.lua @@ -13,8 +13,11 @@ -- 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". +-- The list below is upstream's own `mi_sources` (CMakeLists.txt:75-93 in 3.4.5, +-- 107-135 in 3.6.1), which is the only authoritative answer to "which files are +-- TUs". The two releases lay the same library out differently, and one list +-- names both layouts: a name that is not in a release's tree selects nothing +-- there. -- -- `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 @@ -43,6 +46,13 @@ package = { }, sha256 = "19a43af0645c57d348e729d5b31e23e912582911bb1047f795790834d3416221", }, + ["3.6.1"] = { + url = { + GLOBAL = "https://github.com/microsoft/mimalloc/archive/refs/tags/v3.6.1.tar.gz", + CN = "https://gitcode.com/mcpp-res/mimalloc/releases/download/3.6.1/mimalloc-3.6.1.tar.gz", + }, + sha256 = "2672e6a99d4579fb4bb32d9de0d63aa424ce600d31fbfaf06eb74d940d2e07a6", + }, }, macosx = { ["3.4.5"] = { @@ -52,6 +62,13 @@ package = { }, sha256 = "19a43af0645c57d348e729d5b31e23e912582911bb1047f795790834d3416221", }, + ["3.6.1"] = { + url = { + GLOBAL = "https://github.com/microsoft/mimalloc/archive/refs/tags/v3.6.1.tar.gz", + CN = "https://gitcode.com/mcpp-res/mimalloc/releases/download/3.6.1/mimalloc-3.6.1.tar.gz", + }, + sha256 = "2672e6a99d4579fb4bb32d9de0d63aa424ce600d31fbfaf06eb74d940d2e07a6", + }, }, windows = { ["3.4.5"] = { @@ -61,6 +78,13 @@ package = { }, sha256 = "19a43af0645c57d348e729d5b31e23e912582911bb1047f795790834d3416221", }, + ["3.6.1"] = { + url = { + GLOBAL = "https://github.com/microsoft/mimalloc/archive/refs/tags/v3.6.1.tar.gz", + CN = "https://gitcode.com/mcpp-res/mimalloc/releases/download/3.6.1/mimalloc-3.6.1.tar.gz", + }, + sha256 = "2672e6a99d4579fb4bb32d9de0d63aa424ce600d31fbfaf06eb74d940d2e07a6", + }, }, }, @@ -69,7 +93,14 @@ package = { import_std = false, c_standard = "c11", include_dirs = { "*/include" }, + -- Upstream builds as gnu11; this recipe builds as c11, under which a C + -- library declares nothing beyond ISO C unless asked. 3.6.1's + -- `prim/prim.c' includes headers before `prim/unix/prim.c' states + -- `_DEFAULT_SOURCE' for itself, so `syscall' and `madvise' arrive + -- undeclared; stating it for every unit is what gnu11 did. + cflags = { "-D_DEFAULT_SOURCE" }, sources = { + -- 3.4.5: one directory. "*/src/alloc.c", "*/src/alloc-aligned.c", "*/src/alloc-posix.c", @@ -87,6 +118,37 @@ package = { "*/src/stats.c", "*/src/theap.c", "*/src/threadlocal.c", + -- 3.6.1: the same library in seven directories, and three units + -- the earlier layout did not have (profile/). `alloc/free.c' and + -- `alloc/alloc-override.c' are included by `alloc/alloc.c', as + -- `free.c' was by `alloc.c'. + "*/src/prim/os.c", + "*/src/prim/prim-tls.c", + "*/src/util/libc.c", + "*/src/util/options.c", + "*/src/util/random.c", + "*/src/util/stats.c", + "*/src/util/threadlocal.c", + "*/src/arena/arena.c", + "*/src/arena/arena-alloc.c", + "*/src/arena/arena-page.c", + "*/src/arena/bitmap.c", + "*/src/arena/bitmap-chunk.c", + "*/src/alloc/alloc.c", + "*/src/alloc/alloc-generic.c", + "*/src/alloc/alloc-aligned.c", + "*/src/alloc/alloc-posix.c", + "*/src/alloc/page.c", + "*/src/alloc/page-queue.c", + "*/src/heap/heap.c", + "*/src/heap/process.c", + "*/src/heap/page-map.c", + "*/src/heap/subproc.c", + "*/src/heap/theap.c", + "*/src/profile/sample-guarded.c", + "*/src/profile/sample-profile.c", + "*/src/profile/pprof.c", + -- Both. "*/src/prim/prim.c", }, targets = { ["mimalloc"] = { kind = "lib" } }, diff --git a/tests/examples/mimalloc/mcpp.toml b/tests/examples/mimalloc/mcpp.toml index 7eee8f2c..c88c7fd3 100644 --- a/tests/examples/mimalloc/mcpp.toml +++ b/tests/examples/mimalloc/mcpp.toml @@ -4,11 +4,11 @@ # Resolves compat.mimalloc from this repo's own index via the inherited # workspace-root `[indices]`. The dependency is spelled QUALIFIED for the same # reason every other member does it: the redirect is keyed by the REQUEST's -# namespace, so a bare `mimalloc = "3.4.5"` would resolve from the published +# namespace, so a bare `mimalloc = "3.6.1"` would resolve from the published # remote index and quietly stop testing this checkout. [package] name = "mimalloc-tests" version = "0.1.0" [dependencies.compat] -mimalloc = "3.4.5" +mimalloc = "3.6.1"