Priority-2 ENV Cache: hakmem_batch.c (1変数追加、1箇所置換)
【追加ENV変数】
- HAKMEM_BATCH_BG (default: 0)
【置換ファイル】
- core/hakmem_batch.c (1箇所 → ENV Cache)
【変更詳細】
1. ENV Cache (hakmem_env_cache.h):
- 構造体に1変数追加 (48→49変数)
- hakmem_env_cache_init()に初期化追加
- アクセサマクロ追加
- カウント更新: 48→49
2. hakmem_batch.c:
- batch_init():
getenv("HAKMEM_BATCH_BG") → HAK_ENV_BATCH_BG()
- #include "hakmem_env_cache.h" 追加
【効果】
- Batch初期化からgetenv()呼び出しを排除
- Cold pathだが、起動時のENV参照を削減
【テスト】
✅ make shared → 成功
✅ /tmp/test_mixed3_final → PASSED
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
#include "hakmem_batch.h"
|
||||
#include "hakmem_sys.h" // Phase 6.11.1: Syscall wrappers with timing
|
||||
#include "hakmem_whale.h" // Phase 6.11.1: Whale fast-path cache
|
||||
#include "hakmem_env_cache.h" // Priority-2: ENV cache
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -70,8 +71,8 @@ void hak_batch_init(void) {
|
||||
g_immediate_dontneed = 0;
|
||||
|
||||
// Background worker toggle
|
||||
const char* e_bg = getenv("HAKMEM_BATCH_BG");
|
||||
if (e_bg) g_bg_enabled = (atoi(e_bg) != 0);
|
||||
// Priority-2: Use cached ENV
|
||||
g_bg_enabled = HAK_ENV_BATCH_BG();
|
||||
|
||||
// Sync primitives
|
||||
pthread_mutex_init(&g_batch_mu, NULL);
|
||||
|
||||
Reference in New Issue
Block a user