Remove pernament arena

This commit is contained in:
Krzosa Karol
2022-12-31 18:02:48 +01:00
parent 55515ff420
commit ffd6bc5d23
3 changed files with 14 additions and 13 deletions

View File

@@ -96,10 +96,10 @@ parse_init(Parse_Ctx *ctx, Arena *perm_allocator) {
}
CORE_Static void
begin_compilation() {
begin_compilation(Arena *allocator) {
init_ctx_time_begin = os_time();
Parse_Ctx *ctx = allocate_struct(&pernament_arena, Parse_Ctx);
parse_init(ctx, &pernament_arena);
Parse_Ctx *ctx = allocate_struct(allocator, Parse_Ctx);
parse_init(ctx, allocator);
init_ctx_time_end = os_time();
}
@@ -223,9 +223,9 @@ resolve_everything_in_module(Ast_Module *module) {
}
CORE_Static String
compile_file_to_string(String filename) {
compile_file_to_string(Arena *arena, String filename) {
total_time = os_time();
begin_compilation();
begin_compilation(arena);
{
Ast_Module *module = add_module(0, pctx->intern("Language.core"_s));
{
@@ -299,12 +299,12 @@ const U32 COMPILE_AND_RUN = 0x4;
const U32 COMPILE_TESTING = 0x8;
CORE_Static void
compile_file(String filename, U32 compile_flags = COMPILE_NULL) {
compile_file(Arena *arena, String filename, U32 compile_flags = COMPILE_NULL) {
if (is_flag_set(compile_flags, COMPILE_AND_RUN)) {
log_info_no_nl("%Q - ", filename);
}
String result = compile_file_to_string(filename);
String result = compile_file_to_string(arena, filename);
assert(os_write_file("program.c"_s, result));
Scratch scratch;