optimize frames; remove trampoline

This commit is contained in:
2026-02-18 22:37:48 -06:00
parent 27ca008f18
commit e004b2c472
14 changed files with 318 additions and 91 deletions

View File

@@ -37,6 +37,7 @@ static char *compute_blake2_hex(const char *data, size_t size) {
uint8_t hash[32];
crypto_blake2b(hash, 32, (const uint8_t *)data, size);
char *hex = malloc(65);
if (!hex) return NULL;
for (int i = 0; i < 32; i++)
snprintf(hex + i * 2, 3, "%02x", hash[i]);
return hex;
@@ -64,6 +65,7 @@ static int write_cache_file(const char *path, const uint8_t *data, size_t size)
// Returns heap-allocated binary data and sets *out_size, or NULL on failure
static char *load_or_cache_bootstrap(const char *mcode_data, size_t mcode_size, size_t *out_size) {
char *hex = compute_blake2_hex(mcode_data, mcode_size);
if (!hex) return NULL;
char *cpath = build_cache_path(hex);
free(hex);
@@ -222,6 +224,7 @@ static char *try_engine_cache(size_t *out_size) {
char *hex = compute_blake2_hex(src, src_size);
free(src);
if (!hex) return NULL;
char *cpath = build_cache_path(hex);
if (!cpath) { free(hex); return NULL; }
free(hex);