compile.c: fix the element

* compile.c (iseq_set_sequence): fix the element for line number
  to rb_compile_bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-12-02 07:31:23 +00:00
parent 2a66cc554d
commit e917af6401

View File

@ -1486,8 +1486,6 @@ cdhash_set_label_i(VALUE key, VALUE val, void *ptr)
static int static int
iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor) iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
{ {
LABEL *lobj;
INSN *iobj;
struct iseq_line_info_entry *line_info_table; struct iseq_line_info_entry *line_info_table;
unsigned int last_line = 0; unsigned int last_line = 0;
LINK_ELEMENT *list; LINK_ELEMENT *list;
@ -1502,7 +1500,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
switch (list->type) { switch (list->type) {
case ISEQ_ELEMENT_INSN: case ISEQ_ELEMENT_INSN:
{ {
iobj = (INSN *)list; INSN *iobj = (INSN *)list;
line = iobj->line_no; line = iobj->line_no;
code_index += insn_data_length(iobj); code_index += insn_data_length(iobj);
insn_num++; insn_num++;
@ -1510,7 +1508,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
} }
case ISEQ_ELEMENT_LABEL: case ISEQ_ELEMENT_LABEL:
{ {
lobj = (LABEL *)list; LABEL *lobj = (LABEL *)list;
lobj->position = code_index; lobj->position = code_index;
lobj->set = TRUE; lobj->set = TRUE;
break; break;
@ -1558,8 +1556,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
int j, len, insn; int j, len, insn;
const char *types; const char *types;
VALUE *operands; VALUE *operands;
INSN *iobj = (INSN *)list;
iobj = (INSN *)list;
/* update sp */ /* update sp */
sp = calc_sp_depth(sp, iobj); sp = calc_sp_depth(sp, iobj);
@ -1593,7 +1590,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
case TS_OFFSET: case TS_OFFSET:
{ {
/* label(destination position) */ /* label(destination position) */
lobj = (LABEL *)operands[j]; LABEL *lobj = (LABEL *)operands[j];
if (!lobj->set) { if (!lobj->set) {
COMPILE_ERROR((ruby_sourcefile, iobj->line_no, COMPILE_ERROR((ruby_sourcefile, iobj->line_no,
"unknown label")); "unknown label"));
@ -1704,7 +1701,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
} }
case ISEQ_ELEMENT_LABEL: case ISEQ_ELEMENT_LABEL:
{ {
lobj = (LABEL *)list; LABEL *lobj = (LABEL *)list;
if (lobj->sp == -1) { if (lobj->sp == -1) {
lobj->sp = sp; lobj->sp = sp;
} }
@ -1746,7 +1743,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
generated_iseq[code_index++] = BIN(nop); generated_iseq[code_index++] = BIN(nop);
} }
else { else {
rb_compile_bug(ruby_sourcefile, iobj->line_no, rb_compile_bug(ruby_sourcefile, adjust->line_no,
"iseq_set_sequence: adjust bug %d < %d", orig_sp, sp); "iseq_set_sequence: adjust bug %d < %d", orig_sp, sp);
} }
} }