Skip to content

Cover the registry lookup with a test, register MRU, fix the extend doc - #317

Open
haochengxia wants to merge 1 commit into
1a1a11a:developfrom
haochengxia:fixplugin
Open

haochengxia wants to merge 1 commit into
1a1a11a:developfrom
haochengxia:fixplugin

Conversation

@haochengxia

@haochengxia haochengxia commented Jun 6, 2026 •

Copy link
Copy Markdown
Collaborator

Rebased onto develop. The registry this PR originally proposed landed
independently in #324 (5b4dd39), so the branch now carries only the parts that
are still missing. Original description at the bottom.

Issue #304 is already fixed on develop

Ran the command from #304 verbatim against 93529a1 (Fedora 43 container, GCC 15):

cache_algorithm: lru                    cache_algorithm: fifo
wss_ratio  cache_size  miss_rate        wss_ratio  cache_size  miss_rate
0.010000   292272B     0.333300         0.010000   292272B     0.350060
0.020000   584544B     0.294860         0.020000   584544B     0.315110

plot is saved to /tmp/libcachesim_profile_mrc_test_profiled_rmr.pdf
plot is saved to /tmp/libcachesim_profile_mrc_test_profiled_bmr.pdf

No undefined symbol: lru_init, no abort, exit 0. #304 can be closed.

What this PR contains now

A test for the lookup that broke. Nothing exercised
create_cache_using_plugin() — the entry point MINISIM uses and the one that
failed in #304 by going straight to dlsym(), which cannot see a built-in
constructor in a statically linked build. The new case also pins the
case-insensitive matching, since MINISIM callers pass whatever case the user typed.

MRU registered. It is compiled into the library but was missing from
cacheAlgoRegistry.c, so no CLI could reach it:

before:  mru -> do not support algorithm mru
after:   mru -> miss ratio 0.8544     MRU -> miss ratio 0.8544
         mrcProfiler --algo=mru --profiler=MINISIM -> 0.778945 / 0.700084

LRUv0 deliberately left out. Same situation as MRU, but it segfaults on the
first request, so registering it would only expose a crash:

$ cachesim data/cloudPhysicsIO.vscsi vscsi lruv0 0.1
Segmentation fault (core dumped)     # exit 139

A comment in the registry records why, so the gap does not read as an oversight.
Worth a separate issue — arcv0 and slruv0, the other two v0 variants, both run fine.

Docs. Step 5 of advanced_lib_extend.md still sent contributors to
bin/cachesim/cache_init.h; new algorithms belong in the registry now, and
cache_init.h is only for the ones needing more than a lookup. The mrcProfiler
quickstart and scripts/README.md now say names are case-insensitive, which was
true but undocumented.

Dropped from the original branch

Superseded by #324: evictionAlgoRegister.c, get_builtin_cache_init(), the
plugin.c and cache_init.h rewrites, and the evictionAlgo.h declaration.

Two review comments from the first round resolved themselves: fifo-reinsertion
→ Clock_init is not a bug (FIFO_Reinsertion.c:3 marks that file deprecated in
favour of Clock), and the s3fifod entry is gone — fedce66 removed that name on
purpose. s3lru, sr-lru and cr-lfu also stay unregistered: SR_LRU and
CR_LFU are marked "used by Cacheus" in their headers and S3LRU lives under
eviction/other/, so all three look intentionally internal.

Verification

testEvictionAlgo and testCLI pass with these changes. Unrelated, found while
building: traceAnalyzer/experimental fails to compile on GCC 15 because
robin_hood.h does not include <cstdint>; built with -include cstdint to work
around it.


Original description

For issue #304

In the original plugin system, we would find the symbol always via

sprintf(cache_init_func_name, "%s_init", cache_alg_name);
dlsym(..., cache_init_func_name);

This is safe when we impl plugin init function and name it correctly, but it
would affect the user experience when they need to use builtin init functions.
To achieve unified experiment like cachesim, you can refer to the init function
via lru, s3fifo, etc., we can share the lookup table via a register layer
and move it into the core lib.

After the modifiction, command like the following one would be safe

MPLBACKEND=Agg python3 scripts/profile_mrc.py \
  --tracepath data/twitter_cluster52.csv \
  --trace-format csv \
  --trace-format-params 'time-col=1,obj-id-col=2,obj-size-col=3,delimiter=,,obj-id-is-num=1' \
  --profiler=MINISIM \
  --algos=lru,fifo \
  --profiler-params=FIX_RATE,0.1,10 \
  --sizes=0.01,0.02 \
  --name /tmp/libcachesim_profile_mrc_test

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jun 6, 2026 •

