1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/lib/ExecutionEngine
Serge Pavlov 5202bf068f Report fatal error in the case of out of memory
This is the second part of recommit of r325224. The previous part was
committed in r325426, which deals with C++ memory allocation. Solution
for C memory allocation involved functions `llvm::malloc` and similar.
This was a fragile solution because it caused ambiguity errors in some
cases. In this commit the new functions have names like `llvm::safe_malloc`.

The relevant part of original comment is below, updated for new function
names.

Analysis of fails in the case of out of memory errors can be tricky on
Windows. Such error emerges at the point where memory allocation function
fails, but manifests itself when null pointer is used. These two points
may be distant from each other. Besides, next runs may not exhibit
allocation error.

In some cases memory is allocated by a call to some of C allocation
functions, malloc, calloc and realloc. They are used for interoperability
with C code, when allocated object has variable size and when it is
necessary to avoid call of constructors. In many calls the result is not
checked for null pointer. To simplify checks, new functions are defined
in the namespace 'llvm': `safe_malloc`, `safe_calloc` and `safe_realloc`.
They behave as corresponding standard functions but produce fatal error if
allocation fails. This change replaces the standard functions like 'malloc'
in the cases when the result of the allocation function is not checked
for null pointer.

Finally, there are plain C code, that uses malloc and similar functions. If
the result is not checked, assert statement is added.

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

llvm-svn: 325551
2018-02-20 05:41:26 +00:00
..
IntelJITEvents Remove some leftover DWARFContextInMemory. 2017-07-19 23:34:59 +00:00
Interpreter Report fatal error in the case of out of memory 2018-02-20 05:41:26 +00:00
MCJIT [ORC] Re-apply r322913 with a fix for a read-after-free error. 2018-01-19 22:24:13 +00:00
OProfileJIT Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Orc [ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a 2018-02-14 22:13:02 +00:00
RuntimeDyld Move getPlatformFlags to ELFObjectFileBase and simplify. 2018-01-29 18:27:30 +00:00
CMakeLists.txt [cmake] Expose the dependencies of ExecutionEngine as PUBLIC 2017-08-11 13:25:20 +00:00
ExecutionEngine.cpp [ORC] Re-apply r322913 with a fix for a read-after-free error. 2018-01-19 22:24:13 +00:00
ExecutionEngineBindings.cpp Delete Default and JITDefault code models 2017-08-03 02:16:21 +00:00
GDBRegistrationListener.cpp Do a sweep over move ctors and remove those that are identical to the default. 2016-10-20 12:20:28 +00:00
LLVMBuild.txt add missing dependency for ExecutionEngine lib 2015-06-01 21:56:56 +00:00
SectionMemoryManager.cpp Fix 'not all control paths return a value' warning on MSVC builds 2017-11-09 14:56:17 +00:00
TargetSelect.cpp [ExecutionEngine] After a heroic dev-meeting hack session, the JIT supports TLS. 2017-10-20 00:53:16 +00:00