Skip to content

Commit 24ce8c2

Browse files
authored
[wasm-split] Reorder comments (#7951)
This reorders the numbered list in the beginning of the file that describes the process so that the order matches the actual process. Also removes a few outdated lines of comments and an unnecessarily include.
1 parent f12f084 commit 24ce8c2

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

src/ir/module-splitting.cpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
//
1919
// 1. Create the new secondary module.
2020
//
21-
// 2. Export globals, tags, tables, and memories from the primary module and
22-
// import them in the secondary module.
23-
//
24-
// 3. Move the deferred functions from the primary to the secondary module.
21+
// 2. Move the deferred functions from the primary to the secondary module.
2522
//
26-
// 4. For any secondary function exported from the primary module, export in
23+
// 3. For any secondary function exported from the primary module, export in
2724
// its place a trampoline function that makes an indirect call to its
2825
// placeholder function (and eventually to the original secondary
2926
// function), allocating a new table slot for the placeholder if necessary.
3027
//
28+
// 4. Replace all references to secondary functions in the primary module's
29+
// table segments with references to imported placeholder functions.
30+
//
3131
// 5. Rewrite direct calls from primary functions to secondary functions to be
3232
// indirect calls to their placeholder functions (and eventually to their
3333
// original secondary functions), allocating new table slots for the
@@ -37,22 +37,22 @@
3737
// export the primary function if it is not already exported and import it
3838
// into the secondary module.
3939
//
40-
// 7. Replace all references to secondary functions in the primary module's
41-
// table segments with references to imported placeholder functions.
42-
//
43-
// 8. Create new active table segments in the secondary module that will
40+
// 7. Create new active table segments in the secondary module that will
4441
// replace all the placeholder function references in the table with
4542
// references to their corresponding secondary functions upon
4643
// instantiation.
4744
//
45+
// 8. Export globals, tags, tables, and memories from the primary module and
46+
// import them in the secondary module.
47+
//
48+
// 9. Run RemoveUnusedModuleElements pass on the secondary module in order to
49+
// remove unused imports.
50+
//
4851
// Functions can be used or referenced three ways in a WebAssembly module: they
49-
// can be exported, called, or placed in a table. The above procedure introduces
50-
// a layer of indirection to each of those mechanisms that removes all
51-
// references to secondary functions from the primary module but restores the
52-
// original program's semantics once the secondary module is instantiated. As
53-
// more mechanisms that reference functions are added in the future, such as
54-
// ref.func instructions, they will have to be modified to use a similar layer
55-
// of indirection.
52+
// can be exported, called, or referenced with ref.func. The above procedure
53+
// introduces a layer of indirection to each of those mechanisms that removes
54+
// all references to secondary functions from the primary module but restores
55+
// the original program's semantics once the secondary module is instantiated.
5656
//
5757
// The code as currently written makes a couple assumptions about the module
5858
// that is being split:
@@ -64,13 +64,11 @@
6464
//
6565
// 2. It assumes that either all table segment offsets are constants or there
6666
// is exactly one segment that may have a non-constant offset. It also
67-
// assumes that all segments are active segments (although Binaryen does
68-
// not yet support passive table segments anyway).
67+
// assumes that all segments are active segments.
6968

7069
#include "ir/module-splitting.h"
7170
#include "asmjs/shared-constants.h"
7271
#include "ir/export-utils.h"
73-
#include "ir/manipulation.h"
7472
#include "ir/module-utils.h"
7573
#include "ir/names.h"
7674
#include "pass.h"

0 commit comments

Comments
 (0)