summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-13 01:04:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-13 01:04:56 +0000
commita784132d9810cf0f8664820e1e9128b763c8e8fe (patch)
tree3dd51b57d5262a74afaca77a2c49afe4777bf556
parenta100bf321c7f3a6eb97133735f5d73a1fc92a405 (diff)
compile.c: refine error messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/compile.c b/compile.c
index afbba0b..7f4bddf 100644
--- a/compile.c
+++ b/compile.c
@@ -1562,6 +1562,12 @@ get_ivar_ic_value(rb_iseq_t *iseq,ID id)
return val;
}
+#define BADINSN_ERROR \
+ (xfree(generated_iseq), \
+ xfree(line_info_table), \
+ dump_disasm_list_with_cursor(&anchor->anchor, list), \
+ COMPILE_ERROR)
+
/**
ruby insn object list -> raw instruction sequence
*/
@@ -1610,9 +1616,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
break;
}
default:
- dump_disasm_list(FIRST_ELEMENT(anchor));
- dump_disasm_list(list);
- COMPILE_ERROR(iseq, line, "error: set_sequence");
+ BADINSN_ERROR(iseq, line, "unknown list type: %d", list->type);
return COMPILE_NG;
}
list = list->next;
@@ -1631,12 +1635,6 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
list = FIRST_ELEMENT(anchor);
line_info_index = code_index = sp = 0;
-#define BADINSN_ERROR \
- (dump_disasm_list_with_cursor(&anchor->anchor, list), \
- xfree(generated_iseq), \
- xfree(line_info_table), \
- COMPILE_ERROR)
-
while (list) {
switch (list->type) {
case ISEQ_ELEMENT_INSN:
@@ -1683,7 +1681,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
LABEL *lobj = (LABEL *)operands[j];
if (!lobj->set) {
BADINSN_ERROR(iseq, iobj->line_no,
- "unknown label");
+ "unknown label: "LABEL_FORMAT, lobj->label_no);
return COMPILE_NG;
}
if (lobj->sp == -1) {