summaryrefslogtreecommitdiff
path: root/method.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-18 08:15:51 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-18 08:15:51 +0000
commit3f7c0e9fd567fcfbcc8d2ac3ab8499cb321b3073 (patch)
tree659cc9ee4ffe825840cf55fb7db713e3fd48ca41 /method.h
parente2f0af57407859b1d094e6885c27dabff345c190 (diff)
* method.h: introduce the folliwing field and macros.
* rb_method_definition_t::complemented_count to count shared method entries because of complemented method entries and separate from alias_count. Shared `def' only by complemented method entries should not prevent method re-definition warning. * METHOD_ENTRY_COMPLEMENTED(me) to represent complemented method entry. * METHOD_ENTRY_COMPLEMENTED_SET(me) to check it as complemented me. * vm_insnhelper.c (aliased_callable_method_entry): should also check me->def->complemented_count. * vm_method.c (method_definition_addref_complement): add to count complemented method entries number. * vm_method.c (rb_method_definition_release): release `def' iff alias_count == 0 and complemented_count == 0. * test/ruby/test_module.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'method.h')
-rw-r--r--method.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/method.h b/method.h
index d36cf38297..315915beb8 100644
--- a/method.h
+++ b/method.h
@@ -65,6 +65,8 @@ typedef struct rb_callable_method_entry_struct { /* same fields with rb_method_e
#define METHOD_ENTRY_VISI(me) (rb_method_visibility_t)(((me)->flags & (IMEMO_FL_USER0 | IMEMO_FL_USER1)) >> (IMEMO_FL_USHIFT+0))
#define METHOD_ENTRY_BASIC(me) (int) (((me)->flags & (IMEMO_FL_USER2 )) >> (IMEMO_FL_USHIFT+2))
+#define METHOD_ENTRY_COMPLEMENTED(me) ((me)->flags & IMEMO_FL_USER3)
+#define METHOD_ENTRY_COMPLEMENTED_SET(me) ((me)->flags = (me)->flags | IMEMO_FL_USER3)
static inline void
METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
@@ -143,8 +145,9 @@ typedef struct rb_method_refined_struct {
} rb_method_refined_t;
typedef struct rb_method_definition_struct {
- rb_method_type_t type; /* method type */
- int alias_count;
+ rb_method_type_t type : 8; /* method type */
+ int alias_count : 28;
+ int complemented_count: 28;
union {
rb_method_iseq_t iseq;