From e77fb25b57ed5c64b90dbe760adc454ae3b1a31d Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Tue, 18 Jan 2022 11:35:49 +0800 Subject: [PATCH] Save and restore vcode unit location --- src/vcode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vcode.c b/src/vcode.c index 564a4d76..66820144 100644 --- a/src/vcode.c +++ b/src/vcode.c @@ -198,7 +198,7 @@ struct vcode_unit { #define VCODE_FOR_EACH_MATCHING_OP(name, k) \ VCODE_FOR_EACH_OP(name) if (name->kind == k) -#define VCODE_VERSION 13 +#define VCODE_VERSION 14 #define VCODE_CHECK_UNIONS 0 static __thread vcode_unit_t active_unit = NULL; @@ -4955,6 +4955,7 @@ static void vcode_write_unit(vcode_unit_t unit, fbuf_t *f, write_u32(unit->result, f); write_u32(unit->flags, f); write_u32(unit->depth, f); + loc_write(&(unit->loc), loc_wr_ctx); if (unit->context != NULL) { vcode_select_unit(unit); @@ -5122,6 +5123,8 @@ static vcode_unit_t vcode_read_unit(fbuf_t *f, ident_rd_ctx_t ident_rd_ctx, unit->flags = read_u32(f); unit->depth = read_u32(f); + loc_read(&(unit->loc), loc_rd_ctx); + if (unit->kind != VCODE_UNIT_PACKAGE) { ident_t context_name = ident_read(ident_rd_ctx); unit->context = vcode_find_unit(context_name); -- 2.39.2