-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle each kind of module field separately in preprocessor #5
Commits on Jun 11, 2023
-
Lift #read_list helper to the top of #process_field
This does mean we have to temporarily match against the entire S-expression instead of peeking at it, but that’ll go away once we start consuming it incrementally. For now the priority is to get #read_list lifted out of #process_field so that it’s operating entirely inside a list like all the other methods do.
Configuration menu - View commit details
-
Copy full SHA for 41a1d6c - Browse repository at this point
Copy the full SHA 41a1d6cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6ec6531 - Browse repository at this point
Copy the full SHA 6ec6531View commit details -
We were only wrapping `field` in a single-element array because it was being passed to the #read_list helper inside #process_field, but now the helper’s moved next to the array, the two cancel each other out.
Configuration menu - View commit details
-
Copy full SHA for c93f005 - Browse repository at this point
Copy the full SHA c93f005View commit details -
Configuration menu - View commit details
-
Copy full SHA for a9cea18 - Browse repository at this point
Copy the full SHA a9cea18View commit details -
Use #process_fields helper to recursively desugar inline export
Although this is slightly less efficient, it more directly resembles the specification of export abbreviations (e.g. [0]) and so should be easier to understand at a glance. [0] https://webassembly.github.io/spec/core/text/modules.html#text-global-abbrev
Configuration menu - View commit details
-
Copy full SHA for 0fb3f0d - Browse repository at this point
Copy the full SHA 0fb3f0dView commit details -
Use the same recursive desugaring technique in #expand_inline_module
Just as in #expand_inline_export, we can use #process_command to desugar the result of expanding the module abbreviation [0]. [0] https://webassembly.github.io/spec/core/text/modules.html#id10
Configuration menu - View commit details
-
Copy full SHA for 02c988e - Browse repository at this point
Copy the full SHA 02c988eView commit details -
Allow field-processing methods to return an array of fields
This makes it possible for each method to expand inline exports, which produce multiple fields. In practice it’s only #process_function that needs to do this, but I’ve made the same change to #process_type and #process_import to keep all of the field-processing methods consistent.
Configuration menu - View commit details
-
Copy full SHA for 9b15b3a - Browse repository at this point
Copy the full SHA 9b15b3aView commit details -
Add
_definition
suffix to #process_function and #process_typeThe spec calls these fields “function definitions” [0] and “type definitions” [1], so we should use the same terminology here. [0] https://webassembly.github.io/spec/core/text/modules.html#functions [1] https://webassembly.github.io/spec/core/text/modules.html#types
Configuration menu - View commit details
-
Copy full SHA for 37daf8f - Browse repository at this point
Copy the full SHA 37daf8fView commit details -
Expand inline imports & exports inside #process_function_definition
This removes the need to support inline imports & exports for functions in #process_field.
Configuration menu - View commit details
-
Copy full SHA for f07b595 - Browse repository at this point
Copy the full SHA f07b595View commit details -
Remove inline function import & export support from #process_field
It’s handled in #process_function_definition now.
Configuration menu - View commit details
-
Copy full SHA for af35a58 - Browse repository at this point
Copy the full SHA af35a58View commit details -
Add handler for inline imports & exports in table/memory/global defin…
…itions This removes the need to support inline imports & exports for any kind of field in #process_field.
Configuration menu - View commit details
-
Copy full SHA for c78852a - Browse repository at this point
Copy the full SHA c78852aView commit details -
Remove inline import & export support from #process_field
It’s entirely handled in field-specific methods now.
Configuration menu - View commit details
-
Copy full SHA for 93ea808 - Browse repository at this point
Copy the full SHA 93ea808View commit details -
Move inline import & export methods further down the file
They’re called by both #process_function_definition and #process_table_memory_global_definition, and the code is easier to read if callers come before callees.
Configuration menu - View commit details
-
Copy full SHA for 52fd493 - Browse repository at this point
Copy the full SHA 52fd493View commit details -
Lift field kind #read out of #expand_inline_import & #expand_inline_e…
…xport We really want to get the optional ID out of the way, but we have to read the field kind first.
Configuration menu - View commit details
-
Copy full SHA for 5d5082f - Browse repository at this point
Copy the full SHA 5d5082fView commit details -
Lift field kind #read to the top of #process_function_definition & #p…
…rocess_table_memory_global_definition
Configuration menu - View commit details
-
Copy full SHA for 80d5218 - Browse repository at this point
Copy the full SHA 80d5218View commit details -
Extract helpers for handling inline imports & exports together
We need to do the same work to handle inline imports & exports for function and table/memory/global definitions, so it’s convenient to move the duplicated code into helpers.
Configuration menu - View commit details
-
Copy full SHA for d818769 - Browse repository at this point
Copy the full SHA d818769View commit details -
Decouple ID #read from the rest of #expand_inline_export
We’d like to lift the #read out of this method, so we can’t use it directly in a conditional. Fortunately we can check its side-effect (of assigning to `id`) instead.
Configuration menu - View commit details
-
Copy full SHA for 9b9d070 - Browse repository at this point
Copy the full SHA 9b9d070View commit details -
Reorganise #expand_inline_export to look more like #expand_inline_import
Rather than doing the reads inline when they’re needed, we read everything together first and then build the result. The increased similarity to #expand_inline_import makes the methods easier to compare at a glance.
Configuration menu - View commit details
-
Copy full SHA for 0621dd7 - Browse repository at this point
Copy the full SHA 0621dd7View commit details -
Configuration menu - View commit details
-
Copy full SHA for bed6db7 - Browse repository at this point
Copy the full SHA bed6db7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7d457fb - Browse repository at this point
Copy the full SHA 7d457fbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 810a53b - Browse repository at this point
Copy the full SHA 810a53bView commit details -
Lift ID #read to the top of #process_function_definition & #process_t…
…able_memory_global_definition
Configuration menu - View commit details
-
Copy full SHA for 3355307 - Browse repository at this point
Copy the full SHA 3355307View commit details -
Detect inline imports & exports by peeking
We now only need to look at the next thing we’ll read, not the entire S-expression.
Configuration menu - View commit details
-
Copy full SHA for baca242 - Browse repository at this point
Copy the full SHA baca242View commit details -
Split #process_table_memory_global_definition into per-field methods
Table, memory and global definitions support different abbreviations, so each will need its own slightly different method.
Configuration menu - View commit details
-
Copy full SHA for 3e961a6 - Browse repository at this point
Copy the full SHA 3e961a6View commit details