aboutsummaryrefslogtreecommitdiffstats
path: root/iseq.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-09 06:57:24 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-09 06:57:24 +0000
commite63936421b5ca34881f07bbca5208cb6064cd8a1 (patch)
tree722e7886ad099c5a6adffbb576fcd8960a285703 /iseq.c
parentc4605b52264bfae62f6738b2f5e6ef503b9a2d9c (diff)
downloadruby-e63936421b5ca34881f07bbca5208cb6064cd8a1.tar.gz
insn_info/insns_info
* iseq.h (iseq_line_info_entry): rename to iseq_insn_info_entry. * vm_core.h (rb_iseq_constant_body): rename field name line_info_table to insns_info and also from line_info_size to insns_info_size. * compile.c (INSN): add struct insn_info to contain per insn information. * compile.c (add_insn_info): added to add new insn_info entry. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/iseq.c b/iseq.c
index db9810f565..ac926b7a18 100644
--- a/iseq.c
+++ b/iseq.c
@@ -74,7 +74,7 @@ rb_iseq_free(const rb_iseq_t *iseq)
if (iseq) {
if (iseq->body) {
ruby_xfree((void *)iseq->body->iseq_encoded);
- ruby_xfree((void *)iseq->body->line_info_table);
+ ruby_xfree((void *)iseq->body->insns_info);
ruby_xfree((void *)iseq->body->local_table);
ruby_xfree((void *)iseq->body->is_entries);
@@ -157,7 +157,7 @@ iseq_memsize(const rb_iseq_t *iseq)
size += sizeof(struct rb_iseq_constant_body);
size += body->iseq_size * sizeof(VALUE);
- size += body->line_info_size * sizeof(struct iseq_line_info_entry);
+ size += body->insns_info_size * sizeof(struct iseq_insn_info_entry);
size += body->local_table_size * sizeof(ID);
if (body->catch_table) {
size += iseq_catch_table_bytes(body->catch_table->size);
@@ -1217,45 +1217,45 @@ iseqw_to_a(VALUE self)
/* TODO: search algorithm is brute force.
this should be binary search or so. */
-static const struct iseq_line_info_entry *
-get_line_info(const rb_iseq_t *iseq, size_t pos)
+static const struct iseq_insn_info_entry *
+get_insn_info(const rb_iseq_t *iseq, size_t pos)
{
- size_t i = 0, size = iseq->body->line_info_size;
- const struct iseq_line_info_entry *table = iseq->body->line_info_table;
+ size_t i = 0, size = iseq->body->insns_info_size;
+ const struct iseq_insn_info_entry *insns_info = iseq->body->insns_info;
const int debug = 0;
if (debug) {
printf("size: %"PRIuSIZE"\n", size);
- printf("table[%"PRIuSIZE"]: position: %d, line: %d, pos: %"PRIuSIZE"\n",
- i, table[i].position, table[i].line_no, pos);
+ printf("insns_info[%"PRIuSIZE"]: position: %d, line: %d, pos: %"PRIuSIZE"\n",
+ i, insns_info[i].position, insns_info[i].line_no, pos);
}
if (size == 0) {
- return 0;
+ return NULL;
}
else if (size == 1) {
- return &table[0];
+ return &insns_info[0];
}
else {
for (i=1; i<size; i++) {
- if (debug) printf("table[%"PRIuSIZE"]: position: %d, line: %d, pos: %"PRIuSIZE"\n",
- i, table[i].position, table[i].line_no, pos);
+ if (debug) printf("insns_info[%"PRIuSIZE"]: position: %d, line: %d, pos: %"PRIuSIZE"\n",
+ i, insns_info[i].position, insns_info[i].line_no, pos);
- if (table[i].position == pos) {
- return &table[i];
+ if (insns_info[i].position == pos) {
+ return &insns_info[i];
}
- if (table[i].position > pos) {
- return &table[i-1];
+ if (insns_info[i].position > pos) {
+ return &insns_info[i-1];
}
}
}
- return &table[i-1];
+ return &insns_info[i-1];
}
static unsigned int
find_line_no(const rb_iseq_t *iseq, size_t pos)
{
- const struct iseq_line_info_entry *entry = get_line_info(iseq, pos);
+ const struct iseq_insn_info_entry *entry = get_insn_info(iseq, pos);
if (entry) {
return entry->line_no;
@@ -2090,8 +2090,8 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
rb_ary_push(body, (VALUE)label);
}
- if (ti < iseq->body->line_info_size && iseq->body->line_info_table[ti].position == pos) {
- line = iseq->body->line_info_table[ti].line_no;
+ if (ti < iseq->body->insns_info_size && iseq->body->insns_info[ti].position == pos) {
+ line = iseq->body->insns_info[ti].line_no;
rb_ary_push(body, INT2FIX(line));
ti++;
}