diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-04 05:51:23 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-04 05:51:23 +0100 |
commit | 5e182235cb7e7b601c5e010c298bf17415113ce0 (patch) | |
tree | d7dcfb54efbb5277184e0fcda9aa169b75e771ea /src/libexpr/primops.hh | |
parent | 30f3298e9dafa3bc4422c29dad972e320ad70e01 (diff) |
Merge pull request #7348 from thufschmitt/dont-use-vlas
Remove the usage of VLAs in the code
(cherry picked from commit ac4431e9d016e62fb5dc9ae36833bd0c6cdadeec)
Change-Id: Ifbf5fbfc2e27122362a2aaea4b62c7cf3ca46b1a
Diffstat (limited to 'src/libexpr/primops.hh')
-rw-r--r-- | src/libexpr/primops.hh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libexpr/primops.hh b/src/libexpr/primops.hh index 930e7f32a..45486608f 100644 --- a/src/libexpr/primops.hh +++ b/src/libexpr/primops.hh @@ -8,6 +8,22 @@ namespace nix { +/** + * For functions where we do not expect deep recursion, we can use a sizable + * part of the stack a free allocation space. + * + * Note: this is expected to be multiplied by sizeof(Value), or about 24 bytes. + */ +constexpr size_t nonRecursiveStackReservation = 128; + +/** + * Functions that maybe applied to self-similar inputs, such as concatMap on a + * tree, should reserve a smaller part of the stack for allocation. + * + * Note: this is expected to be multiplied by sizeof(Value), or about 24 bytes. + */ +constexpr size_t conservativeStackReservation = 16; + struct RegisterPrimOp { typedef std::vector<PrimOp> PrimOps; |