Skip to content

Commit

Permalink
Merge pull request #94 from WebAssembly/fix-alias-sugar-examples
Browse files Browse the repository at this point in the history
Fix inline aliases used in 'memory' examples
  • Loading branch information
lukewagner committed Aug 17, 2022
2 parents 4d6e519 + 4a09867 commit 7ea933a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions design/mvp/Explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ takes a string, does some logging, then returns a string.
))
(func $run (param string) (result string) (canon lift
(core func $main "run")
(memory $libc "mem") (realloc (func $libc "realloc"))
(memory (core memory $libc "mem")) (realloc (func $libc "realloc"))
))
(export "run" (func $run))
)
Expand Down Expand Up @@ -794,7 +794,7 @@ exported string at instantiation time:
(core instance $main (instantiate $Main (with "libc" (instance $libc))))
(func $start (param string) (result string) (canon lift
(core func $main "start")
(memory $libc "mem") (realloc (func $libc "realloc"))
(memory (core memory $libc "mem")) (realloc (func $libc "realloc"))
))
(start $start (value $name) (result (value $greeting)))
(export "greeting" (value $greeting))
Expand Down
72 changes: 36 additions & 36 deletions design/mvp/examples/SharedEverythingDynamicLinking.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,17 @@ would look like:
```wasm
;; zipper.wat
(component
(import "libc" (module $Libc
(import "libc" (core module $Libc
(export "memory" (memory 1))
(export "malloc" (func (param i32) (result i32)))
))
(import "libzip" (module $Libzip
(import "libzip" (core module $Libzip
(import "libc" "memory" (memory 1))
(import "libc" "malloc" (func (param i32) (result i32)))
(export "zip" (func (param i32 i32 i32) (result i32)))
))
(module $Main
(core module $Main
(import "libc" "memory" (memory 1))
(import "libc" "malloc" (func (param i32) (result i32)))
(import "libzip" "zip" (func (param i32 i32 i32) (result i32)))
Expand All @@ -149,17 +149,17 @@ would look like:
)
)
(instance $libc (instantiate (module $Libc)))
(instance $libzip (instantiate (module $Libzip))
(core instance $libc (instantiate (module $Libc)))
(core instance $libzip (instantiate (module $Libzip))
(with "libc" (instance $libc))
))
(instance $main (instantiate (module $Main)
(core instance $main (instantiate (module $Main)
(with "libc" (instance $libc))
(with "libzip" (instance $libzip))
))
(func $zip (param (list u8)) (result (list u8)) (canon lift
(func $main "zip")
(memory $libc "memory") (realloc (func $libc "realloc"))
(core func $main "zip")
(memory (core memory $libc "memory")) (realloc (func $libc "realloc"))
))
(export "zip" (func $zip))
)
Expand Down Expand Up @@ -210,11 +210,11 @@ component-aware `clang`, the resulting component would look like:
```wasm
;; imgmgk.wat
(component $Imgmgk
(import "libc" (module $Libc ...))
(import "libzip" (module $Libzip ...))
(import "libimg" (module $Libimg ...))
(import "libc" (core module $Libc ...))
(import "libzip" (core module $Libzip ...))
(import "libimg" (core module $Libimg ...))
(module $Main
(core module $Main
(import "libc" "memory" (memory 1))
(import "libc" "malloc" (func (param i32) (result i32)))
(import "libimg" "compress" (func (param i32 i32 i32) (result i32)))
Expand All @@ -224,21 +224,21 @@ component-aware `clang`, the resulting component would look like:
)
)
(instance $libc (instantiate (module $Libc)))
(instance $libzip (instantiate (module $Libzip)
(core instance $libc (instantiate (module $Libc)))
(core instance $libzip (instantiate (module $Libzip)
(with "libc" (instance $libc))
))
(instance $libimg (instantiate (module $Libimg)
(core instance $libimg (instantiate (module $Libimg)
(with "libc" (instance $libc))
(with "libzip" (instance $libzip))
))
(instance $main (instantiate (module $Main)
(core instance $main (instantiate (module $Main)
(with "libc" (instance $libc))
(with "libimg" (instance $libimg))
))
(func $transform (param (list u8)) (result (list u8)) (canon lift
(func $main "transform")
(memory $libc "memory") (realloc (func $libc "realloc"))
(core func $main "transform")
(memory (core memory $libc "memory")) (realloc (func $libc "realloc"))
))
(export "transform" (func $transform))
)
Expand All @@ -254,14 +254,14 @@ components. The resulting component could look like:
```wasm
;; app.wat
(component
(import "libc" (module $Libc ...))
(import "libzip" (module $Libzip ...))
(import "libimg" (module $Libimg ...))
(import "libc" (core module $Libc ...))
(import "libzip" (core module $Libzip ...))
(import "libimg" (core module $Libimg ...))
(import "zipper" (component $Zipper ...))
(import "imgmgk" (component $Imgmgk ...))
(module $Main
(core module $Main
(import "libc" "memory" (memory 1))
(import "libc" "malloc" (func (param i32) (result i32)))
(import "zipper" "zip" (func (param i32 i32) (result i32 i32)))
Expand All @@ -282,23 +282,23 @@ components. The resulting component could look like:
(with "libimg" (module $Libimg))
))
(instance $libc (instantiate (module $Libc)))
(func $zip (canon lower
(core instance $libc (instantiate (module $Libc)))
(core func $zip (canon lower
(func $zipper "zip")
(memory $libc "memory") (realloc (func $libc "realloc"))
(memory (core memory $libc "memory")) (realloc (func $libc "realloc"))
))
(func $transform (canon lower
(core func $transform (canon lower
(func $imgmgk "transform")
(memory $libc "memory") (realloc (func $libc "realloc"))
(memory (core memory $libc "memory")) (realloc (func $libc "realloc"))
))
(instance $main (instantiate (module $Main)
(core instance $main (instantiate (module $Main)
(with "libc" (instance $libc))
(with "zipper" (instance (export "zip" (func $zipper "zip"))))
(with "imgmgk" (instance (export "transform" (func $imgmgk "transform"))))
))
(func $run (param string) (result string) (canon lift
(func $main "run")
(memory $libc "memory") (realloc (func $libc "realloc"))
(core func $main "run")
(memory (core memory $libc "memory")) (realloc (func $libc "realloc"))
))
(export "run" (func $run))
)
Expand Down Expand Up @@ -358,17 +358,17 @@ a wrapper adapter module that supplies both `$A` and `$B` with a shared
function table and `bar-index` mutable global.
```wat
(component
(import "A" (module $A ...))
(import "B" (module $B ...))
(module $Linkage
(import "A" (core module $A ...))
(import "B" (core module $B ...))
(core module $Linkage
(global (export "bar-index") (mut i32))
(table (export "table") funcref 1)
)
(instance $linkage (instantiate (module $Linkage)))
(instance $a (instantiate (module $A)
(core instance $linkage (instantiate (module $Linkage)))
(core instance $a (instantiate (module $A)
(with "linkage" (instance $linkage))
))
(instance $b (instantiate (module $B)
(core instance $b (instantiate (module $B)
(import "a" (instance $a))
(with "linkage" (instance $linkage))
))
Expand Down

0 comments on commit 7ea933a

Please sign in to comment.