File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3466,10 +3466,16 @@ impl ComponentEncoder {
34663466 Ok ( self )
34673467 }
34683468
3469- /// True if the realloc and stack allocation should use memory.grow
3470- /// The default is to use the main module realloc
3471- /// Can be useful if cabi_realloc cannot be called before the host
3469+ /// Whether adapters use `memory.grow` for realloc and stack allocation.
3470+ ///
3471+ /// By default an adapter imports `cabi_realloc` from the main module.
3472+ /// Setting this to `true` makes it allocate with `memory.grow` instead,
3473+ /// which can be useful if `cabi_realloc` cannot be called before the host
34723474 /// runtime is initialized.
3475+ ///
3476+ /// This only affects modules added with [`ComponentEncoder::adapter`]. It
3477+ /// has no effect on the main module and does not synthesize a
3478+ /// `cabi_realloc` for a module that doesn't export one.
34733479 pub fn realloc_via_memory_grow ( & mut self , value : bool ) -> & mut Self {
34743480 self . realloc_via_memory_grow = value;
34753481 self
Original file line number Diff line number Diff line change @@ -192,7 +192,15 @@ struct ComponentEncoderOpts {
192192 ) ]
193193 validate : Option < Option < bool > > ,
194194
195- /// Use memory.grow to realloc memory and stack allocation.
195+ /// Use memory.grow to realloc memory and stack allocation in adapters.
196+ ///
197+ /// This only affects adapter modules passed with `--adapt`. It makes an
198+ /// adapter allocate with `memory.grow` instead of importing `cabi_realloc`
199+ /// from the main module, which is the default. It does not synthesize a
200+ /// `cabi_realloc` for a main module that doesn't export one.
201+ ///
202+ /// This can be useful if `cabi_realloc` cannot be called before the host
203+ /// runtime is initialized.
196204 #[ clap( long) ]
197205 realloc_via_memory_grow : bool ,
198206
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ Options:
2727 Whether or not to validate the output component [possible values:
2828 true, false]
2929 --realloc-via-memory-grow
30- Use memory.grow to realloc memory and stack allocation
30+ Use memory.grow to realloc memory and stack allocation in adapters
3131 --merge-imports-based-on-semver[=<true|false>]
3232 Indicates whether imports into the final component are merged based on
3333 semver ranges [possible values: true, false]
Original file line number Diff line number Diff line change @@ -84,7 +84,15 @@ Options:
8484 [possible values: true, false]
8585
8686 --realloc-via-memory-grow
87- Use memory.grow to realloc memory and stack allocation
87+ Use memory.grow to realloc memory and stack allocation in adapters.
88+
89+ This only affects adapter modules passed with `--adapt`. It makes an
90+ adapter allocate with `memory.grow` instead of importing
91+ `cabi_realloc` from the main module, which is the default. It does not
92+ synthesize a `cabi_realloc` for a main module that doesn't export one.
93+
94+ This can be useful if `cabi_realloc` cannot be called before the host
95+ runtime is initialized.
8896
8997 --merge-imports-based-on-semver[=<true|false>]
9098 Indicates whether imports into the final component are merged based on
You can’t perform that action at this time.
0 commit comments