Skip to content

Conversation

@aigerimu
Copy link
Contributor

@aigerimu aigerimu commented Dec 8, 2025

closes #1545

@aigerimu
Copy link
Contributor Author

aigerimu commented Dec 8, 2025

/review

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update to languages/tolk/features/asm-functions.mdx: there’s one inline suggestion to clarify the asm argument ordering, so please apply the inline suggestion.

Comment on lines +67 to +81
Sometimes a function accepts parameters in an order different from what a TVM instruction expects. For example, `GETSTORAGEFEE` expects the parameters in the order cells, bits, seconds, and workchain. For a clearer API, the function should take the workchain as its first argument. To reorder stack positions, use the `asm(<INPUT_ORDER>)` syntax:

```tolk
fun calculateStorageFee(workchain: int8, seconds: int, bits: int, cells: int): coins
asm(cells bits seconds workchain) "GETSTORAGEFEE"
```

Similarly for return values. If multiple slots are returned, and they must be reordered to match typing,
use `asm(-> ...)` syntax:
Similarly for return values. If multiple slots are returned and must be reordered to match typing, use the `asm(-> <RETURN_ORDER>)` syntax:

```tolk
fun asmLoadCoins(s: slice): (slice, int)
asm(-> 1 0) "LDVARUINT16"
```

Both the input and output sides may be combined: `asm(... -> ...)`.
Reordering is mostly used with `mutate` variables.
Both the input and output sides can be combined: `asm(<INPUT_ORDER> -> <RETURN_ORDER>)`. Reordering is mostly used with `mutate` variables.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Undefined <INPUT_ORDER> and <RETURN_ORDER> placeholders in asm syntax

The section “Stack-based argument reordering” introduces the inline forms asm(<INPUT_ORDER>), asm(-> <RETURN_ORDER>), and asm(<INPUT_ORDER> -> <RETURN_ORDER>) without defining what <INPUT_ORDER> and <RETURN_ORDER> represent. Because the surrounding text otherwise uses concrete argument orders (for example, asm(cells bits seconds workchain) and asm(-> 1 0)), these angle-bracket placeholders are ambiguous and can be misread as literal code to type. Per the style guide’s rule on global overrides and copy/paste hazards, leaving such placeholders undefined is treated as a high‑severity documentation issue. This ambiguity may cause readers to copy these snippets verbatim or remain uncertain about the expected format of these order values.

Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tolk > Language features > Assembler functions] Improve article in agreement with styleguide

2 participants