Actually substitute token array. init_language_core.
Seems like perf improved
This commit is contained in:
@@ -23,7 +23,6 @@ static void core_init_compiler(Core_Ctx *ctx, Allocator *allocator) {
|
|||||||
ctx->scope_ids = 1;
|
ctx->scope_ids = 1;
|
||||||
bigint_allocator = ctx->perm;
|
bigint_allocator = ctx->perm;
|
||||||
|
|
||||||
ctx->tokens = array_make<Token>(ctx->heap, 4096 * 4);
|
|
||||||
ctx->interns = intern_table_make(ctx->perm, ctx->heap, 2048);
|
ctx->interns = intern_table_make(ctx->perm, ctx->heap, 2048);
|
||||||
|
|
||||||
/*#import meta
|
/*#import meta
|
||||||
@@ -281,12 +280,8 @@ resolve_everything_in_module(Ast_Module *module) {
|
|||||||
pctx->time.typechecking = os_time() - pctx->time.typechecking;
|
pctx->time.typechecking = os_time() - pctx->time.typechecking;
|
||||||
}
|
}
|
||||||
|
|
||||||
CORE_Static String
|
CORE_Static void
|
||||||
compile_file_to_string(Allocator *allocator, String filename) {
|
init_language_core() {
|
||||||
F64 total_time = os_time();
|
|
||||||
core_bootstrap_compiler(allocator);
|
|
||||||
pctx->time.total = total_time;
|
|
||||||
pctx->time.start = total_time;
|
|
||||||
{
|
{
|
||||||
Ast_Module *module = add_module(0, pctx->intern("Language.core"_s), false, true);
|
Ast_Module *module = add_module(0, pctx->intern("Language.core"_s), false, true);
|
||||||
get(&module->all_loaded_files, 0)->filecontent =
|
get(&module->all_loaded_files, 0)->filecontent =
|
||||||
@@ -412,6 +407,15 @@ GetTypeInfo :: (type: Type): *Type_Info
|
|||||||
assert(string_decl->type == pctx->type_type);
|
assert(string_decl->type == pctx->type_type);
|
||||||
pctx->type_string = string_decl->type_val;
|
pctx->type_string = string_decl->type_val;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CORE_Static String
|
||||||
|
compile_file_to_string(Allocator *allocator, String filename) {
|
||||||
|
F64 total_time = os_time();
|
||||||
|
core_bootstrap_compiler(allocator);
|
||||||
|
pctx->time.total = total_time;
|
||||||
|
pctx->time.start = total_time;
|
||||||
|
init_language_core();
|
||||||
|
|
||||||
Ast_Module *module = add_module(0, pctx->intern(filename), true);
|
Ast_Module *module = add_module(0, pctx->intern(filename), true);
|
||||||
parse_all_modules();
|
parse_all_modules();
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ lex_add_token(Core_Ctx *ctx, Token *token) {
|
|||||||
Token *top = (Token *)arena_push_size(ctx->stage_arena, sizeof(Token));
|
Token *top = (Token *)arena_push_size(ctx->stage_arena, sizeof(Token));
|
||||||
*top = *token;
|
*top = *token;
|
||||||
ctx->tokens.len += 1;
|
ctx->tokens.len += 1;
|
||||||
|
ctx->tokens.cap += 1;
|
||||||
ctx->tokens.data = (Token *)ctx->stage_arena->memory.data;
|
ctx->tokens.data = (Token *)ctx->stage_arena->memory.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user