diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-01 06:05:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-01 06:05:21 +0000 |
commit | 11da4cf25c3de590ecf434316973e9f25eec34c3 (patch) | |
tree | d87f943e29eaabf9e204fd2ab8af186183e915e9 /lib/System/Unix/MappedFile.inc | |
parent | 799ed1053b6a4cb2e3a6d588bd24025daee7ad1f (diff) |
Reimplement MemoryBuffer::getFile with three enhancements:
1) stop using MappedFile.
2) if profitable use the sys::path::MapInFilePages api to
read the file.
3) otherwise fallback to read.
When sys::path::MapInFilePages is implemented, this provides
several benefits:
#1: this avoids fragmenting memory for small files.
#2: this avoids extraneous stat calls when the file size is known.
#3: this only keeps the file descriptor open while reading the
file, not for the duration of the lifetime of the memory
buffer. This fixes a serious clang FD 'leak' problem.
I believe that this will work on a win32 machine, but I don't have
one to test on. I'd appreciate it if someone could check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49031 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix/MappedFile.inc')
0 files changed, 0 insertions, 0 deletions