diff options
author | Reid Kleckner <rnk@google.com> | 2019-07-10 00:34:13 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2019-07-10 00:34:13 +0000 |
commit | cc418a3af45adbe740f868a31bde6155083f0b9d (patch) | |
tree | d0b24abef24564f0f5a81d17df58ec768b2de356 /llvm/lib/XRay | |
parent | 9c147bd40bc93376df274e8a5d51c69a55199044 (diff) | |
download | bcm5719-llvm-cc418a3af45adbe740f868a31bde6155083f0b9d.tar.gz bcm5719-llvm-cc418a3af45adbe740f868a31bde6155083f0b9d.zip |
[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
Diffstat (limited to 'llvm/lib/XRay')
-rw-r--r-- | llvm/lib/XRay/InstrumentationMap.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/XRay/Profile.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/XRay/Trace.cpp | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/XRay/InstrumentationMap.cpp b/llvm/lib/XRay/InstrumentationMap.cpp index 2eeb4559021..5b90c5a7ebd 100644 --- a/llvm/lib/XRay/InstrumentationMap.cpp +++ b/llvm/lib/XRay/InstrumentationMap.cpp @@ -178,7 +178,8 @@ loadYAML(int Fd, size_t FileSize, StringRef Filename, InstrumentationMap::FunctionAddressReverseMap &FunctionIds) { std::error_code EC; sys::fs::mapped_file_region MappedFile( - Fd, sys::fs::mapped_file_region::mapmode::readonly, FileSize, 0, EC); + sys::fs::convertFDToNativeFile(Fd), + sys::fs::mapped_file_region::mapmode::readonly, FileSize, 0, EC); if (EC) return make_error<StringError>( Twine("Failed memory-mapping file '") + Filename + "'.", EC); diff --git a/llvm/lib/XRay/Profile.cpp b/llvm/lib/XRay/Profile.cpp index e92eb7e3a7e..9ba8eb1088d 100644 --- a/llvm/lib/XRay/Profile.cpp +++ b/llvm/lib/XRay/Profile.cpp @@ -272,7 +272,8 @@ Expected<Profile> loadProfile(StringRef Filename) { std::error_code EC; sys::fs::mapped_file_region MappedFile( - Fd, sys::fs::mapped_file_region::mapmode::readonly, FileSize, 0, EC); + sys::fs::convertFDToNativeFile(Fd), + sys::fs::mapped_file_region::mapmode::readonly, FileSize, 0, EC); if (EC) return make_error<StringError>( Twine("Cannot mmap profile '") + Filename + "'", EC); diff --git a/llvm/lib/XRay/Trace.cpp b/llvm/lib/XRay/Trace.cpp index f0a70038d3b..0945c8e847e 100644 --- a/llvm/lib/XRay/Trace.cpp +++ b/llvm/lib/XRay/Trace.cpp @@ -391,7 +391,8 @@ Expected<Trace> llvm::xray::loadTraceFile(StringRef Filename, bool Sort) { // Map the opened file into memory and use a StringRef to access it later. std::error_code EC; sys::fs::mapped_file_region MappedFile( - Fd, sys::fs::mapped_file_region::mapmode::readonly, FileSize, 0, EC); + sys::fs::convertFDToNativeFile(Fd), + sys::fs::mapped_file_region::mapmode::readonly, FileSize, 0, EC); if (EC) { return make_error<StringError>( Twine("Cannot read log from '") + Filename + "'", EC); |