Skip to content

Commit d9bb6bb

Browse files
committed
[Tolk] Use parenthesis () as a suffix for Fift generation
For every function f, name it `f()` instead of `f` in Fift output. > DECLPROC f() > f() CALLDICT This avoids collisions with Fift reserved names like execute/swap/etc. For global vars, `$` prefix is now used: > DECLGLOBVAR $name
1 parent dc328ac commit d9bb6bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+289
-252
lines changed

tolk-tester/tests/allow-post-modification.tolk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ fun main() {
154154

155155
@fif_codegen
156156
"""
157-
int.~inc PROC:<{ // self y
158-
inc CALLDICT // self newY
157+
int.~inc() PROC:<{ // self y
158+
inc() CALLDICT // self newY
159159
}>
160160
"""
161161

162162
@fif_codegen
163163
"""
164-
test_assign_tensor_global PROC:<{ // x.0 x.1
164+
test_assign_tensor_global() PROC:<{ // x.0 x.1
165165
"""
166166

167167
@code_hash 6737917279814799680932710799951154408447028229503449454536845752635763933556

tolk-tester/tests/asm-arg-order.tolk

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ fun main() {
219219

220220
@fif_codegen
221221
"""
222-
test27 PROC:<{
222+
test27() PROC:<{
223223
10 PUSHINT
224224
2 PUSHINT
225225
1 ADDCONST MUL
@@ -228,36 +228,36 @@ fun main() {
228228

229229
@fif_codegen
230230
"""
231-
test28 PROC:<{
232-
get10Pure CALLDICT
233-
get2Pure CALLDICT
231+
test28() PROC:<{
232+
get10Pure() CALLDICT
233+
get2Pure() CALLDICT
234234
1 ADDCONST MUL
235235
}>
236236
"""
237237

238238
@fif_codegen
239239
"""
240-
test29 PROC:<{
241-
get2Impure CALLDICT
242-
get10Impure CALLDICT
240+
test29() PROC:<{
241+
get2Impure() CALLDICT
242+
get10Impure() CALLDICT
243243
SWAP
244244
1 ADDCONST MUL
245245
}>
246246
"""
247247

248248
@fif_codegen
249249
"""
250-
test30 PROC:<{
250+
test30() PROC:<{
251251
...
252-
g10 GETGLOB
253-
g2 GETGLOB
252+
$g10 GETGLOB
253+
$g2 GETGLOB
254254
1 ADDCONST MUL
255255
}>
256256
"""
257257

258258
@fif_codegen
259259
"""
260-
test32 PROC:<{
260+
test32() PROC:<{
261261
10 PUSHINT
262262
2 PUSHINT
263263
1 ADDCONST MUL
@@ -266,7 +266,7 @@ fun main() {
266266

267267
@fif_codegen
268268
"""
269-
test34 PROC:<{
269+
test34() PROC:<{
270270
x{020a} PUSHSLICE
271271
8 LDU
272272
8 LDU

tolk-tester/tests/assignment-tests.tolk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ fun main(value: int, ) {
283283

284284
@fif_codegen
285285
"""
286-
test116 PROC:<{ //
286+
test116() PROC:<{ //
287287
1 PUSHINT // '10=1
288288
2 PUSHINT // '10=1 '11=2
289289
3 PUSHINT // '10=1 '11=2 '12=3

tolk-tester/tests/bit-operators.tolk

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fun testBoolCompareOptimized(x: bool) {
126126

127127
@fif_codegen
128128
"""
129-
boolWithBitwiseConst PROC:<{
129+
boolWithBitwiseConst() PROC:<{
130130
0 PUSHINT // '3
131131
-1 PUSHINT // '3 '5
132132
0 PUSHINT // '3 '5 '7
@@ -136,7 +136,7 @@ fun testBoolCompareOptimized(x: bool) {
136136

137137
@fif_codegen
138138
"""
139-
testDoUntilCodegen PROC:<{ // i n
139+
testDoUntilCodegen() PROC:<{ // i n
140140
0 PUSHINT // i n cnt=0
141141
UNTIL:<{
142142
INC // i n cnt
@@ -162,7 +162,7 @@ fun testBoolCompareOptimized(x: bool) {
162162

163163
@fif_codegen
164164
"""
165-
testConstNegateCodegen PROC:<{
165+
testConstNegateCodegen() PROC:<{
166166
TRUE // '0
167167
FALSE // '0 '1
168168
FALSE // '0 '1 '2
@@ -174,7 +174,7 @@ fun testBoolCompareOptimized(x: bool) {
174174

175175
@fif_codegen
176176
"""
177-
testBoolNegateOptimized PROC:<{ // x
177+
testBoolNegateOptimized() PROC:<{ // x
178178
DUP // x x
179179
NOT // x '1
180180
OVER // x '1 x
@@ -186,14 +186,14 @@ fun testBoolCompareOptimized(x: bool) {
186186

187187
@fif_codegen
188188
"""
189-
testBoolCompareOptimized PROC:<{ // x
189+
testBoolCompareOptimized() PROC:<{ // x
190190
DUP // x x
191191
NOT // x '1
192192
OVER // x '1 x
193-
eqX CALLDICT // x '1 '2
193+
eqX() CALLDICT // x '1 '2
194194
NOT // x '1 '3
195195
s2 PUSH // x '1 '3 x
196-
eqX CALLDICT // x '1 '3 '4
196+
eqX() CALLDICT // x '1 '3 '4
197197
s3 PUSH // x '1 '3 '4 x
198198
}>
199199
"""

tolk-tester/tests/cells-slices.tolk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ We test that consequtive storeInt/storeUint with constants are joined into a sin
352352

353353
@fif_codegen
354354
"""
355-
test6 PROC:<{
355+
test6() PROC:<{
356356
18446744082299486211 PUSHINT
357357
NEWC
358358
96 STU // '2
@@ -361,23 +361,23 @@ We test that consequtive storeInt/storeUint with constants are joined into a sin
361361

362362
@fif_codegen
363363
"""
364-
test17 PROC:<{
364+
test17() PROC:<{
365365
4219 PUSHINT
366366
NEWC
367367
16 STU
368368
"""
369369

370370
@fif_codegen
371371
"""
372-
test18 PROC:<{
372+
test18() PROC:<{
373373
421 PUSHINT
374374
NEWC
375375
26 STU
376376
"""
377377

378378
@fif_codegen
379379
"""
380-
test19 PROC:<{
380+
test19() PROC:<{
381381
NEWC
382382
123 PUSHINT
383383
SWAP
@@ -392,23 +392,23 @@ We test that consequtive storeInt/storeUint with constants are joined into a sin
392392

393393
@fif_codegen
394394
"""
395-
test20 PROC:<{
395+
test20() PROC:<{
396396
40976 PUSHINT
397397
NEWC
398398
16 STU
399399
"""
400400

401401
@fif_codegen
402402
"""
403-
test21 PROC:<{
403+
test21() PROC:<{
404404
14 PUSHINT
405405
SDSKIPFIRST
406406
}>
407407
"""
408408

409409
@fif_codegen
410410
"""
411-
test22 PROC:<{
411+
test22() PROC:<{
412412
NEWC // '2
413413
NEWC // b1 b2
414414
SWAP // b2 b1
@@ -421,7 +421,7 @@ We test that consequtive storeInt/storeUint with constants are joined into a sin
421421

422422
@fif_codegen
423423
"""
424-
test23 PROC:<{
424+
test23() PROC:<{
425425
NEWC
426426
SWAP
427427
IF:<{

tolk-tester/tests/codegen-check-demo.tolk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Below, I just give examples of @fif_codegen tag:
3333

3434
@fif_codegen
3535
"""
36-
main PROC:<{ // s
36+
main() PROC:<{ // s
3737
17 PUSHINT // s '3=17
3838
OVER // s z=17 t
3939
WHILE:<{
@@ -49,7 +49,7 @@ main PROC:<{ // s
4949

5050
@fif_codegen
5151
"""
52-
main PROC:<{
52+
main() PROC:<{
5353
...
5454
WHILE:<{
5555
...
@@ -76,13 +76,13 @@ main PROC:<{
7676

7777
@fif_codegen
7878
"""
79-
test1 PROC:<{
79+
test1() PROC:<{
8080
FALSE
8181
}>
8282
"""
8383

8484
@fif_codegen NOT // '8
85-
@fif_codegen main PROC:<{
85+
@fif_codegen main() PROC:<{
8686

8787
@fif_codegen_avoid PROCINLINE
8888
@fif_codegen_avoid END c

tolk-tester/tests/comments-tests.tolk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fun main() {
2727
@fif_codegen_enable_comments
2828
@fif_codegen
2929
"""
30-
demo_fields_def PROC:<{ // x
30+
demo_fields_def() PROC:<{ // x
3131
// 13: f1: x + C_20
3232
20 ADDCONST // '6
3333
10 PUSHINT // '6 '7=10

tolk-tester/tests/generics-1.tolk

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,19 @@ fun main(x: int): (int, [Tup2Int]) {
234234
@testcase | 112 | 0 0 | 0 0 -1
235235
@testcase | 113 | 5 1 | 5 1 -100 (null) 5 1 -100 9 -100 (null) -100 (null) 5 1 -100 (null) (null) (null) 0
236236

237-
@fif_codegen DECLPROC eq1<int>
238-
@fif_codegen DECLPROC eq1<tuple>
239-
@fif_codegen DECLPROC eq1<(int,int)>
240-
@fif_codegen DECLPROC eq1<[int,int]>
241-
@fif_codegen DECLPROC eq1<MInt?>
242-
@fif_codegen DECLPROC eq1<int|slice|null>
243-
@fif_codegen DECLPROC eq1<Wrapper<Wrapper<int8>>>
237+
@fif_codegen DECLPROC eq1<int>()
238+
@fif_codegen DECLPROC eq1<tuple>()
239+
@fif_codegen DECLPROC eq1<(int,int)>()
240+
@fif_codegen DECLPROC eq1<[int,int]>()
241+
@fif_codegen DECLPROC eq1<MInt?>()
242+
@fif_codegen DECLPROC eq1<int|slice|null>()
243+
@fif_codegen DECLPROC eq1<Wrapper<Wrapper<int8>>>()
244244

245245
// was inlined
246-
@fif_codegen_avoid DECLPROC getTwo<int>
246+
@fif_codegen_avoid DECLPROC getTwo<int>()
247247
@fif_codegen_avoid getTwo
248248

249-
@fif_codegen_avoid DECLPROC eq1
250-
@fif_codegen_avoid DECLPROC eq2
251-
@fif_codegen_avoid DECLPROC eq3
249+
@fif_codegen_avoid DECLPROC eq1()
250+
@fif_codegen_avoid DECLPROC eq2()
251+
@fif_codegen_avoid DECLPROC eq3()
252252
*/

tolk-tester/tests/generics-2.tolk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,12 @@ fun main(c: Wrapper<slice>, d: WrappedInt) {
475475

476476
@fif_codegen
477477
"""
478-
test1 PROC:<{
478+
test1() PROC:<{
479479
23 PUSHINT // c1=23
480480
DUP // c1=23 c2=23
481481
}>
482482
"""
483483

484-
@fif_codegen DECLPROC getWrappervalue1<Wrapper<(int,int)>>
485-
@fif_codegen DECLPROC getWrappervalue2<Wrapper<Wrapper<(int,int)>>>
484+
@fif_codegen DECLPROC getWrappervalue1<Wrapper<(int,int)>>()
485+
@fif_codegen DECLPROC getWrappervalue2<Wrapper<Wrapper<(int,int)>>>()
486486
*/

tolk-tester/tests/generics-3.tolk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fun main() {
136136

137137
@fif_codegen
138138
"""
139-
test3 PROC:<{
139+
test3() PROC:<{
140140
10 PUSHINT // r.USlot1=10
141141
-1 PUSHINT // r.USlot1=10 '22=-1
142142
FALSE // r.USlot1=10 '22=-1 '24

0 commit comments

Comments
 (0)