Copy link
Copy Markdown

Looking for one thing? Review this PR in Change Stack to search files, summaries, diffs, and code without losing your place.

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces a built-in eviction algorithm registry system that enables case-insensitive algorithm name lookup and simplifies the plugin loading pathway. The registry maps algorithm name strings to initialization functions, consolidating algorithm discovery into a single lookup mechanism used by both the CLI and plugin systems.

Changes

Built-in Algorithm Registry System

Layer / File(s) Summary
Registry infrastructure and public API
libCacheSim/cache/evictionAlgoRegister.c, libCacheSim/include/libCacheSim/evictionAlgo.h, libCacheSim/cache/CMakeLists.txt
Defines a static eviction_algo_entry_t struct mapping algorithm names to cache_init_func_ptr initializer functions. Implements get_builtin_cache_init() with case-insensitive strcasecmp lookup over a built-in algorithm table that includes many standard algorithm names and feature-gated conditional entries (e.g., ENABLE_3L_CACHE, ENABLE_GLCACHE, ENABLE_LRB). Exposes the lookup function in the public header and adds the registry source to the CMake build.
Plugin system integration with registry lookup
libCacheSim/cache/plugin.c
Updates create_cache_internal to attempt builtin initialization first via get_builtin_cache_init() before falling back to dlopen/dlsym. Refactors dynamic-symbol-resolution error handling: clears prior dlerror, uses a typed function-pointer wrapper for dlsym, and now logs a warning and returns NULL on resolution failure instead of aborting, allowing fallback to external plugin loading.
Cache initialization refactoring for registry fallback
libCacheSim/bin/cachesim/cache_init.h
Decouples the hyperbolic algorithm check from the prior else if chain by converting it to a standalone if statement. Replaces the unsupported-algorithm error path with a call to get_builtin_cache_init(eviction_algo); if a builtin initializer is found, uses it to create the cache; otherwise, prints an error and aborts.
Tests and documentation for case-insensitive algorithm names
test/test_evictionAlgo.c, doc/advanced_lib_extend.md, doc/quickstart_mrcProfiler.md, scripts/README.md
Adds test_create_cache_using_plugin_lowercase() to verify that lowercase algorithm names (lru, fifo) resolve correctly via the registry. Updates documentation to describe the new registry-based integration workflow for custom eviction algorithms, clarifies that built-in algorithm names are case-insensitive (e.g., lru and LRU are equivalent), and removes outdated instructions about CLI-option modifications.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • 1a1a11a/libCacheSim#314: Both PRs touch eviction-algorithm initialization/registration: the main PR adds get_builtin_cache_init and changes create_cache to use it (affecting builtin algorithm resolution), while the retrieved PR adds the Clock2QPlus initializer declaration and registers "clock2qplus" in create_cache's simple_algos, so Clock2QPlus selection flows through the same initialization logic.

Poem

🐰 A registry is born, case-blind and keen,
Where algorithm names find homes serene,
From CLI to plugin, the paths now align,
No more hardcoded branches to tighten—
The cache builders leap through this cleaner design! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title mentions 'builtin algo lookup in plugin via unified register,' which directly matches the core change: introducing a unified registry to enable builtin algorithm lookup by name in the plugin system.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Infer (1.2.0)
libCacheSim/cache/evictionAlgoRegister.c

libCacheSim/cache/evictionAlgoRegister.c:3:10: fatal error: 'libCacheSim/evictionAlgo.h' file not found
3 | #include "libCacheSim/evictionAlgo.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/f0f98a88a8b72d76fc20174a25fd3bdd0eca399d-9b7cf1ed869f76ac/tmp/clang_command_.tmp.9f5149.txt
++Contents of '/tmp/coderabbit-infer/f0f98a88a8b72d76fc20174a25fd3bdd0eca399d-9b7cf1ed869f76ac/tmp/clang_command_.tmp.9f5149.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknow

... [truncated 789 characters] ...

.2.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/18/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/9b7cf1ed869f76ac/file.o" "-x" "c"
"libCacheSim/cache/evictionAlgoRegister.c" "-O0" "-fno-builtin"
"-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"

libCacheSim/cache/plugin.c

