Organization cleanup, stage arena to Scratch_Arena

This commit is contained in:
Krzosa Karol
2023-01-01 13:15:20 +01:00
parent 39f46900b2
commit c238e5ba46
8 changed files with 143 additions and 137 deletions

View File

@@ -1,12 +1,21 @@
/*
* Get rid of Scratch, move that concept onto the main context, create scratch memory from user allocator
* Simplify allocators, only should be derived from the user allocator
* Cleanup big int allocator
* Replace iterator interface
@! Change type of Stage allocator
@! Look into stage allocator and perhaps
use it more often to reduce scenarios
with 2 allocators, and simplify stuff
@! Cleanup big int allocator
@! Replace iterator interface
* Reset compiler
@! Clean way to free all memory and reset the compiler
@! Bring the Table<>
@! Look into List, check if that's neccessary
@! Compute time statistics inside context and expose them properly
Probably want to implement a Red Black Tree then
probably I wouldn't need any sort of heap based
data structure.
*/
struct Lex_Stream{
@@ -17,17 +26,15 @@ struct Lex_Stream{
Intern_String file;
S32 line;
S32 inside_brace_paren;
Array<Token *> indent_stack;
Array<Token *> indent_stack; // @scratch_allocated
};
struct Core_Ctx{
Allocator *heap;
Push_Arena perm_push_only;
Push_Arena *perm; // Stores: AST, tokens, interns
Allocator *heap;
Scratch_Arena *scratch;
Arena stage_arena;
Scratch_Arena *stage_arena;
// Lexer stuff
Lex_Stream stream;