summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-22 10:55:02 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-22 10:55:02 +0000
commit0d775f2a3c402310b71a581e368f347c52af78e5 (patch)
treebc30b3a636d69901ca2742534704d7acd0daefef /iseq.c
parent2f5897e6b67d78d65c1aa3c9c16c0dfb65c38416 (diff)
* vm_core.h: separate rb_iseq_body into rb_iseq_constant_body and
rb_iseq_variable_body (rb_iseq_t::variable_body). rb_iseq_variable_body can be modified after compilation. * compile.c: use rb_iseq_t::variable_body. * iseq.c: ditto. * thread.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/iseq.c b/iseq.c
index e4790e2..489be5f 100644
--- a/iseq.c
+++ b/iseq.c
@@ -92,7 +92,7 @@ rb_iseq_free(const rb_iseq_t *iseq)
ruby_xfree(iseq->body->param.keyword);
}
compile_data_free(iseq->compile_data);
- ruby_xfree(iseq->body->iseq);
+ ruby_xfree(iseq->variable_body->iseq);
ruby_xfree(iseq->body);
}
RUBY_FREE_LEAVE("iseq");
@@ -106,14 +106,17 @@ rb_iseq_mark(const rb_iseq_t *iseq)
RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->body->location.label), RSTRING_PTR(iseq->body->location.path));
if (iseq->body) {
- const struct rb_iseq_body *body = iseq->body;
+ const struct rb_iseq_constant_body *body = iseq->body;
RUBY_MARK_UNLESS_NULL(body->mark_ary);
RUBY_MARK_UNLESS_NULL(body->location.label);
RUBY_MARK_UNLESS_NULL(body->location.base_label);
RUBY_MARK_UNLESS_NULL(body->location.path);
RUBY_MARK_UNLESS_NULL(body->location.absolute_path);
- RUBY_MARK_UNLESS_NULL(body->coverage);
+ }
+
+ if (iseq->variable_body) {
+ RUBY_MARK_UNLESS_NULL(iseq->variable_body->coverage);
}
if (iseq->compile_data != 0) {
@@ -173,7 +176,8 @@ static rb_iseq_t *
iseq_alloc(void)
{
rb_iseq_t *iseq = (rb_iseq_t *)rb_imemo_new(imemo_iseq, 0, 0, 0, 0);
- iseq->body = ZALLOC(struct rb_iseq_body);
+ iseq->body = ZALLOC(struct rb_iseq_constant_body);
+ iseq->variable_body = ZALLOC(struct rb_iseq_variable_body);
return iseq;
}
@@ -264,13 +268,13 @@ prepare_iseq_build(rb_iseq_t *iseq,
iseq->compile_data->option = option;
iseq->compile_data->last_coverable_line = -1;
- RB_OBJ_WRITE(iseq, &iseq->body->coverage, Qfalse);
+ RB_OBJ_WRITE(iseq, &iseq->variable_body->coverage, Qfalse);
if (!GET_THREAD()->parse_in_eval) {
VALUE coverages = rb_get_coverages();
if (RTEST(coverages)) {
- RB_OBJ_WRITE(iseq, &iseq->body->coverage, rb_hash_lookup(coverages, path));
- if (NIL_P(iseq->body->coverage)) RB_OBJ_WRITE(iseq, &iseq->body->coverage, Qfalse);
+ RB_OBJ_WRITE(iseq, &iseq->variable_body->coverage, rb_hash_lookup(coverages, path));
+ if (NIL_P(iseq->variable_body->coverage)) RB_OBJ_WRITE(iseq, &iseq->variable_body->coverage, Qfalse);
}
}