diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-08-08 15:13:39 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-12 16:21:34 +0900 |
| commit | cb89e1f0d9d9f05e53705d228b69decbc428a650 (patch) | |
| tree | 348725848fbc3ef491392a90c55f47499392d4b2 /src/dump.c | |
| parent | 6bc5857125029aa519371b10625f7384767d7138 (diff) | |
| download | mruby-cb89e1f0d9d9f05e53705d228b69decbc428a650.tar.gz mruby-cb89e1f0d9d9f05e53705d228b69decbc428a650.zip | |
Adjust PR #5060 to the latest `mruby3` branch.
Diffstat (limited to 'src/dump.c')
| -rw-r--r-- | src/dump.c | 5 |
1 files changed, 3 insertions, 2 deletions
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; i<len; i++) { 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, } /* dump irep */ 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); if (irep->pool) { fprintf(fp, " %s_pool_%d,", name, n); |
