Bother. It looks like I'd already fully implemented hashmaps...

May need to back out a whole hill of work.
This commit is contained in:
Simon Brooke 2021-08-16 15:12:05 +01:00
parent 132f5fb268
commit bfd7304da1
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
11 changed files with 378 additions and 83 deletions

View file

@ -22,6 +22,8 @@
#include "conspage.h"
#include "consspaceobject.h"
#include "debug.h"
#include "hashmap.h"
#include "stack.h"
#include "vectorspace.h"
@ -112,3 +114,27 @@ struct cons_pointer make_vso( char *tag, uint64_t payload_size ) {
return result;
}
/** for vector space pointers, free the actual vector-space
* object. Dangerous! */
void free_vso( struct cons_pointer pointer ) {
struct cons_space_object * cell = &pointer2cell( pointer);
debug_printf( DEBUG_ALLOC, L"About to free vector-space object at 0x%lx\n",
cell->payload.vectorp.address );
struct vector_space_object *vso = cell->payload.vectorp.address;
switch ( vso->header.tag.value ) {
case HASHTV:
free_hashmap( pointer );
break;
case STACKFRAMETV:
free_stack_frame( get_stack_frame( pointer ) );
break;
}
free( (void *)cell->payload.vectorp.address );
debug_printf( DEBUG_ALLOC, L"Freed vector-space object at 0x%lx\n",
cell->payload.vectorp.address );
}