summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-20 08:36:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-20 08:36:42 +0000
commitce848356aeafcb0cae6a74e6ff38f4cbc1f2142e (patch)
tree92ee753b74252691dffab42890c887d31e9de149 /compile.c
parent9e26858e8c32e7f4b6ae3bccf9896ea7b61ce335 (diff)
compile.c: fix ibf_load_code
* compile.c (ibf_load_iseq_each): manage iseq_size to point loaded objects in iseq_encoded. now marking iseq scans iseq_encoded directly. * test/ruby/test_iseq.rb (test_to_binary_with_objects): skip for now, but fix argument order of assert_equal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/compile.c b/compile.c
index 68d4bf549a..806c86f72a 100644
--- a/compile.c
+++ b/compile.c
@@ -8442,11 +8442,14 @@ ibf_load_code(const struct ibf_load *load, const rb_iseq_t *iseq, const struct r
int code_index;
VALUE *code = IBF_R(body->iseq_encoded, VALUE, iseq_size);
+ struct rb_iseq_constant_body *load_body = iseq->body;
struct rb_call_info *ci_entries = iseq->body->ci_entries;
struct rb_call_info_with_kwarg *ci_kw_entries = (struct rb_call_info_with_kwarg *)&iseq->body->ci_entries[iseq->body->ci_size];
struct rb_call_cache *cc_entries = iseq->body->cc_entries;
union iseq_inline_storage_entry *is_entries = iseq->body->is_entries;
+ load_body->iseq_encoded = code;
+ load_body->iseq_size = 0;
for (code_index=0; code_index<iseq_size;) {
const VALUE insn = code[code_index++];
const char *types = insn_op_types(insn);
@@ -8487,14 +8490,15 @@ ibf_load_code(const struct ibf_load *load, const rb_iseq_t *iseq, const struct r
break;
default:
/* code[code_index] = op; */
- break;
+ continue;
}
+ load_body->iseq_size = code_index + 1;
}
if (insn_len(insn) != op_index+1) {
rb_raise(rb_eRuntimeError, "operand size mismatch");
}
}
-
+ load_body->iseq_size = code_index;
return code;
}
@@ -8793,7 +8797,6 @@ ibf_load_iseq_each(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t of
/* memcpy(load_body, load->buff + offset, sizeof(*load_body)); */
load_body->type = body->type;
load_body->stack_max = body->stack_max;
- load_body->iseq_size = body->iseq_size;
load_body->param = body->param;
load_body->local_table_size = body->local_table_size;
load_body->is_size = body->is_size;
@@ -8852,7 +8855,7 @@ ibf_load_iseq_each(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t of
load_body->parent_iseq = ibf_load_iseq(load, body->parent_iseq);
load_body->local_iseq = ibf_load_iseq(load, body->local_iseq);
- load_body->iseq_encoded = ibf_load_code(load, iseq, body);
+ ibf_load_code(load, iseq, body);
rb_iseq_translate_threaded_code(iseq);
}