Skip to content

Commit 5756e73

Browse files
committed
[Tolk] Don't emit unused functions to Fift code
Drop experimental option "remove-unused-functions": it's always on now
1 parent 635bbd0 commit 5756e73

19 files changed

+41
-21
lines changed

tolk-tester/tests/calls-tests.tolk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,11 @@ fun test11(a: int, b: int) {
179179
return ((b < a), (b <= a), (b > a), (b >= a));
180180
}
181181

182-
fun main() {}
182+
fun main() {
183+
// mark used to codegen them
184+
cmp1; cmp2; cmp3; cmp4;
185+
leq1; leq2; leq3; leq4;
186+
}
183187

184188
/**
185189
@testcase | 101 | 10 | 10 15 100 12 3 110 300

tolk-tester/tests/cells-slices.tolk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ fun test18() {
249249
return (s.loadUint(14), s.loadInt(8), s.loadUint(4));
250250
}
251251

252+
@method_id(119)
252253
fun test19() {
253254
// numbers with potential overflow for STU are not joined, check via codegen
254255
var b = beginCell();
@@ -267,6 +268,7 @@ fun test20() {
267268
return (s.loadBool(), s.loadBool(), s.loadBool(), s.loadUint(8), s.loadBool(), s.loadCoins());
268269
}
269270

271+
@method_id(121)
270272
fun test21(s: slice) {
271273
// successive skipBits are also joined
272274
var x = 8;

tolk-tester/tests/comments-tests.tolk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ fun demo_fields_def(x: int) {
1818
}
1919

2020
fun main() {
21+
var cb = demo_fields_def;
2122
return 1;
2223
}
2324

tolk-tester/tests/generics-4.tolk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ fun mySend<TBody = never, TInit = never>(p: Parameters<TBody, TInit>): int {
6363
return total;
6464
}
6565

66+
@method_id(101)
6667
fun test1() {
6768
eqUnusedT(100);
6869
eqUnusedU(100);

tolk-tester/tests/indexed-access.tolk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ fun getConstTuple(): Tup2Int {
179179
return [1,2];
180180
}
181181

182+
@noinline
182183
fun testCodegenNoPureIndexedAccess() {
183184
(getConstTuple().1, getConstTuple().0) = (3, 4);
184185
return 0;
@@ -277,7 +278,9 @@ fun test123() {
277278
return t;
278279
}
279280

280-
fun main(){}
281+
fun main(){
282+
testCodegenNoPureIndexedAccess();
283+
}
281284

282285

283286
/**

tolk-tester/tests/intN-tests.tolk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ fun test11() {
201201
];
202202
}
203203

204+
@method_id(112)
204205
fun test12() {
205206
var a = ton("1") + ton("2"); // check absence in fif codegen
206207
return ton("0.1");

tolk-tester/tests/logical-operators.tolk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import "imports/use-dicts.ext.tolk"
22

3+
@method_id(90)
34
fun simpleAllConst() {
45
return (!0, !!0 & !false, !!!0, !1, !!1, !-1, !!-1, (!5 as int == 0) == !0, !0 == true);
56
}
67

8+
@method_id(91)
79
fun compileTimeEval1(x: int) {
810
// todo now compiler doesn't understand that bool can't be equal to number other than 0/-1
911
// (but understands that it can't be positive)

tolk-tester/tests/mutate-methods.tolk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,12 @@ fun testExplicitReturn() {
307307
}
308308

309309

310-
fun main(){}
310+
fun main(){
311+
// mark used to codegen them
312+
load_next;
313+
testStoreUintPureUnusedResult;
314+
testStoreUintImpureUnusedResult
315+
}
311316

312317
/**
313318
@testcase | 101 | | 70 60

tolk-tester/tests/parse-address.tolk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ fun check0(addr: address) {
3030
assert (addr.getWorkchain() == 0) throw 111;
3131
}
3232

33+
@method_id(90)
3334
fun codegenAddrEq(a: address, b: address) {
3435
if (a == b) { return 1; }
3536
if (a != b) { return 2; }

tolk-tester/tests/remove-unused-functions.tolk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ fun main(): (int, int, int) {
2828
}
2929

3030
/**
31-
@experimental_options remove-unused-functions
32-
3331
@testcase | 0 | | 3 10 20
3432

3533
@fif_codegen DECLPROC used_as_noncall1()

0 commit comments

Comments
 (0)