Reduce max call stack size for debug.
This commit is contained in:
parent
1272eeb81a
commit
d511aac7a4
@ -26,6 +26,7 @@ Enhancements
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
* Many one-liners and few-liners are now marked `#[inline]` or `[inline(always)]`, just in case it helps when LTO is not turned on.
|
* Many one-liners and few-liners are now marked `#[inline]` or `[inline(always)]`, just in case it helps when LTO is not turned on.
|
||||||
|
* Default call stack depth for `debug` builds is reduced to 12 (from 16).
|
||||||
|
|
||||||
|
|
||||||
Version 0.19.0
|
Version 0.19.0
|
||||||
|
@ -6,7 +6,7 @@ Maximum Call Stack Depth
|
|||||||
Limit How Stack Usage by Scripts
|
Limit How Stack Usage by Scripts
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
Rhai by default limits function calls to a maximum depth of 128 levels (16 levels in debug build).
|
Rhai by default limits function calls to a maximum depth of 128 levels (12 levels in debug build).
|
||||||
|
|
||||||
This limit may be changed via the `Engine::set_max_call_levels` method.
|
This limit may be changed via the `Engine::set_max_call_levels` method.
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ pub type Imports = Vec<(ImmutableString, Module)>;
|
|||||||
|
|
||||||
#[cfg(not(feature = "unchecked"))]
|
#[cfg(not(feature = "unchecked"))]
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
pub const MAX_CALL_STACK_DEPTH: usize = 16;
|
pub const MAX_CALL_STACK_DEPTH: usize = 12;
|
||||||
#[cfg(not(feature = "unchecked"))]
|
#[cfg(not(feature = "unchecked"))]
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
pub const MAX_EXPR_DEPTH: usize = 32;
|
pub const MAX_EXPR_DEPTH: usize = 32;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#![cfg(not(feature = "no_optimize"))]
|
#![cfg(not(feature = "no_optimize"))]
|
||||||
|
|
||||||
use rhai::{Engine, EvalAltResult, OptimizationLevel, INT, RegisterFn};
|
use rhai::{Engine, EvalAltResult, OptimizationLevel, RegisterFn, INT};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_optimizer_run() -> Result<(), Box<EvalAltResult>> {
|
fn test_optimizer_run() -> Result<(), Box<EvalAltResult>> {
|
||||||
|
@ -10,10 +10,10 @@ fn test_stack_overflow_fn_calls() -> Result<(), Box<EvalAltResult>> {
|
|||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
r"
|
||||||
fn foo(n) { if n <= 1 { 0 } else { n + foo(n-1) } }
|
fn foo(n) { if n <= 1 { 0 } else { n + foo(n-1) } }
|
||||||
foo(8)
|
foo(7)
|
||||||
",
|
",
|
||||||
)?,
|
)?,
|
||||||
35
|
27
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(not(feature = "unchecked"))]
|
#[cfg(not(feature = "unchecked"))]
|
||||||
|
Loading…
Reference in New Issue
Block a user