This commit is contained in:
2026-02-19 01:23:41 -06:00
parent 3f206d80dd
commit 85ef711229
12 changed files with 63609 additions and 58305 deletions

View File

@@ -13,6 +13,7 @@
#define BOOTSTRAP_MCODE "boot/bootstrap.cm.mcode"
#define ENGINE_SRC "internal/engine.cm"
#define ENGINE_CACHE_VERSION "engine-cache-v2"
#define CELL_SHOP_DIR ".cell"
#define CELL_CORE_DIR "packages/core"
@@ -222,7 +223,18 @@ static char *try_engine_cache(size_t *out_size) {
char *src = load_core_file(ENGINE_SRC, &src_size);
if (!src) return NULL;
char *hex = compute_blake2_hex(src, src_size);
size_t ver_len = strlen(ENGINE_CACHE_VERSION);
size_t salted_size = src_size + 1 + ver_len;
char *salted = malloc(salted_size);
if (!salted) {
free(src);
return NULL;
}
memcpy(salted, src, src_size);
salted[src_size] = '\n';
memcpy(salted + src_size + 1, ENGINE_CACHE_VERSION, ver_len);
char *hex = compute_blake2_hex(salted, salted_size);
free(salted);
free(src);
if (!hex) return NULL;
char *cpath = build_cache_path(hex);