Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(codegen): rearrange parameters of asm methods in order described in Asm Shuffle #1702

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

i582
Copy link
Contributor

@i582 i582 commented Feb 4, 2025

Support only some asm functions:

  • is method
  • non mutable
  • without return rearrangement

Example:

asm(value self) extends fun storeBool(self: Builder, value: Bool): Builder { 1 STI }

Issue

Closes #1571.
Towards #1584.

Checklist

  • I have updated CHANGELOG.md
  • I have added tests to demonstrate the contribution is correctly implemented: this usually includes both positive and negative tests, showing the happy path(s) and featuring intentionally broken cases
  • I have run all the tests locally and no test failure was reported
  • I have run the linter, formatter and spellchecker
  • I did not do unrelated and/or undiscussed refactorings

@i582 i582 added this to the v1.6.0 milestone Feb 4, 2025
src/generator/writers/writeExpression.ts Outdated Show resolved Hide resolved
src/generator/writers/writeExpression.ts Outdated Show resolved Hide resolved
@i582 i582 marked this pull request as ready for review February 7, 2025 10:52
@i582 i582 requested a review from a team as a code owner February 7, 2025 10:52
@i582 i582 requested a review from anton-trunov February 7, 2025 10:52
novusnota
novusnota previously approved these changes Feb 7, 2025
@@ -54,11 +54,17 @@
"burn": "16029",
"discovery": "10093"
},
{
"label": "1.5.3 with improved storeBool",
Copy link
Member

Choose a reason for hiding this comment

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

let's add the link to this PR or some other way of identifying the exact version of Tact here (the commit hash will be known only after we squash and merge)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 584 to 585
let functionParams = params;
let needShuffle = true;
Copy link
Member

Choose a reason for hiding this comment

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

please don't use mutation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 603 to 608
const paramsDict = Object.fromEntries(
params.map((param, i) => [
i === 0 ? "self" : f.params[i - 1]!.name.text,
param,
]),
);
Copy link
Member

Choose a reason for hiding this comment

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

can we somehow reuse the code from writeExpression?

Copy link
Contributor

@verytactical verytactical left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Reverse __tact_store_bool parameters to remove extra SWAP
4 participants