@@ -4,7 +4,9 @@ arrays › array_access
44 (type $none_=>_i32 (func (result i32)))
55 (type $none_=>_none (func))
66 (import \"_grainEnv\" \"mem\" (memory $0 0))
7+ (import \"_grainEnv\" \"tbl\" (table $tbl 0 funcref))
78 (import \"_grainEnv\" \"relocBase\" (global $relocBase_0 i32))
9+ (import \"_grainEnv\" \"moduleRuntimeId\" (global $moduleRuntimeId_0 i32))
810 (import \"GRAIN$MODULE$runtime/exception\" \"GRAIN$EXPORT$printException\" (global $GRAIN$EXPORT$printException_0 (mut i32)))
911 (import \"GRAIN$MODULE$runtime/exception\" \"GRAIN$EXPORT$IndexOutOfBounds\" (global $GRAIN$EXPORT$IndexOutOfBounds_0 (mut i32)))
1012 (import \"GRAIN$MODULE$runtime/gc\" \"GRAIN$EXPORT$malloc\" (global $GRAIN$EXPORT$malloc_0 (mut i32)))
@@ -16,104 +18,147 @@ arrays › array_access
1618 (import \"GRAIN$MODULE$runtime/exception\" \"printException\" (func $printException_0 (param i32 i32) (result i32)))
1719 (global $x_1131 (mut i32) (i32.const 0))
1820 (global $GRAIN$TABLE_SIZE i32 (i32.const 0))
21+ (elem $elem (global.get $relocBase_0))
1922 (export \"memory\" (memory $0))
2023 (export \"_gmain\" (func $_gmain))
2124 (export \"_start\" (func $_start))
2225 (export \"GRAIN$TABLE_SIZE\" (global $GRAIN$TABLE_SIZE))
23- (func $_gmain (; has Stack IR ;) ( result i32)
26+ (func $_gmain (result i32)
2427 (local $0 i32)
2528 (local $1 i32)
26- (i32.store
27- (local.tee $0
28- (call $malloc_0
29- (global.get $GRAIN$EXPORT$malloc_0)
30- (i32.const 20)
31- )
32- )
33- (i32.const 4)
34- )
35- (i32.store offset=4
36- (local.get $0)
37- (i32.const 3)
38- )
39- (i32.store offset=8
40- (local.get $0)
41- (i32.const 3)
42- )
43- (i32.store offset=12
44- (local.get $0)
45- (i32.const 5)
46- )
47- (i32.store offset=16
48- (local.get $0)
49- (i32.const 7)
50- )
51- (global.set $x_1131
52- (tuple.extract 0
53- (tuple.make
54- (local.get $0)
55- (call $decRef_0
56- (global.get $GRAIN$EXPORT$decRef_0)
57- (global.get $x_1131)
58- )
59- )
60- )
61- )
62- (if
63- (i32.lt_s
64- (local.tee $0
65- (i32.const 0)
66- )
67- (i32.sub
68- (i32.const 0)
69- (i32.load offset=4
70- (local.tee $1
71- (global.get $x_1131)
29+ (local $2 i32)
30+ (local $3 i64)
31+ (local $4 f32)
32+ (local $5 f64)
33+ (return
34+ (block $cleanup_locals.8 (result i32)
35+ (local.set $0
36+ (block $compile_block.7 (result i32)
37+ (block $compile_store.3
38+ (global.set $x_1131
39+ (tuple.extract 0
40+ (tuple.make
41+ (block $allocate_array.1 (result i32)
42+ (i32.store
43+ (local.tee $0
44+ (call $malloc_0
45+ (global.get $GRAIN$EXPORT$malloc_0)
46+ (i32.const 20)
47+ )
48+ )
49+ (i32.const 4)
50+ )
51+ (i32.store offset=4
52+ (local.get $0)
53+ (i32.const 3)
54+ )
55+ (i32.store offset=8
56+ (local.get $0)
57+ (i32.const 3)
58+ )
59+ (i32.store offset=12
60+ (local.get $0)
61+ (i32.const 5)
62+ )
63+ (i32.store offset=16
64+ (local.get $0)
65+ (i32.const 7)
66+ )
67+ (local.get $0)
68+ )
69+ (call $decRef_0
70+ (global.get $GRAIN$EXPORT$decRef_0)
71+ (global.get $x_1131)
72+ )
73+ )
74+ )
75+ )
76+ (block $do_backpatches.2
77+ )
78+ )
79+ (block $MArrayGet.6 (result i32)
80+ (local.set $1
81+ (i32.shr_s
82+ (i32.const 1)
83+ (i32.const 1)
84+ )
85+ )
86+ (local.set $2
87+ (global.get $x_1131)
88+ )
89+ (if
90+ (i32.gt_s
91+ (i32.mul
92+ (i32.load offset=4
93+ (local.get $2)
94+ )
95+ (i32.const -1)
96+ )
97+ (local.get $1)
98+ )
99+ (drop
100+ (block $call_error_handler.5
101+ (drop
102+ (call $printException_0
103+ (global.get $GRAIN$EXPORT$printException_0)
104+ (global.get $GRAIN$EXPORT$IndexOutOfBounds_0)
105+ )
106+ )
107+ (unreachable)
108+ )
109+ )
110+ )
111+ (if
112+ (i32.le_s
113+ (i32.load offset=4
114+ (local.get $2)
115+ )
116+ (local.get $1)
117+ )
118+ (drop
119+ (block $call_error_handler.4
120+ (drop
121+ (call $printException_0
122+ (global.get $GRAIN$EXPORT$printException_0)
123+ (global.get $GRAIN$EXPORT$IndexOutOfBounds_0)
124+ )
125+ )
126+ (unreachable)
127+ )
128+ )
129+ )
130+ (call $incRef_0
131+ (global.get $GRAIN$EXPORT$incRef_0)
132+ (i32.load offset=8
133+ (i32.add
134+ (i32.mul
135+ (if (result i32)
136+ (i32.lt_s
137+ (local.get $1)
138+ (i32.const 0)
139+ )
140+ (i32.add
141+ (local.get $1)
142+ (i32.load offset=4
143+ (local.get $2)
144+ )
145+ )
146+ (local.get $1)
147+ )
148+ (i32.const 4)
149+ )
150+ (local.get $2)
151+ )
152+ )
153+ )
72154 )
73155 )
74156 )
75- )
76- (block
77- (drop
78- (call $printException_0
79- (global.get $GRAIN$EXPORT$printException_0)
80- (global.get $GRAIN$EXPORT$IndexOutOfBounds_0)
81- )
82- )
83- (unreachable)
84- )
85- )
86- (if
87- (i32.le_s
88- (i32.load offset=4
89- (local.get $1)
90- )
91157 (local.get $0)
92158 )
93- (block
94- (drop
95- (call $printException_0
96- (global.get $GRAIN$EXPORT$printException_0)
97- (global.get $GRAIN$EXPORT$IndexOutOfBounds_0)
98- )
99- )
100- (unreachable)
101- )
102- )
103- (call $incRef_0
104- (global.get $GRAIN$EXPORT$incRef_0)
105- (i32.load offset=8
106- (i32.add
107- (i32.shl
108- (local.get $0)
109- (i32.const 2)
110- )
111- (local.get $1)
112- )
113- )
114159 )
115160 )
116- (func $_start (; has Stack IR ;)
161+ (func $_start
117162 (drop
118163 (call $_gmain)
119164 )
0 commit comments