caca80b5daaf0b366c5d006c4fc58dfbe02f2966
[platform/framework/web/lwnode.git] /
1 ;;
2 ;; Generated by ../meta/generate_memory_fill.js
3 ;;
4
5 (module
6   (memory 1 1)
7   
8   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
9     (loop $cont
10       (if (i32.eq (local.get $from) (local.get $to))
11         (then
12           (return (i32.const -1))))
13       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
14         (then
15           (local.set $from (i32.add (local.get $from) (i32.const 1)))
16           (br $cont))))
17     (return (local.get $from)))
18
19   (func (export "test")
20     (memory.fill (i32.const 0xFF00) (i32.const 0x55) (i32.const 256))))
21 (invoke "test")
22
23 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 65280) (i32.const 0))
24                (i32.const -1))
25 (assert_return (invoke "checkRange" (i32.const 65280) (i32.const 65536) (i32.const 85))
26                (i32.const -1))
27 (module
28   (memory 1 1)
29   
30   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
31     (loop $cont
32       (if (i32.eq (local.get $from) (local.get $to))
33         (then
34           (return (i32.const -1))))
35       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
36         (then
37           (local.set $from (i32.add (local.get $from) (i32.const 1)))
38           (br $cont))))
39     (return (local.get $from)))
40
41   (func (export "test")
42     (memory.fill (i32.const 0xFF00) (i32.const 0x55) (i32.const 257))))
43 (assert_trap (invoke "test") "out of bounds memory access")
44
45 (module
46   (memory 1 1)
47   
48   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
49     (loop $cont
50       (if (i32.eq (local.get $from) (local.get $to))
51         (then
52           (return (i32.const -1))))
53       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
54         (then
55           (local.set $from (i32.add (local.get $from) (i32.const 1)))
56           (br $cont))))
57     (return (local.get $from)))
58
59   (func (export "test")
60     (memory.fill (i32.const 0xFFFFFF00) (i32.const 0x55) (i32.const 257))))
61 (assert_trap (invoke "test") "out of bounds memory access")
62
63 (module
64   (memory 1 1)
65   
66   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
67     (loop $cont
68       (if (i32.eq (local.get $from) (local.get $to))
69         (then
70           (return (i32.const -1))))
71       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
72         (then
73           (local.set $from (i32.add (local.get $from) (i32.const 1)))
74           (br $cont))))
75     (return (local.get $from)))
76
77   (func (export "test")
78     (memory.fill (i32.const 0x12) (i32.const 0x55) (i32.const 0))))
79 (invoke "test")
80
81 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 65536) (i32.const 0))
82                (i32.const -1))
83 (module
84   (memory 1 1)
85   
86   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
87     (loop $cont
88       (if (i32.eq (local.get $from) (local.get $to))
89         (then
90           (return (i32.const -1))))
91       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
92         (then
93           (local.set $from (i32.add (local.get $from) (i32.const 1)))
94           (br $cont))))
95     (return (local.get $from)))
96
97   (func (export "test")
98     (memory.fill (i32.const 0x10000) (i32.const 0x55) (i32.const 0))))
99 (invoke "test")
100
101 (module
102   (memory 1 1)
103   
104   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
105     (loop $cont
106       (if (i32.eq (local.get $from) (local.get $to))
107         (then
108           (return (i32.const -1))))
109       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
110         (then
111           (local.set $from (i32.add (local.get $from) (i32.const 1)))
112           (br $cont))))
113     (return (local.get $from)))
114
115   (func (export "test")
116     (memory.fill (i32.const 0x20000) (i32.const 0x55) (i32.const 0))))
117 (assert_trap (invoke "test") "out of bounds")
118
119 (module
120   (memory 1 1)
121   
122   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
123     (loop $cont
124       (if (i32.eq (local.get $from) (local.get $to))
125         (then
126           (return (i32.const -1))))
127       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
128         (then
129           (local.set $from (i32.add (local.get $from) (i32.const 1)))
130           (br $cont))))
131     (return (local.get $from)))
132
133   (func (export "test")
134     (memory.fill (i32.const 0x1) (i32.const 0xAA) (i32.const 0xFFFE))))
135 (invoke "test")
136
137 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
138                (i32.const -1))
139 (assert_return (invoke "checkRange" (i32.const 1) (i32.const 65535) (i32.const 170))
140                (i32.const -1))
141 (assert_return (invoke "checkRange" (i32.const 65535) (i32.const 65536) (i32.const 0))
142                (i32.const -1))
143
144 (module
145   (memory 1 1)
146   
147   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
148     (loop $cont
149       (if (i32.eq (local.get $from) (local.get $to))
150         (then
151           (return (i32.const -1))))
152       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
153         (then
154           (local.set $from (i32.add (local.get $from) (i32.const 1)))
155           (br $cont))))
156     (return (local.get $from)))
157
158   (func (export "test")
159      (memory.fill (i32.const 0x12) (i32.const 0x55) (i32.const 10))
160      (memory.fill (i32.const 0x15) (i32.const 0xAA) (i32.const 4))))
161 (invoke "test")
162
163 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 18) (i32.const 0))
164                (i32.const -1))
165 (assert_return (invoke "checkRange" (i32.const 18) (i32.const 21) (i32.const 85))
166                (i32.const -1))
167 (assert_return (invoke "checkRange" (i32.const 21) (i32.const 25) (i32.const 170))
168                (i32.const -1))
169 (assert_return (invoke "checkRange" (i32.const 25) (i32.const 28) (i32.const 85))
170                (i32.const -1))
171 (assert_return (invoke "checkRange" (i32.const 28) (i32.const 65536) (i32.const 0))
172                (i32.const -1))
173 (assert_invalid
174   (module
175     (func (export "testfn")
176       (memory.fill (i32.const 10) (i32.const 20) (i32.const 30))))
177   "unknown memory 0")
178
179 (assert_invalid
180   (module
181     (memory 1 1)
182     (func (export "testfn")
183       (memory.fill (i32.const 10) (i32.const 20) (f32.const 30))))
184   "type mismatch")
185
186 (assert_invalid
187   (module
188     (memory 1 1)
189     (func (export "testfn")
190       (memory.fill (i32.const 10) (i32.const 20) (i64.const 30))))
191   "type mismatch")
192
193 (assert_invalid
194   (module
195     (memory 1 1)
196     (func (export "testfn")
197       (memory.fill (i32.const 10) (i32.const 20) (f64.const 30))))
198   "type mismatch")
199
200 (assert_invalid
201   (module
202     (memory 1 1)
203     (func (export "testfn")
204       (memory.fill (i32.const 10) (f32.const 20) (i32.const 30))))
205   "type mismatch")
206
207 (assert_invalid
208   (module
209     (memory 1 1)
210     (func (export "testfn")
211       (memory.fill (i32.const 10) (f32.const 20) (f32.const 30))))
212   "type mismatch")
213
214 (assert_invalid
215   (module
216     (memory 1 1)
217     (func (export "testfn")
218       (memory.fill (i32.const 10) (f32.const 20) (i64.const 30))))
219   "type mismatch")
220
221 (assert_invalid
222   (module
223     (memory 1 1)
224     (func (export "testfn")
225       (memory.fill (i32.const 10) (f32.const 20) (f64.const 30))))
226   "type mismatch")
227
228 (assert_invalid
229   (module
230     (memory 1 1)
231     (func (export "testfn")
232       (memory.fill (i32.const 10) (i64.const 20) (i32.const 30))))
233   "type mismatch")
234
235 (assert_invalid
236   (module
237     (memory 1 1)
238     (func (export "testfn")
239       (memory.fill (i32.const 10) (i64.const 20) (f32.const 30))))
240   "type mismatch")
241
242 (assert_invalid
243   (module
244     (memory 1 1)
245     (func (export "testfn")
246       (memory.fill (i32.const 10) (i64.const 20) (i64.const 30))))
247   "type mismatch")
248
249 (assert_invalid
250   (module
251     (memory 1 1)
252     (func (export "testfn")
253       (memory.fill (i32.const 10) (i64.const 20) (f64.const 30))))
254   "type mismatch")
255
256 (assert_invalid
257   (module
258     (memory 1 1)
259     (func (export "testfn")
260       (memory.fill (i32.const 10) (f64.const 20) (i32.const 30))))
261   "type mismatch")
262
263 (assert_invalid
264   (module
265     (memory 1 1)
266     (func (export "testfn")
267       (memory.fill (i32.const 10) (f64.const 20) (f32.const 30))))
268   "type mismatch")
269
270 (assert_invalid
271   (module
272     (memory 1 1)
273     (func (export "testfn")
274       (memory.fill (i32.const 10) (f64.const 20) (i64.const 30))))
275   "type mismatch")
276
277 (assert_invalid
278   (module
279     (memory 1 1)
280     (func (export "testfn")
281       (memory.fill (i32.const 10) (f64.const 20) (f64.const 30))))
282   "type mismatch")
283
284 (assert_invalid
285   (module
286     (memory 1 1)
287     (func (export "testfn")
288       (memory.fill (f32.const 10) (i32.const 20) (i32.const 30))))
289   "type mismatch")
290
291 (assert_invalid
292   (module
293     (memory 1 1)
294     (func (export "testfn")
295       (memory.fill (f32.const 10) (i32.const 20) (f32.const 30))))
296   "type mismatch")
297
298 (assert_invalid
299   (module
300     (memory 1 1)
301     (func (export "testfn")
302       (memory.fill (f32.const 10) (i32.const 20) (i64.const 30))))
303   "type mismatch")
304
305 (assert_invalid
306   (module
307     (memory 1 1)
308     (func (export "testfn")
309       (memory.fill (f32.const 10) (i32.const 20) (f64.const 30))))
310   "type mismatch")
311
312 (assert_invalid
313   (module
314     (memory 1 1)
315     (func (export "testfn")
316       (memory.fill (f32.const 10) (f32.const 20) (i32.const 30))))
317   "type mismatch")
318
319 (assert_invalid
320   (module
321     (memory 1 1)
322     (func (export "testfn")
323       (memory.fill (f32.const 10) (f32.const 20) (f32.const 30))))
324   "type mismatch")
325
326 (assert_invalid
327   (module
328     (memory 1 1)
329     (func (export "testfn")
330       (memory.fill (f32.const 10) (f32.const 20) (i64.const 30))))
331   "type mismatch")
332
333 (assert_invalid
334   (module
335     (memory 1 1)
336     (func (export "testfn")
337       (memory.fill (f32.const 10) (f32.const 20) (f64.const 30))))
338   "type mismatch")
339
340 (assert_invalid
341   (module
342     (memory 1 1)
343     (func (export "testfn")
344       (memory.fill (f32.const 10) (i64.const 20) (i32.const 30))))
345   "type mismatch")
346
347 (assert_invalid
348   (module
349     (memory 1 1)
350     (func (export "testfn")
351       (memory.fill (f32.const 10) (i64.const 20) (f32.const 30))))
352   "type mismatch")
353
354 (assert_invalid
355   (module
356     (memory 1 1)
357     (func (export "testfn")
358       (memory.fill (f32.const 10) (i64.const 20) (i64.const 30))))
359   "type mismatch")
360
361 (assert_invalid
362   (module
363     (memory 1 1)
364     (func (export "testfn")
365       (memory.fill (f32.const 10) (i64.const 20) (f64.const 30))))
366   "type mismatch")
367
368 (assert_invalid
369   (module
370     (memory 1 1)
371     (func (export "testfn")
372       (memory.fill (f32.const 10) (f64.const 20) (i32.const 30))))
373   "type mismatch")
374
375 (assert_invalid
376   (module
377     (memory 1 1)
378     (func (export "testfn")
379       (memory.fill (f32.const 10) (f64.const 20) (f32.const 30))))
380   "type mismatch")
381
382 (assert_invalid
383   (module
384     (memory 1 1)
385     (func (export "testfn")
386       (memory.fill (f32.const 10) (f64.const 20) (i64.const 30))))
387   "type mismatch")
388
389 (assert_invalid
390   (module
391     (memory 1 1)
392     (func (export "testfn")
393       (memory.fill (f32.const 10) (f64.const 20) (f64.const 30))))
394   "type mismatch")
395
396 (assert_invalid
397   (module
398     (memory 1 1)
399     (func (export "testfn")
400       (memory.fill (i64.const 10) (i32.const 20) (i32.const 30))))
401   "type mismatch")
402
403 (assert_invalid
404   (module
405     (memory 1 1)
406     (func (export "testfn")
407       (memory.fill (i64.const 10) (i32.const 20) (f32.const 30))))
408   "type mismatch")
409
410 (assert_invalid
411   (module
412     (memory 1 1)
413     (func (export "testfn")
414       (memory.fill (i64.const 10) (i32.const 20) (i64.const 30))))
415   "type mismatch")
416
417 (assert_invalid
418   (module
419     (memory 1 1)
420     (func (export "testfn")
421       (memory.fill (i64.const 10) (i32.const 20) (f64.const 30))))
422   "type mismatch")
423
424 (assert_invalid
425   (module
426     (memory 1 1)
427     (func (export "testfn")
428       (memory.fill (i64.const 10) (f32.const 20) (i32.const 30))))
429   "type mismatch")
430
431 (assert_invalid
432   (module
433     (memory 1 1)
434     (func (export "testfn")
435       (memory.fill (i64.const 10) (f32.const 20) (f32.const 30))))
436   "type mismatch")
437
438 (assert_invalid
439   (module
440     (memory 1 1)
441     (func (export "testfn")
442       (memory.fill (i64.const 10) (f32.const 20) (i64.const 30))))
443   "type mismatch")
444
445 (assert_invalid
446   (module
447     (memory 1 1)
448     (func (export "testfn")
449       (memory.fill (i64.const 10) (f32.const 20) (f64.const 30))))
450   "type mismatch")
451
452 (assert_invalid
453   (module
454     (memory 1 1)
455     (func (export "testfn")
456       (memory.fill (i64.const 10) (i64.const 20) (i32.const 30))))
457   "type mismatch")
458
459 (assert_invalid
460   (module
461     (memory 1 1)
462     (func (export "testfn")
463       (memory.fill (i64.const 10) (i64.const 20) (f32.const 30))))
464   "type mismatch")
465
466 (assert_invalid
467   (module
468     (memory 1 1)
469     (func (export "testfn")
470       (memory.fill (i64.const 10) (i64.const 20) (i64.const 30))))
471   "type mismatch")
472
473 (assert_invalid
474   (module
475     (memory 1 1)
476     (func (export "testfn")
477       (memory.fill (i64.const 10) (i64.const 20) (f64.const 30))))
478   "type mismatch")
479
480 (assert_invalid
481   (module
482     (memory 1 1)
483     (func (export "testfn")
484       (memory.fill (i64.const 10) (f64.const 20) (i32.const 30))))
485   "type mismatch")
486
487 (assert_invalid
488   (module
489     (memory 1 1)
490     (func (export "testfn")
491       (memory.fill (i64.const 10) (f64.const 20) (f32.const 30))))
492   "type mismatch")
493
494 (assert_invalid
495   (module
496     (memory 1 1)
497     (func (export "testfn")
498       (memory.fill (i64.const 10) (f64.const 20) (i64.const 30))))
499   "type mismatch")
500
501 (assert_invalid
502   (module
503     (memory 1 1)
504     (func (export "testfn")
505       (memory.fill (i64.const 10) (f64.const 20) (f64.const 30))))
506   "type mismatch")
507
508 (assert_invalid
509   (module
510     (memory 1 1)
511     (func (export "testfn")
512       (memory.fill (f64.const 10) (i32.const 20) (i32.const 30))))
513   "type mismatch")
514
515 (assert_invalid
516   (module
517     (memory 1 1)
518     (func (export "testfn")
519       (memory.fill (f64.const 10) (i32.const 20) (f32.const 30))))
520   "type mismatch")
521
522 (assert_invalid
523   (module
524     (memory 1 1)
525     (func (export "testfn")
526       (memory.fill (f64.const 10) (i32.const 20) (i64.const 30))))
527   "type mismatch")
528
529 (assert_invalid
530   (module
531     (memory 1 1)
532     (func (export "testfn")
533       (memory.fill (f64.const 10) (i32.const 20) (f64.const 30))))
534   "type mismatch")
535
536 (assert_invalid
537   (module
538     (memory 1 1)
539     (func (export "testfn")
540       (memory.fill (f64.const 10) (f32.const 20) (i32.const 30))))
541   "type mismatch")
542
543 (assert_invalid
544   (module
545     (memory 1 1)
546     (func (export "testfn")
547       (memory.fill (f64.const 10) (f32.const 20) (f32.const 30))))
548   "type mismatch")
549
550 (assert_invalid
551   (module
552     (memory 1 1)
553     (func (export "testfn")
554       (memory.fill (f64.const 10) (f32.const 20) (i64.const 30))))
555   "type mismatch")
556
557 (assert_invalid
558   (module
559     (memory 1 1)
560     (func (export "testfn")
561       (memory.fill (f64.const 10) (f32.const 20) (f64.const 30))))
562   "type mismatch")
563
564 (assert_invalid
565   (module
566     (memory 1 1)
567     (func (export "testfn")
568       (memory.fill (f64.const 10) (i64.const 20) (i32.const 30))))
569   "type mismatch")
570
571 (assert_invalid
572   (module
573     (memory 1 1)
574     (func (export "testfn")
575       (memory.fill (f64.const 10) (i64.const 20) (f32.const 30))))
576   "type mismatch")
577
578 (assert_invalid
579   (module
580     (memory 1 1)
581     (func (export "testfn")
582       (memory.fill (f64.const 10) (i64.const 20) (i64.const 30))))
583   "type mismatch")
584
585 (assert_invalid
586   (module
587     (memory 1 1)
588     (func (export "testfn")
589       (memory.fill (f64.const 10) (i64.const 20) (f64.const 30))))
590   "type mismatch")
591
592 (assert_invalid
593   (module
594     (memory 1 1)
595     (func (export "testfn")
596       (memory.fill (f64.const 10) (f64.const 20) (i32.const 30))))
597   "type mismatch")
598
599 (assert_invalid
600   (module
601     (memory 1 1)
602     (func (export "testfn")
603       (memory.fill (f64.const 10) (f64.const 20) (f32.const 30))))
604   "type mismatch")
605
606 (assert_invalid
607   (module
608     (memory 1 1)
609     (func (export "testfn")
610       (memory.fill (f64.const 10) (f64.const 20) (i64.const 30))))
611   "type mismatch")
612
613 (assert_invalid
614   (module
615     (memory 1 1)
616     (func (export "testfn")
617       (memory.fill (f64.const 10) (f64.const 20) (f64.const 30))))
618   "type mismatch")
619
620 (module
621   (memory 1 1 )
622   
623   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
624     (loop $cont
625       (if (i32.eq (local.get $from) (local.get $to))
626         (then
627           (return (i32.const -1))))
628       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
629         (then
630           (local.set $from (i32.add (local.get $from) (i32.const 1)))
631           (br $cont))))
632     (return (local.get $from)))
633
634   (func (export "run") (param $offs i32) (param $val i32) (param $len i32)
635     (memory.fill (local.get $offs) (local.get $val) (local.get $len))))
636
637 (assert_trap (invoke "run" (i32.const 65280) (i32.const 37) (i32.const 512))
638               "out of bounds")
639
640 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
641                (i32.const -1))
642 (module
643   (memory 1 1 )
644   
645   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
646     (loop $cont
647       (if (i32.eq (local.get $from) (local.get $to))
648         (then
649           (return (i32.const -1))))
650       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
651         (then
652           (local.set $from (i32.add (local.get $from) (i32.const 1)))
653           (br $cont))))
654     (return (local.get $from)))
655
656   (func (export "run") (param $offs i32) (param $val i32) (param $len i32)
657     (memory.fill (local.get $offs) (local.get $val) (local.get $len))))
658
659 (assert_trap (invoke "run" (i32.const 65279) (i32.const 37) (i32.const 514))
660               "out of bounds")
661
662 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
663                (i32.const -1))
664 (module
665   (memory 1 1 )
666   
667   (func (export "checkRange") (param $from i32) (param $to i32) (param $expected i32) (result i32)
668     (loop $cont
669       (if (i32.eq (local.get $from) (local.get $to))
670         (then
671           (return (i32.const -1))))
672       (if (i32.eq (i32.load8_u (local.get $from)) (local.get $expected))
673         (then
674           (local.set $from (i32.add (local.get $from) (i32.const 1)))
675           (br $cont))))
676     (return (local.get $from)))
677
678   (func (export "run") (param $offs i32) (param $val i32) (param $len i32)
679     (memory.fill (local.get $offs) (local.get $val) (local.get $len))))
680
681 (assert_trap (invoke "run" (i32.const 65279) (i32.const 37) (i32.const 4294967295))
682               "out of bounds")
683
684 (assert_return (invoke "checkRange" (i32.const 0) (i32.const 1) (i32.const 0))
685                (i32.const -1))