2024-04-26 11:27:16 +00:00
|
|
|
;; Here we test that a just-return function is not a valid wrapper, it will not be inlined.
|
|
|
|
;; (doesn't use all arguments, has different pureness, has method_id, etc.)
|
|
|
|
|
2024-05-03 10:26:57 +00:00
|
|
|
builder begin_cell() pure asm "NEWC";
|
|
|
|
cell end_cell(builder b) pure asm "ENDC";
|
|
|
|
slice begin_parse(cell c) pure asm "CTOS";
|
|
|
|
() set_data(cell c) asm "c4 POP";
|
|
|
|
cell get_data() pure asm "c4 PUSH";
|
|
|
|
tuple empty_tuple() pure asm "NIL";
|
|
|
|
forall X -> (tuple, ()) tpush(tuple t, X x) pure asm "TPUSH";
|
2024-04-26 11:27:16 +00:00
|
|
|
|
|
|
|
builder storeUint(builder b, int x, int unused) { return store_uint(b, x, x); }
|
2024-05-03 10:26:57 +00:00
|
|
|
() throwIf(int excNo, int cond) { throw_if(excNo, cond); }
|
2024-04-26 11:27:16 +00:00
|
|
|
|
|
|
|
_ initial1(x) { return x; }
|
|
|
|
_ initial2(x) { return initial1(x); }
|
|
|
|
|
2024-05-03 10:26:57 +00:00
|
|
|
tuple asm_func_4(int a, (int, (int, int)) b, int c) pure asm (b a c -> 0) "5 TUPLE";
|
2024-04-26 11:27:16 +00:00
|
|
|
_ asmFunc4(int a, (int, (int, int)) b, int c) { return asm_func_4(a, b, c); }
|
|
|
|
|
|
|
|
int postpone_elections() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
(int) setAndGetData(int ret) {
|
|
|
|
cell c = begin_cell().store_uint(ret, 8).end_cell();
|
|
|
|
set_data(c);
|
|
|
|
slice s = get_data().begin_parse();
|
|
|
|
throwIf(101, 0);
|
|
|
|
return s~load_uint(8);
|
|
|
|
}
|
|
|
|
|
|
|
|
int setAndGetDataWrapper(int ret) {
|
|
|
|
return setAndGetData(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test1() method_id(101) {
|
|
|
|
cell c = begin_cell().storeUint(32, 10000000).end_cell();
|
|
|
|
slice s = c.begin_parse();
|
|
|
|
return s~load_uint(32);
|
|
|
|
}
|
|
|
|
|
2024-05-21 12:34:37 +00:00
|
|
|
get int test2(int ret) {
|
2024-04-26 11:27:16 +00:00
|
|
|
return setAndGetDataWrapper(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test3() method_id(103) {
|
|
|
|
return initial2(10);
|
|
|
|
}
|
|
|
|
|
|
|
|
global tuple t;
|
|
|
|
|
|
|
|
int foo(int x) {
|
|
|
|
t~tpush(x);
|
|
|
|
return x * 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
(tuple, tuple) test4() method_id(104) {
|
|
|
|
t = empty_tuple();
|
|
|
|
tuple t2 = asmFunc4(foo(11), (foo(22), (foo(33), foo(44))), foo(55));
|
|
|
|
return (t, t2);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test5() method_id(105) {
|
|
|
|
if (1) {
|
|
|
|
return postpone_elections();
|
|
|
|
}
|
|
|
|
return 123;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int ret) {
|
|
|
|
return setAndGetDataWrapper(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
int recv_external(int ret) {
|
|
|
|
return setAndGetData(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
{-
|
|
|
|
method_id | in | out
|
|
|
|
TESTCASE | 101 | | 32
|
|
|
|
TESTCASE | 103 | | 10
|
|
|
|
TESTCASE | 104 | | [ 11 22 33 44 55 ] [ 220 330 440 110 550 ]
|
|
|
|
TESTCASE | 105 | | 0
|
|
|
|
TESTCASE | 74435 | 99 | 99
|
|
|
|
TESTCASE | 0 | 98 | 98
|
|
|
|
TESTCASE | -1 | 97 | 97
|
|
|
|
|
|
|
|
@fif_codegen DECLPROC storeUint
|
|
|
|
@fif_codegen DECLPROC throwIf
|
|
|
|
@fif_codegen DECLPROC postpone_elections
|
|
|
|
@fif_codegen 74435 DECLMETHOD test2
|
|
|
|
|
|
|
|
@fif_codegen
|
|
|
|
"""
|
|
|
|
test3 PROC:<{
|
|
|
|
//
|
|
|
|
10 PUSHINT // _0=10
|
|
|
|
initial2 CALLDICT // _1
|
|
|
|
}>
|
|
|
|
"""
|
|
|
|
|
|
|
|
@fif_codegen
|
|
|
|
"""
|
|
|
|
test2 PROC:<{
|
|
|
|
// ret
|
|
|
|
setAndGetData CALLDICT // _1
|
|
|
|
}>
|
|
|
|
"""
|
|
|
|
|
|
|
|
@fif_codegen
|
|
|
|
"""
|
|
|
|
11 PUSHINT
|
|
|
|
foo CALLDICT
|
|
|
|
22 PUSHINT
|
|
|
|
foo CALLDICT
|
|
|
|
33 PUSHINT
|
|
|
|
foo CALLDICT
|
|
|
|
44 PUSHINT
|
|
|
|
foo CALLDICT
|
|
|
|
55 PUSHINT
|
|
|
|
foo CALLDICT
|
|
|
|
asmFunc4 CALLDICT // t2
|
|
|
|
"""
|
|
|
|
|
|
|
|
@fif_codegen_avoid setAndGetDataWrapper
|
|
|
|
-}
|