Draft
Conversation
c8e8d05 to
e8830d4
Compare
Collaborator
Author
|
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>
8ddd802 to
c0cec4c
Compare
Signed-off-by: Davide Bettio <davide@uninstall.it>
nifs.c: introduce new VALIDATE_ARG macro, that raises badarg error and tells the VM that function arguments can be safely taken from x registers. Change error handling code accordingly to support this new behavior. In order to keep this change understandable, use this new feature only in erlang:integer_to_binary first argument. Signed-off-by: Davide Bettio <davide@uninstall.it>
3e0d052 to
5278082
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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