Cleanup includes, remove stdio.h from base

This commit is contained in:
Krzosa Karol
2023-01-01 12:58:57 +01:00
parent c5539276ae
commit 39f46900b2
9 changed files with 608 additions and 624 deletions

View File

@@ -1,20 +1,21 @@
CORE_Static void
core_init_compiler(Core_Ctx *ctx, Arena *perm, Allocator *heap) {
core_init_compiler(Core_Ctx *ctx, Allocator *allocator) {
ctx->init_ctx_time_begin = os_time();
pctx = ctx;
ctx->scratch = allocate_scratch_arena(perm, mib(1));
ctx->perm = perm;
ctx->heap = heap;
ctx->type_map = map_make(heap, 2048);
ctx->perm_push_only = make_push_arena(allocator);
ctx->perm = &ctx->perm_push_only;
ctx->scratch = allocate_scratch_arena(ctx->perm, mib(1));
ctx->heap = allocator;
ctx->type_map = map_make(ctx->heap, 2048);
ctx->gen = {ctx->perm};
ctx->helper_builder = {ctx->perm};
ctx->scope_ids = 1;
bigint_allocator = ctx->perm;
arena_init(&ctx->stage_arena, "Compiler stage arena"_s);
ctx->tokens = array_make<Token>(heap, 4096 * 4);
ctx->interns = intern_table_make(ctx->perm, heap, 2048);
ctx->tokens = array_make<Token>(ctx->heap, 4096 * 4);
ctx->interns = intern_table_make(ctx->perm, ctx->heap, 2048);
/*#import meta
for i in meta.keywords:
@@ -97,9 +98,8 @@ core_init_compiler(Core_Ctx *ctx, Arena *perm, Allocator *heap) {
CORE_Static void
core_bootstrap_compiler(Allocator *allocator) {
Core_Ctx *ctx = allocate_struct(allocator, Core_Ctx);
assert((uintptr_t)allocator->allocate == (uintptr_t)arena_push_size);
core_init_compiler(ctx, (Arena *)allocator, allocator);
core_init_compiler(ctx, allocator);
}
CORE_Static void
@@ -300,6 +300,8 @@ compile_file(Arena *arena, String filename, U32 compile_flags = COMPILE_NULL) {
B32 r = os_write_file("program.c"_s, result);
assert(r);
F64 total_compiler_time = os_time() - pctx->total_time;
log_info_no_nl("%f - ", total_compiler_time);
Scratch_Arena *scratch = pctx->scratch;
Scratch_Scope _scope(scratch);