summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-08-12 01:59:18 +0900
committerYukihiro Matsumoto <[email protected]>2012-08-12 01:59:18 +0900
commitc9fe903fe15e601900ec17ae40fe82b0d2dc4978 (patch)
tree29a4455e280dbc95d060dd2b18316566df49ffb3 /include
parent3fe4b6414f9daa33ec238cb3f32b53b2dddeabf4 (diff)
downloadmruby-c9fe903fe15e601900ec17ae40fe82b0d2dc4978.tar.gz
mruby-c9fe903fe15e601900ec17ae40fe82b0d2dc4978.zip
now segmented list can be used as instance variable tables by -DMRB_USE_IV_SEGLIST; we still need to measure the performance and memory consumption
Diffstat (limited to 'include')
-rw-r--r--include/mrbconf.h5
-rw-r--r--include/mruby.h2
-rw-r--r--include/mruby/class.h2
-rw-r--r--include/mruby/data.h2
-rw-r--r--include/mruby/hash.h2
-rw-r--r--include/mruby/object.h2
-rw-r--r--include/mruby/variable.h13
7 files changed, 16 insertions, 12 deletions
diff --git a/include/mrbconf.h b/include/mrbconf.h
index 20f49ec29..693e7da88 100644
--- a/include/mrbconf.h
+++ b/include/mrbconf.h
@@ -19,7 +19,10 @@
/* number of object per heap page */
//#define MRB_HEAP_PAGE_SIZE 1024
-/* initial size for IV khash */
+/* use segmented list for IV table */
+//#define MRB_USE_IV_SEGLIST
+
+/* initial size for IV khash; ignored when MRB_USE_IV_SEGLIST is set */
//#define MRB_IV_INITIAL_SIZE 8
/* default size of khash table bucket */
diff --git a/include/mruby.h b/include/mruby.h
index 353ff93f4..380c5f24c 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -233,7 +233,7 @@ typedef struct mrb_state {
int esize;
struct RObject *exc;
- struct kh_iv *globals;
+ struct iv_tbl *globals;
struct mrb_irep **irep;
size_t irep_len, irep_capa;
diff --git a/include/mruby/class.h b/include/mruby/class.h
index 2cc90310e..b4a2e9471 100644
--- a/include/mruby/class.h
+++ b/include/mruby/class.h
@@ -13,7 +13,7 @@ extern "C" {
struct RClass {
MRUBY_OBJECT_HEADER;
- struct kh_iv *iv;
+ struct iv_tbl *iv;
struct kh_mt *mt;
struct RClass *super;
};
diff --git a/include/mruby/data.h b/include/mruby/data.h
index 4c136555c..ca2a04b55 100644
--- a/include/mruby/data.h
+++ b/include/mruby/data.h
@@ -18,7 +18,7 @@ struct mrb_data_type {
struct RData {
MRUBY_OBJECT_HEADER;
- struct kh_iv *iv;
+ struct iv_tbl *iv;
struct mrb_data_type *type;
void *data;
};
diff --git a/include/mruby/hash.h b/include/mruby/hash.h
index f3755eb25..2b0aeeef2 100644
--- a/include/mruby/hash.h
+++ b/include/mruby/hash.h
@@ -13,7 +13,7 @@ extern "C" {
struct RHash {
MRUBY_OBJECT_HEADER;
- struct kh_iv *iv;
+ struct iv_tbl *iv;
struct kh_ht *ht;
};
diff --git a/include/mruby/object.h b/include/mruby/object.h
index 4be060078..e42a5f428 100644
--- a/include/mruby/object.h
+++ b/include/mruby/object.h
@@ -44,7 +44,7 @@ struct RBasic {
struct RObject {
MRUBY_OBJECT_HEADER;
- struct kh_iv *iv;
+ struct iv_tbl *iv;
};
#define mrb_obj_ptr(v) ((struct RObject*)((v).value.p))
diff --git a/include/mruby/variable.h b/include/mruby/variable.h
index e93a77c55..0dac75c5b 100644
--- a/include/mruby/variable.h
+++ b/include/mruby/variable.h
@@ -38,17 +38,21 @@ mrb_value mrb_const_get(mrb_state*, mrb_value, mrb_sym);
void mrb_const_set(mrb_state*, mrb_value, mrb_sym, mrb_value);
int mrb_const_defined(mrb_state*, mrb_value, mrb_sym);
-mrb_value mrb_obj_iv_get(mrb_state*, struct RObject*, mrb_sym);
-void mrb_obj_iv_set(mrb_state*, struct RObject*, mrb_sym, mrb_value);
-const char * mrb_class2name(mrb_state *mrb, struct RClass* klass);
+mrb_value mrb_obj_iv_get(mrb_state *mrb, struct RObject *obj, mrb_sym sym);
+void mrb_obj_iv_set(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v);
+int mrb_obj_iv_defined(mrb_state *mrb, struct RObject *obj, mrb_sym sym);
mrb_value mrb_iv_get(mrb_state *mrb, mrb_value obj, mrb_sym sym);
void mrb_iv_set(mrb_state *mrb, mrb_value obj, mrb_sym sym, mrb_value v);
+int mrb_iv_defined(mrb_state*, mrb_value, mrb_sym);
mrb_value mrb_iv_remove(mrb_state *mrb, mrb_value obj, mrb_sym sym);
+void mrb_iv_copy(mrb_state *mrb, mrb_value dst, mrb_value src);
int mrb_const_defined_at(mrb_state *mrb, struct RClass *klass, mrb_sym id);
mrb_value mrb_f_global_variables(mrb_state *mrb, mrb_value self);
mrb_value mrb_gv_get(mrb_state *mrb, mrb_sym sym);
void mrb_gv_set(mrb_state *mrb, mrb_sym sym, mrb_value val);
mrb_value mrb_obj_instance_variables(mrb_state*, mrb_value);
+mrb_value mrb_obj_iv_inspect(mrb_state*, struct RObject*);
+mrb_sym mrb_class_sym(mrb_state *mrb, struct RClass *c, struct RClass *outer);
/* GC functions */
void mrb_gc_mark_gv(mrb_state*);
@@ -57,9 +61,6 @@ void mrb_gc_mark_iv(mrb_state*, struct RObject*);
size_t mrb_gc_mark_iv_size(mrb_state*, struct RObject*);
void mrb_gc_free_iv(mrb_state*, struct RObject*);
-#include "mruby/khash.h"
-KHASH_DECLARE(iv, mrb_sym, mrb_value, 1)
-
#if defined(__cplusplus)
} /* extern "C" { */
#endif