summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--class.c2
-rw-r--r--gc.c2
-rw-r--r--method.h3
-rw-r--r--proc.c9
-rw-r--r--vm_method.c19
6 files changed, 29 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 5ea4aea..3fe6c34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Tue Jun 2 23:27:18 2015 Koichi Sasada <ko1@atdot.net>
+
+ * method.h: remove rb_method_iseq_t::iseqval.
+ While making a r50728, iseqval is needed (to mark correctly),
+ but now just iseqptr is enough.
+
+ * class.c: catch up this fix.
+
+ * gc.c: ditto.
+
+ * proc.c: ditto.
+
+ * vm_method.c: ditto.
+
Tue Jun 2 21:29:28 2015 Koichi Sasada <ko1@atdot.net>
* proc.c (proc_curry): remove a debug line.
diff --git a/class.c b/class.c
index a32b860..f3812a5 100644
--- a/class.c
+++ b/class.c
@@ -247,7 +247,7 @@ clone_method(VALUE klass, ID mid, const rb_method_entry_t *me)
if (me->def->type == VM_METHOD_TYPE_ISEQ) {
VALUE newiseqval;
rb_cref_t *new_cref;
- newiseqval = rb_iseq_clone(me->def->body.iseq.iseqval, klass);
+ newiseqval = rb_iseq_clone(me->def->body.iseq.iseqptr->self, klass);
rb_vm_rewrite_cref_stack(me->def->body.iseq.cref, me->klass, klass, &new_cref);
rb_add_method_iseq(klass, mid, newiseqval, new_cref, me->def->flag);
RB_GC_GUARD(newiseqval);
diff --git a/gc.c b/gc.c
index 286e83a..d7269cf 100644
--- a/gc.c
+++ b/gc.c
@@ -3932,7 +3932,7 @@ mark_method_entry(rb_objspace_t *objspace, const rb_method_entry_t *me)
switch (def->type) {
case VM_METHOD_TYPE_ISEQ:
- gc_mark(objspace, def->body.iseq.iseqval);
+ gc_mark(objspace, def->body.iseq.iseqptr->self);
gc_mark(objspace, (VALUE)def->body.iseq.cref);
break;
case VM_METHOD_TYPE_ATTRSET:
diff --git a/method.h b/method.h
index 05db085..7c30888 100644
--- a/method.h
+++ b/method.h
@@ -74,7 +74,6 @@ typedef struct rb_iseq_struct rb_iseq_t;
typedef struct rb_method_iseq_struct {
rb_iseq_t * const iseqptr; /* should be separated from iseqval */
rb_cref_t * const cref; /* shoudl be marked */
- const VALUE iseqval; /* should be marked */
} rb_method_iseq_t;
typedef struct rb_method_cfunc_struct {
@@ -120,7 +119,7 @@ typedef struct rb_method_definition_struct {
UNDEFINED_METHOD_ENTRY_P((def)->body.orig_me))
void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex);
-void rb_add_method_iseq(VALUE klass, ID mid, VALUE iseq, rb_cref_t *cref, rb_method_flag_t noex);
+void rb_add_method_iseq(VALUE klass, ID mid, VALUE iseqval, rb_cref_t *cref, rb_method_flag_t noex);
rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex);
rb_method_entry_t *rb_method_entry(VALUE klass, ID id, VALUE *define_class_ptr);
rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
diff --git a/proc.c b/proc.c
index 73baf55..3d05264 100644
--- a/proc.c
+++ b/proc.c
@@ -2046,8 +2046,7 @@ rb_method_entry_min_max_arity(const rb_method_entry_t *me, int *max)
case VM_METHOD_TYPE_BMETHOD:
return rb_proc_min_max_arity(def->body.proc, max);
case VM_METHOD_TYPE_ISEQ: {
- rb_iseq_t *iseq;
- GetISeqPtr(def->body.iseq.iseqval, iseq);
+ rb_iseq_t *iseq = def->body.iseq.iseqptr;
return rb_iseq_min_max_arity(iseq, max);
}
case VM_METHOD_TYPE_UNDEF:
@@ -2183,11 +2182,7 @@ method_def_iseq(const rb_method_definition_t *def)
{
switch (def->type) {
case VM_METHOD_TYPE_ISEQ:
- {
- rb_iseq_t *iseq;
- GetISeqPtr(def->body.iseq.iseqval, iseq);
- return iseq;
- }
+ return def->body.iseq.iseqptr;
case VM_METHOD_TYPE_BMETHOD:
return get_proc_iseq(def->body.proc, 0);
case VM_METHOD_TYPE_ALIAS:
diff --git a/vm_method.c b/vm_method.c
index 5708b7a..09116b0 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -226,12 +226,9 @@ rb_method_definition_set(rb_method_definition_t *def, void *opts)
{
rb_method_iseq_t *iseq_body = (rb_method_iseq_t *)opts;
rb_cref_t *method_cref, *cref = iseq_body->cref;
- rb_iseq_t *iseq;
- GetISeqPtr(iseq_body->iseqval, iseq);
/* setup iseq first (before invoking GC) */
- DEF_OBJ_WRITE(&def->body.iseq.iseqval, iseq_body->iseqval);
- DEF_OBJ_WRITE(&def->body.iseq.iseqptr, iseq);
+ DEF_OBJ_WRITE(&def->body.iseq.iseqptr, iseq_body->iseqptr);
if (0) vm_cref_dump("rb_method_definition_create", cref);
@@ -312,7 +309,7 @@ rb_method_definition_reset(rb_method_entry_t *me, rb_method_definition_t *def)
{
switch(def->type) {
case VM_METHOD_TYPE_ISEQ:
- RB_OBJ_WRITTEN(me, Qundef, def->body.iseq.iseqval);
+ RB_OBJ_WRITTEN(me, Qundef, def->body.iseq.iseqptr->self);
RB_OBJ_WRITTEN(me, Qundef, def->body.iseq.cref);
break;
case VM_METHOD_TYPE_IVAR:
@@ -558,8 +555,12 @@ rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *opts, rb_method_
void
rb_add_method_iseq(VALUE klass, ID mid, VALUE iseqval, rb_cref_t *cref, rb_method_flag_t noex)
{
- rb_method_iseq_t iseq_body = {NULL, cref, iseqval};
- rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, &iseq_body, noex);
+ rb_iseq_t *iseq;
+ GetISeqPtr(iseqval, iseq);
+ {
+ rb_method_iseq_t iseq_body = {iseq, cref};
+ rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, &iseq_body, noex);
+ }
}
static rb_method_entry_t *
@@ -1281,7 +1282,7 @@ rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_defini
switch (d1->type) {
case VM_METHOD_TYPE_ISEQ:
- return d1->body.iseq.iseqval == d2->body.iseq.iseqval;
+ return d1->body.iseq.iseqptr == d2->body.iseq.iseqptr;
case VM_METHOD_TYPE_CFUNC:
return
d1->body.cfunc.func == d2->body.cfunc.func &&
@@ -1316,7 +1317,7 @@ rb_hash_method_definition(st_index_t hash, const rb_method_definition_t *def)
switch (def->type) {
case VM_METHOD_TYPE_ISEQ:
- return rb_hash_uint(hash, (st_index_t)def->body.iseq.iseqval);
+ return rb_hash_uint(hash, (st_index_t)def->body.iseq.iseqptr);
case VM_METHOD_TYPE_CFUNC:
hash = rb_hash_uint(hash, (st_index_t)def->body.cfunc.func);
return rb_hash_uint(hash, def->body.cfunc.argc);