Adjust PR #5060 to the latest `mruby3` branch.

parent 6bc58571
...@@ -1315,6 +1315,7 @@ static const mrb_sym each_syms[] = { ...@@ -1315,6 +1315,7 @@ static const mrb_sym each_syms[] = {
static const mrb_irep each_irep = { static const mrb_irep each_irep = {
3, /* nlocals */ 3, /* nlocals */
7, /* nregs */ 7, /* nregs */
0, /* clen */
MRB_ISEQ_NO_FREE | MRB_IREP_NO_FREE, /* flags */ MRB_ISEQ_NO_FREE | MRB_IREP_NO_FREE, /* flags */
each_iseq, /* iseq */ each_iseq, /* iseq */
NULL, /* pool */ NULL, /* pool */
......
...@@ -2287,7 +2287,7 @@ static const mrb_code new_iseq[] = { ...@@ -2287,7 +2287,7 @@ static const mrb_code new_iseq[] = {
const mrb_sym new_syms[] = { MRB_SYM(allocate), MRB_SYM(initialize) }; const mrb_sym new_syms[] = { MRB_SYM(allocate), MRB_SYM(initialize) };
static const mrb_irep new_irep = { static const mrb_irep new_irep = {
3, 6, MRB_IREP_STATIC, 3, 6, 0, MRB_IREP_STATIC,
new_iseq, NULL, new_syms, NULL, NULL, NULL, new_iseq, NULL, new_syms, NULL, NULL, NULL,
sizeof(new_iseq), 0, 2, 0, 0, sizeof(new_iseq), 0, 2, 0, 0,
}; };
......
...@@ -291,6 +291,7 @@ write_catch_table_block(mrb_state *mrb, const mrb_irep *irep, uint8_t *buf) ...@@ -291,6 +291,7 @@ write_catch_table_block(mrb_state *mrb, const mrb_irep *irep, uint8_t *buf)
const struct mrb_irep_catch_hander *e = mrb_irep_catch_handler_table(irep); const struct mrb_irep_catch_hander *e = mrb_irep_catch_handler_table(irep);
mrb_static_assert1(sizeof(*e) == 7); mrb_static_assert1(sizeof(*e) == 7);
if (e == NULL) return 0;
/* irep->clen has already been written before iseq block */ /* irep->clen has already been written before iseq block */
memcpy(cur, (const void *)e, sizeof(*e) * irep->clen); memcpy(cur, (const void *)e, sizeof(*e) * irep->clen);
cur += sizeof(*e) * irep->clen; cur += sizeof(*e) * irep->clen;
...@@ -1058,7 +1059,7 @@ dump_irep_struct(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, FILE *fp, ...@@ -1058,7 +1059,7 @@ dump_irep_struct(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, FILE *fp,
fputs("};\n", fp); fputs("};\n", fp);
} }
/* dump iseq */ /* dump iseq */
len=irep->ilen; len=irep->ilen+sizeof(struct mrb_irep_catch_handler)*irep->clen;
fprintf(fp, "static const mrb_code %s_iseq_%d[%d] = {", name, n, len); fprintf(fp, "static const mrb_code %s_iseq_%d[%d] = {", name, n, len);
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
if (i%20 == 0) fputs("\n", fp); if (i%20 == 0) fputs("\n", fp);
...@@ -1076,7 +1077,7 @@ dump_irep_struct(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, FILE *fp, ...@@ -1076,7 +1077,7 @@ dump_irep_struct(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, FILE *fp,
} }
/* dump irep */ /* dump irep */
fprintf(fp, "static const mrb_irep %s_irep_%d = {\n", name, n); fprintf(fp, "static const mrb_irep %s_irep_%d = {\n", name, n);
fprintf(fp, " %d,%d,\n", irep->nlocals, irep->nregs); fprintf(fp, " %d,%d,%d,\n", irep->nlocals, irep->nregs, irep->clen);
fprintf(fp, " MRB_IREP_STATIC,%s_iseq_%d,\n", name, n); fprintf(fp, " MRB_IREP_STATIC,%s_iseq_%d,\n", name, n);
if (irep->pool) { if (irep->pool) {
fprintf(fp, " %s_pool_%d,", name, n); fprintf(fp, " %s_pool_%d,", name, n);
......
...@@ -17,6 +17,7 @@ static const mrb_code call_iseq[] = { ...@@ -17,6 +17,7 @@ static const mrb_code call_iseq[] = {
static const mrb_irep call_irep = { static const mrb_irep call_irep = {
0, /* nlocals */ 0, /* nlocals */
2, /* nregs */ 2, /* nregs */
0, /* clen */
MRB_ISEQ_NO_FREE | MRB_IREP_NO_FREE, /* flags */ MRB_ISEQ_NO_FREE | MRB_IREP_NO_FREE, /* flags */
call_iseq, /* iseq */ call_iseq, /* iseq */
NULL, /* pool */ NULL, /* pool */
......
...@@ -875,7 +875,7 @@ break_tag_p(struct RBreak *brk, uint32_t tag) ...@@ -875,7 +875,7 @@ break_tag_p(struct RBreak *brk, uint32_t tag)
} }
static void static void
prepare_tagged_break(mrb_state *mrb, uint32_t tag, struct RProc *proc, mrb_value val) prepare_tagged_break(mrb_state *mrb, uint32_t tag, const struct RProc *proc, mrb_value val)
{ {
if (break_tag_p((struct RBreak*)mrb->exc, tag)) { if (break_tag_p((struct RBreak*)mrb->exc, tag)) {
mrb_break_tag_set((struct RBreak*)mrb->exc, tag); mrb_break_tag_set((struct RBreak*)mrb->exc, tag);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment