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

avr: add support for recover() #2915

Merged
merged 3 commits into from
Jun 19, 2022
Merged

avr: add support for recover() #2915

merged 3 commits into from
Jun 19, 2022

Conversation

aykevl
Copy link
Member

@aykevl aykevl commented Jun 17, 2022

You can see that it works with the following command:

tinygo run -target=simavr ./testdata/recover.go

This also gets the following tests to pass again (which started failing since #2331):

go test -run=Build -target=simavr -v

Adding support for AVR was a bit more compliated because it's also necessary to save and restore the Y register. That's why the first two commits move things around a bit.

This is a small change to make it easier to support architectures that
need to restore more than just the sp and pc registers. In particular,
it is needed for the AVR architecture that needs to restore the frame
pointer (Y register).
This is a refactor that makes the next commit simpler. Perhaps it should
have been like this from the beginning but I didn't like all the casts.
You can see that it works with the following command:

    tinygo run -target=simavr ./testdata/recover.go

This also gets the following tests to pass again:

    go test -run=Build -target=simavr -v

Adding support for AVR was a bit more compliated because it's also
necessary to save and restore the Y register.
@aykevl
Copy link
Member Author

aykevl commented Jun 18, 2022

Pushed a fix for the test failure.

@deadprogram
Copy link
Member

You are not kidding that it was a bit more complicated. Digesting the changes now.

Hopefully after this the WebAssembly recover() is lot easier.

@aykevl
Copy link
Member Author

aykevl commented Jun 18, 2022

Hopefully after this the WebAssembly recover() is lot easier.

Unfortunately not, I'm afraid. WebAssembly is a really weird architecture.

@deadprogram
Copy link
Member

Let's merge it! Thanks @aykevl

@deadprogram deadprogram merged commit 9af535b into dev Jun 19, 2022
@deadprogram deadprogram deleted the recover-avr branch June 19, 2022 09:51
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