From f16ea05a178a0ffd38a054d28a01c1780d63d03a Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 8 Jul 2021 07:10:11 +0900 Subject: debug.c: new debug line information format `mrb_debug_line_packed_map`. It uses BER number compression of delta of instruction positions and line numbers. BER compression is a variable length number representation. * `mrb_debug_line_ary`: array of line numbers represented in `uint16_t`. `[lineno, lineno, ...]` * `mrb_debug_line_flat_map`: array of `mrb_irep_debug_info_line`, which is `struct {uint32_t pos; uint16_t lineno}`, for each line. * `mrb_debug_line_packed_map` [new]: sequence of BER compressed 2 numbers, `pos_delta, lineno_delta`. Deltas are differences from previous values (starting `0`). `line_entry_counts` represents total length of a packed map string for this type. --- src/dump.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/dump.c') diff --git a/src/dump.c b/src/dump.c index 0b4200795..628c3dbc4 100644 --- a/src/dump.c +++ b/src/dump.c @@ -413,6 +413,10 @@ get_debug_record_size(mrb_state *mrb, const mrb_irep *irep) ret += (sizeof(uint32_t) + sizeof(uint16_t)) * (size_t)(file->line_entry_count); break; + case mrb_debug_line_packed_map: + ret += (size_t)(file->line_entry_count); + break; + default: mrb_assert(0); break; } } @@ -507,6 +511,11 @@ write_debug_record_1(mrb_state *mrb, const mrb_irep *irep, uint8_t *bin, mrb_sym } } break; + case mrb_debug_line_packed_map: { + memcpy(cur, file->lines.packed_map, file->line_entry_count); + cur += file->line_entry_count; + } break; + default: mrb_assert(0); break; } } -- cgit v1.2.3