libCacheSim/cache/plugin.c:5:10: fatal error: 'libCacheSim/plugin.h' file not found
5 | #include "libCacheSim/plugin.h"
| ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/f0f98a88a8b72d76fc20174a25fd3bdd0eca399d-270ce802f01cb493/tmp/clang_command_.tmp.d58b7b.txt
++Contents of '/tmp/coderabbit-infer/f0f98a88a8b72d76fc20174a25fd3bdd0eca399d-270ce802f01cb493/tmp/clang_command_.tmp.d58b7b.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrela

... [truncated 721 characters] ...

er-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/18/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/270ce802f01cb493/file.o" "-x" "c"
"libCacheSim/cache/plugin.c" "-O0" "-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"

test/test_evictionAlgo.c

In file included from test/test_evictionAlgo.c:5:
test/common.h:8:10: fatal error: 'glib.h' file not found
8 | #include <glib.h>
| ^~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/f0f98a88a8b72d76fc20174a25fd3bdd0eca399d-98cdb18218f63ee2/tmp/clang_command_.tmp.113f1e.txt
++Contents of '/tmp/coderabbit-infer/f0f98a88a8b72d76fc20174a25fd3bdd0eca399d-98cdb18218f63ee2/tmp/clang_command_.tmp.113f1e.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all

... [truncated 729 characters] ...

