File: roundtrip-gc-types.wast

package info (click to toggle)
binaryen 120-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,284 kB
  • sloc: cpp: 189,449; javascript: 62,189; ansic: 14,087; python: 5,379; pascal: 441; sh: 77; makefile: 30; asm: 27
file content (31 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.

;; RUN: wasm-opt %s -all --roundtrip -S -o - | filecheck %s

;; Regression test for an issue in which roundtripping failed to reproduce the
;; original types because type canonicalization was incorrect when the canonical
;; types already existed in the store.

(module
 (rec
  ;; CHECK:      (rec
  ;; CHECK-NEXT:  (type $A (sub (struct (field (ref $C)))))
  (type $A (sub (struct (field (ref $C)))))

  ;; CHECK:       (type $B (func (param (ref $A)) (result (ref $B))))
  (type $B (func (param (ref $A)) (result (ref $B))))

  ;; CHECK:       (type $C (struct (field (mut (ref $B)))))
  (type $C (struct (field (mut (ref $B)))))

  ;; CHECK:       (type $D (sub $A (struct (field (ref $C)) (field (ref $A)))))
  (type $D (sub $A (struct (field (ref $C)) (field (ref $A)))))
 )

 ;; CHECK:      (func $use-types (type $4) (param $0 (ref $A)) (param $1 (ref $D))
 ;; CHECK-NEXT:  (nop)
 ;; CHECK-NEXT: )
 (func $use-types (param (ref $A) (ref $D))
  (nop)
 )
)