mirror of
https://github.com/janet-lang/janet
synced 2025-10-30 15:13:03 +00:00
Change object implementaion to use open hashing. Currently
using simple linear probing.
This commit is contained in:
@@ -134,9 +134,6 @@ typedef struct GstFuncDef GstFuncDef;
|
||||
typedef struct GstFuncEnv GstFuncEnv;
|
||||
typedef union GstValueUnion GstValueUnion;
|
||||
|
||||
/* Definitely implementation details */
|
||||
typedef struct GstBucket GstBucket;
|
||||
|
||||
/* API Types */
|
||||
typedef struct GstModuleItem GstModuleItem;
|
||||
|
||||
@@ -208,7 +205,8 @@ struct GstBuffer {
|
||||
struct GstObject {
|
||||
uint32_t count;
|
||||
uint32_t capacity;
|
||||
GstBucket **buckets;
|
||||
uint32_t deleted;
|
||||
GstValue *data;
|
||||
GstObject *parent;
|
||||
};
|
||||
|
||||
@@ -240,13 +238,6 @@ struct GstFunction {
|
||||
GstFunction *parent;
|
||||
};
|
||||
|
||||
/* A hash table bucket in an object */
|
||||
struct GstBucket {
|
||||
GstValue key;
|
||||
GstValue value;
|
||||
GstBucket *next;
|
||||
};
|
||||
|
||||
/* Contains information about userdata */
|
||||
struct GstUserdataHeader {
|
||||
uint32_t size;
|
||||
@@ -381,6 +372,7 @@ GstValue *gst_struct_begin(Gst *vm, uint32_t count);
|
||||
void gst_struct_put(GstValue *st, GstValue key, GstValue value);
|
||||
const GstValue *gst_struct_end(Gst *vm, GstValue *st);
|
||||
GstValue gst_struct_get(const GstValue *st, GstValue key);
|
||||
GstValue gst_struct_next(const GstValue *st, GstValue key);
|
||||
|
||||
/****/
|
||||
/* Object functions */
|
||||
@@ -388,8 +380,9 @@ GstValue gst_struct_get(const GstValue *st, GstValue key);
|
||||
|
||||
GstObject *gst_object(Gst *vm, uint32_t capacity);
|
||||
GstValue gst_object_get(GstObject *obj, GstValue key);
|
||||
GstValue gst_object_remove(Gst *vm, GstObject *obj, GstValue key);
|
||||
GstValue gst_object_remove(GstObject *obj, GstValue key);
|
||||
void gst_object_put(Gst *vm, GstObject *obj, GstValue key, GstValue value);
|
||||
GstValue gst_object_next(GstObject *o, GstValue key);
|
||||
|
||||
/****/
|
||||
/* Threads */
|
||||
|
||||
Reference in New Issue
Block a user