summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-16 01:40:44 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-16 01:40:44 (GMT)
commita12bfb3bbd5a196723cea45bba3262828d023232 (patch)
tree9ba1a44c2528719dc52d8067a91fafcc068b12f0 /iseq.c
parentdb5765ba54419a45a61cf26157eff46d2cd5f692 (diff)
iseq body local variables
* compile.c, iseq.c: extract body and param.keyword in iseq as local variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/iseq.c b/iseq.c
index 8b9da6c..c01d94f 100644
--- a/iseq.c
+++ b/iseq.c
@@ -228,12 +228,13 @@ rb_iseq_mark(const rb_iseq_t *iseq)
RUBY_MARK_UNLESS_NULL((VALUE)body->parent_iseq);
if (body->param.flags.has_kw && ISEQ_COMPILE_DATA(iseq) == NULL) {
+ const struct rb_iseq_param_keyword *const keyword = body->param.keyword;
int i, j;
- i = body->param.keyword->required_num;
+ i = keyword->required_num;
- for (j = 0; i < body->param.keyword->num; i++, j++) {
- VALUE obj = body->param.keyword->default_values[j];
+ for (j = 0; i < keyword->num; i++, j++) {
+ VALUE obj = keyword->default_values[j];
if (!SPECIAL_CONST_P(obj)) {
rb_gc_mark(obj);
}
@@ -2706,6 +2707,7 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
{
int i, r;
const struct rb_iseq_constant_body *const body = iseq->body;
+ const struct rb_iseq_param_keyword *const keyword = body->param.keyword;
VALUE a, args = rb_ary_new2(body->param.size);
ID req, opt, rest, block, key, keyrest;
#define PARAM_TYPE(type) rb_ary_push(a = rb_ary_new2(2), ID2SYM(type))
@@ -2757,29 +2759,29 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
}
if (body->param.flags.has_kw) {
i = 0;
- if (body->param.keyword->required_num > 0) {
+ if (keyword->required_num > 0) {
ID keyreq;
CONST_ID(keyreq, "keyreq");
- for (; i < body->param.keyword->required_num; i++) {
+ for (; i < keyword->required_num; i++) {
PARAM_TYPE(keyreq);
- if (rb_id2str(body->param.keyword->table[i])) {
- rb_ary_push(a, ID2SYM(body->param.keyword->table[i]));
+ if (rb_id2str(keyword->table[i])) {
+ rb_ary_push(a, ID2SYM(keyword->table[i]));
}
rb_ary_push(args, a);
}
}
CONST_ID(key, "key");
- for (; i < body->param.keyword->num; i++) {
+ for (; i < keyword->num; i++) {
PARAM_TYPE(key);
- if (rb_id2str(body->param.keyword->table[i])) {
- rb_ary_push(a, ID2SYM(body->param.keyword->table[i]));
+ if (rb_id2str(keyword->table[i])) {
+ rb_ary_push(a, ID2SYM(keyword->table[i]));
}
rb_ary_push(args, a);
}
}
if (body->param.flags.has_kwrest) {
CONST_ID(keyrest, "keyrest");
- rb_ary_push(args, PARAM(body->param.keyword->rest_start, keyrest));
+ rb_ary_push(args, PARAM(keyword->rest_start, keyrest));
}
if (body->param.flags.has_block) {
CONST_ID(block, "block");