Skip to content

Commit 37c9fcd

Browse files
committed
[Tolk] Change STSLICER to STSLICE in stdlib
In real-world code, it requires fewer stack permutations, because slices are not constant
1 parent f825c35 commit 37c9fcd

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

crypto/smartcont/tolk-stdlib/common.tolk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -759,12 +759,12 @@ fun builder.storeUint(mutate self, x: int, len: int): self
759759
/// Stores a slice into a builder.
760760
@pure
761761
fun builder.storeSlice(mutate self, s: slice): self
762-
asm "STSLICER";
762+
asm(s self) "STSLICE";
763763

764764
/// Stores an address into a builder.
765765
@pure
766766
fun builder.storeAddress(mutate self, addr: address): self
767-
asm "STSLICER";
767+
asm(addr self) "STSLICE";
768768

769769
/// Stores amount of Toncoins into a builder.
770770
@pure
@@ -792,7 +792,7 @@ fun builder.storeMaybeRef(mutate self, c: cell?): self
792792
/// Concatenates two builders.
793793
@pure
794794
fun builder.storeBuilder(mutate self, from: builder): self
795-
asm "STBR";
795+
asm(from self) "STB";
796796

797797
/// Stores a slice representing TL addr_none$00 (two `0` bits).
798798
@pure

tolk-tester/tests/pack-unpack-6.tolk

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ RETALT
131131
@fif_codegen
132132
"""
133133
test3 PROC:<{
134-
NEWC
135134
x{0109ab} PUSHSLICE
136-
STSLICER
135+
NEWC
136+
STSLICE
137137
ENDC
138138
CTOS
139139
x{01} SDBEGINSQ
@@ -168,17 +168,15 @@ IF:<{
168168
9 THROWIF
169169
8 EQINT
170170
9 THROWIFNOT
171-
SWAP
172-
STSLICER
171+
STSLICE
173172
"""
174173

175174
@fif_codegen
176175
"""
177176
test6 PROC:<{
178177
x{11} PUSHSLICE
179178
NEWC
180-
SWAP
181-
STSLICER
179+
STSLICE
182180
ENDC
183181
HASHCU
184182
"""

0 commit comments

Comments
 (0)