Print is less badly broken. Read is less badly broken. GC is too aggressive.
This commit is contained in:
parent
22b0160a26
commit
63906fe817
19 changed files with 489 additions and 303 deletions
|
|
@ -76,9 +76,14 @@ struct pso_pointer initialise_memory( uint32_t node ) {
|
|||
|
||||
/**
|
||||
* @brief Pop an object off the freelist for the specified `size_class`.
|
||||
*
|
||||
* There is no conventional way this function can signal an error. Any pointer
|
||||
* it returns is potentially valid. However, every valid object must have an
|
||||
* even numbered offset, so possibly {:node 0, :page 0, :offset 1} could be
|
||||
* used as a magic marker to indicate total exhaustion of store for this size
|
||||
* class. TODO: think about this.
|
||||
*/
|
||||
struct pso_pointer pop_freelist( uint8_t size_class ) {
|
||||
// `t`, because if `allocate_page` fails it will be set to `nil`.
|
||||
struct pso_pointer result = t;
|
||||
|
||||
if ( size_class <= MAX_SIZE_CLASS ) {
|
||||
|
|
@ -103,16 +108,16 @@ struct pso_pointer pop_freelist( uint8_t size_class ) {
|
|||
/* the object ought already to have the right size class in its tag
|
||||
* because it was popped off the freelist for that size class. */
|
||||
if ( object->header.tag.bytes.size_class != size_class ) {
|
||||
// TODO: return an exception instead? Or warn, set it, and continue?
|
||||
fwprintf( stderr,
|
||||
L"WARNING: Unexpected size class %x. on free list for class %x while allocating.\n",
|
||||
object->header.tag.bytes.size_class, size_class );
|
||||
}
|
||||
/* the objext ought to have a reference count ot zero, because it's
|
||||
* on the freelist, but again we should sanity check. */
|
||||
if ( object->header.count != 0 ) {
|
||||
fwprintf( stderr,
|
||||
L"WARNING: Count of %d in newly allocated object at %d, %d, should be 0\n",
|
||||
result.page,
|
||||
result.offset,
|
||||
object->header.count );
|
||||
L"\nWARNING: Count of %u in newly allocated object at %u, %u, should be 0\n",
|
||||
object->header.count, result.page, result.offset );
|
||||
object->header.count = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue