@@ -141,6 +141,10 @@ pub struct Component {
141
141
/// stored in two different locations).
142
142
pub num_runtime_memories : u32 ,
143
143
144
+ /// The number of runtime tables (maximum `RuntimeTableIndex`) needed to
145
+ /// instantiate this component. See notes on `num_runtime_memories`.
146
+ pub num_runtime_tables : u32 ,
147
+
144
148
/// The number of runtime reallocs (maximum `RuntimeReallocIndex`) needed to
145
149
/// instantiate this component.
146
150
///
@@ -215,10 +219,11 @@ impl Component {
215
219
}
216
220
}
217
221
218
- /// GlobalInitializer instructions to get processed when instantiating a component
222
+ /// GlobalInitializer instructions to get processed when instantiating a
223
+ /// component.
219
224
///
220
- /// The variants of this enum are processed during the instantiation phase of
221
- /// a component in-order from front-to-back. These are otherwise emitted as a
225
+ /// The variants of this enum are processed during the instantiation phase of a
226
+ /// component in-order from front-to-back. These are otherwise emitted as a
222
227
/// component is parsed and read and translated.
223
228
//
224
229
// FIXME(#2639) if processing this list is ever a bottleneck we could
@@ -257,11 +262,10 @@ pub enum GlobalInitializer {
257
262
/// A core wasm linear memory is going to be saved into the
258
263
/// `VMComponentContext`.
259
264
///
260
- /// This instruction indicates that the `index`th core wasm linear memory
261
- /// needs to be extracted from the `export` specified, a pointer to a
262
- /// previously created module instance, and stored into the
263
- /// `VMComponentContext` at the `index` specified. This lowering is then
264
- /// used in the future by pointers from `CanonicalOptions`.
265
+ /// This instruction indicates that a core wasm linear memory needs to be
266
+ /// extracted from the `export` and stored into the `VMComponentContext` at
267
+ /// the `index` specified. This lowering is then used in the future by
268
+ /// pointers from `CanonicalOptions`.
265
269
ExtractMemory ( ExtractMemory ) ,
266
270
267
271
/// Same as `ExtractMemory`, except it's extracting a function pointer to be
@@ -276,14 +280,24 @@ pub enum GlobalInitializer {
276
280
/// used as a `post-return` function.
277
281
ExtractPostReturn ( ExtractPostReturn ) ,
278
282
283
+ /// A core wasm table is going to be saved into the `VMComponentContext`.
284
+ ///
285
+ /// This instruction indicates that s core wasm table needs to be extracted
286
+ /// from its `export` and stored into the `VMComponentContext` at the
287
+ /// `index` specified. During this extraction, we will also capture the
288
+ /// table's containing instance pointer to access the table at runtime. This
289
+ /// extraction is useful for `thread.spawn_indirect`.
290
+ ExtractTable ( ExtractTable ) ,
291
+
279
292
/// Declares a new defined resource within this component.
280
293
///
281
294
/// Contains information about the destructor, for example.
282
295
Resource ( Resource ) ,
283
296
}
284
297
285
- /// Metadata for extraction of a memory of what's being extracted and where it's
286
- /// going.
298
+ /// Metadata for extraction of a memory; contains what's being extracted (the
299
+ /// memory at `export`) and where it's going (the `index` within a
300
+ /// `VMComponentContext`).
287
301
#[ derive( Debug , Serialize , Deserialize ) ]
288
302
pub struct ExtractMemory {
289
303
/// The index of the memory being defined.
@@ -319,6 +333,15 @@ pub struct ExtractPostReturn {
319
333
pub def : CoreDef ,
320
334
}
321
335
336
+ /// Metadata for extraction of a table.
337
+ #[ derive( Debug , Serialize , Deserialize ) ]
338
+ pub struct ExtractTable {
339
+ /// The index of the table being defined in a `VMComponentContext`.
340
+ pub index : RuntimeTableIndex ,
341
+ /// Where this table is being extracted from.
342
+ pub export : CoreExport < TableIndex > ,
343
+ }
344
+
322
345
/// Different methods of instantiating a core wasm module.
323
346
#[ derive( Debug , Serialize , Deserialize ) ]
324
347
pub enum InstantiateModule {
0 commit comments