Optimizing search, buggy BlockArena on emscripten, cleanup MergeSort, address sanitizer, compile web on linux
This commit is contained in:
+17
-2
@@ -51,7 +51,6 @@ struct BlockArena {
|
||||
U8 *end;
|
||||
BlockArenaNode *blocks;
|
||||
Allocator allocator;
|
||||
bool when_unwinding_make_sure_to_keep_last_block_alive;
|
||||
|
||||
operator Allocator() { return {BlockArenaAllocatorProc, this}; }
|
||||
};
|
||||
@@ -96,9 +95,24 @@ API void Release(VirtualArena *arena);
|
||||
|
||||
///////////////////////////////
|
||||
// Scratch
|
||||
#if OS_WASM
|
||||
struct Scratch {
|
||||
BlockArena arena = {};
|
||||
Scratch() {}
|
||||
Scratch(BlockArena *conflict) {}
|
||||
Scratch(BlockArena *c1, BlockArena *c2) {}
|
||||
Scratch(Allocator conflict) {}
|
||||
Scratch(Allocator c1, Allocator c2) {}
|
||||
~Scratch() { Release(&arena); }
|
||||
operator BlockArena *() { return &arena; }
|
||||
operator Allocator() { return arena; }
|
||||
private: // @Note: Disable copy constructors, cause its error prone
|
||||
Scratch(Scratch &arena);
|
||||
Scratch(Scratch &arena, Scratch &a2);
|
||||
};
|
||||
#else
|
||||
extern thread_local VirtualArena ScratchArenas[4];
|
||||
API VirtualArena *GetScratchEx(VirtualArena **conflicts, int conflict_count);
|
||||
|
||||
struct Scratch {
|
||||
VirtualArena *arena;
|
||||
U64 p;
|
||||
@@ -131,6 +145,7 @@ struct Scratch {
|
||||
Scratch(Scratch &arena);
|
||||
Scratch(Scratch &arena, Scratch &a2);
|
||||
};
|
||||
#endif
|
||||
|
||||
const int PAGE_SIZE = 4096;
|
||||
const int DEFAULT_ALIGNMENT = sizeof(void *);
|
||||
|
||||
Reference in New Issue
Block a user