mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-19 09:25:08 -04:00
mem: implement most of StandardAllocator (#860)
This was tested using `https://github.com/node-dot-cpp/alloc-test` plus a few other by-hand tests. It seems to work for the case we care about (sysmodules without thread cache-ing). External users are advised to build with assertions on and contact SciresM if you find issues. This is a lot of code to have gotten right in one go, and it was written mostly after midnight while sick, so there are probably un-noticed issues.
This commit is contained in:
parent
7502e2174f
commit
87ec045a98
47 changed files with 5473 additions and 43 deletions
|
@ -46,11 +46,11 @@ namespace ams::diag {
|
|||
#endif
|
||||
|
||||
#ifdef AMS_ENABLE_ASSERTIONS
|
||||
#define AMS_ASSERT_IMPL(expr, ...) \
|
||||
({ \
|
||||
if (const bool __tmp_ams_assert_val = (expr); AMS_UNLIKELY(!__tmp_ams_assert_val)) { \
|
||||
AMS_CALL_ASSERT_FAIL_IMPL(#expr, ## __VA_ARGS__); \
|
||||
} \
|
||||
#define AMS_ASSERT_IMPL(expr, ...) \
|
||||
({ \
|
||||
if (const bool __tmp_ams_assert_val = static_cast<bool>(expr); AMS_UNLIKELY(!__tmp_ams_assert_val)) { \
|
||||
AMS_CALL_ASSERT_FAIL_IMPL(#expr, ## __VA_ARGS__); \
|
||||
} \
|
||||
})
|
||||
#else
|
||||
#define AMS_ASSERT_IMPL(expr, ...) AMS_UNUSED(expr, ## __VA_ARGS__)
|
||||
|
@ -68,9 +68,9 @@ namespace ams::diag {
|
|||
|
||||
#define AMS_ABORT(...) AMS_CALL_ABORT_IMPL("", ## __VA_ARGS__)
|
||||
|
||||
#define AMS_ABORT_UNLESS(expr, ...) \
|
||||
({ \
|
||||
if (const bool __tmp_ams_assert_val = (expr); AMS_UNLIKELY(!__tmp_ams_assert_val)) { \
|
||||
AMS_CALL_ABORT_IMPL(#expr, ##__VA_ARGS__); \
|
||||
} \
|
||||
#define AMS_ABORT_UNLESS(expr, ...) \
|
||||
({ \
|
||||
if (const bool __tmp_ams_assert_val = static_cast<bool>(expr); AMS_UNLIKELY(!__tmp_ams_assert_val)) { \
|
||||
AMS_CALL_ABORT_IMPL(#expr, ##__VA_ARGS__); \
|
||||
} \
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue