Getting rid of heap stuff completely but also naively

This commit is contained in:
Krzosa Karol
2022-10-09 10:45:36 +02:00
parent 829de11987
commit 8ad8e72b3a
5 changed files with 13 additions and 130 deletions

View File

@@ -2,8 +2,8 @@
function void
lex_init(Allocator *token_string_arena, Allocator *map_allocator, Lexer *l){
l->arena = token_string_arena;
l->tokens = array_make<Token>(token_string_arena, 1024*2);
l->interns= intern_table_make(token_string_arena, map_allocator, 1024);
l->tokens = array_make<Token>(token_string_arena, 4096*4);
l->interns= intern_table_make(token_string_arena, map_allocator, 2048);
/*#import meta
for i in meta.keywords:
@@ -71,18 +71,17 @@ op_info_table[19].op = l->intern("!"_s);
}
function void
parse_init(Parse_Ctx *ctx, Arena *perm_allocator, Allocator *heap_allocator){
parse_init(Parse_Ctx *ctx, Arena *perm_allocator){
pctx = ctx;
ctx->perm = perm_allocator;
ctx->heap = heap_allocator;
ctx->type_map = {ctx->heap};
ctx->type_map = map_make(ctx->perm, 2048);
ctx->gen = {ctx->perm};
ctx->helper_builder= {ctx->perm};
ctx->scope_ids = 1;
ctx->scope_ids = 1;
bigint_allocator = ctx->perm;
arena_init(&ctx->stage_arena, "Compiler stage arena"_s);
lex_init(ctx->perm, ctx->heap, ctx);
lex_init(ctx->perm, ctx->perm, ctx);
init_type();
// Init paths
@@ -97,18 +96,15 @@ parse_init(Parse_Ctx *ctx, Arena *perm_allocator, Allocator *heap_allocator){
function void
begin_compilation(){
init_ctx_time_begin = os_time();
OS_Heap *heap = exp_alloc_type(&pernament_arena, OS_Heap, AF_ZeroMemory);
*heap = win32_os_heap_create(false, mib(4), 0, "Compiler heap"_s);
Parse_Ctx *ctx = exp_alloc_type(&pernament_arena, Parse_Ctx, AF_ZeroMemory);
parse_init(ctx, &pernament_arena, heap);
parse_init(ctx, &pernament_arena);
init_ctx_time_end = os_time();
}
function void
destroy_compiler(){
exp_destroy(pctx->heap);
exp_free_all(pctx->perm);
exp_destroy(&pctx->stage_arena);
exp_free_all(&pctx->stage_arena);
}
function void