test5.wast 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. (module
  2. (type $t0 (sub (struct)))
  3. (type $t1 (sub $t0 (struct (field i32))))
  4. (type $t1' (sub $t0 (struct (field i32))))
  5. (type $t2 (sub $t1 (struct (field i32 i32))))
  6. (type $t2' (sub $t1' (struct (field i32 i32))))
  7. (type $t3 (sub $t0 (struct (field i32 i32))))
  8. (type $t0' (sub $t0 (struct)))
  9. (type $t4 (sub $t0' (struct (field i32 i32))))
  10. (table 20 (ref null struct))
  11. (func $init
  12. (table.set (i32.const 0) (struct.new_canon_default $t0))
  13. (table.set (i32.const 10) (struct.new_canon_default $t0))
  14. (table.set (i32.const 1) (struct.new_canon_default $t1))
  15. (table.set (i32.const 11) (struct.new_canon_default $t1'))
  16. (table.set (i32.const 2) (struct.new_canon_default $t2))
  17. (table.set (i32.const 12) (struct.new_canon_default $t2'))
  18. (table.set (i32.const 3) (struct.new_canon_default $t3))
  19. (table.set (i32.const 4) (struct.new_canon_default $t4))
  20. )
  21. (func (export "test-sub")
  22. (call $init)
  23. (drop (ref.cast null $t0 (ref.null struct)))
  24. (drop (ref.cast null $t0 (table.get (i32.const 0))))
  25. (drop (ref.cast null $t0 (table.get (i32.const 1))))
  26. (drop (ref.cast null $t0 (table.get (i32.const 2))))
  27. (drop (ref.cast null $t0 (table.get (i32.const 3))))
  28. (drop (ref.cast null $t0 (table.get (i32.const 4))))
  29. (drop (ref.cast null $t0 (ref.null struct)))
  30. (drop (ref.cast null $t1 (table.get (i32.const 1))))
  31. (drop (ref.cast null $t1 (table.get (i32.const 2))))
  32. (drop (ref.cast null $t0 (ref.null struct)))
  33. (drop (ref.cast null $t2 (table.get (i32.const 2))))
  34. (drop (ref.cast null $t0 (ref.null struct)))
  35. (drop (ref.cast null $t3 (table.get (i32.const 3))))
  36. (drop (ref.cast null $t4 (table.get (i32.const 4))))
  37. (drop (ref.cast $t0 (table.get (i32.const 0))))
  38. (drop (ref.cast $t0 (table.get (i32.const 1))))
  39. (drop (ref.cast $t0 (table.get (i32.const 2))))
  40. (drop (ref.cast $t0 (table.get (i32.const 3))))
  41. (drop (ref.cast $t0 (table.get (i32.const 4))))
  42. (drop (ref.cast $t1 (table.get (i32.const 1))))
  43. (drop (ref.cast $t1 (table.get (i32.const 2))))
  44. (drop (ref.cast $t2 (table.get (i32.const 2))))
  45. (drop (ref.cast $t3 (table.get (i32.const 3))))
  46. (drop (ref.cast $t4 (table.get (i32.const 4))))
  47. )
  48. (func (export "test-canon")
  49. (call $init)
  50. (drop (ref.cast $t0 (table.get (i32.const 0))))
  51. (drop (ref.cast $t0 (table.get (i32.const 1))))
  52. (drop (ref.cast $t0 (table.get (i32.const 2))))
  53. (drop (ref.cast $t0 (table.get (i32.const 3))))
  54. (drop (ref.cast $t0 (table.get (i32.const 4))))
  55. (drop (ref.cast $t0 (table.get (i32.const 10))))
  56. (drop (ref.cast $t0 (table.get (i32.const 11))))
  57. (drop (ref.cast $t0 (table.get (i32.const 12))))
  58. (drop (ref.cast $t1' (table.get (i32.const 1))))
  59. (drop (ref.cast $t1' (table.get (i32.const 2))))
  60. (drop (ref.cast $t1 (table.get (i32.const 11))))
  61. (drop (ref.cast $t1 (table.get (i32.const 12))))
  62. (drop (ref.cast $t2' (table.get (i32.const 2))))
  63. (drop (ref.cast $t2 (table.get (i32.const 12))))
  64. )
  65. )