-
Notifications
You must be signed in to change notification settings - Fork 141
WIP: Error handling rework #1959
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
base: main
Are you sure you want to change the base?
Conversation
c8e8d05 to
e8830d4
Compare
|
I will back to this PR after this discussion: https://erlangforums.com/t/question-about-how-vm-deals-with-exceptions/5410 |
0380b66 to
2dc5720
Compare
RAISE()/RAISE_ERROR() is more maintainable than directly writing to registers. Signed-off-by: Davide Bettio <davide@uninstall.it>
2dc5720 to
af4ebb5
Compare
Signed-off-by: Davide Bettio <davide@uninstall.it>
26d571e to
b98105e
Compare
|
|
||
| #ifdef IMPL_EXECUTE_LOOP | ||
| RAISE_ERROR(FUNCTION_CLAUSE_ATOM); | ||
| RAISE_ERROR_MFA(FUNCTION_CLAUSE_ATOM, module_atom, function_name_atom, arity); |
Check failure
Code scanning / CodeQL
Passing a non-term to a function expecting a term Error
|
|
||
| #ifdef IMPL_EXECUTE_LOOP | ||
| RAISE_ERROR(FUNCTION_CLAUSE_ATOM); | ||
| RAISE_ERROR_MFA(FUNCTION_CLAUSE_ATOM, module_atom, function_name_atom, arity); |
Check failure
Code scanning / CodeQL
Passing a non-term to a function expecting a term Error
This change follows what the BEAM is already doing: exception information is temporarily stored in the process structure rather than returning it using x[0..2] registers. Following fields are added to Context for this purpose: exception_class, exception_reason, exception_stacktrace. Their lifespan is just the time required to build a raw stacktrace, after that, they can be safely discarded. Future AtomVM version might move those new fields to the emulator/execution environment rather having them for each process. Since they are super-short lived, GC ignores them. This approach has been confirmed by BEAM devs. Signed-off-by: Davide Bettio <davide@uninstall.it>
b98105e to
8ddd802
Compare
raise/3 allows to (re-)raise an exception while keeping the already existing stacktrace. This change make this work, by supporting the 3rd raise parameter, and changing `stacktrace_build` and `stacktrace_create_raw` accordingly`. Fixes atomvm#1951 Closes atomvm#1804 Signed-off-by: Davide Bettio <davide@uninstall.it>
Make sure that is a 6-arity tuple, before taking any element from it. Signed-off-by: Davide Bettio <davide@uninstall.it>
Signed-off-by: Davide Bettio <davide@uninstall.it>
8ddd802 to
c0cec4c
Compare
See also #1951
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later