store rectype information to slot hash

This commit is contained in:
Yuichi Nishiwaki 2014-08-06 11:36:36 +09:00
parent 0610c0e95b
commit 7a98c3619a
3 changed files with 3 additions and 6 deletions

View File

@ -11,7 +11,6 @@ extern "C" {
struct pic_record {
PIC_OBJECT_HEADER
pic_value rectype;
xhash hash;
};

View File

@ -506,7 +506,6 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
struct pic_record *rec = (struct pic_record *)obj;
xh_iter it;
gc_mark(pic, rec->rectype);
xh_begin(&it, &rec->hash);
while (xh_next(&it)) {
gc_mark(pic, xh_val(it.e, pic_value));

View File

@ -11,18 +11,17 @@ pic_record_new(pic_state *pic, pic_value rectype)
struct pic_record *rec;
rec = (struct pic_record *)pic_obj_alloc(pic, sizeof(struct pic_record), PIC_TT_RECORD);
rec->rectype = rectype;
xh_init_int(&rec->hash, sizeof(pic_value));
pic_record_set(pic, rec, pic_intern_cstr(pic, "@@type"), rectype);
return rec;
}
pic_value
pic_record_type(pic_state *pic, struct pic_record *rec)
{
UNUSED(pic);
return rec->rectype;
return pic_record_ref(pic, rec, pic_intern_cstr(pic, "@@type"));
}
pic_value