-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DUK_USE_NATIVE_STACK_CHECK macro support
* Add DUK_USE_NATIVE_STACK_CHECK config option. * Add internal duk_native_stack_check() helper which checks and throws if DUK_USE_NATIVE_STACK_CHECK() indicates we're out of stack space. * Add initial call sites for duk_native_stack_check(). These are in addition to existing recursion limit checks. * Add stack check example to cmdline example and 'duk' build on Linux. Disabled by default for now.
- Loading branch information
Showing
11 changed files
with
111 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
define: DUK_USE_NATIVE_STACK_CHECK | ||
introduced: 2.4.0 | ||
default: false | ||
tags: | ||
- portability | ||
- execution | ||
description: > | ||
Provide a macro hook to check for available native stack space for the | ||
currently executing native thread. The macro must evaluate to zero if | ||
there is enough stack space available and non-zero otherwise; a RangeError | ||
will then be thrown. | ||
The definition of "enough space" depends on the target platform and the | ||
compiler because the size of native stack frames cannot be easily known | ||
in advance. As a relatively safe estimate, one can check for 8kB of | ||
available stack. | ||
Duktape doesn't call this macro for every internal native call. The macro | ||
is called in code paths that are involved in potentially unlimited | ||
recursion (such as making Ecmascript/native function calls, invoking | ||
getters and Proxy traps, and resolving Proxy chains) and code paths | ||
requiring a lot of stack space temporarily. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
---*/ | ||
|
||
/*=== | ||
RangeError: C call stack depth limit | ||
RangeError: C stack depth limit | ||
still here | ||
===*/ | ||
|
||
|
This file contains 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