Skip to content

Commit 7ea933a

Browse files
authored
Merge pull request #94 from WebAssembly/fix-alias-sugar-examples
Fix inline aliases used in 'memory' examples
2 parents 4d6e519 + 4a09867 commit 7ea933a

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

design/mvp/Explainer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ takes a string, does some logging, then returns a string.
736736
))
737737
(func $run (param string) (result string) (canon lift
738738
(core func $main "run")
739-
(memory $libc "mem") (realloc (func $libc "realloc"))
739+
(memory (core memory $libc "mem")) (realloc (func $libc "realloc"))
740740
))
741741
(export "run" (func $run))
742742
)
@@ -794,7 +794,7 @@ exported string at instantiation time:
794794
(core instance $main (instantiate $Main (with "libc" (instance $libc))))
795795
(func $start (param string) (result string) (canon lift
796796
(core func $main "start")
797-
(memory $libc "mem") (realloc (func $libc "realloc"))
797+
(memory (core memory $libc "mem")) (realloc (func $libc "realloc"))
798798
))
799799
(start $start (value $name) (result (value $greeting)))
800800
(export "greeting" (value $greeting))

design/mvp/examples/SharedEverythingDynamicLinking.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ would look like:
129129
```wasm
130130
;; zipper.wat
131131
(component
132-
(import "libc" (module $Libc
132+
(import "libc" (core module $Libc
133133
(export "memory" (memory 1))
134134
(export "malloc" (func (param i32) (result i32)))
135135
))
136-
(import "libzip" (module $Libzip
136+
(import "libzip" (core module $Libzip
137137
(import "libc" "memory" (memory 1))
138138
(import "libc" "malloc" (func (param i32) (result i32)))
139139
(export "zip" (func (param i32 i32 i32) (result i32)))
140140
))
141141
142-
(module $Main
142+
(core module $Main
143143
(import "libc" "memory" (memory 1))
144144
(import "libc" "malloc" (func (param i32) (result i32)))
145145
(import "libzip" "zip" (func (param i32 i32 i32) (result i32)))
@@ -149,17 +149,17 @@ would look like:
149149
)
150150
)
151151
152-
(instance $libc (instantiate (module $Libc)))
153-
(instance $libzip (instantiate (module $Libzip))
152+
(core instance $libc (instantiate (module $Libc)))
153+
(core instance $libzip (instantiate (module $Libzip))
154154
(with "libc" (instance $libc))
155155
))
156-
(instance $main (instantiate (module $Main)
156+
(core instance $main (instantiate (module $Main)
157157
(with "libc" (instance $libc))
158158
(with "libzip" (instance $libzip))
159159
))
160160
(func $zip (param (list u8)) (result (list u8)) (canon lift
161-
(func $main "zip")
162-
(memory $libc "memory") (realloc (func $libc "realloc"))
161+
(core func $main "zip")
162+
(memory (core memory $libc "memory")) (realloc (func $libc "realloc"))
163163
))
164164
(export "zip" (func $zip))
165165
)
@@ -210,11 +210,11 @@ component-aware `clang`, the resulting component would look like:
210210
```wasm
211211
;; imgmgk.wat
212212
(component $Imgmgk
213-
(import "libc" (module $Libc ...))
214-
(import "libzip" (module $Libzip ...))
215-
(import "libimg" (module $Libimg ...))
213+
(import "libc" (core module $Libc ...))
214+
(import "libzip" (core module $Libzip ...))
215+
(import "libimg" (core module $Libimg ...))
216216
217-
(module $Main
217+
(core module $Main
218218
(import "libc" "memory" (memory 1))
219219
(import "libc" "malloc" (func (param i32) (result i32)))
220220
(import "libimg" "compress" (func (param i32 i32 i32) (result i32)))
@@ -224,21 +224,21 @@ component-aware `clang`, the resulting component would look like:
224224
)
225225
)
226226
227-
(instance $libc (instantiate (module $Libc)))
228-
(instance $libzip (instantiate (module $Libzip)
227+
(core instance $libc (instantiate (module $Libc)))
228+
(core instance $libzip (instantiate (module $Libzip)
229229
(with "libc" (instance $libc))
230230
))
231-
(instance $libimg (instantiate (module $Libimg)
231+
(core instance $libimg (instantiate (module $Libimg)
232232
(with "libc" (instance $libc))
233233
(with "libzip" (instance $libzip))
234234
))
235-
(instance $main (instantiate (module $Main)
235+
(core instance $main (instantiate (module $Main)
236236
(with "libc" (instance $libc))
237237
(with "libimg" (instance $libimg))
238238
))
239239
(func $transform (param (list u8)) (result (list u8)) (canon lift
240-
(func $main "transform")
241-
(memory $libc "memory") (realloc (func $libc "realloc"))
240+
(core func $main "transform")
241+
(memory (core memory $libc "memory")) (realloc (func $libc "realloc"))
242242
))
243243
(export "transform" (func $transform))
244244
)
@@ -254,14 +254,14 @@ components. The resulting component could look like:
254254
```wasm
255255
;; app.wat
256256
(component
257-
(import "libc" (module $Libc ...))
258-
(import "libzip" (module $Libzip ...))
259-
(import "libimg" (module $Libimg ...))
257+
(import "libc" (core module $Libc ...))
258+
(import "libzip" (core module $Libzip ...))
259+
(import "libimg" (core module $Libimg ...))
260260
261261
(import "zipper" (component $Zipper ...))
262262
(import "imgmgk" (component $Imgmgk ...))
263263
264-
(module $Main
264+
(core module $Main
265265
(import "libc" "memory" (memory 1))
266266
(import "libc" "malloc" (func (param i32) (result i32)))
267267
(import "zipper" "zip" (func (param i32 i32) (result i32 i32)))
@@ -282,23 +282,23 @@ components. The resulting component could look like:
282282
(with "libimg" (module $Libimg))
283283
))
284284
285-
(instance $libc (instantiate (module $Libc)))
286-
(func $zip (canon lower
285+
(core instance $libc (instantiate (module $Libc)))
286+
(core func $zip (canon lower
287287
(func $zipper "zip")
288-
(memory $libc "memory") (realloc (func $libc "realloc"))
288+
(memory (core memory $libc "memory")) (realloc (func $libc "realloc"))
289289
))
290-
(func $transform (canon lower
290+
(core func $transform (canon lower
291291
(func $imgmgk "transform")
292-
(memory $libc "memory") (realloc (func $libc "realloc"))
292+
(memory (core memory $libc "memory")) (realloc (func $libc "realloc"))
293293
))
294-
(instance $main (instantiate (module $Main)
294+
(core instance $main (instantiate (module $Main)
295295
(with "libc" (instance $libc))
296296
(with "zipper" (instance (export "zip" (func $zipper "zip"))))
297297
(with "imgmgk" (instance (export "transform" (func $imgmgk "transform"))))
298298
))
299299
(func $run (param string) (result string) (canon lift
300-
(func $main "run")
301-
(memory $libc "memory") (realloc (func $libc "realloc"))
300+
(core func $main "run")
301+
(memory (core memory $libc "memory")) (realloc (func $libc "realloc"))
302302
))
303303
(export "run" (func $run))
304304
)
@@ -358,17 +358,17 @@ a wrapper adapter module that supplies both `$A` and `$B` with a shared
358358
function table and `bar-index` mutable global.
359359
```wat
360360
(component
361-
(import "A" (module $A ...))
362-
(import "B" (module $B ...))
363-
(module $Linkage
361+
(import "A" (core module $A ...))
362+
(import "B" (core module $B ...))
363+
(core module $Linkage
364364
(global (export "bar-index") (mut i32))
365365
(table (export "table") funcref 1)
366366
)
367-
(instance $linkage (instantiate (module $Linkage)))
368-
(instance $a (instantiate (module $A)
367+
(core instance $linkage (instantiate (module $Linkage)))
368+
(core instance $a (instantiate (module $A)
369369
(with "linkage" (instance $linkage))
370370
))
371-
(instance $b (instantiate (module $B)
371+
(core instance $b (instantiate (module $B)
372372
(import "a" (instance $a))
373373
(with "linkage" (instance $linkage))
374374
))

0 commit comments

Comments
 (0)