|
50 | 50 | (import "" "task.return" (func $task.return (param i32))) |
51 | 51 | (import "" "subtask.cancel" (func $subtask.cancel (param i32) (result i32))) |
52 | 52 | (import "" "thread.yield" (func $thread.yield (result i32))) |
53 | | - ;;(import "" "thread.yield-to" (func $thread.yield-to (param i32) (result i32))) |
54 | | - ;;(import "" "thread.switch-to" (func $thread.switch-to (param i32) (result i32))) |
55 | | - ;;(import "" "thread.resume-later" (func $thread.resume-later (param i32))) |
| 53 | + (import "" "thread.yield-then-resume" (func $thread.yield-then-resume (param i32) (result i32))) |
| 54 | + (import "" "thread.suspend-then-resume" (func $thread.suspend-then-resume (param i32) (result i32))) |
| 55 | + (import "" "thread.resume-later" (func $thread.resume-later (param i32))) |
56 | 56 | (import "" "thread.index" (func $thread-index (result i32))) |
57 | 57 | (import "" "thread.suspend" (func $thread.suspend (result i32))) |
58 | 58 | (import "" "thread.new-indirect" (func $thread.new-indirect (param i32 i32) (result i32))) |
|
126 | 126 | ) |
127 | 127 | (func $thread-start-noop (param i32)) |
128 | 128 | (elem (table $indirect-function-table) (i32.const 0) func $thread-start-noop) |
129 | | - (func (export "yield-to-is-fine") (result i32) |
130 | | - ;; TODO: rename and reenable |
131 | | - ;;(drop (call $thread.yield-to (call $thread.new-indirect (i32.const 0) (i32.const 0)))) |
| 129 | + (func (export "yield-then-resume-is-fine") (result i32) |
| 130 | + (drop (call $thread.yield-then-resume (call $thread.new-indirect (i32.const 0) (i32.const 0)))) |
132 | 131 | (i32.const 42) |
133 | 132 | ) |
134 | | - (func $thread-start-switch-back (param i32) |
135 | | - ;;(drop (call $thread.switch-to (local.get 0))) |
| 133 | + (func $thread-start-resume-back (param i32) |
| 134 | + (drop (call $thread.suspend-then-resume (local.get 0))) |
136 | 135 | ) |
137 | | - (elem (table $indirect-function-table) (i32.const 1) func $thread-start-switch-back) |
138 | | - (func (export "switch-to-is-fine") (result i32) |
139 | | - ;; TODO: rename and reenable |
140 | | - ;;(drop (call $thread.switch-to (call $thread.new-indirect (i32.const 1) (call $thread-index)))) |
| 136 | + (elem (table $indirect-function-table) (i32.const 1) func $thread-start-resume-back) |
| 137 | + (func (export "suspend-then-resume-is-fine") (result i32) |
| 138 | + (drop (call $thread.suspend-then-resume (call $thread.new-indirect (i32.const 1) (call $thread-index)))) |
141 | 139 | (i32.const 42) |
142 | 140 | ) |
143 | 141 | (func (export "resume-later-is-fine") (result i32) |
144 | | - ;; TODO: rename and reenable |
145 | | - ;;(call $thread.resume-later (call $thread.new-indirect (i32.const 0) (i32.const 0))) |
| 142 | + (call $thread.resume-later (call $thread.new-indirect (i32.const 0) (i32.const 0))) |
146 | 143 | (i32.const 42) |
147 | 144 | ) |
148 | 145 | (func (export "trap-if-sync-cancel") |
|
192 | 189 | (canon subtask.cancel (core func $subtask.cancel)) |
193 | 190 | (canon thread.yield (core func $thread.yield)) |
194 | 191 | (canon thread.suspend (core func $thread.suspend)) |
195 | | - ;;(canon thread.yield-to (core func $thread.yield-to)) |
196 | | - ;;(canon thread.switch-to (core func $thread.switch-to)) |
197 | | - ;;(canon thread.resume-later (core func $thread.resume-later)) |
| 192 | + (canon thread.yield-then-resume (core func $thread.yield-then-resume)) |
| 193 | + (canon thread.suspend-then-resume (core func $thread.suspend-then-resume)) |
| 194 | + (canon thread.resume-later (core func $thread.resume-later)) |
198 | 195 | (canon thread.index (core func $thread.index)) |
199 | 196 | (canon waitable.join (core func $waitable.join)) |
200 | 197 | (canon waitable-set.new (core func $waitable-set.new)) |
|
217 | 214 | (export "subtask.cancel" (func $subtask.cancel)) |
218 | 215 | (export "thread.yield" (func $thread.yield)) |
219 | 216 | (export "thread.suspend" (func $thread.suspend)) |
220 | | - ;;(export "thread.yield-to" (func $thread.yield-to)) |
221 | | - ;;(export "thread.switch-to" (func $thread.switch-to)) |
222 | | - ;;(export "thread.resume-later" (func $thread.resume-later)) |
| 217 | + (export "thread.yield-then-resume" (func $thread.yield-then-resume)) |
| 218 | + (export "thread.suspend-then-resume" (func $thread.suspend-then-resume)) |
| 219 | + (export "thread.resume-later" (func $thread.resume-later)) |
223 | 220 | (export "thread.index" (func $thread.index)) |
224 | 221 | (export "thread.new-indirect" (func $thread.new-indirect)) |
225 | 222 | (export "waitable.join" (func $waitable.join)) |
|
245 | 242 | (func (export "trap-if-invalid-callback-code") async (param "invalid-code" u32) (canon lift (core func $core "trap-if-invalid-callback-code") async (callback (core func $core "unreachable-cb")))) |
246 | 243 | (func (export "yield-is-fine") (result u32) (canon lift (core func $core "yield-is-fine"))) |
247 | 244 | (func (export "yield-is-fine-cb") async (result u32) (canon lift (core func $core "yield-is-fine-cb") async (callback (core func $core "return-42-cb")))) |
248 | | - (func (export "yield-to-is-fine") (result u32) (canon lift (core func $core "yield-to-is-fine"))) |
249 | | - (func (export "switch-to-is-fine") (result u32) (canon lift (core func $core "switch-to-is-fine"))) |
| 245 | + (func (export "yield-then-resume-is-fine") (result u32) (canon lift (core func $core "yield-then-resume-is-fine"))) |
| 246 | + (func (export "suspend-then-resume-is-fine") (result u32) (canon lift (core func $core "suspend-then-resume-is-fine"))) |
250 | 247 | (func (export "resume-later-is-fine") (result u32) (canon lift (core func $core "resume-later-is-fine"))) |
251 | 248 | (func (export "trap-if-sync-call-async1") (canon lift (core func $core "trap-if-sync-call-async1"))) |
252 | 249 | (func (export "trap-if-sync-call-async2") (canon lift (core func $core "trap-if-sync-call-async2"))) |
|
272 | 269 | (func (export "trap-if-invalid-callback-code") (alias export $d "trap-if-invalid-callback-code")) |
273 | 270 | (func (export "yield-is-fine") (alias export $d "yield-is-fine")) |
274 | 271 | (func (export "yield-is-fine-cb") (alias export $d "yield-is-fine-cb")) |
275 | | - (func (export "yield-to-is-fine") (alias export $d "yield-to-is-fine")) |
276 | | - (func (export "switch-to-is-fine") (alias export $d "switch-to-is-fine")) |
| 272 | + (func (export "yield-then-resume-is-fine") (alias export $d "yield-then-resume-is-fine")) |
| 273 | + (func (export "suspend-then-resume-is-fine") (alias export $d "suspend-then-resume-is-fine")) |
277 | 274 | (func (export "resume-later-is-fine") (alias export $d "resume-later-is-fine")) |
278 | 275 | (func (export "trap-if-sync-cancel") (alias export $d "trap-if-sync-cancel")) |
279 | 276 | (func (export "trap-if-sync-stream-read") (alias export $d "trap-if-sync-stream-read")) |
|
309 | 306 | (component instance $i $Tester) |
310 | 307 | (assert_return (invoke "yield-is-fine-cb") (u32.const 42)) |
311 | 308 | (component instance $i $Tester) |
312 | | -(assert_return (invoke "yield-to-is-fine") (u32.const 42)) |
| 309 | +(assert_return (invoke "yield-then-resume-is-fine") (u32.const 42)) |
313 | 310 | (component instance $i $Tester) |
314 | | -(assert_return (invoke "switch-to-is-fine") (u32.const 42)) |
| 311 | +(assert_return (invoke "suspend-then-resume-is-fine") (u32.const 42)) |
315 | 312 | (component instance $i $Tester) |
316 | 313 | (assert_return (invoke "resume-later-is-fine") (u32.const 42)) |
317 | 314 | (component instance $i $Tester) |
|
0 commit comments