-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9430 from hercules-ci/remove-vlas
Fix stack overflow in `filter`
- Loading branch information
Showing
5 changed files
with
70 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/include/gc_allocator.h b/include/gc_allocator.h | ||
index 597c7f13..587286be 100644 | ||
--- a/include/gc_allocator.h | ||
+++ b/include/gc_allocator.h | ||
@@ -312,6 +312,7 @@ public: | ||
|
||
template<> | ||
class traceable_allocator<void> { | ||
+public: | ||
typedef size_t size_type; | ||
typedef ptrdiff_t difference_type; | ||
typedef void* pointer; |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#pragma once | ||
|
||
#include <boost/container/small_vector.hpp> | ||
|
||
#if HAVE_BOEHMGC | ||
|
||
#include <gc/gc.h> | ||
#include <gc/gc_cpp.h> | ||
#include <gc/gc_allocator.h> | ||
|
||
#endif | ||
|
||
namespace nix { | ||
|
||
struct Value; | ||
|
||
/** | ||
* A GC compatible vector that may used a reserved portion of `nItems` on the stack instead of allocating on the heap. | ||
*/ | ||
#if HAVE_BOEHMGC | ||
template <typename T, size_t nItems> | ||
using SmallVector = boost::container::small_vector<T, nItems, traceable_allocator<T>>; | ||
#else | ||
template <typename T, size_t nItems> | ||
using SmallVector = boost::container::small_vector<T, nItems>; | ||
#endif | ||
|
||
/** | ||
* A vector of value pointers. See `SmallVector`. | ||
*/ | ||
template <size_t nItems> | ||
using SmallValueVector = SmallVector<Value *, nItems>; | ||
|
||
/** | ||
* A vector of values that must not be referenced after the vector is destroyed. | ||
* | ||
* See also `SmallValueVector`. | ||
*/ | ||
template <size_t nItems> | ||
using SmallTemporaryValueVector = SmallVector<Value, nItems>; | ||
|
||
} |
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