Created
May 9, 2018 04:42
-
-
Save shyouhei/43f157b0bb67987cceac80f56cbd1d49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: trunk/compile.c | |
=================================================================== | |
--- trunk/compile.c (revision 63362) | |
+++ trunk/compile.c (working copy) | |
@@ -8929,7 +8929,7 @@ | |
dump_body.ci_entries = ibf_dump_ci_entries(dump, iseq); | |
dump_body.cc_entries = NULL; | |
dump_body.variable.coverage = Qnil; | |
- dump_body.variable.original_iseq = Qnil; | |
+ dump_body.variable.original_iseq = NULL; | |
IBF_W_ALIGN(struct rb_iseq_constant_body); | |
return IBF_WV(dump_body); | |
Index: trunk/iseq.c | |
=================================================================== | |
--- trunk/iseq.c (revision 63362) | |
+++ trunk/iseq.c (working copy) | |
@@ -222,7 +222,6 @@ | |
} | |
rb_gc_mark(body->variable.coverage); | |
- rb_gc_mark(body->variable.original_iseq); | |
rb_gc_mark(body->location.label); | |
rb_gc_mark(body->location.base_label); | |
rb_gc_mark(body->location.pathobj); | |
Index: trunk/iseq.h | |
=================================================================== | |
--- trunk/iseq.h (revision 63363) | |
+++ trunk/iseq.h (working copy) | |
@@ -46,23 +46,24 @@ | |
static inline VALUE * | |
ISEQ_ORIGINAL_ISEQ(const rb_iseq_t *iseq) | |
{ | |
- VALUE str = iseq->body->variable.original_iseq; | |
- if (RTEST(str)) return (VALUE *)RSTRING_PTR(str); | |
- return NULL; | |
+ return iseq->body->variable.original_iseq; | |
} | |
static inline void | |
ISEQ_ORIGINAL_ISEQ_CLEAR(const rb_iseq_t *iseq) | |
{ | |
- RB_OBJ_WRITE(iseq, &iseq->body->variable.original_iseq, Qnil); | |
+ void *ptr = iseq->body->variable.original_iseq; | |
+ iseq->body->variable.original_iseq = NULL; | |
+ if (ptr) { | |
+ ruby_xfree(ptr); | |
+ } | |
} | |
static inline VALUE * | |
ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size) | |
{ | |
- VALUE str = rb_str_tmp_new(size * sizeof(VALUE)); | |
- RB_OBJ_WRITE(iseq, &iseq->body->variable.original_iseq, str); | |
- return (VALUE *)RSTRING_PTR(str); | |
+ return iseq->body->variable.original_iseq = | |
+ ruby_xmalloc2(sizeof(VALUE), size); | |
} | |
#define ISEQ_TRACE_EVENTS (RUBY_EVENT_LINE | \ | |
Index: trunk/vm_core.h | |
=================================================================== | |
--- trunk/vm_core.h (revision 63362) | |
+++ trunk/vm_core.h (working copy) | |
@@ -420,7 +420,7 @@ | |
struct { | |
rb_snum_t flip_count; | |
VALUE coverage; | |
- VALUE original_iseq; | |
+ VALUE *original_iseq; | |
} variable; | |
unsigned int local_table_size; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment