mirror of
https://github.com/NixOS/nix
synced 2025-06-27 16:51:15 +02:00
addToStore(): Do evaluation on the main stack
This hopefully avoids the need for all our Boehm GC coroutine workarounds, since the GC roots will be on the main stack of the thread. Fixes #11141.
This commit is contained in:
parent
b13ba7490c
commit
0194f81587
3 changed files with 14 additions and 11 deletions
|
@ -1245,6 +1245,7 @@ StorePath LocalStore::addToStoreFromDump(
|
|||
});
|
||||
try {
|
||||
got = source.read(dumpBuffer.get() + oldSize, want);
|
||||
if (!got) break;
|
||||
} catch (EndOfFile &) {
|
||||
inMemory = true;
|
||||
break;
|
||||
|
|
|
@ -210,14 +210,16 @@ StorePath Store::addToStore(
|
|||
fsm = FileSerialisationMethod::NixArchive;
|
||||
break;
|
||||
}
|
||||
auto source = sinkToSource([&](Sink & sink) {
|
||||
dumpPath(path, sink, fsm, filter);
|
||||
});
|
||||
LengthSource lengthSource(*source);
|
||||
auto storePath = addToStoreFromDump(lengthSource, name, fsm, method, hashAlgo, references, repair);
|
||||
std::optional<StorePath> storePath;
|
||||
auto sink = sourceToSink([&](Source & source) {
|
||||
LengthSource lengthSource(source);
|
||||
storePath = addToStoreFromDump(lengthSource, name, fsm, method, hashAlgo, references, repair);
|
||||
if (lengthSource.total >= settings.warnLargePathThreshold)
|
||||
warn("copied large path '%s' to the store (%s)", path, renderSize(lengthSource.total));
|
||||
return storePath;
|
||||
});
|
||||
dumpPath(path, *sink, fsm, filter);
|
||||
sink->finish();
|
||||
return storePath.value();
|
||||
}
|
||||
|
||||
void Store::addMultipleToStore(
|
||||
|
|
|
@ -271,12 +271,12 @@ std::unique_ptr<FinishSink> sourceToSink(std::function<void(Source &)> fun)
|
|||
void finish() override
|
||||
{
|
||||
if (!coro) return;
|
||||
if (!*coro) abort();
|
||||
//if (!*coro) abort();
|
||||
{
|
||||
CoroutineContext ctx;
|
||||
(*coro)(true);
|
||||
}
|
||||
if (*coro) abort();
|
||||
//if (*coro) abort();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue