small hto load improvements

This commit is contained in:
Krzosa Karol
2025-01-26 19:55:31 +01:00
parent 5d127b7f2c
commit 8ae6e15bf8
18 changed files with 197 additions and 216 deletions

View File

@@ -9,7 +9,5 @@ gb_thread thread_ctx_t global_thread_context = {
fn void core_init(void) {
tcx = &global_thread_context;
tcx->temp = ma_create(ma_default_reserve_size);
ma_init(&tcx->perm, ma_default_reserve_size);
os_core_init();
}

View File

@@ -23,7 +23,7 @@ fn void default_log_proc(log_level_t level, s8_t file_and_line, s8_t string) {
} break;
case log_level_fatal: {
os_error_box(s8_printf(scratch.arena, "%S: fatal error: %S\n", file_and_line, string).str);
debug_break();
if (tcx->log.break_on_fatal) debug_break();
} break;
default_is_invalid;
}

View File

@@ -34,4 +34,6 @@ fn f64 os_parse_float(char *str) {
}
fn void os_core_init(void) {
tcx->temp = ma_create(ma_default_reserve_size);
ma_init(&tcx->perm, ma_default_reserve_size);
}

View File

@@ -41,13 +41,13 @@ fn void os_core_init(void) {
isize page_count = __builtin_wasm_memory_size(0);
u8 *memory = (u8 *)&__heap_base;
usize memory_size = page_count * (page_size) - (isize)memory;
tcx._perm.data = memory;
tcx._perm.commit = tcx._perm.reserve = memory_size;
tcx->perm.data = memory;
tcx->perm.commit = tcx->perm.reserve = memory_size;
ma_arena_t *perm = &tcx._perm;
ma_push_arena_ex(&tcx._perm, &tcx.scratch[0], mib(1));
ma_push_arena_ex(&tcx._perm, &tcx.scratch[1], kib(256));
ma_push_arena_ex(&tcx._perm, &tcx.scratch[2], kib(64));
ma_arena_t *perm = &tcx->perm;
ma_push_arena_ex(&tcx->perm, &tcx->scratch[0], mib(1));
ma_push_arena_ex(&tcx->perm, &tcx->scratch[1], kib(256));
ma_push_arena_ex(&tcx->perm, &tcx->scratch[2], kib(64));
tcx.temp = ma_push_arena(perm, mib(2));
tcx->temp = ma_push_arena(perm, mib(2));
}

View File

@@ -34,4 +34,6 @@ fn f64 os_parse_float(char *str) {
}
fn void os_core_init(void) {
tcx->temp = ma_create(ma_default_reserve_size);
ma_init(&tcx->perm, ma_default_reserve_size);
}