Skip to content

Commit

Permalink
Example with a Cerise module
Browse files Browse the repository at this point in the history
  • Loading branch information
JuneRousseau committed Aug 20, 2023
1 parent 1b55add commit 5f87d59
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
30 changes: 30 additions & 0 deletions wat-toys/external/env.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.text
#(RO, Global, 13, 17, 13)
mov r10 pc
lea r10 -1
load r10 r10 ; fetch data capanbility
lea r10 2
load r1 r10 ; fetch capability to global Main.g
lea r10 1
load r10 r10 ; fetch common.link_tbl cap
lea r10 5
load r10 r10 ; fetch store_global cap
mov r2 31
loadU r0 stk -3
jmp r10

.data
#(E, Global, 0, 13, 1) ; function adv
#{1: (RW, Global, 17, 20, 17)} ; sealed to global
$main.g
$_Common.link_tbl
#0
#0
;; Global h
#3
#0
#1

.symtab
$env.h: 1
$env.adv: 0
17 changes: 17 additions & 0 deletions wat-toys/external/main.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(module $main
(type $main_t (func))
(global $g mut i32 10)

(import "env" "adv" (func $env.adv (type 0)))
(import "env" "h" (global mut i32))
(export "g" (global 1))

(func $main (type 0)
global.get 0
i32.const 0
i32.add
global.set 0

call 0)

(start 1))

0 comments on commit 5f87d59

Please sign in to comment.