[Support] Move llvm::MemoryBuffer to sys::fs::file_t
authorReid Kleckner <rnk@google.com>
Wed, 10 Jul 2019 00:34:13 +0000 (00:34 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 10 Jul 2019 00:34:13 +0000 (00:34 +0000)
commitcc418a3af45adbe740f868a31bde6155083f0b9d
treed0b24abef24564f0f5a81d17df58ec768b2de356
parent9c147bd40bc93376df274e8a5d51c69a55199044
[Support] Move llvm::MemoryBuffer to sys::fs::file_t

Summary:
On Windows, Posix integer file descriptors are a compatibility layer
over native file handles provided by the C runtime. There is a hard
limit on the maximum number of file descriptors that a process can open,
and the limit is 8192. LLD typically doesn't run into this limit because
it opens input files, maps them into memory, and then immediately closes
the file descriptor. This prevents it from running out of FDs.

For various reasons, I'd like to open handles to every input file and
keep them open during linking. That requires migrating MemoryBuffer over
to taking open native file handles instead of integer FDs.

Reviewers: aganea, Bigcheese

Reviewed By: aganea

Subscribers: smeenai, silvas, mehdi_amini, hiraditya, steven_wu, dexonsmith, dang, llvm-commits, zturner

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63453

llvm-svn: 365588
18 files changed:
llvm/include/llvm/Support/FileSystem.h
llvm/include/llvm/Support/MemoryBuffer.h
llvm/lib/LTO/Caching.cpp
llvm/lib/LTO/LTOModule.cpp
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/lib/Object/ArchiveWriter.cpp
llvm/lib/Support/FileOutputBuffer.cpp
llvm/lib/Support/MemoryBuffer.cpp
llvm/lib/Support/Unix/Path.inc
llvm/lib/Support/VirtualFileSystem.cpp
llvm/lib/Support/Windows/Path.inc
llvm/lib/XRay/InstrumentationMap.cpp
llvm/lib/XRay/Profile.cpp
llvm/lib/XRay/Trace.cpp
llvm/tools/llvm-xray/xray-fdr-dump.cpp
llvm/unittests/Support/MemoryBufferTest.cpp
llvm/unittests/Support/Path.cpp
llvm/unittests/Support/ReplaceFileTest.cpp