Progress on updating entire compiler for snake_case

This commit is contained in:
Sam Mohr 2025-01-05 03:48:03 -08:00
parent db6cc5a7b1
commit b56fbd38e1
No known key found for this signature in database
GPG key ID: EA41D161A3C1BC99
297 changed files with 8416 additions and 8544 deletions

View file

@ -186,7 +186,7 @@ The [official spec](https://webassembly.github.io/spec/core/binary/modules.html#
We implement a few linking operations in the Wasm backend. The most important are host-to-app calls.
In the host .wasm file, `roc__mainForHost_1_exposed` is defined as a Wasm Import, as if it were an external JavaScript function. But when we link the host and app, we need to make it an internal function instead.
In the host .wasm file, `roc__main_for_host_1_exposed` is defined as a Wasm Import, as if it were an external JavaScript function. But when we link the host and app, we need to make it an internal function instead.
There are a few important facts to note about the Wasm binary format:
@ -197,8 +197,8 @@ There are a few important facts to note about the Wasm binary format:
With that background, here are the linking steps for a single app function that gets called by the host:
- Remove `roc__mainForHost_1_exposed` from the imports, updating all call sites to the new index, which is somewhere in the app.
- Swap the _last_ JavaScript import into the slot where `roc__mainForHost_1_exposed` was, updating all of its call sites in the host.
- Remove `roc__main_for_host_1_exposed` from the imports, updating all call sites to the new index, which is somewhere in the app.
- Swap the _last_ JavaScript import into the slot where `roc__main_for_host_1_exposed` was, updating all of its call sites in the host.
- Insert an internally-defined dummy function at the index where the last JavaScript import used to be.
The diagram below illustrates this process.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 262 KiB

Before After
Before After