-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add cross-ctx-account and cross-ctx-note tests
For testing cross-context lifting/lowering.
- Loading branch information
Showing
19 changed files
with
3,088 additions
and
0 deletions.
There are no files selected for viewing
285 changes: 285 additions & 0 deletions
285
tests/integration/expected/rust_sdk/cross_ctx_account.hir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,285 @@ | ||
(component | ||
;; Component Imports | ||
(lower ( (type (func (abi canon) (result u32)))) (#cross_ctx_account #miden_sdk_alloc::heap_base) | ||
|
||
;; Modules | ||
(module #cross_ctx_account | ||
;; Data Segments | ||
(data (mut) (offset 1048576) 0x010000000100000001000000010000000100000001000000010000000100000002000000) | ||
|
||
;; Constants | ||
(const (id 0) 0x00100000) | ||
|
||
;; Global Variables | ||
(global (export #__stack_pointer) (id 0) (type i32) (const 0)) | ||
|
||
;; Functions | ||
(func #__wasm_call_ctors | ||
(block 0 | ||
(br (block 1))) | ||
|
||
(block 1 | ||
(ret)) | ||
) | ||
|
||
(func #cross_ctx_account::bindings::__link_custom_section_describing_imports | ||
|
||
(block 0 | ||
(br (block 1))) | ||
|
||
(block 1 | ||
(ret)) | ||
) | ||
|
||
(func #__rust_alloc (param i32) (param i32) (result i32) | ||
(block 0 (param v0 i32) (param v1 i32) | ||
(let (v3 i32) (const.i32 1048612)) | ||
(let (v4 i32) (exec #<miden_sdk_alloc::BumpAlloc as core::alloc::global::GlobalAlloc>::alloc v3 v1 v0)) | ||
(br (block 1 v4))) | ||
|
||
(block 1 (param v2 i32) | ||
(ret v2)) | ||
) | ||
|
||
(func #__rust_realloc | ||
(param i32) (param i32) (param i32) (param i32) (result i32) | ||
(block 0 (param v0 i32) (param v1 i32) (param v2 i32) (param v3 i32) | ||
(let (v5 i32) (const.i32 1048612)) | ||
(let (v6 i32) (exec #<miden_sdk_alloc::BumpAlloc as core::alloc::global::GlobalAlloc>::alloc v5 v2 v3)) | ||
(let (v7 i1) (eq v6 0)) | ||
(let (v8 i32) (zext v7)) | ||
(let (v9 i1) (neq v8 0)) | ||
(condbr v9 (block 2 v6) (block 3))) | ||
|
||
(block 1 (param v4 i32) | ||
(ret v4)) | ||
|
||
(block 2 (param v21 i32) | ||
(br (block 1 v21))) | ||
|
||
(block 3 | ||
(let (v10 u32) (bitcast v1)) | ||
(let (v11 u32) (bitcast v3)) | ||
(let (v12 i1) (lt v10 v11)) | ||
(let (v13 i32) (sext v12)) | ||
(let (v14 i1) (neq v13 0)) | ||
(let (v15 i32) (select v14 v1 v3)) | ||
(let (v16 u32) (bitcast v15)) | ||
(let (v17 u32) (bitcast v6)) | ||
(let (v18 (ptr u8)) (inttoptr v17)) | ||
(let (v19 u32) (bitcast v0)) | ||
(let (v20 (ptr u8)) (inttoptr v19)) | ||
(memcpy v20 v18 v16) | ||
(br (block 2 v6))) | ||
) | ||
|
||
(func (export #miden:cross-ctx-account/[email protected]#process-felt) | ||
(param felt) (result felt) | ||
(block 0 (param v0 felt) | ||
(exec #wit_bindgen_rt::run_ctors_once) | ||
(let (v2 i32) (const.i32 3)) | ||
(let (v3 felt) (bitcast v2)) | ||
(let (v4 felt) (add.unchecked v0 v3)) | ||
(br (block 1 v4))) | ||
|
||
(block 1 (param v1 felt) | ||
(ret v1)) | ||
) | ||
|
||
(func (export #cabi_realloc_wit_bindgen_0_28_0) | ||
(param i32) (param i32) (param i32) (param i32) (result i32) | ||
(block 0 (param v0 i32) (param v1 i32) (param v2 i32) (param v3 i32) | ||
(let (v5 i32) (exec #wit_bindgen_rt::cabi_realloc v0 v1 v2 v3)) | ||
(br (block 1 v5))) | ||
|
||
(block 1 (param v4 i32) | ||
(ret v4)) | ||
) | ||
|
||
(func #wit_bindgen_rt::cabi_realloc | ||
(param i32) (param i32) (param i32) (param i32) (result i32) | ||
(block 0 (param v0 i32) (param v1 i32) (param v2 i32) (param v3 i32) | ||
(let (v5 i1) (neq v1 0)) | ||
(condbr v5 (block 4) (block 5))) | ||
|
||
(block 1 (param v4 i32) | ||
(ret v4)) | ||
|
||
(block 2 (param v19 i32) | ||
(br (block 1 v19))) | ||
|
||
(block 3 (param v17 i32) | ||
(let (v18 i1) (neq v17 0)) | ||
(condbr v18 (block 2 v17) (block 7))) | ||
|
||
(block 4 | ||
(let (v16 i32) (exec #__rust_realloc v0 v1 v2 v3)) | ||
(br (block 3 v16))) | ||
|
||
(block 5 | ||
(let (v6 i1) (eq v3 0)) | ||
(let (v7 i32) (zext v6)) | ||
(let (v8 i1) (neq v7 0)) | ||
(condbr v8 (block 2 v2) (block 6))) | ||
|
||
(block 6 | ||
(let (v9 i32) (const.i32 0)) | ||
(let (v10 u32) (bitcast v9)) | ||
(let (v11 u32) (add.checked v10 1048616)) | ||
(let (v12 (ptr u8)) (inttoptr v11)) | ||
(let (v13 u8) (load v12)) | ||
(let (v14 i32) (zext v13)) | ||
(let (v15 i32) (exec #__rust_alloc v3 v2)) | ||
(br (block 3 v15))) | ||
|
||
(block 7 | ||
(unreachable)) | ||
) | ||
|
||
(func #wit_bindgen_rt::run_ctors_once | ||
(block 0 | ||
(let (v0 i32) (const.i32 0)) | ||
(let (v1 u32) (bitcast v0)) | ||
(let (v2 u32) (add.checked v1 1048617)) | ||
(let (v3 (ptr u8)) (inttoptr v2)) | ||
(let (v4 u8) (load v3)) | ||
(let (v5 i32) (zext v4)) | ||
(let (v6 i1) (neq v5 0)) | ||
(condbr v6 (block 2) (block 3))) | ||
|
||
(block 1 | ||
(ret)) | ||
|
||
(block 2 | ||
(br (block 1))) | ||
|
||
(block 3 | ||
(exec #__wasm_call_ctors) | ||
(let (v7 i32) (const.i32 0)) | ||
(let (v8 i32) (const.i32 1)) | ||
(let (v9 u32) (bitcast v8)) | ||
(let (v10 u8) (trunc v9)) | ||
(let (v11 u32) (bitcast v7)) | ||
(let (v12 u32) (add.checked v11 1048617)) | ||
(let (v13 (ptr u8)) (inttoptr v12)) | ||
(store v13 v10) | ||
(br (block 2))) | ||
) | ||
|
||
(func #<miden_sdk_alloc::BumpAlloc as core::alloc::global::GlobalAlloc>::alloc | ||
(param i32) (param i32) (param i32) (result i32) | ||
(block 0 (param v0 i32) (param v1 i32) (param v2 i32) | ||
(let (v4 i32) (const.i32 0)) | ||
(let (v5 i32) (const.i32 32)) | ||
(let (v6 i32) (const.i32 32)) | ||
(let (v7 u32) (bitcast v1)) | ||
(let (v8 u32) (bitcast v6)) | ||
(let (v9 i1) (gt v7 v8)) | ||
(let (v10 i32) (sext v9)) | ||
(let (v11 i1) (neq v10 0)) | ||
(let (v12 i32) (select v11 v1 v5)) | ||
(let (v13 u32) (popcnt v12)) | ||
(let (v14 i32) (bitcast v13)) | ||
(let (v15 i32) (const.i32 1)) | ||
(let (v16 i1) (neq v14 v15)) | ||
(let (v17 i32) (zext v16)) | ||
(let (v18 i1) (neq v17 0)) | ||
(condbr v18 (block 2) (block 3))) | ||
|
||
(block 1 (param v3 i32)) | ||
|
||
(block 2 | ||
(unreachable)) | ||
|
||
(block 3 | ||
(let (v19 i32) (const.i32 -2147483648)) | ||
(let (v20 i32) (sub.wrapping v19 v12)) | ||
(let (v21 u32) (bitcast v20)) | ||
(let (v22 u32) (bitcast v2)) | ||
(let (v23 i1) (lt v21 v22)) | ||
(let (v24 i32) (sext v23)) | ||
(let (v25 i1) (neq v24 0)) | ||
(condbr v25 (block 2) (block 4))) | ||
|
||
(block 4 | ||
(let (v26 i32) (const.i32 0)) | ||
(let (v27 i32) (add.wrapping v12 v2)) | ||
(let (v28 i32) (const.i32 -1)) | ||
(let (v29 i32) (add.wrapping v27 v28)) | ||
(let (v30 i32) (const.i32 0)) | ||
(let (v31 i32) (sub.wrapping v30 v12)) | ||
(let (v32 i32) (band v29 v31)) | ||
(let (v33 u32) (bitcast v0)) | ||
(let (v34 u32) (mod.unchecked v33 4)) | ||
(assertz 250 v34) | ||
(let (v35 (ptr i32)) (inttoptr v33)) | ||
(let (v36 i32) (load v35)) | ||
(let (v37 i1) (neq v36 0)) | ||
(condbr v37 (block 5 v0 v32 v12 v26) (block 6))) | ||
|
||
(block 5 | ||
(param v49 i32) | ||
(param v55 i32) | ||
(param v65 i32) | ||
(param v68 i32) | ||
(let (v48 i32) (const.i32 268435456)) | ||
(let (v50 u32) (bitcast v49)) | ||
(let (v51 u32) (mod.unchecked v50 4)) | ||
(assertz 250 v51) | ||
(let (v52 (ptr i32)) (inttoptr v50)) | ||
(let (v53 i32) (load v52)) | ||
(let (v54 i32) (sub.wrapping v48 v53)) | ||
(let (v56 u32) (bitcast v54)) | ||
(let (v57 u32) (bitcast v55)) | ||
(let (v58 i1) (lt v56 v57)) | ||
(let (v59 i32) (sext v58)) | ||
(let (v60 i1) (neq v59 0)) | ||
(condbr v60 (block 7 v68) (block 8))) | ||
|
||
(block 6 | ||
(let (v38 u32) (exec (#intrinsics::mem #heap_base))) | ||
(let (v39 u32) (memory.size)) | ||
(let (v40 i32) (const.i32 16)) | ||
(let (v41 u32) (bitcast v40)) | ||
(let (v42 u32) (shl.wrapping v39 v41)) | ||
(let (v43 u32) (add.wrapping v38 v42)) | ||
(let (v44 i32) (bitcast v43)) | ||
(let (v45 u32) (bitcast v0)) | ||
(let (v46 u32) (mod.unchecked v45 4)) | ||
(assertz 250 v46) | ||
(let (v47 (ptr i32)) (inttoptr v45)) | ||
(store v47 v44) | ||
(br (block 5 v0 v32 v12 v26))) | ||
|
||
(block 7 (param v67 i32) | ||
(ret v67)) | ||
|
||
(block 8 | ||
(let (v61 i32) (add.wrapping v53 v55)) | ||
(let (v62 u32) (bitcast v49)) | ||
(let (v63 u32) (mod.unchecked v62 4)) | ||
(assertz 250 v63) | ||
(let (v64 (ptr i32)) (inttoptr v62)) | ||
(store v64 v61) | ||
(let (v66 i32) (add.wrapping v53 v65)) | ||
(br (block 7 v66))) | ||
) | ||
|
||
(func (export #cabi_realloc) | ||
(param i32) (param i32) (param i32) (param i32) (result i32) | ||
(block 0 (param v0 i32) (param v1 i32) (param v2 i32) (param v3 i32) | ||
(let (v5 i32) (exec #cabi_realloc_wit_bindgen_0_28_0 v0 v1 v2 v3)) | ||
(br (block 1 v5))) | ||
|
||
(block 1 (param v4 i32) | ||
(ret v4)) | ||
) | ||
|
||
;; Imports | ||
(func (import #intrinsics::mem #heap_base) (result u32)) | ||
) | ||
|
||
|
||
;; Component Exports | ||
(lift (miden:cross-ctx-account/[email protected]#process-felt) (#cross_ctx_account #miden:cross-ctx-account/[email protected]#process-felt (func (abi wasm) (param (struct felt)) (result (struct felt))) ) | ||
) |
Oops, something went wrong.