Misc changes (refactors, notes)

This commit is contained in:
2024-06-20 14:39:50 -04:00
parent 03500acb9a
commit 489faf5515
17 changed files with 70 additions and 567 deletions

View File

@ -310,14 +310,3 @@ array_block_size :: proc "contextless" ( self : Array( $Type ) ) -> u64 {
block_size := cast(u64) (header_size + self.capacity * size_of(Type))
return block_size
}
array_memtracker_entry :: proc( self : Array( $Type ), name : string ) -> MemoryTrackerEntry {
header_size :: size_of(ArrayHeader(Type))
block_size := cast(uintptr) (header_size + (cast(uintptr) self.capacity) * size_of(Type))
block_start := transmute(^u8) self.header
block_end := ptr_offset( block_start, block_size )
tracker_entry := MemoryTrackerEntry { name, block_start, block_end }
return tracker_entry
}

View File

@ -0,0 +1 @@
package grime

View File

@ -21,27 +21,6 @@ push_back_slice_queue :: proc( self : ^$QueueType / Queue($Type), slice : []Type
{
queue.push_back_elems( self, ..slice )
return
// num := cast(uint) len(slice)
// if uint( space_left( self^ )) < num {
// error = queue._grow( self, self.len + num )
// if error != .None do return
// }
// size := uint(len(self.data))
// insert_from := (self.offset + self.len) % size
// insert_to := num
// if insert_from + insert_to > size {
// insert_to = size - insert_from
// }
// copy( self.data[ insert_from : ], slice[ : insert_to ])
// copy( self.data[ : insert_from ], slice[ insert_to : ])
// self.len += num
// return
}
QueueIterator :: struct( $Type : typeid ) {

View File

@ -64,6 +64,8 @@ str_cache_init :: proc( table_allocator, slabs_allocator : Allocator ) -> (cache
@static dbg_name := "StringCache slab"
// TODO(Ed): Is this nessary (essentially is there a perf impact of using vs not using, which is better because thats all that matters)
// Interning should only be handled on a growing arena anyway so it doesn't really need this.
alloc_error : AllocatorError
cache.slab, alloc_error = slab_init( & policy, allocator = slabs_allocator, dbg_name = dbg_name )
verify(alloc_error == .None, "Failed to initialize the string cache" )