@@ -69,9 +69,12 @@ pub struct ComponentDfg {
6969 /// Same as `reallocs`, but for post-return.
7070 pub post_returns : Intern < PostReturnId , CoreDef > ,
7171
72- /// Same as `reallocs`, but for post-return .
72+ /// Same as `reallocs`, but for memories .
7373 pub memories : Intern < MemoryId , CoreExport < MemoryIndex > > ,
7474
75+ /// Same as `reallocs`, but for tables.
76+ pub tables : Intern < TableId , CoreExport < TableIndex > > ,
77+
7578 /// Metadata about identified fused adapters.
7679 ///
7780 /// Note that this list is required to be populated in-order where the
@@ -483,6 +486,27 @@ pub enum Trampoline {
483486 instance : RuntimeComponentInstanceIndex ,
484487 slot : u32 ,
485488 } ,
489+ ThreadIndex ,
490+ ThreadNewIndirect {
491+ instance : RuntimeComponentInstanceIndex ,
492+ start_func_ty_idx : ComponentTypeIndex ,
493+ start_func_table_id : TableId ,
494+ } ,
495+ ThreadSwitchTo {
496+ instance : RuntimeComponentInstanceIndex ,
497+ cancellable : bool ,
498+ } ,
499+ ThreadSuspend {
500+ instance : RuntimeComponentInstanceIndex ,
501+ cancellable : bool ,
502+ } ,
503+ ThreadResumeLater {
504+ instance : RuntimeComponentInstanceIndex ,
505+ } ,
506+ ThreadYieldTo {
507+ instance : RuntimeComponentInstanceIndex ,
508+ cancellable : bool ,
509+ } ,
486510}
487511
488512#[ derive( Copy , Clone , Hash , Eq , PartialEq ) ]
@@ -833,6 +857,15 @@ impl LinearizeDfg<'_> {
833857 )
834858 }
835859
860+ fn runtime_table ( & mut self , table : TableId ) -> RuntimeTableIndex {
861+ self . intern (
862+ table,
863+ |me| & mut me. runtime_tables ,
864+ |me, table| me. core_export ( & me. dfg . tables [ table] ) ,
865+ |index, export| GlobalInitializer :: ExtractTable ( ExtractTable { index, export } ) ,
866+ )
867+ }
868+
836869 fn runtime_realloc ( & mut self , realloc : ReallocId ) -> RuntimeReallocIndex {
837870 self . intern (
838871 realloc,
@@ -1135,6 +1168,40 @@ impl LinearizeDfg<'_> {
11351168 instance : * instance,
11361169 slot : * slot,
11371170 } ,
1171+ Trampoline :: ThreadIndex => info:: Trampoline :: ThreadIndex ,
1172+ Trampoline :: ThreadNewIndirect {
1173+ instance,
1174+ start_func_ty_idx,
1175+ start_func_table_id,
1176+ } => info:: Trampoline :: ThreadNewIndirect {
1177+ instance : * instance,
1178+ start_func_ty_idx : * start_func_ty_idx,
1179+ start_func_table_idx : self . runtime_table ( * start_func_table_id) ,
1180+ } ,
1181+ Trampoline :: ThreadSwitchTo {
1182+ instance,
1183+ cancellable,
1184+ } => info:: Trampoline :: ThreadSwitchTo {
1185+ instance : * instance,
1186+ cancellable : * cancellable,
1187+ } ,
1188+ Trampoline :: ThreadSuspend {
1189+ instance,
1190+ cancellable,
1191+ } => info:: Trampoline :: ThreadSuspend {
1192+ instance : * instance,
1193+ cancellable : * cancellable,
1194+ } ,
1195+ Trampoline :: ThreadResumeLater { instance } => info:: Trampoline :: ThreadResumeLater {
1196+ instance : * instance,
1197+ } ,
1198+ Trampoline :: ThreadYieldTo {
1199+ instance,
1200+ cancellable,
1201+ } => info:: Trampoline :: ThreadYieldTo {
1202+ instance : * instance,
1203+ cancellable : * cancellable,
1204+ } ,
11381205 } ;
11391206 let i1 = self . trampolines . push ( * signature) ;
11401207 let i2 = self . trampoline_defs . push ( trampoline) ;
0 commit comments