From cb89e1f0d9d9f05e53705d228b69decbc428a650 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 8 Aug 2020 15:13:39 +0900 Subject: Adjust PR #5060 to the latest `mruby3` branch. --- src/array.c | 1 + src/class.c | 2 +- src/dump.c | 5 +++-- src/proc.c | 1 + src/vm.c | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/array.c b/src/array.c index 4f2b5466c..f86743138 100644 --- a/src/array.c +++ b/src/array.c @@ -1315,6 +1315,7 @@ static const mrb_sym each_syms[] = { static const mrb_irep each_irep = { 3, /* nlocals */ 7, /* nregs */ + 0, /* clen */ MRB_ISEQ_NO_FREE | MRB_IREP_NO_FREE, /* flags */ each_iseq, /* iseq */ NULL, /* pool */ diff --git a/src/class.c b/src/class.c index 5ce32439a..0e443da90 100644 --- a/src/class.c +++ b/src/class.c @@ -2287,7 +2287,7 @@ static const mrb_code new_iseq[] = { const mrb_sym new_syms[] = { MRB_SYM(allocate), MRB_SYM(initialize) }; 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, sizeof(new_iseq), 0, 2, 0, 0, }; diff --git a/src/dump.c b/src/dump.c index 884c44dc6..b14fc4a1f 100644 --- a/src/dump.c +++ b/src/dump.c @@ -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); mrb_static_assert1(sizeof(*e) == 7); + if (e == NULL) return 0; /* irep->clen has already been written before iseq block */ memcpy(cur, (const void *)e, 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, fputs("};\n", fp); } /* 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); for (i=0; inlocals, 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); if (irep->pool) { fprintf(fp, " %s_pool_%d,", name, n); diff --git a/src/proc.c b/src/proc.c index 14ba407d8..de463df3e 100644 --- a/src/proc.c +++ b/src/proc.c @@ -17,6 +17,7 @@ static const mrb_code call_iseq[] = { static const mrb_irep call_irep = { 0, /* nlocals */ 2, /* nregs */ + 0, /* clen */ MRB_ISEQ_NO_FREE | MRB_IREP_NO_FREE, /* flags */ call_iseq, /* iseq */ NULL, /* pool */ diff --git a/src/vm.c b/src/vm.c index 9b501808b..4d3ab720a 100644 --- a/src/vm.c +++ b/src/vm.c @@ -875,7 +875,7 @@ break_tag_p(struct RBreak *brk, uint32_t tag) } 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)) { mrb_break_tag_set((struct RBreak*)mrb->exc, tag); -- cgit v1.2.3