Conversation
We currently do not allow callbacks to throw exceptions (including the special termination exception used when e.g. tearing down worker threads), because we have no way of generically propagating exceptions through the native layer back to the calling JS code that originally entered the native code. However, exceptions may be explicitly or implicitly enabled, e.g. when the target library is a C++ library, or when the compiler was configured to emit unwinding information as part of the code generation process. Since this change currently makes no attempt to automatically discover the library's level of exception support (which would likely be possible, but platform-dependent), it expects users to actively indicate whether this feature is available in the called library. Since this change requires access to native exceptions and most of Node.js is built without support for it, a small part of the code is split out into a new GYP target where exceptions are enabled, and as a part of the Node.js source is also on the path for passing exceptions through, the compiler flags for it are changed to include `-funwind-tables`. The total effect on compiled binary sizes of this patch is approximately 15 kB, which is negligible compared to the total size of the binary.
Collaborator
|
Review requested:
|
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.
We currently do not allow callbacks to throw exceptions (including the special termination exception used when e.g. tearing down worker threads), because we have no way of generically propagating exceptions through the native layer back to the calling JS code that originally entered the native code.
However, exceptions may be explicitly or implicitly enabled, e.g. when the target library is a C++ library, or when the compiler was configured to emit unwinding information as part of the code generation process.
Since this change currently makes no attempt to automatically discover the library's level of exception support (which would likely be possible, but platform-dependent), it expects users to actively indicate whether this feature is available in the called library.
Since this change requires access to native exceptions and most of Node.js is built without support for it, a small part of the code is split out into a new GYP target where exceptions are enabled, and as a part of the Node.js source is also on the path for passing exceptions through, the compiler flags for it are changed to include
-funwind-tables. The total effect on compiled binary sizes of this patch is approximately 15 kB, which is negligible compared to the total size of the binary.AI disclosure: Claude was used for automated debugging and early review.