diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-08-05 00:15:30 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-08-05 16:37:41 +0200 |
commit | 304995b88d4e068db43a5edb677c2d525f7b49d3 (patch) | |
tree | d3259491ea9e4b525a09ec171de5faee8bfce3e2 /program.c | |
parent | 506cc372436f6b03ac79762e66e307bb4c5a28ea (diff) |
compiler: rework export index allocation
The current implementation of the module export offset tracking was
inadequate and failed to properly handle larger module dependency
graphs. In order to properly support nested module imports/exports,
the following changes have been introduced:
- Gather export slots during module compilation and emit corresponding
export opcodes as one contiguous block at the end of the module
function body, right before the final return. This ensures that
interleaved imports of other modules do not place foreign exports
between our module exports.
- Track the number of program wide allocated export slots in order
to derive per-module-source offsets for the global VM export list.
- Derive import opcode source index from the module source export
offset and the index of the requested name within the module source
export name list.
- Improve error reporting for circular module imports.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'program.c')
0 files changed, 0 insertions, 0 deletions