Much better allocation strategy with new ncore arenas. Add more builtin node gen stuff. It's kind of wonky.
This commit is contained in:
20
module.jai
20
module.jai
@@ -181,7 +181,23 @@ Compile_Result :: struct {
|
||||
messages : [..]Compiler_Message;
|
||||
|
||||
allocator : Allocator;
|
||||
arena : Arena;
|
||||
// arena : Arena;
|
||||
|
||||
// scratch_arenas : [2]Arena;
|
||||
scratch_allocators : [2]Allocator;
|
||||
}
|
||||
|
||||
get_scratch :: (result : *Compile_Result, conflict : Allocator = .{}) -> Scratch {
|
||||
arena := cast(*Arena)conflict.data;
|
||||
if result.scratch_allocators[0].data == null {
|
||||
result.scratch_allocators[0] = make_arena(Megabytes(128));
|
||||
result.scratch_allocators[1] = make_arena(Megabytes(128));
|
||||
}
|
||||
|
||||
if arena == get_arena(result.scratch_allocators[0]) {
|
||||
return scratch_begin(*result.scratch_allocators[1]);
|
||||
}
|
||||
return scratch_begin(*result.scratch_allocators[0]);
|
||||
}
|
||||
|
||||
record_error :: (result : *Compile_Result, format : string, args : .. Any) {
|
||||
@@ -481,7 +497,7 @@ generate_output_data :: (result : *Compile_Result) {
|
||||
compile_file :: (compiler : *Shader_Compiler, path : string) -> Compile_Result {
|
||||
result : Compile_Result;
|
||||
|
||||
result.allocator = make_arena(*result.arena);
|
||||
result.allocator = make_arena(Megabytes(128));
|
||||
|
||||
result.file = make_file(*result, path);
|
||||
result.environment = compiler.environment;
|
||||
|
||||
Reference in New Issue
Block a user