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

runtime: make runtime panics recover()-able #3511

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

dgryski
Copy link
Member

@dgryski dgryski commented Mar 3, 2023

No description provided.

@aykevl
Copy link
Member

aykevl commented Mar 4, 2023

Did you check the binary size impact?
In any case, this results in an unnecessary heap allocation in a very sensitive area (for example, when an "out of memory" runtime panic is triggered, allocating would lead to infinite recursion). So I suggest factoring out the recover part of runtime._panic to avoid the conversion to an interface.

(I'm a bit careful with this change, as I think there might be reasons why it's the way it is now. Just want to make sure we don't overlook anything).

@dgryski
Copy link
Member Author

dgryski commented Mar 4, 2023

No, I didn't. I also noticed that CI failed. Marking as draft for now.

@aykevl
Copy link
Member

aykevl commented Mar 4, 2023

Actually, the fact that CI fails is because of this heap allocation:

/Users/runner/work/tinygo/tinygo/build/tinygo build -size short -o test.hex -target=pca10040 -gc=none -scheduler=none examples/blinky1
tinygo:ld.lld: error: undefined symbol: runtime.alloc
>>> referenced by string.go:62 (/Users/runner/work/tinygo/tinygo/src/runtime/string.go:62)
>>>               /Users/runner/Library/Caches/tinygo/thinlto/llvmcache-059CC3AC26AD6D48C9F8BD6A8548A01527722C0E:(runtime.stringConcat)

@dgryski dgryski marked this pull request as draft March 4, 2023 00:10
@dgryski
Copy link
Member Author

dgryski commented Aug 16, 2024

This is needed to make the bytes package from 1.23 pass tests.

@aykevl
Copy link
Member

aykevl commented Feb 25, 2025

I have made a new PR with a somewhat different approach: #4758

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.

2 participants