From 6d61e72344bfc606304a3ef4b256539e3b216a14 Mon Sep 17 00:00:00 2001 From: Zhenwei Jin <109658203+kylo5aby@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:43:24 +0800 Subject: [PATCH] Update unit test cases (#4214) * Update gc unit test cases * Update aot stack frame unit test cases --- tests/unit/aot-stack-frame/CMakeLists.txt | 25 ++- .../aot-stack-frame/aot_stack_frame_test.cc | 69 +------ .../aot-stack-frame/wasm-apps/CMakeLists.txt | 2 +- tests/unit/gc/wasm-apps/func1.wasm | Bin 106 -> 71 bytes tests/unit/gc/wasm-apps/func1.wast | 4 +- tests/unit/gc/wasm-apps/func2.wasm | Bin 470 -> 8 bytes tests/unit/gc/wasm-apps/struct1.wasm | Bin 85 -> 8 bytes tests/unit/gc/wasm-apps/struct2.wasm | Bin 234 -> 302 bytes tests/unit/gc/wasm-apps/struct2.wast | 34 +++- tests/unit/gc/wasm-apps/struct3.wasm | Bin 118 -> 94 bytes tests/unit/gc/wasm-apps/test1.wasm | Bin 647 -> 8 bytes tests/unit/gc/wasm-apps/test2.wasm | Bin 626 -> 626 bytes tests/unit/gc/wasm-apps/test2.wast | 57 +++--- tests/unit/gc/wasm-apps/test3.wasm | Bin 976 -> 931 bytes tests/unit/gc/wasm-apps/test3.wast | 184 +++++++++--------- tests/unit/gc/wasm-apps/test4.wasm | Bin 299 -> 322 bytes tests/unit/gc/wasm-apps/test4.wast | 33 ++-- tests/unit/gc/wasm-apps/test5.wasm | Bin 512 -> 466 bytes tests/unit/gc/wasm-apps/test5.wast | 92 ++++----- tests/unit/gc/wasm-apps/test6.wasm | Bin 197 -> 139 bytes tests/unit/gc/wasm-apps/test6.wast | 14 +- 21 files changed, 237 insertions(+), 277 deletions(-) diff --git a/tests/unit/aot-stack-frame/CMakeLists.txt b/tests/unit/aot-stack-frame/CMakeLists.txt index cbdc62f65..90a61aea7 100644 --- a/tests/unit/aot-stack-frame/CMakeLists.txt +++ b/tests/unit/aot-stack-frame/CMakeLists.txt @@ -17,6 +17,7 @@ set (WAMR_BUILD_LIBC_BUILTIN 0) set (WAMR_BUILD_MULTI_MODULE 0) set (WAMR_DISABLE_HW_BOUND_CHECK 1) set (WAMR_DISABLE_WRITE_GS_BASE 1) +set (WAMR_BUILD_GC 1) include (../unit_common.cmake) @@ -31,15 +32,21 @@ file (GLOB_RECURSE source_all ${CMAKE_CURRENT_SOURCE_DIR}/*.cc) set (UNIT_SOURCE ${source_all}) set (unit_test_sources - ${UNIT_SOURCE} - ${PLATFORM_SHARED_SOURCE} - ${UTILS_SHARED_SOURCE} - ${MEM_ALLOC_SHARED_SOURCE} - ${NATIVE_INTERFACE_SOURCE} - ${IWASM_COMMON_SOURCE} - ${IWASM_INTERP_SOURCE} - ${IWASM_AOT_SOURCE} - ${WASM_APP_LIB_SOURCE_ALL} + ${UNIT_SOURCE} + ${WAMR_RUNTIME_LIB_SOURCE} + ${UNCOMMON_SHARED_SOURCE} + ${SRC_LIST} + ${PLATFORM_SHARED_SOURCE} + ${UTILS_SHARED_SOURCE} + ${MEM_ALLOC_SHARED_SOURCE} + ${LIB_HOST_AGENT_SOURCE} + ${NATIVE_INTERFACE_SOURCE} + ${LIBC_BUILTIN_SOURCE} + ${IWASM_COMMON_SOURCE} + ${IWASM_INTERP_SOURCE} + ${IWASM_AOT_SOURCE} + ${IWASM_COMPL_SOURCE} + ${WASM_APP_LIB_SOURCE_ALL} ) # Automatically build wasm-apps for this test diff --git a/tests/unit/aot-stack-frame/aot_stack_frame_test.cc b/tests/unit/aot-stack-frame/aot_stack_frame_test.cc index 9bea2b2a0..bcc1e246c 100644 --- a/tests/unit/aot-stack-frame/aot_stack_frame_test.cc +++ b/tests/unit/aot-stack-frame/aot_stack_frame_test.cc @@ -162,57 +162,6 @@ TEST_F(AOTStackFrameTest, test1) exec_env = wasm_runtime_create_exec_env(module_inst, 8 * 1024); ASSERT_TRUE(exec_env != NULL); - func_inst = wasm_runtime_lookup_function(module_inst, "test1"); - ASSERT_TRUE(func_inst != NULL); - - argv[0] = 33; - argv[1] = 44; - wasm_runtime_call_wasm(exec_env, func_inst, 2, argv); - ASSERT_TRUE(wasm_runtime_get_exception(module_inst)); - - frames = AOTStackFrameTest::my_frames; - frame_num = AOTStackFrameTest::my_frame_num; - - ASSERT_TRUE(frames != NULL); - ASSERT_TRUE(frame_num == 1); - - ASSERT_TRUE(frames[0]->lp[0] == 33); - ASSERT_TRUE(frames[0]->lp[1] == 44); - ASSERT_TRUE(frames[0]->lp[2] == 0x11223344); - ASSERT_TRUE(*(uint64 *)(frames[0]->lp + 3) == 0x12345678ABCDEF99LL); - ASSERT_TRUE(*(float *)(frames[0]->lp + 5) == 5566.7788f); - ASSERT_TRUE(*(double *)(frames[0]->lp + 6) == 99887766.55443322); - - wasm_runtime_destroy_exec_env(exec_env); - exec_env = NULL; - - wasm_runtime_deinstantiate(module_inst); - module_inst = NULL; - - wasm_runtime_unload(module); - module = NULL; -} - -TEST_F(AOTStackFrameTest, test2) -{ - MyAOTFrame *frame, **frames; - uint32 frame_num; - - aot_set_stack_frame_callback(aot_stack_frame_cb); - - bh_memcpy_s(test_aot_buf, sizeof(test_aot_buf), test_aot, sizeof(test_aot)); - - module = wasm_runtime_load(test_aot_buf, sizeof(test_aot), error_buf, - sizeof(error_buf)); - ASSERT_TRUE(module != NULL); - - module_inst = wasm_runtime_instantiate(module, 16384, 0, error_buf, - sizeof(error_buf)); - ASSERT_TRUE(module_inst != NULL); - - exec_env = wasm_runtime_create_exec_env(module_inst, 8 * 1024); - ASSERT_TRUE(exec_env != NULL); - func_inst = wasm_runtime_lookup_function(module_inst, "test2"); ASSERT_TRUE(func_inst != NULL); @@ -233,11 +182,9 @@ TEST_F(AOTStackFrameTest, test2) ASSERT_TRUE(*(uint64 *)(frames[0]->lp + 3) == 0x12345678ABCDEF99LL); ASSERT_TRUE(*(float *)(frames[0]->lp + 5) == 5566.7788f); ASSERT_TRUE(*(double *)(frames[0]->lp + 6) == 99887766.55443322); - ASSERT_TRUE(frames[0]->lp[8] == 0x1234); - ASSERT_TRUE(frames[0]->lp[9] == 0x5678); } -TEST_F(AOTStackFrameTest, test3) +TEST_F(AOTStackFrameTest, test2) { MyAOTFrame *frame, **frames; uint32 frame_num; @@ -271,18 +218,14 @@ TEST_F(AOTStackFrameTest, test3) ASSERT_TRUE(frames != NULL); ASSERT_TRUE(frame_num == 2); - ASSERT_TRUE(frames[0]->sp - frames[0]->lp == 5); - ASSERT_TRUE(frames[0]->ip_offset == 24); + // 5(i32) + 1(i64) local variables, occupied 7 * 4 bytes + ASSERT_TRUE(frames[0]->sp - frames[0]->lp == 7); + + // offset of ip from module load address + ASSERT_TRUE(frames[0]->ip_offset == 163); ASSERT_TRUE(frames[0]->lp[0] == 1234); ASSERT_TRUE(frames[0]->lp[1] == 5678); ASSERT_TRUE(frames[0]->lp[2] == 0x11223344); ASSERT_TRUE(*(uint64 *)(frames[0]->lp + 3) == 0x12345678ABCDEF99LL); - - ASSERT_TRUE(frames[1]->lp[0] == 0x1234); - ASSERT_TRUE(frames[1]->lp[1] == 0x5678); - ASSERT_TRUE(frames[1]->lp[2] == 0x11223344); - ASSERT_TRUE(*(uint64 *)(frames[1]->lp + 3) == 0x12345678ABCDEF99LL); - ASSERT_TRUE(*(float *)(frames[1]->lp + 5) == 5566.7788f); - ASSERT_TRUE(*(double *)(frames[1]->lp + 6) == 99887766.55443322); } diff --git a/tests/unit/aot-stack-frame/wasm-apps/CMakeLists.txt b/tests/unit/aot-stack-frame/wasm-apps/CMakeLists.txt index 2becb77c9..6c43a4184 100644 --- a/tests/unit/aot-stack-frame/wasm-apps/CMakeLists.txt +++ b/tests/unit/aot-stack-frame/wasm-apps/CMakeLists.txt @@ -13,7 +13,7 @@ add_custom_target(aot-stack-frame-test-wasm ALL -o ${CMAKE_CURRENT_BINARY_DIR}/test.wasm ${CMAKE_CURRENT_LIST_DIR}/test.wast && ${CMAKE_CURRENT_BINARY_DIR}/build-wamrc/wamrc - --enable-dump-call-stack --bounds-checks=1 + --enable-dump-call-stack --bounds-checks=1 --enable-gc -o ${CMAKE_CURRENT_BINARY_DIR}/test.aot ${CMAKE_CURRENT_BINARY_DIR}/test.wasm && cmake -B ${CMAKE_CURRENT_BINARY_DIR}/build-binarydump diff --git a/tests/unit/gc/wasm-apps/func1.wasm b/tests/unit/gc/wasm-apps/func1.wasm index 51b316b54edacd385cb79b8d54e8ebe886eb0c20..1553dec75fd9882fce678c3a91f2e8d93aca3cfa 100644 GIT binary patch literal 71 zcmV~$yAFUL5Cp*8^Abf{V?jlXABG_|0zLwNPs0q(k_muDJm4iJ3_^|*wO*wH^TFNd Xr>{JcCGwV}0St6#>u(*~mh932hJ*}q literal 106 zcmZQbEY4+QU|?YEY-ng;U`k+MNMK6OVqk6paTyueJHRwcNosKk0|VD~FmEG>6ksl3 s&S%VH%wPq&S7B8VPq^|1kw=UEXH&NhTk4(QVNW}9kZmk0cPtN<^TWy diff --git a/tests/unit/gc/wasm-apps/func1.wast b/tests/unit/gc/wasm-apps/func1.wast index 1b4941787..adc9640e7 100644 --- a/tests/unit/gc/wasm-apps/func1.wast +++ b/tests/unit/gc/wasm-apps/func1.wast @@ -26,10 +26,10 @@ (local (ref null struct)) local.get 0 - ref.test null array + ref.test (ref array) drop local.get 1 - ref.cast i31 + ref.cast (ref i31) drop ) ) diff --git a/tests/unit/gc/wasm-apps/func2.wasm b/tests/unit/gc/wasm-apps/func2.wasm index e5d852ce4664d9109bc5ae6e0c5f7da48096d746..d8fc92d022fbf4d1072da17bc8e0840054b51ddc 100644 GIT binary patch literal 8 PcmZQbEY4+QU|;|M2ZjMd literal 470 zcmcJKO=`q23`U=l$)+dhsz>ON;iMMtn~{e0(kf z$k*e3=Y51xqA}r+RpHTk{>JMo6g)Z)`ut}Aj z8&@(bArn>-3lpA*jXmnE;+bvs@%k2s> diff --git a/tests/unit/gc/wasm-apps/struct1.wasm b/tests/unit/gc/wasm-apps/struct1.wasm index 513442f96f3d8e21005d6c4048092279380f9420..d8fc92d022fbf4d1072da17bc8e0840054b51ddc 100644 GIT binary patch literal 8 PcmZQbEY4+QU|;|M2ZjMd literal 85 zcmXAeNeX~K48T$uLHuO#>V_~Ui`xFqZ&{Tb0trK11dux-=#)eZEyj;Fj-$P?r!P(p SRyHP>1#RDEjM=pKcbx}0=@RMy diff --git a/tests/unit/gc/wasm-apps/struct2.wasm b/tests/unit/gc/wasm-apps/struct2.wasm index 497a96441938f39943904cfb416a6bcc60893952..7d22e80fdd4a6472e555f1576c30f258d9056529 100644 GIT binary patch literal 302 zcmZ{dK@Ng25JmsAlu{~&6BrUNfG3c|rH25c#FcC?8Wv6T+}$`uWI5 diff --git a/tests/unit/gc/wasm-apps/test1.wasm b/tests/unit/gc/wasm-apps/test1.wasm index d907e457f589c37ecdb58ceac4ac65fd12e46af4..d8fc92d022fbf4d1072da17bc8e0840054b51ddc 100644 GIT binary patch literal 8 PcmZQbEY4+QU|;|M2ZjMd literal 647 zcmd5%NlwE+5Uh3x2VTJ&P;x;$A}?s0L+r#g9$VsMEAiyOr@2vMgAgA;sMXb@nyOy# z`qmi$`*^?I@KOQQeE_kf(NH}NeeBw%KAulMFAnS(*|BBAnn#{_3J4a8FAYIs@msbT zdRkSaB-x)0Djz3|mTblq7YyjZ0qhacp+SvSry>-~Pv+W%CA2@d$(TK1tK(4SunFbe zgf+?{A)$QG4Apf;ltcck-)3%7&nQn?Hjw(?ZR8VtgeUk6zrru@2xp_L;VMF1@o{hUJ>MlCw6h{J@|zWK5n5e4$$nj4Yts`#qjPH#zniB7ujxEU~t|NKg;|B z%zt;Rc4CR)S(~c+k<<3|Ai=%}GMc$N{*TzBXZ0SYfx-HDQm-W`0bADQq7rkstXh-u zYD=oQrks-Nk})#Fg)})8gBj!%xmhK(qsr%ucBZ8K8>FbRIVX~k@)<}qcPOXwnksc# zT^N;6Zok#{&v1h;C33Qj?Dv*QM>JIQ>87EZK8+h1_vyN!>pqPd8b#d%OijS#BtJ7)%!Pm)|ExtwGtNiLnFp-E)_0={Xnd;kCd literal 626 zcmZ9HK~94}6o&s9ptMjmX*>WMyEk5-?0O0*sX!s^Kq*bEo1%#u6Jzu^o&r697nzN3 zz(A3N|9|hBe`emm-)$HG_EDB4j0ND~_5ll)(tl(}?N#wHG`;&?6w(B&3|0!u{CuR| z)?*PDV3Rxuy&~8Zp4hL~-ko3g;Nuqh;sDKV+h7a5Ta0h6VO+F}yCUB&3k=R%;^(=4 zfcfu^a4(h^p0%mEA6>S6JxFk01Ub#z9sft{(X)CF)4*W;JgL``lz=U3b5V&YTvkP- zyb4G)*OU&qE;%DJT*wKhV&Fh#Sh+_1UEl)l?yC>0{{9Se zV~Z<<6{4fHOfHkpRE#t?^QcRCjW;MSX*`=7lhYmJR0sYTr#dcKH)qu386{#biFiXI zI)3SL&&@>ap_PL*wQ}%|IEkkJJESsf^b=$!s6rQkAF(0m4uUiUY5b@ms0V^H1Zm1q rLy(4`gb~hb)E}mwEy@2im@1E`&a}*=>Zf6eq!URuoobZYBeAR>+}+;9 literal 976 zcmb7?F;2rk5JhKaZEWlyD7XUYxP!NdM420efRHOfkx(Z{h#OFF6&iY~+=C-*!=Jxv zo0jT*ujkL-8C%xdM<*ig>u@;8=~7m*bh2{$32vo(v1c8GOajLz>FHL)zgiPt*L6YV zdbzAV>`d$3!*+MQeZCXdP~NXMPaDzZ`^_w$RwO~9%3MN|;G#M_wNVw&s2-R_EdU?2 z1d6EDT-qPRiCl!5M^y~U5?oFokw7AWL;{Hf zW9m!AzI=xsKKCHegG3J!JxKI020D2HXPKQOoFtqioFtsazzKK)XO*2KoFtqioFtsa zz=^4BN1bhzvm|9VO3D(FGRL2~aprDPoQ4kGjt-{waN@H8F2N_12^GS54ZP({R>mt* z@D&{Cf+m<@f)OTIgLbLL1ZOb88WXIsEc+Qc6Ra`8h7jkiwC^v&|CSv8+D$WVsU6j9 ZR1DU|kW9ro?vQoUHVdocneEkX_6yM(<=+4R diff --git a/tests/unit/gc/wasm-apps/test3.wast b/tests/unit/gc/wasm-apps/test3.wast index 4df02ce8f..e551b14b4 100644 --- a/tests/unit/gc/wasm-apps/test3.wast +++ b/tests/unit/gc/wasm-apps/test3.wast @@ -11,105 +11,105 @@ (table 20 (ref null struct)) (func $init - (table.set (i32.const 0) (struct.new_canon_default $t0)) - (table.set (i32.const 10) (struct.new_canon_default $t0)) - (table.set (i32.const 1) (struct.new_canon_default $t1)) - (table.set (i32.const 11) (struct.new_canon_default $t1')) - (table.set (i32.const 2) (struct.new_canon_default $t2)) - (table.set (i32.const 12) (struct.new_canon_default $t2')) - (table.set (i32.const 3) (struct.new_canon_default $t3)) - (table.set (i32.const 4) (struct.new_canon_default $t4)) + (table.set (i32.const 0) (struct.new_default $t0)) + (table.set (i32.const 10) (struct.new_default $t0)) + (table.set (i32.const 1) (struct.new_default $t1)) + (table.set (i32.const 11) (struct.new_default $t1')) + (table.set (i32.const 2) (struct.new_default $t2)) + (table.set (i32.const 12) (struct.new_default $t2')) + (table.set (i32.const 3) (struct.new_default $t3)) + (table.set (i32.const 4) (struct.new_default $t4)) ) (func (export "test-sub") (call $init) (block $l ;; must hold - (br_if $l (i32.eqz (ref.test null $t0 (ref.null struct)))) - (br_if $l (i32.eqz (ref.test null $t0 (ref.null $t0)))) - (br_if $l (i32.eqz (ref.test null $t0 (ref.null $t1)))) - (br_if $l (i32.eqz (ref.test null $t0 (ref.null $t2)))) - (br_if $l (i32.eqz (ref.test null $t0 (ref.null $t3)))) - (br_if $l (i32.eqz (ref.test null $t0 (ref.null $t4)))) - (br_if $l (i32.eqz (ref.test null $t0 (table.get (i32.const 0))))) - (br_if $l (i32.eqz (ref.test null $t0 (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test null $t0 (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test null $t0 (table.get (i32.const 3))))) - (br_if $l (i32.eqz (ref.test null $t0 (table.get (i32.const 4))))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null struct)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null $t0)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null $t1)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null $t2)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null $t3)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (ref.null $t4)))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (table.get (i32.const 0))))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (table.get (i32.const 3))))) + (br_if $l (i32.eqz (ref.test (ref null $t0) (table.get (i32.const 4))))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null struct)))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null $t0)))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null $t1)))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null $t2)))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null $t3)))) - (br_if $l (i32.eqz (ref.test null $t1 (ref.null $t4)))) - (br_if $l (i32.eqz (ref.test null $t1 (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test null $t1 (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null struct)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null $t0)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null $t1)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null $t2)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null $t3)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (ref.null $t4)))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref null $t1) (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null struct)))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null $t0)))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null $t1)))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null $t2)))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null $t3)))) - (br_if $l (i32.eqz (ref.test null $t2 (ref.null $t4)))) - (br_if $l (i32.eqz (ref.test null $t2 (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null struct)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null $t0)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null $t1)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null $t2)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null $t3)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (ref.null $t4)))) + (br_if $l (i32.eqz (ref.test (ref null $t2) (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null struct)))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null $t0)))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null $t1)))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null $t2)))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null $t3)))) - (br_if $l (i32.eqz (ref.test null $t3 (ref.null $t4)))) - (br_if $l (i32.eqz (ref.test null $t3 (table.get (i32.const 3))))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null struct)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null $t0)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null $t1)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null $t2)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null $t3)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (ref.null $t4)))) + (br_if $l (i32.eqz (ref.test (ref null $t3) (table.get (i32.const 3))))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null struct)))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null $t0)))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null $t1)))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null $t2)))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null $t3)))) - (br_if $l (i32.eqz (ref.test null $t4 (ref.null $t4)))) - (br_if $l (i32.eqz (ref.test null $t4 (table.get (i32.const 4))))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null struct)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null $t0)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null $t1)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null $t2)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null $t3)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (ref.null $t4)))) + (br_if $l (i32.eqz (ref.test (ref null $t4) (table.get (i32.const 4))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 0))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 3))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 4))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 0))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 3))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 4))))) - (br_if $l (i32.eqz (ref.test $t1 (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test $t1 (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t1) (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref $t1) (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t2 (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t2) (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t3 (table.get (i32.const 3))))) + (br_if $l (i32.eqz (ref.test (ref $t3) (table.get (i32.const 3))))) - (br_if $l (i32.eqz (ref.test $t4 (table.get (i32.const 4))))) + (br_if $l (i32.eqz (ref.test (ref $t4) (table.get (i32.const 4))))) ;; must not hold - (br_if $l (ref.test $t0 (ref.null struct))) - (br_if $l (ref.test $t1 (ref.null struct))) - (br_if $l (ref.test $t2 (ref.null struct))) - (br_if $l (ref.test $t3 (ref.null struct))) - (br_if $l (ref.test $t4 (ref.null struct))) + (br_if $l (ref.test (ref $t0) (ref.null struct))) + (br_if $l (ref.test (ref $t1) (ref.null struct))) + (br_if $l (ref.test (ref $t2) (ref.null struct))) + (br_if $l (ref.test (ref $t3) (ref.null struct))) + (br_if $l (ref.test (ref $t4) (ref.null struct))) - (br_if $l (ref.test $t1 (table.get (i32.const 0)))) - (br_if $l (ref.test $t1 (table.get (i32.const 3)))) - (br_if $l (ref.test $t1 (table.get (i32.const 4)))) + (br_if $l (ref.test (ref $t1) (table.get (i32.const 0)))) + (br_if $l (ref.test (ref $t1) (table.get (i32.const 3)))) + (br_if $l (ref.test (ref $t1) (table.get (i32.const 4)))) - (br_if $l (ref.test $t2 (table.get (i32.const 0)))) - (br_if $l (ref.test $t2 (table.get (i32.const 1)))) - (br_if $l (ref.test $t2 (table.get (i32.const 3)))) - (br_if $l (ref.test $t2 (table.get (i32.const 4)))) + (br_if $l (ref.test (ref $t2) (table.get (i32.const 0)))) + (br_if $l (ref.test (ref $t2) (table.get (i32.const 1)))) + (br_if $l (ref.test (ref $t2) (table.get (i32.const 3)))) + (br_if $l (ref.test (ref $t2) (table.get (i32.const 4)))) - (br_if $l (ref.test $t3 (table.get (i32.const 0)))) - (br_if $l (ref.test $t3 (table.get (i32.const 1)))) - (br_if $l (ref.test $t3 (table.get (i32.const 2)))) - (br_if $l (ref.test $t3 (table.get (i32.const 4)))) + (br_if $l (ref.test (ref $t3) (table.get (i32.const 0)))) + (br_if $l (ref.test (ref $t3) (table.get (i32.const 1)))) + (br_if $l (ref.test (ref $t3) (table.get (i32.const 2)))) + (br_if $l (ref.test (ref $t3) (table.get (i32.const 4)))) - (br_if $l (ref.test $t4 (table.get (i32.const 0)))) - (br_if $l (ref.test $t4 (table.get (i32.const 1)))) - (br_if $l (ref.test $t4 (table.get (i32.const 2)))) - (br_if $l (ref.test $t4 (table.get (i32.const 3)))) + (br_if $l (ref.test (ref $t4) (table.get (i32.const 0)))) + (br_if $l (ref.test (ref $t4) (table.get (i32.const 1)))) + (br_if $l (ref.test (ref $t4) (table.get (i32.const 2)))) + (br_if $l (ref.test (ref $t4) (table.get (i32.const 3)))) (return) ) @@ -119,25 +119,25 @@ (func (export "test-canon") (call $init) (block $l - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 0))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 3))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 4))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 0))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 3))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 4))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 10))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 11))))) - (br_if $l (i32.eqz (ref.test $t0 (table.get (i32.const 12))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 10))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 11))))) + (br_if $l (i32.eqz (ref.test (ref $t0) (table.get (i32.const 12))))) - (br_if $l (i32.eqz (ref.test $t1' (table.get (i32.const 1))))) - (br_if $l (i32.eqz (ref.test $t1' (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t1') (table.get (i32.const 1))))) + (br_if $l (i32.eqz (ref.test (ref $t1') (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t1 (table.get (i32.const 11))))) - (br_if $l (i32.eqz (ref.test $t1 (table.get (i32.const 12))))) + (br_if $l (i32.eqz (ref.test (ref $t1) (table.get (i32.const 11))))) + (br_if $l (i32.eqz (ref.test (ref $t1) (table.get (i32.const 12))))) - (br_if $l (i32.eqz (ref.test $t2' (table.get (i32.const 2))))) + (br_if $l (i32.eqz (ref.test (ref $t2') (table.get (i32.const 2))))) - (br_if $l (i32.eqz (ref.test $t2 (table.get (i32.const 12))))) + (br_if $l (i32.eqz (ref.test (ref $t2) (table.get (i32.const 12))))) (return) ) diff --git a/tests/unit/gc/wasm-apps/test4.wasm b/tests/unit/gc/wasm-apps/test4.wasm index b4841a82cb878091351cbe6e43bbcdef6e88341f..e7522e88fff5dd36390f91f31b6c6f17f8bc4868 100644 GIT binary patch literal 322 zcmYL>y$*sf6ot=)LXGu*(4=v2(ZS8Qx$zZE$j@@Vd%oUV zgxQ4v(AWv+g#ZZX3LpCi><%Z(JOPZ6LYMDd7OOZnyXoQRM`4!x>Z*KoPZC)D))n3E zH9g*Lz=loD^7J0%a0ZPD(=>d-?Y@ay5IcDI+*a_&<9cprX|fG$51KPGum!X!Z5?qq__ba>{DX^ diff --git a/tests/unit/gc/wasm-apps/test4.wast b/tests/unit/gc/wasm-apps/test4.wast index 8bf02e430..eeec11faa 100644 --- a/tests/unit/gc/wasm-apps/test4.wast +++ b/tests/unit/gc/wasm-apps/test4.wast @@ -10,10 +10,10 @@ (func (export "init") (param $x externref) (table.set (i32.const 0) (ref.null any)) - (table.set (i32.const 1) (i31.new (i32.const 7))) - (table.set (i32.const 2) (struct.new_canon_default $st)) - (table.set (i32.const 3) (array.new_canon_default $at (i32.const 0))) - (table.set (i32.const 4) (extern.internalize (local.get $x))) + (table.set (i32.const 1) (ref.i31 (i32.const 7))) + (table.set (i32.const 2) (struct.new_default $st)) + (table.set (i32.const 3) (array.new_default $at (i32.const 0))) + (table.set (i32.const 4) (any.convert_extern (local.get $x))) (table.set (i32.const 5) (ref.null i31)) (table.set (i32.const 6) (ref.null struct)) (table.set (i32.const 7) (ref.null none)) @@ -21,26 +21,25 @@ (func (export "ref_cast_non_null") (param $i i32) (drop (ref.as_non_null (table.get (local.get $i)))) - (drop (ref.cast null any (table.get (local.get $i)))) + (drop (ref.cast (ref null any) (table.get (local.get $i)))) ) (func (export "ref_cast_null") (param $i i32) - (drop (ref.cast null any (table.get (local.get $i)))) - (drop (ref.cast null struct (table.get (local.get $i)))) - (drop (ref.cast null array (table.get (local.get $i)))) - (drop (ref.cast null i31 (table.get (local.get $i)))) - (drop (ref.cast null none (table.get (local.get $i)))) + (drop (ref.cast anyref (table.get (local.get $i)))) + (drop (ref.cast structref (table.get (local.get $i)))) + (drop (ref.cast arrayref (table.get (local.get $i)))) + (drop (ref.cast i31ref (table.get (local.get $i)))) + (drop (ref.cast nullref (table.get (local.get $i)))) ) (func (export "ref_cast_i31") (param $i i32) - (drop (ref.cast i31 (table.get (local.get $i)))) - (drop (ref.cast null i31 (table.get (local.get $i)))) + (drop (ref.cast (ref i31) (table.get (local.get $i)))) + (drop (ref.cast i31ref (table.get (local.get $i)))) ) (func (export "ref_cast_struct") (param $i i32) - (drop (ref.cast struct (table.get (local.get $i)))) - (drop (ref.cast null struct (table.get (local.get $i)))) + (drop (ref.cast (ref struct) (table.get (local.get $i)))) + (drop (ref.cast structref (table.get (local.get $i)))) ) (func (export "ref_cast_array") (param $i i32) - (drop (ref.cast array (table.get (local.get $i)))) - (drop (ref.cast null array (table.get (local.get $i)))) + (drop (ref.cast (ref array) (table.get (local.get $i)))) + (drop (ref.cast arrayref (table.get (local.get $i)))) ) ) - diff --git a/tests/unit/gc/wasm-apps/test5.wasm b/tests/unit/gc/wasm-apps/test5.wasm index 050ead4ae9fde01db1690721be8f931206be8d43..e92d600d152d5087749beff4530eb73932b34672 100644 GIT binary patch literal 466 zcmaKmF-`+96hvpf%?7PgP@s))PdY?T=Nse(OF&eJplFwRFUBFb2?ub4{rwZsfSc#> z%>QHTr#AxN{c491J7VNgz)=<~c!WOby?RAmG{<>Yj`w`U_3B10=a*@|n?9bvUa!yl z!}|f!e~WuSLMFCIeFHODRA`V)DQex|GJR1#v)dwk5?A;-=FKrC+#+uf6OCeYM&D>@ zO)(}-G1{vtIVqj=G3jL28U|~qtm(>{tE{=RZ@Y&R#d5Z9=wg`5=k?p?p?{Y4wmcZu Qf0U_TO4a{Wu3BRF0l~sx=l}o! literal 512 zcmaKoF;c@o3`M`R4mREtDX6w5T@JA&U2b3k!=xe<4s}e1OK=s28Lq%#sMrQcmPsnA zr!W04t&L6pNC4<_7zSLf(P2&K=x_pce1K}63Y-dQUySM&2(P*%G)+@kMO$3eZ`$K# z|IqJO{qr5Dweo(md)k59pQA?J)r5?~SR%J0s4$6&g;~IbgJ52`5`@AtK~=b3B7VGR ze1WfRxk1XfhLN1?49;q#yUj%@n~RcnO@&EWa+b0s>+wRCOPW=xTd6*!`u^s=J5LPm n^L@Ea@!P(CA%EaJ_|M|jebG5T&#^y9XmdGi^XUPV>yY9vVfuIE diff --git a/tests/unit/gc/wasm-apps/test5.wast b/tests/unit/gc/wasm-apps/test5.wast index 895473ce3..f74da50e8 100644 --- a/tests/unit/gc/wasm-apps/test5.wast +++ b/tests/unit/gc/wasm-apps/test5.wast @@ -11,75 +11,75 @@ (table 20 (ref null struct)) (func $init - (table.set (i32.const 0) (struct.new_canon_default $t0)) - (table.set (i32.const 10) (struct.new_canon_default $t0)) - (table.set (i32.const 1) (struct.new_canon_default $t1)) - (table.set (i32.const 11) (struct.new_canon_default $t1')) - (table.set (i32.const 2) (struct.new_canon_default $t2)) - (table.set (i32.const 12) (struct.new_canon_default $t2')) - (table.set (i32.const 3) (struct.new_canon_default $t3)) - (table.set (i32.const 4) (struct.new_canon_default $t4)) + (table.set (i32.const 0) (struct.new_default $t0)) + (table.set (i32.const 10) (struct.new_default $t0)) + (table.set (i32.const 1) (struct.new_default $t1)) + (table.set (i32.const 11) (struct.new_default $t1')) + (table.set (i32.const 2) (struct.new_default $t2)) + (table.set (i32.const 12) (struct.new_default $t2')) + (table.set (i32.const 3) (struct.new_default $t3)) + (table.set (i32.const 4) (struct.new_default $t4)) ) (func (export "test-sub") (call $init) - (drop (ref.cast null $t0 (ref.null struct))) - (drop (ref.cast null $t0 (table.get (i32.const 0)))) - (drop (ref.cast null $t0 (table.get (i32.const 1)))) - (drop (ref.cast null $t0 (table.get (i32.const 2)))) - (drop (ref.cast null $t0 (table.get (i32.const 3)))) - (drop (ref.cast null $t0 (table.get (i32.const 4)))) + (drop (ref.cast (ref null $t0) (ref.null struct))) + (drop (ref.cast (ref null $t0) (table.get (i32.const 0)))) + (drop (ref.cast (ref null $t0) (table.get (i32.const 1)))) + (drop (ref.cast (ref null $t0) (table.get (i32.const 2)))) + (drop (ref.cast (ref null $t0) (table.get (i32.const 3)))) + (drop (ref.cast (ref null $t0) (table.get (i32.const 4)))) - (drop (ref.cast null $t0 (ref.null struct))) - (drop (ref.cast null $t1 (table.get (i32.const 1)))) - (drop (ref.cast null $t1 (table.get (i32.const 2)))) + (drop (ref.cast (ref null $t0) (ref.null struct))) + (drop (ref.cast (ref null $t1) (table.get (i32.const 1)))) + (drop (ref.cast (ref null $t1) (table.get (i32.const 2)))) - (drop (ref.cast null $t0 (ref.null struct))) - (drop (ref.cast null $t2 (table.get (i32.const 2)))) + (drop (ref.cast (ref null $t0) (ref.null struct))) + (drop (ref.cast (ref null $t2) (table.get (i32.const 2)))) - (drop (ref.cast null $t0 (ref.null struct))) - (drop (ref.cast null $t3 (table.get (i32.const 3)))) + (drop (ref.cast (ref null $t0) (ref.null struct))) + (drop (ref.cast (ref null $t3) (table.get (i32.const 3)))) - (drop (ref.cast null $t4 (table.get (i32.const 4)))) + (drop (ref.cast (ref null $t4) (table.get (i32.const 4)))) - (drop (ref.cast $t0 (table.get (i32.const 0)))) - (drop (ref.cast $t0 (table.get (i32.const 1)))) - (drop (ref.cast $t0 (table.get (i32.const 2)))) - (drop (ref.cast $t0 (table.get (i32.const 3)))) - (drop (ref.cast $t0 (table.get (i32.const 4)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 0)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 1)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 2)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 3)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 4)))) - (drop (ref.cast $t1 (table.get (i32.const 1)))) - (drop (ref.cast $t1 (table.get (i32.const 2)))) + (drop (ref.cast (ref $t1) (table.get (i32.const 1)))) + (drop (ref.cast (ref $t1) (table.get (i32.const 2)))) - (drop (ref.cast $t2 (table.get (i32.const 2)))) + (drop (ref.cast (ref $t2) (table.get (i32.const 2)))) - (drop (ref.cast $t3 (table.get (i32.const 3)))) + (drop (ref.cast (ref $t3) (table.get (i32.const 3)))) - (drop (ref.cast $t4 (table.get (i32.const 4)))) + (drop (ref.cast (ref $t4) (table.get (i32.const 4)))) ) (func (export "test-canon") (call $init) - (drop (ref.cast $t0 (table.get (i32.const 0)))) - (drop (ref.cast $t0 (table.get (i32.const 1)))) - (drop (ref.cast $t0 (table.get (i32.const 2)))) - (drop (ref.cast $t0 (table.get (i32.const 3)))) - (drop (ref.cast $t0 (table.get (i32.const 4)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 0)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 1)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 2)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 3)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 4)))) - (drop (ref.cast $t0 (table.get (i32.const 10)))) - (drop (ref.cast $t0 (table.get (i32.const 11)))) - (drop (ref.cast $t0 (table.get (i32.const 12)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 10)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 11)))) + (drop (ref.cast (ref $t0) (table.get (i32.const 12)))) - (drop (ref.cast $t1' (table.get (i32.const 1)))) - (drop (ref.cast $t1' (table.get (i32.const 2)))) + (drop (ref.cast (ref $t1') (table.get (i32.const 1)))) + (drop (ref.cast (ref $t1') (table.get (i32.const 2)))) - (drop (ref.cast $t1 (table.get (i32.const 11)))) - (drop (ref.cast $t1 (table.get (i32.const 12)))) + (drop (ref.cast (ref $t1) (table.get (i32.const 11)))) + (drop (ref.cast (ref $t1) (table.get (i32.const 12)))) - (drop (ref.cast $t2' (table.get (i32.const 2)))) + (drop (ref.cast (ref $t2') (table.get (i32.const 2)))) - (drop (ref.cast $t2 (table.get (i32.const 12)))) + (drop (ref.cast (ref $t2) (table.get (i32.const 12)))) ) ) diff --git a/tests/unit/gc/wasm-apps/test6.wasm b/tests/unit/gc/wasm-apps/test6.wasm index b1abc14729ffe04acd72180963e77174e24912ab..f6b7a9e4a5fa88b46fbe2616c63b70d7077e64bf 100644 GIT binary patch literal 139 zcmXYlAr8Vo6b0x1UD$>Vf&_`EDfjpWjX*;Yh>DUlt*F~8l5m_gY)Z|WH^X!61(1Wk z^58zxLaQlBa!%EGFFnVwSKqz63G_7}yPIAxKEoN4Wz|AH6>}@SRf})3Q1bSVVB{dh OtM$Z4O+zgW-}nRFw;5yr literal 197 zcmXYpu?@m75Jmr83^t@g4B#g0;SD?ign}YSMnX{0*b;P6W?>8JG<0m@2HQz-|J{Gm z9ga6g0O%b;z{=u)G~}^=z*25gPFxlZuAud= us83E9jBW=*<2fZ88FgYcQy5kHA~KR*PLKw1!>Oxzsr&Luqk*Od-}(