Remove pernament arena
This commit is contained in:
2
base.cpp
2
base.cpp
@@ -520,7 +520,6 @@ struct Thread_Ctx{
|
|||||||
};
|
};
|
||||||
|
|
||||||
thread_local Thread_Ctx thread_ctx;
|
thread_local Thread_Ctx thread_ctx;
|
||||||
global Arena pernament_arena;
|
|
||||||
|
|
||||||
#define REPORT_ALLOCATIONS 0
|
#define REPORT_ALLOCATIONS 0
|
||||||
#define report_file_and_line() report__file_and_line(__FILE__, __LINE__)
|
#define report_file_and_line() report__file_and_line(__FILE__, __LINE__)
|
||||||
@@ -564,7 +563,6 @@ CORE_Static void
|
|||||||
thread_ctx_init(){
|
thread_ctx_init(){
|
||||||
arena_init(thread_ctx.scratch, "Scratch1"_s);
|
arena_init(thread_ctx.scratch, "Scratch1"_s);
|
||||||
arena_init(thread_ctx.scratch+1, "Scratch2"_s);
|
arena_init(thread_ctx.scratch+1, "Scratch2"_s);
|
||||||
arena_init(&pernament_arena, "Pernament Arena"_s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -96,10 +96,10 @@ parse_init(Parse_Ctx *ctx, Arena *perm_allocator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CORE_Static void
|
CORE_Static void
|
||||||
begin_compilation() {
|
begin_compilation(Arena *allocator) {
|
||||||
init_ctx_time_begin = os_time();
|
init_ctx_time_begin = os_time();
|
||||||
Parse_Ctx *ctx = allocate_struct(&pernament_arena, Parse_Ctx);
|
Parse_Ctx *ctx = allocate_struct(allocator, Parse_Ctx);
|
||||||
parse_init(ctx, &pernament_arena);
|
parse_init(ctx, allocator);
|
||||||
init_ctx_time_end = os_time();
|
init_ctx_time_end = os_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,9 +223,9 @@ resolve_everything_in_module(Ast_Module *module) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CORE_Static String
|
CORE_Static String
|
||||||
compile_file_to_string(String filename) {
|
compile_file_to_string(Arena *arena, String filename) {
|
||||||
total_time = os_time();
|
total_time = os_time();
|
||||||
begin_compilation();
|
begin_compilation(arena);
|
||||||
{
|
{
|
||||||
Ast_Module *module = add_module(0, pctx->intern("Language.core"_s));
|
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;
|
const U32 COMPILE_TESTING = 0x8;
|
||||||
|
|
||||||
CORE_Static void
|
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)) {
|
if (is_flag_set(compile_flags, COMPILE_AND_RUN)) {
|
||||||
log_info_no_nl("%Q - ", filename);
|
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));
|
assert(os_write_file("program.c"_s, result));
|
||||||
|
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Fix backlog
|
|||||||
- [ ] Fix invalid error message: AlmostLinearToSRGB :: (a: Color);; return {sqrtf(a.r), sqrtf(a.g), sqrtf(a.b), a.a}
|
- [ ] Fix invalid error message: AlmostLinearToSRGB :: (a: Color);; return {sqrtf(a.r), sqrtf(a.g), sqrtf(a.b), a.a}
|
||||||
- [ ] Fix untyped literal going to codegen stage, example in arms_race
|
- [ ] Fix untyped literal going to codegen stage, example in arms_race
|
||||||
- [ ] Fix and decide what to do when initializing global variable using not constants C:/AProgramming/cparse/compiler/modules/Language.core:180:28: error: initializer element is not a compile-time constant
|
- [ ] Fix and decide what to do when initializing global variable using not constants C:/AProgramming/cparse/compiler/modules/Language.core:180:28: error: initializer element is not a compile-time constant
|
||||||
- [ ] Fix adressing void is possible, maybe make it possible to address void
|
- [ ] Fix adressing void is possible, mayp make it possible to address void
|
||||||
using bytes
|
using bytes
|
||||||
* a.void + 10
|
* a.void + 10
|
||||||
* a.void[10]
|
* a.void[10]
|
||||||
@@ -288,6 +288,9 @@ For modules it's a bit different cause they should be distributed as valid.
|
|||||||
int main(int argument_count, char **arguments){
|
int main(int argument_count, char **arguments){
|
||||||
thread_ctx_init();
|
thread_ctx_init();
|
||||||
|
|
||||||
|
Arena arena = {};
|
||||||
|
arena_init(&arena, "Pernament arena"_s);
|
||||||
|
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
Array<String> args = {scratch};
|
Array<String> args = {scratch};
|
||||||
for(int i = 1; i < argument_count; i+=1){
|
for(int i = 1; i < argument_count; i+=1){
|
||||||
@@ -344,17 +347,17 @@ int main(int argument_count, char **arguments){
|
|||||||
Array<OS_File_Info> tests = os_list_dir(scratch, "tests"_s);
|
Array<OS_File_Info> tests = os_list_dir(scratch, "tests"_s);
|
||||||
For(examples){
|
For(examples){
|
||||||
if(it.is_directory) continue;
|
if(it.is_directory) continue;
|
||||||
compile_file(it.absolute_path, COMPILE_AND_RUN | COMPILE_TESTING);
|
compile_file(&arena, it.absolute_path, COMPILE_AND_RUN | COMPILE_TESTING);
|
||||||
}
|
}
|
||||||
For(tests){
|
For(tests){
|
||||||
if(it.is_directory) continue;
|
if(it.is_directory) continue;
|
||||||
compile_file(it.absolute_path, COMPILE_AND_RUN | COMPILE_TESTING);
|
compile_file(&arena, it.absolute_path, COMPILE_AND_RUN | COMPILE_TESTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
String program_name = string_from_cstring(arguments[1]);
|
String program_name = string_from_cstring(arguments[1]);
|
||||||
compile_file(program_name, COMPILE_PRINT_STATS);
|
compile_file(&arena, program_name, COMPILE_PRINT_STATS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user