@@ -2316,36 +2316,38 @@ impl<'a> Instantiator<'a, '_> {
23162316 uwriteln ! ( self . src. js, "const trampoline{i} = {resource_transfer};" ) ;
23172317 }
23182318
2319- Trampoline :: ResourceEnterCall => {
2320- let scope_id = self . bindgen . intrinsic ( Intrinsic :: ScopeId ) ;
2321- uwrite ! ( self . src. js, "function trampoline{i}() {{ {scope_id}++; }}" ) ;
2322- }
2323-
2324- Trampoline :: ResourceExitCall => {
2325- let scope_id = self . bindgen . intrinsic ( Intrinsic :: ScopeId ) ;
2326- let resource_borrows = self
2327- . bindgen
2328- . intrinsic ( Intrinsic :: Resource ( ResourceIntrinsic :: ResourceCallBorrows ) ) ;
2329- let handle_tables = self . bindgen . intrinsic ( Intrinsic :: HandleTables ) ;
2330- // To verify that borrows are dropped, it is enough to verify that the handle
2331- // either no longer exists (part of free list) or belongs to another scope, since
2332- // the enter call closed off the ability to create new handles in the parent scope
2333- uwrite ! (
2334- self . src. js,
2335- r#"function trampoline{i}() {{
2336- {scope_id}--;
2337- for (const {{ rid, handle }} of {resource_borrows}) {{
2338- const storedScopeId = {handle_tables}[rid][handle << 1]
2339- if (storedScopeId === {scope_id}) {{
2340- throw new TypeError('borrows not dropped for resource call');
2341- }}
2342- }}
2343- {resource_borrows} = [];
2344- }}
2345- "# ,
2346- ) ;
2347- }
2348-
2319+ // TODO: we need to do this? does this mean we need to start keeping track of when we
2320+ // enter a call on a resource explicitly?
2321+
2322+ // Trampoline::ResourceEnterCall => {
2323+ // let scope_id = self.bindgen.intrinsic(Intrinsic::ScopeId);
2324+ // uwrite!(self.src.js, "function trampoline{i}() {{ {scope_id}++; }}");
2325+ // }
2326+
2327+ // Trampoline::ResourceExitCall => {
2328+ // let scope_id = self.bindgen.intrinsic(Intrinsic::ScopeId);
2329+ // let resource_borrows = self
2330+ // .bindgen
2331+ // .intrinsic(Intrinsic::Resource(ResourceIntrinsic::ResourceCallBorrows));
2332+ // let handle_tables = self.bindgen.intrinsic(Intrinsic::HandleTables);
2333+ // // To verify that borrows are dropped, it is enough to verify that the handle
2334+ // // either no longer exists (part of free list) or belongs to another scope, since
2335+ // // the enter call closed off the ability to create new handles in the parent scope
2336+ // uwrite!(
2337+ // self.src.js,
2338+ // r#"function trampoline{i}() {{
2339+ // {scope_id}--;
2340+ // for (const {{ rid, handle }} of {resource_borrows}) {{
2341+ // const storedScopeId = {handle_tables}[rid][handle << 1]
2342+ // if (storedScopeId === {scope_id}) {{
2343+ // throw new TypeError('borrows not dropped for resource call');
2344+ // }}
2345+ // }}
2346+ // {resource_borrows} = [];
2347+ // }}
2348+ // "#,
2349+ // );
2350+ // }
23492351 Trampoline :: ContextSet { instance, slot, .. } => {
23502352 let context_set_fn = self
23512353 . bindgen
@@ -2532,10 +2534,15 @@ impl<'a> Instantiator<'a, '_> {
25322534 }
25332535 Trampoline :: ThreadIndex => todo ! ( "Trampoline::ThreadIndex" ) ,
25342536 Trampoline :: ThreadNewIndirect { .. } => todo ! ( "Trampoline::ThreadNewIndirect" ) ,
2535- Trampoline :: ThreadSwitchTo { .. } => todo ! ( "Trampoline::ThreadSwitchTo" ) ,
25362537 Trampoline :: ThreadSuspend { .. } => todo ! ( "Trampoline::ThreadSuspend" ) ,
2537- Trampoline :: ThreadResumeLater { .. } => todo ! ( "Trampoline::ThreadResumeLater" ) ,
2538- Trampoline :: ThreadYieldTo { .. } => todo ! ( "Trampoline::ThreadYieldTo" ) ,
2538+ Trampoline :: ThreadSuspendTo { .. } => todo ! ( "Trampoline::ThreadSuspendTo" ) ,
2539+ Trampoline :: ThreadUnsuspend { .. } => todo ! ( "Trampoline::ThreadUnsuspend" ) ,
2540+ Trampoline :: ThreadYieldToSuspended { .. } => {
2541+ todo ! ( "Trampoline::ThreadYieldToSuspended" )
2542+ }
2543+ Trampoline :: ThreadSuspendToSuspended { .. } => {
2544+ todo ! ( "Trampoline::ThreadYieldToSuspended" )
2545+ }
25392546
25402547 Trampoline :: Trap => {
25412548 uwriteln ! (
@@ -3947,11 +3954,12 @@ impl<'a> Instantiator<'a, '_> {
39473954 . iter ( )
39483955 . find_map ( |( name, i) | if * i == idx { Some ( name) } else { None } )
39493956 . unwrap ( )
3957+ . to_string ( )
39503958 }
3951- ExportItem :: Name ( s) => s,
3959+ ExportItem :: Name ( s) => s. to_string ( ) ,
39523960 } ;
39533961 let i = export. instance . as_u32 ( ) as usize ;
3954- let quoted = maybe_quote_member ( name) ;
3962+ let quoted = maybe_quote_member ( & name) ;
39553963 format ! ( "exports{i}{quoted}" )
39563964 }
39573965
0 commit comments