nfer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/18/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/98cdb18218f63ee2/file.o" "-x" "c"
"test/test_evictionAlgo.c" "-O0" "-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the eviction algorithm registration by introducing a centralized registry (evictionAlgoRegister.c) and a helper function get_builtin_cache_init to look up built-in cache initialization functions. This replaces the inline registry in cache_init.h and allows unified lookup for both cachesim and plugin-based cache creation, enabling case-insensitive algorithm resolution. The feedback suggests adding defensive NULL checks for algorithm names, handling potential NULL values from dlopen and dlerror in plugin.c, and registering "tinyLFU" as an alias for "wtinyLFU" in the new registry.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread libCacheSim/cache/plugin.c Outdated
Comment on lines +59 to +62
cache_t *create_cache_internal(const char *const cache_alg_name,
common_cache_params_t cc_params,
void *cache_specific_params) {
cache_t *(*cache_init)(common_cache_params_t, void *) = NULL;
cache_init_func_ptr cache_init = get_builtin_cache_init(cache_alg_name);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Add a defensive check to ensure cache_alg_name is not NULL before proceeding. If cache_alg_name is NULL, passing it to get_builtin_cache_init or sprintf later in the function will cause a segmentation fault.

cache_t *create_cache_internal(const char *const cache_alg_name,
                               common_cache_params_t cc_params,
                               void *cache_specific_params) {
  if (cache_alg_name == NULL) {
    return NULL;
  }
  cache_init_func_ptr cache_init = get_builtin_cache_init(cache_alg_name);

cache_init_func_ptr init_func;
} eviction_algo_entry_t;

cache_init_func_ptr get_builtin_cache_init(const char *const cache_alg_name) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Add a defensive check to ensure cache_alg_name is not NULL before calling strcasecmp. If cache_alg_name is NULL, strcasecmp will dereference a null pointer and cause a segmentation fault.

cache_init_func_ptr get_builtin_cache_init(const char *const cache_alg_name) {
  if (cache_alg_name == NULL) {
    return NULL;
  }

Comment thread libCacheSim/cache/plugin.c Outdated
Comment on lines 71 to 73
void *handle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
/* should not check err here, otherwise ubuntu will report err even though
* everything is OK */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Add a defensive check to ensure handle is not NULL after calling dlopen. If dlopen fails and returns NULL, passing it to dlsym can cause undefined behavior or a crash on some platforms.

  void *handle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
  if (handle == NULL) {
    return NULL;
  }
  /* should not check err here, otherwise ubuntu will report err even though
   * everything is OK */

Comment on lines 89 to 92
if (cache_init == NULL) {
WARN("cannot load internal cache %s: error %s\n", cache_alg_name, err);
abort();
return NULL;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Handle the case where err is NULL gracefully. If dlerror() returns NULL, passing it directly to %s in WARN can cause undefined behavior or a crash on some platforms.

  if (cache_init == NULL) {
    WARN("cannot load internal cache %s: error %s\n", cache_alg_name, err ? err : "symbol not found");
    return NULL;
  }

Comment on lines +68 to +69
{"twoq", TwoQ_init},
{"wtinyLFU", WTinyLFU_init},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Add "tinyLFU" as an alias for WTinyLFU_init in the registry. Currently, only "wtinyLFU" is registered, but "tinyLFU" is a very common name used by users (e.g., in cachesim command line and potentially in mrcProfiler). Registering it as an alias ensures it can be resolved correctly through the unified registry.

Suggested change
{"twoq", TwoQ_init},
{"wtinyLFU", WTinyLFU_init},
{"twoq", TwoQ_init},
{"tinyLFU", WTinyLFU_init},
{"wtinyLFU", WTinyLFU_init},

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@libCacheSim/cache/evictionAlgoRegister.c`:
- Line 32: The mapping for the algorithm name "fifo-reinsertion" incorrectly
points to Clock_init; change the initializer to FIFO_Reinsertion_init in the
registration table so the string "fifo-reinsertion" is associated with the
correct initializer function (ensure FIFO_Reinsertion_init is declared/visible
where the table is defined).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e7c7aa52-41e7-4ba2-8a1c-2ac2550641a6

📥 Commits

Reviewing files that changed from the base of the PR and between da022c2 and f0f98a8.

📒 Files selected for processing (9)
  • doc/advanced_lib_extend.md
  • doc/quickstart_mrcProfiler.md
  • libCacheSim/bin/cachesim/cache_init.h
  • libCacheSim/cache/CMakeLists.txt
  • libCacheSim/cache/evictionAlgoRegister.c
  • libCacheSim/cache/plugin.c
  • libCacheSim/include/libCacheSim/evictionAlgo.h
  • scripts/README.md
  • test/test_evictionAlgo.c

{"cr_lfu", CR_LFU_init},
{"fifo", FIFO_init},
{"fifo-merge", FIFO_Merge_init},
{"fifo-reinsertion", Clock_init},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Map fifo-reinsertion to the correct initializer

Line 32 maps "fifo-reinsertion" to Clock_init, which will initialize the wrong policy for that algorithm name. This should point to FIFO_Reinsertion_init.

Suggested fix
-      {"fifo-reinsertion", Clock_init},
+      {"fifo-reinsertion", FIFO_Reinsertion_init},
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{"fifo-reinsertion", Clock_init},
{"fifo-reinsertion", FIFO_Reinsertion_init},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libCacheSim/cache/evictionAlgoRegister.c` at line 32, The mapping for the
algorithm name "fifo-reinsertion" incorrectly points to Clock_init; change the
initializer to FIFO_Reinsertion_init in the registration table so the string
"fifo-reinsertion" is associated with the correct initializer function (ensure
FIFO_Reinsertion_init is declared/visible where the table is defined).

@1a1a11a

1a1a11a commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Should I merge it?

@haochengxia haochengxia reopened this Sep 30, 2026
@haochengxia haochengxia changed the title [Bugfix] fix builtin algo lookup in plugin via unifed register [Superseded by #324] Registry leftovers: unreachable built-in names, stale docs, and a regression test for #304 Sep 30, 2026
The registry this PR originally proposed landed in 1a1a11a#324, so what is left is
the part around it.

test_evictionAlgo gains a case for create_cache_using_plugin(). Nothing
exercised that entry point, which is the one the MINISIM profiler uses and the
one that failed in issue 1a1a11a#304: it went straight to dlsym(), which cannot see a
built-in constructor in a statically linked build because the archive member
holding it is never pulled in. The case also pins the case-insensitive
matching, since MINISIM callers pass names in whatever case the user typed.

MRU is compiled into the library but was absent from the registry, so no CLI
could reach it. LRUv0 is absent for the same reason but stays out: unlike the
other v0 variants it segfaults on the first request, so naming it would only
expose a crash. A comment records that, so the omission does not read as an
oversight.

Step 5 of the extend doc still sent contributors to bin/cachesim/cache_init.h.
New algorithms belong in the registry now; cache_init.h is only for the ones
that need more than a lookup. The mrcProfiler quickstart and scripts/README
note that names are case-insensitive, which was true but undocumented.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@haochengxia haochengxia changed the title [Superseded by #324] Registry leftovers: unreachable built-in names, stale docs, and a regression test for #304 Cover the registry lookup with a test, register MRU, fix the extend doc Sep 30, 2026
@1a1a11a

1a1a11a commented Oct 6, 2026

Copy link
Copy Markdown
Owner

shoud this be merged

@haochengxia

Copy link
Copy Markdown
Collaborator Author

shoud this be merged

Yes. Before merging, I plan to spend a bit more time to check.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants