diff options
| -rw-r--r-- | example/.keep (renamed from examples/.keep) | 0 | ||||
| -rw-r--r-- | example/example_01_asm/exit_nekernel_abi.asm (renamed from examples/example_01_asm/exit_nekernel_abi.asm) | 0 | ||||
| -rw-r--r-- | example/example_01_asm/return_5_rax.asm (renamed from examples/example_01_asm/return_5_rax.asm) | 0 | ||||
| -rw-r--r-- | example/example_02_cxx/example.cc (renamed from examples/example_02_cxx/example.cc) | 0 | ||||
| -rw-r--r-- | example/example_03_compilerkit/example.cc (renamed from examples/example_03_compilerkit/example.cc) | 0 | ||||
| -rw-r--r-- | example/example_04_debuggerkit/example.cc (renamed from examples/example_04_debuggerkit/example.cc) | 0 | ||||
| -rw-r--r-- | include/LibC++/base_alloc.h | 8 | ||||
| -rwxr-xr-x | include/LibC++/make-stdcpp-hdrs.sh | 2 | ||||
| -rw-r--r-- | include/LibC++/new.h | 24 | ||||
| -rw-r--r-- | test/.gitkeep (renamed from tests/.gitkeep) | 0 | ||||
| -rw-r--r-- | test/test_01_codegen/.gitkeep (renamed from tests/test_01_codegen/.gitkeep) | 0 | ||||
| -rw-r--r-- | test/test_01_codegen/CMakeLists.txt (renamed from tests/test_01_codegen/CMakeLists.txt) | 0 | ||||
| -rw-r--r-- | test/test_01_codegen/codegen_test.cc (renamed from tests/test_01_codegen/codegen_test.cc) | 0 | ||||
| -rw-r--r-- | test/test_02_linker/.gitkeep (renamed from tests/test_02_linker/.gitkeep) | 0 | ||||
| -rw-r--r-- | test/test_02_linker/CMakeLists.txt (renamed from tests/test_02_linker/CMakeLists.txt) | 0 | ||||
| -rw-r--r-- | test/test_02_linker/linker_test.cc (renamed from tests/test_02_linker/linker_test.cc) | 0 | ||||
| -rw-r--r-- | test/test_samples/sample.asm (renamed from tests/test_samples/sample.asm) | 0 | ||||
| -rw-r--r-- | test/test_samples/sample.cc (renamed from tests/test_samples/sample.cc) | 0 |
18 files changed, 25 insertions, 9 deletions
diff --git a/examples/.keep b/example/.keep index e69de29..e69de29 100644 --- a/examples/.keep +++ b/example/.keep diff --git a/examples/example_01_asm/exit_nekernel_abi.asm b/example/example_01_asm/exit_nekernel_abi.asm index 6f69a00..6f69a00 100644 --- a/examples/example_01_asm/exit_nekernel_abi.asm +++ b/example/example_01_asm/exit_nekernel_abi.asm diff --git a/examples/example_01_asm/return_5_rax.asm b/example/example_01_asm/return_5_rax.asm index 82c0320..82c0320 100644 --- a/examples/example_01_asm/return_5_rax.asm +++ b/example/example_01_asm/return_5_rax.asm diff --git a/examples/example_02_cxx/example.cc b/example/example_02_cxx/example.cc index e74acbb..e74acbb 100644 --- a/examples/example_02_cxx/example.cc +++ b/example/example_02_cxx/example.cc diff --git a/examples/example_03_compilerkit/example.cc b/example/example_03_compilerkit/example.cc index e69de29..e69de29 100644 --- a/examples/example_03_compilerkit/example.cc +++ b/example/example_03_compilerkit/example.cc diff --git a/examples/example_04_debuggerkit/example.cc b/example/example_04_debuggerkit/example.cc index e69de29..e69de29 100644 --- a/examples/example_04_debuggerkit/example.cc +++ b/example/example_04_debuggerkit/example.cc diff --git a/include/LibC++/base_alloc.h b/include/LibC++/base_alloc.h index 7ae03df..cd95806 100644 --- a/include/LibC++/base_alloc.h +++ b/include/LibC++/base_alloc.h @@ -11,7 +11,7 @@ namespace std::base_alloc { /// @brief allocate a new class. /// @tparam KindClass the class type to allocate. -template <typename KindClass, typename... Args> +template <class KindClass, typename... Args> inline KindClass* allocate(Args&&... args) { return new KindClass(forward(args)...); } @@ -19,14 +19,14 @@ inline KindClass* allocate(Args&&... args) { /// @brief allocate a new class. /// @note aborts on error. /// @tparam KindClass the class type to allocate. -template <typename KindClass, typename... Args> +template <class KindClass, typename... Args> inline KindClass* allocate_nothrow(Args&&... args) noexcept { return allocate(forward(args)...); } /// @brief free a class. /// @tparam KindClass the class type to allocate. -template <typename KindClass> +template <class KindClass> inline void release(KindClass ptr) { if (!ptr) return; @@ -36,7 +36,7 @@ inline void release(KindClass ptr) { /// @brief destroy and free a class. /// @note aborts on error. /// @tparam KindClass the class type to allocate. -template <typename KindClass> +template <class KindClass> inline void release_nothrow(KindClass ptr) noexcept { release(ptr); } diff --git a/include/LibC++/make-stdcpp-hdrs.sh b/include/LibC++/make-stdcpp-hdrs.sh index a3730de..880f227 100755 --- a/include/LibC++/make-stdcpp-hdrs.sh +++ b/include/LibC++/make-stdcpp-hdrs.sh @@ -1,6 +1,6 @@ #! /bin/sh -outputDir=libc++/ +outputDir=libc++/nectar/ mkdir -p $outputDir diff --git a/include/LibC++/new.h b/include/LibC++/new.h index faa9da4..23bfa50 100644 --- a/include/LibC++/new.h +++ b/include/LibC++/new.h @@ -24,16 +24,32 @@ struct placement_t final { }; } // namespace std -#ifndef __has_placement -#define placement +// AMLALE: Define the placement_t feature. +#ifndef __cpp_has_placement +#define __cpp_has_placement 1 +#endif + +// AMLALE: Define nothrow +#ifndef __cpp_has_nothrow +#define __cpp_has_nothrow 1 #endif void* operator new(size_t); void* operator new[](size_t); -void* operator new(size_t, const std::nothrow_t&) noexcept; +/// \brief placement_t new and delete operators. Governs how the memory shall be placed. +/// \note This is a feature that shall be used wisely, failure to do so will produce Undefined Behaviors at runtime. +void* operator _placement_new(size_t); +void operator _placement_delete(void*); + +/// \note This should NOT fail, failure to meet the conditions will cause the program's state to be aborted. +/// \brief Set the placement policy of future memory allocations. +template <class PlaceableType> +void set_placement_policy(const PlaceableType&) noexcept; + +void* operator new(size_t, const nothrow_t&) noexcept; void* operator new(size_t, void*) noexcept; -void* operator new[](size_t, const std::nothrow_t&) noexcept; +void* operator new[](size_t, const nothrow_t&) noexcept; void* operator new[](size_t, void*) noexcept; void operator delete(void*) noexcept; diff --git a/tests/.gitkeep b/test/.gitkeep index e69de29..e69de29 100644 --- a/tests/.gitkeep +++ b/test/.gitkeep diff --git a/tests/test_01_codegen/.gitkeep b/test/test_01_codegen/.gitkeep index e69de29..e69de29 100644 --- a/tests/test_01_codegen/.gitkeep +++ b/test/test_01_codegen/.gitkeep diff --git a/tests/test_01_codegen/CMakeLists.txt b/test/test_01_codegen/CMakeLists.txt index 8b782d5..8b782d5 100644 --- a/tests/test_01_codegen/CMakeLists.txt +++ b/test/test_01_codegen/CMakeLists.txt diff --git a/tests/test_01_codegen/codegen_test.cc b/test/test_01_codegen/codegen_test.cc index 06c8e25..06c8e25 100644 --- a/tests/test_01_codegen/codegen_test.cc +++ b/test/test_01_codegen/codegen_test.cc diff --git a/tests/test_02_linker/.gitkeep b/test/test_02_linker/.gitkeep index e69de29..e69de29 100644 --- a/tests/test_02_linker/.gitkeep +++ b/test/test_02_linker/.gitkeep diff --git a/tests/test_02_linker/CMakeLists.txt b/test/test_02_linker/CMakeLists.txt index f3493fc..f3493fc 100644 --- a/tests/test_02_linker/CMakeLists.txt +++ b/test/test_02_linker/CMakeLists.txt diff --git a/tests/test_02_linker/linker_test.cc b/test/test_02_linker/linker_test.cc index 617327f..617327f 100644 --- a/tests/test_02_linker/linker_test.cc +++ b/test/test_02_linker/linker_test.cc diff --git a/tests/test_samples/sample.asm b/test/test_samples/sample.asm index 82c0320..82c0320 100644 --- a/tests/test_samples/sample.asm +++ b/test/test_samples/sample.asm diff --git a/tests/test_samples/sample.cc b/test/test_samples/sample.cc index 4cce7f6..4cce7f6 100644 --- a/tests/test_samples/sample.cc +++ b/test/test_samples/sample.cc |
