From b61e16917617ba57a2bf89b196005863fc4b42fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hillerstr=C3=B6m?= Date: Mon, 5 Aug 2024 11:47:54 +0200 Subject: [PATCH] Resume table syntax --- c10m/wasmfx_import.wast | 2 +- make.config | 3 ++- micro/2resumes_same_function/bench.wat | 4 ++-- micro/suspend_resume/bench.wat | 2 +- sieve/wasmfx_import.wast | 4 ++-- skynet/wasmfx_import.wast | 2 +- state/wasmfx_import.wast | 8 ++++---- vendor/fiber-c | 2 +- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/c10m/wasmfx_import.wast b/c10m/wasmfx_import.wast index bd2d381..1d7a86d 100644 --- a/c10m/wasmfx_import.wast +++ b/c10m/wasmfx_import.wast @@ -40,7 +40,7 @@ (local $k (ref null $cawt)) (block $on_return (result i32) (block $on_yield (result i32 (ref $cawt)) - (resume $cawt (tag $yield $on_yield) (local.get $value) (table.get $conts (local.get $key))) + (resume $cawt (on $yield $on_yield) (local.get $value) (table.get $conts (local.get $key))) (br $on_return) ) ;; on_yield [ i32 (ref $cawt) ] (local.set $k) diff --git a/make.config b/make.config index 992a7d1..f037497 100644 --- a/make.config +++ b/make.config @@ -1,5 +1,6 @@ # Default stack size -ASYNCIFY_DEFAULT_STACK_SIZE?=2097152 +DEFAULT_STACK_SIZE?=2097152 +ASYNCIFY_DEFAULT_STACK_SIZE?=$(DEFAULT_STACK_SIZE) WASMFX_CONT_TABLE_INITIAL_CAPACITY?=1024 # Mimalloc (drop-in replacement for malloc) diff --git a/micro/2resumes_same_function/bench.wat b/micro/2resumes_same_function/bench.wat index 34a297e..21b3237 100644 --- a/micro/2resumes_same_function/bench.wat +++ b/micro/2resumes_same_function/bench.wat @@ -23,10 +23,10 @@ (cont.new $ct (ref.func $suspend0)) (loop $loop (param (ref $ct)) (block $inner (param (ref $ct)) (result (ref $ct)) - (resume $ct (tag $t $inner)) + (resume $ct (on $t $inner)) (return) ) - (resume $ct (tag $t $loop)) + (resume $ct (on $t $loop)) (return) ) ) diff --git a/micro/suspend_resume/bench.wat b/micro/suspend_resume/bench.wat index 336f037..607c96f 100644 --- a/micro/suspend_resume/bench.wat +++ b/micro/suspend_resume/bench.wat @@ -23,7 +23,7 @@ (cont.new $cp0r0 (ref.func $suspend0)) (loop $loop (param (ref $cp0r0)) - (resume $cp0r0 (tag $tr0s0 $loop)) + (resume $cp0r0 (on $tr0s0 $loop)) (return) ) diff --git a/sieve/wasmfx_import.wast b/sieve/wasmfx_import.wast index 7ee98f2..aa751c5 100644 --- a/sieve/wasmfx_import.wast +++ b/sieve/wasmfx_import.wast @@ -42,7 +42,7 @@ (local $fiber (ref $cfilter)) (local.set $fiber (cont.new $cfilter (ref.func $filter))) (block $on_init (result (ref $cfilter)) - (resume $cfilter (tag $init $on_init) + (resume $cfilter (on $init $on_init) (local.get $prime) (local.get $fiber)) (unreachable) @@ -64,7 +64,7 @@ (func $filter_send (export "filter_send") (param $fiber_idx i32) (param $candidate i32) (result i32) (local $next_k (ref $cfilter)) (block $on_yield (result i32 (ref $cfilter)) - (resume $cfilter (tag $yield $on_yield) + (resume $cfilter (on $yield $on_yield) (local.get $candidate) (table.get $conts (local.get $fiber_idx))) (unreachable) diff --git a/skynet/wasmfx_import.wast b/skynet/wasmfx_import.wast index cac6e8d..4f5f5bc 100644 --- a/skynet/wasmfx_import.wast +++ b/skynet/wasmfx_import.wast @@ -19,7 +19,7 @@ (param $num i64) (result i64) (block $on_yield (result i64 (ref $cyield)) - (resume $ct (tag $yield $on_yield) + (resume $ct (on $yield $on_yield) (local.get $level) (local.get $num) (cont.new $ct (ref.func $skynet))) diff --git a/state/wasmfx_import.wast b/state/wasmfx_import.wast index 99594ce..fb6fac6 100644 --- a/state/wasmfx_import.wast +++ b/state/wasmfx_import.wast @@ -29,7 +29,7 @@ (block $on_done (result i32) (block $on_put (result i32 (ref $cput)) (block $on_get (result (ref $cget)) - (resume $kt (tag $get $on_get) (tag $put $on_put) (local.get $k)) + (resume $kt (on $get $on_get) (on $put $on_put) (local.get $k)) (br $on_done) ) ;; on_get [ (ref $cget) ] (local.set $kget) @@ -53,7 +53,7 @@ (block $continue (block $on_put1 (result i32 (ref $cput)) (block $on_get1 (result (ref $cget)) - (resume $cinit (tag $get $on_get1) (tag $put $on_put1) + (resume $cinit (on $get $on_get1) (on $put $on_put1) (local.get $limit) (cont.new $cinit (ref.func $count))) (br $on_done) @@ -75,11 +75,11 @@ ;; must have been `put`. (br_on_null $handle_put (local.get $kget)) ) ;; $handle_get - (resume $cget (tag $get $on_get) (tag $put $on_put) + (resume $cget (on $get $on_get) (on $put $on_put) (local.get $state) (local.get $kget)) (br $on_done) ) ;; $handle_put - (resume $cput (tag $get $on_get) (tag $put $on_put) + (resume $cput (on $get $on_get) (on $put $on_put) (local.get $kput)) (br $on_done) ) ;; $on_get [ (ref $cget) ] diff --git a/vendor/fiber-c b/vendor/fiber-c index 0e296f5..cce6dd1 160000 --- a/vendor/fiber-c +++ b/vendor/fiber-c @@ -1 +1 @@ -Subproject commit 0e296f57f702cf64a2b90665e172b7d0736576ea +Subproject commit cce6dd1a578e6bde52ba872a3266b15d2356b063