feat(3p/nix): Add function to allocate a Value in traceable memory
Backported from:b3e5eea4a9fcd048a526Intentionally skipped because we have not backported the JSON changes:9f46f54de4Did not apply changes ni primops.cc, because those look suspect and are also based on something that we don't have in our tree. Change-Id: I837787ce9f2c90267bc39fce15177980d209d4e9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1253 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
This commit is contained in:
parent
014436eb4a
commit
80eaa1eaf9
5 changed files with 19 additions and 10 deletions
7
third_party/nix/src/libexpr/eval.cc
vendored
7
third_party/nix/src/libexpr/eval.cc
vendored
|
|
@ -5,10 +5,13 @@
|
|||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
|
||||
#define GC_INCLUDE_NEW
|
||||
|
||||
#include <absl/strings/match.h>
|
||||
#include <gc/gc.h>
|
||||
#include <gc/gc_cpp.h>
|
||||
|
|
@ -40,6 +43,10 @@ static char* dupString(const char* s) {
|
|||
return t;
|
||||
}
|
||||
|
||||
std::shared_ptr<Value*> allocRootValue(Value* v) {
|
||||
return std::allocate_shared<Value*>(traceable_allocator<Value*>(), v);
|
||||
}
|
||||
|
||||
static void printValue(std::ostream& str, std::set<const Value*>& active,
|
||||
const Value& v) {
|
||||
checkInterrupt();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue