Skip to content

Fix Risc-V code gen problem causing Python interpreter crash. #10301

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

Merged
merged 3 commits into from
May 5, 2025

Conversation

eightycc
Copy link
Collaborator

@eightycc eightycc commented May 1, 2025

Fix for gcc compiler code gen problem when targeting Risc-V.

Makes module_fun compiled function pointer in parse_compile_execute volatile to prevent RISC-V code gen from re-ordering store of the pointer into the stack frame. Generated code was scheduling store of the pointer after a call to gc_collect, causing free of the compiled function object before execution the function. When the function was executed, it was overlayed while running, resulting in a crash in the interpreter.

Resolves issue #10298.

@eightycc eightycc requested a review from tannewt May 1, 2025 02:38
@eightycc eightycc marked this pull request as draft May 1, 2025 12:46
@eightycc
Copy link
Collaborator Author

eightycc commented May 1, 2025

Converted back to draft. Testing this workaround with ESP-IDF 5.4.1 updates (#10267) the failure has returned.

Issue with ESP-IDF 5.4.1 resolved. See #10298 for details.

@eightycc eightycc removed the request for review from tannewt May 1, 2025 12:49
@eightycc eightycc changed the title Workaround Risc-V code gen problem causing Python interpreter crash. Fix Risc-V code gen problem causing Python interpreter crash. May 3, 2025
@eightycc eightycc marked this pull request as ready for review May 3, 2025 06:46
@eightycc
Copy link
Collaborator Author

eightycc commented May 3, 2025

Now working correctly with ESP-IDF 5.4.1. Tested on Adafruit Feather ESP32-C6 board.

@eightycc eightycc requested a review from tannewt May 3, 2025 06:48
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thank you!

@tannewt tannewt merged commit 04b17e1 into adafruit:main May 5, 2025
615 checks passed
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