From 3ba8bd08fbf30f478d99217168716552790043ba Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sat, 18 Jun 2022 09:53:40 +0200 Subject: [PATCH] Stage arena is not a sub --- compiler.h | 2 +- main.cpp | 4 ++++ programs/main.kl | 3 --- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler.h b/compiler.h index 13a048a..796a5d5 100644 --- a/compiler.h +++ b/compiler.h @@ -242,8 +242,8 @@ parse_init(Parse_Ctx *ctx, Allocator *perm_allocator, Allocator *heap_allocator) ctx->ordered_decls = {ctx->heap}; ctx->type_map = {ctx->heap}; ctx->modules = {ctx->heap}; - ctx->stage_arena = arena_sub(perm_allocator, mib(4), "Compiler stage arena"_s); bigint_allocator = ctx->perm; + arena_init(&ctx->stage_arena, "Compiler stage arena"_s); lex_init(ctx->perm, ctx->heap, ctx); ctx->builtins = ast_module(ctx->intern("builtins"_s)); diff --git a/main.cpp b/main.cpp index c6178e0..b4f25e7 100644 --- a/main.cpp +++ b/main.cpp @@ -176,10 +176,14 @@ int main(int argument_count, char **arguments){ F64 total_time = os_time(); begin_compilation(); + Ast_Module *module = add_module(pctx->intern(program_name)); parse_all_modules(); assert(module); resolve_everything_in_module(module); + + + arena_clear(&pctx->stage_arena); String result = get_compilation_result(); assert(os_write_file("program.c"_s, result)); { diff --git a/programs/main.kl b/programs/main.kl index 8f212b1..5a8d313 100644 --- a/programs/main.kl +++ b/programs/main.kl @@ -69,9 +69,6 @@ WinMain :: (hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: LPSTR, nS } assert(RegisterClassW(&w) != 0) - buff: *char = allocate(100) - thing: int = buff - screen_size: Vec2I = {1280, 720} window := CreateWindowExW( dwExStyle = 0, hWndParent = 0, hMenu = 0, lpParam = 0,