kh_s_t -> kh_oblist_t

This commit is contained in:
Yuichi Nishiwaki 2016-02-15 12:59:58 +09:00
parent b084a20390
commit 294477ff13
4 changed files with 10 additions and 10 deletions

View File

@ -645,7 +645,7 @@ gc_sweep_phase(pic_state *pic)
struct heap_page *page;
khiter_t it;
khash_t(weak) *h;
khash_t(s) *s = &pic->oblist;
khash_t(oblist) *s = &pic->oblist;
pic_sym *sym;
struct pic_object *obj;
size_t total = 0, inuse = 0;
@ -670,7 +670,7 @@ gc_sweep_phase(pic_state *pic)
continue;
sym = kh_val(s, it);
if (sym->gc_mark == PIC_GC_UNMARK) {
kh_del(s, s, it);
kh_del(oblist, s, it);
}
}

View File

@ -16,7 +16,7 @@ extern "C" {
#include "picrin/read.h"
#include "picrin/gc.h"
KHASH_DECLARE(s, struct pic_string *, pic_sym *)
KHASH_DECLARE(oblist, struct pic_string *, pic_sym *)
typedef struct pic_checkpoint {
PIC_OBJECT_HEADER
@ -73,7 +73,7 @@ struct pic_state {
pic_value features;
khash_t(s) oblist; /* string to symbol */
khash_t(oblist) oblist; /* string to symbol */
int ucnt;
struct pic_weak *globals;
struct pic_weak *macros;

View File

@ -252,7 +252,7 @@ pic_open(pic_allocf allocf, void *userdata)
pic->heap = pic_heap_open(pic);
/* symbol table */
kh_init(s, &pic->oblist);
kh_init(oblist, &pic->oblist);
/* unique symbol count */
pic->ucnt = 0;
@ -376,7 +376,7 @@ pic_open(pic_allocf allocf, void *userdata)
void
pic_close(pic_state *pic)
{
khash_t(s) *h = &pic->oblist;
khash_t(oblist) *h = &pic->oblist;
pic_allocf allocf = pic->allocf;
/* clear out root objects */
@ -420,7 +420,7 @@ pic_close(pic_state *pic)
allocf(pic->userdata, pic->xpbase, 0);
/* free global stacks */
kh_destroy(s, h);
kh_destroy(oblist, h);
/* free GC arena */
allocf(pic->userdata, pic->arena, 0);

View File

@ -7,17 +7,17 @@
#define kh_pic_str_hash(a) (pic_str_hash(pic, (a)))
#define kh_pic_str_cmp(a, b) (pic_str_cmp(pic, (a), (b)) == 0)
KHASH_DEFINE(s, struct pic_string *, pic_sym *, kh_pic_str_hash, kh_pic_str_cmp)
KHASH_DEFINE(oblist, struct pic_string *, pic_sym *, kh_pic_str_hash, kh_pic_str_cmp)
pic_sym *
pic_intern(pic_state *pic, struct pic_string *str)
{
khash_t(s) *h = &pic->oblist;
khash_t(oblist) *h = &pic->oblist;
pic_sym *sym;
khiter_t it;
int ret;
it = kh_put(s, h, str, &ret);
it = kh_put(oblist, h, str, &ret);
if (ret == 0) { /* if exists */
sym = kh_val(h, it);
pic_gc_protect(pic, pic_obj_value(sym));