aboutsummaryrefslogtreecommitdiffstats
path: root/method.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-06 10:19:48 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-06 10:19:48 +0000
commit853818918f6cdf383358a6b454ed46d5cf41609e (patch)
tree159cbb86e18c888b67145278fb709470178b5088 /method.h
parent163d19cbca0de49549c295013a0e79d39adebf3b (diff)
downloadruby-853818918f6cdf383358a6b454ed46d5cf41609e.tar.gz
* method.h: back to share rb_method_definition_t by
rb_method_entry_t. r50728 changed sharing `def's to isolating `def's on alias and so on. However, this change conflicts future improvement plan. So I change back to sharing approach. * method.h: move rb_method_definition_t::flags to rb_method_entry_t::attr::flags. rb_method_entry_t::attr is union with VALUE because this field should have same size of VALUE. rb_method_entry_t is T_IMEMO). And also add the following access macros to it's fileds. * METHOD_ENTRY_VISI(me) * METHOD_ENTRY_BASIC(me) * METHOD_ENTRY_SAFE(me) * vm_method.c (rb_method_definition_addref): added instead of rb_method_definition_clone(). Do not create new definition, but increment alias_count. * class.c (clone_method): catch up this fix. * class.c (method_entry_i): ditto. * proc.c (mnew_internal): ditto. * proc.c (mnew_missing): ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'method.h')
-rw-r--r--method.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/method.h b/method.h
index 2c9bddb486..7f307f45c6 100644
--- a/method.h
+++ b/method.h
@@ -47,12 +47,25 @@ typedef struct rb_cref_struct {
typedef struct rb_method_entry_struct {
VALUE flags;
- VALUE reserved;
+
+ union {
+ struct {
+ rb_method_visibility_t visi: 3;
+ unsigned int safe: 3;
+ unsigned int basic: 1;
+ } flags;
+ VALUE v; /* it should be VALUE size */
+ } attr;
+
struct rb_method_definition_struct * const def;
ID called_id;
const VALUE klass; /* should be marked */
} rb_method_entry_t;
+#define METHOD_ENTRY_VISI(me) (me)->attr.flags.visi
+#define METHOD_ENTRY_BASIC(me) (me)->attr.flags.basic
+#define METHOD_ENTRY_SAFE(me) (me)->attr.flags.safe
+
typedef enum {
VM_METHOD_TYPE_ISEQ,
VM_METHOD_TYPE_CFUNC,
@@ -97,12 +110,8 @@ typedef struct rb_method_refined_struct {
} rb_method_refined_t;
typedef struct rb_method_definition_struct {
- struct {
- rb_method_visibility_t visi: 3;
- unsigned int safe: 3;
- unsigned int basic: 1;
- } flags;
rb_method_type_t type; /* method type */
+ int alias_count;
union {
rb_method_iseq_t iseq;
@@ -120,7 +129,6 @@ typedef struct rb_method_definition_struct {
} optimize_type;
} body;
- int *alias_count_ptr;
ID original_id;
} rb_method_definition_t;
@@ -157,7 +165,7 @@ VALUE rb_obj_method_location(VALUE obj, ID id);
void rb_free_method_entry(const rb_method_entry_t *me);
void rb_sweep_method_entry(void *vm);
-rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_definition_t *def);
+rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, rb_method_definition_t *def);
rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me);
void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src);