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

@ -15,24 +15,24 @@
#include "memory/consspaceobject.h"
#include "memory/vectorspace.h"
/**
* The payload of a hashmap. The number of buckets is assigned at run-time,
* and is stored in n_buckets. Each bucket is something ASSOC can consume:
* i.e. either an assoc list or a further hashmap.
*/
struct hashmap_payload {
struct cons_pointer hash_fn;
uint32_t n_buckets;
uint32_t unused; /* for word alignment and possible later expansion */
struct cons_pointer buckets[];
};
uint32_t get_hash( struct cons_pointer ptr );
uint32_t get_hash(struct cons_pointer ptr);
void free_hashmap( struct cons_pointer ptr );
struct cons_pointer lisp_get_hash(struct stack_frame *frame,
struct cons_pointer frame_pointer,
struct cons_pointer env);
struct cons_pointer lisp_get_hash( struct stack_frame *frame,
struct cons_pointer frame_pointer,
struct cons_pointer env );
struct cons_pointer make_hashmap( uint32_t n_buckets, struct cons_pointer hash_fn);
struct cons_pointer lisp_hashmap_put( struct stack_frame *frame,
struct cons_pointer frame_pointer,
struct cons_pointer env );
struct cons_pointer lisp_hashmap_put_all( struct stack_frame *frame,
struct cons_pointer frame_pointer,
struct cons_pointer env );
struct cons_pointer lisp_make_hashmap( struct stack_frame *frame,
struct cons_pointer frame_pointer,
struct cons_pointer env );
#endif