Runtime: Remove custom operator new(InPlace).

C++ no longer imposes a null check requirement on placement 'new', and clang no longer emits the null check. This hack is no longer needed.
This commit is contained in:
Joe Groff
2015-11-18 12:26:19 -08:00
parent d9ae1565e8
commit 9ea30d00fe
9 changed files with 30 additions and 45 deletions

View File

@@ -21,21 +21,6 @@
#include <cassert>
#include <cstdlib>
namespace swift {
enum InPlace_t { InPlace };
}
/// A slightly more efficient version of the global placement operator new.
///
/// Unlike the standard global placement operator new, this operator
/// is not declared noexcept, which means it is not allowed to return
/// null under the language semantics, which eliminates an unnecessary
/// null check that the compiler would otherwise have to insert.
/// (C++ is dumb.)
inline void *operator new(size_t size, void *ptr, swift::InPlace_t) {
return ptr;
}
namespace swift {
// FIXME: Use C11 aligned_alloc or Windows _aligned_malloc if available.