Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: createInlineAsm:avoid mapupdate collect after call#5009

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
luoliwoshang wants to merge2 commits intotinygo-org:dev
base:dev
Choose a base branch
Loading
fromluoliwoshang:fix-asmfull-mapupdate-bug

Conversation

@luoliwoshang
Copy link
Contributor

@luoliwoshangluoliwoshang commentedAug 22, 2025
edited
Loading

fixed#5008

Problem:
The original code used a break statement inside a switch within a for loop, which only exited the switch but continued processing subsequent MapUpdate operations. This led to AsmFull returning register values from map updates that happened after the function call, violating the expected behavior.

Solution:

  • Stops processing when encountering the AsmFull call itself

@luoliwoshangluoliwoshangforce-pushed thefix-asmfull-mapupdate-bug branch fromfa7af34 to73a1250CompareAugust 22, 2025 10:52
@luoliwoshangluoliwoshang changed the base branch fromrelease todevAugust 22, 2025 11:16
Copy link
Contributor

@eliasnaureliasnaur left a comment

Choose a reason for hiding this comment

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

Probably for@aykevl

registers[key]=b.getValue(r.Value.(*ssa.MakeInterface).X,getPos(instr))
case*ssa.Call:
ifr.Common()==instr {
break
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of extractingcollectInlineAsmRegisters, why not name the outer loop and usebreak <name>? Something like:

referrers:for_,r:=range*registerMap.Referrers() {...ifr.Common()==instr {break referrers        }

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks for the great suggestion! You're absolutely right - using labeled break is cleaner and more idiomatic. I've updated the code accordingly. I initially went with function extraction due to personal preference, but your approach is definitely better with fewer code changes. Thanks for the review!

@luoliwoshangluoliwoshangforce-pushed thefix-asmfull-mapupdate-bug branch 2 times, most recently from6fd682d to07aa451CompareAugust 24, 2025 15:00
@eliasnaur
Copy link
Contributor

The test disappeared, was that on purpose? Also, please squash the two "goto" and "named break" commits into one.

Probably@aykevl for the meat of this change.

builder/createInlineAsm:with independant logic to avoid goto operate
@luoliwoshangluoliwoshangforce-pushed thefix-asmfull-mapupdate-bug branch from07aa451 toa996f85CompareAugust 25, 2025 01:18
@luoliwoshang
Copy link
ContributorAuthor

The test disappeared, was that on purpose? Also, please squash the two "goto" and "named break" commits into one.

I have merged the two commits into one. I temporarily removed the added tests to confirm whether the test failure issue is only coming from the CI environment. I will add back the tests shortly.

@luoliwoshangluoliwoshangforce-pushed thefix-asmfull-mapupdate-bug branch from702167d to2986a7aCompareAugust 25, 2025 02:15
@luoliwoshang
Copy link
ContributorAuthor

luoliwoshang commentedAug 26, 2025
edited
Loading

Hey@aykevl! 👋 I found a little bug in TinyGo and managed to fix it - would love to get your eyes on the PR when you have a moment!
Thanks for building such an awesome project! TinyGo makes embedded Go so much fun, and I'd love to be part of the contributor community

@luoliwoshangluoliwoshang changed the titlecreateInlineAsm:avoid mapupdate collect after callfix: createInlineAsm:avoid mapupdate collect after callSep 7, 2025
@aykevl
Copy link
Member

While I appreciate you fixing this, I would actually prefer if we could remove AsmFull entirely. It's not very well defined, and C (GCC/Clang) has a far more flexible way to write inline assembly. It's annoying to use, yes, but doesn't require TinyGo to know all the details of an architecture.

Here is an example of how it is done in the WS2812 driver:
https://github.com/tinygo-org/drivers/blob/release/ws2812/ws2812-asm_cortexm.go

@luoliwoshang
Copy link
ContributorAuthor

Thank you for your feedback and for sharing the WS2812 example.
I completely understand your preference to remove AsmFull in favor of standard C inline assembly, which is indeed more flexible and reduces maintenance burden on TinyGo.
However, ifAsmFull won't be removed in the immediate next release, would this fix still provide some value in the interim?
I totally respect your decision either way and am happy to follow whatever direction you think is best for the project.

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

Reviewers

@eliasnaureliasnaureliasnaur left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bug Report: AsmFull incorrectly processes MapUpdate operations after the call

3 participants

@luoliwoshang@eliasnaur@aykevl

[8]ページ先頭

©2009-2025 Movatter.jp