diff options
| author | 2022-08-19 21:58:25 -0400 | |
|---|---|---|
| committer | 2022-10-06 21:00:54 +0200 | |
| commit | c80ed6d81fef5858508ac4b841defe8ee3a8663d (patch) | |
| tree | 3f2a193176de0b7e6dff6cefc47172aaf3d6c34e /src/common/address_space.inc | |
| parent | nvdisp: End system frame after requesting to swap buffers (diff) | |
| download | yuzu-c80ed6d81fef5858508ac4b841defe8ee3a8663d.tar.gz yuzu-c80ed6d81fef5858508ac4b841defe8ee3a8663d.tar.xz yuzu-c80ed6d81fef5858508ac4b841defe8ee3a8663d.zip | |
general: rework usages of UNREACHABLE macro
Diffstat (limited to 'src/common/address_space.inc')
| -rw-r--r-- | src/common/address_space.inc | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/common/address_space.inc b/src/common/address_space.inc index 9f957c81d..2195dabd5 100644 --- a/src/common/address_space.inc +++ b/src/common/address_space.inc | |||
| @@ -34,7 +34,7 @@ MAP_MEMBER_CONST()::FlatAddressSpaceMap(VaType va_limit_, | |||
| 34 | std::function<void(VaType, VaType)> unmap_callback_) | 34 | std::function<void(VaType, VaType)> unmap_callback_) |
| 35 | : va_limit{va_limit_}, unmap_callback{std::move(unmap_callback_)} { | 35 | : va_limit{va_limit_}, unmap_callback{std::move(unmap_callback_)} { |
| 36 | if (va_limit > VaMaximum) { | 36 | if (va_limit > VaMaximum) { |
| 37 | UNREACHABLE_MSG("Invalid VA limit!"); | 37 | ASSERT_MSG(false, "Invalid VA limit!"); |
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | 40 | ||
| @@ -42,14 +42,14 @@ MAP_MEMBER(void)::MapLocked(VaType virt, PaType phys, VaType size, ExtraBlockInf | |||
| 42 | VaType virt_end{virt + size}; | 42 | VaType virt_end{virt + size}; |
| 43 | 43 | ||
| 44 | if (virt_end > va_limit) { | 44 | if (virt_end > va_limit) { |
| 45 | UNREACHABLE_MSG( | 45 | ASSERT_MSG(false, |
| 46 | "Trying to map a block past the VA limit: virt_end: 0x{:X}, va_limit: 0x{:X}", virt_end, | 46 | "Trying to map a block past the VA limit: virt_end: 0x{:X}, va_limit: 0x{:X}", |
| 47 | va_limit); | 47 | virt_end, va_limit); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | auto block_end_successor{std::lower_bound(blocks.begin(), blocks.end(), virt_end)}; | 50 | auto block_end_successor{std::lower_bound(blocks.begin(), blocks.end(), virt_end)}; |
| 51 | if (block_end_successor == blocks.begin()) { | 51 | if (block_end_successor == blocks.begin()) { |
| 52 | UNREACHABLE_MSG("Trying to map a block before the VA start: virt_end: 0x{:X}", virt_end); | 52 | ASSERT_MSG(false, "Trying to map a block before the VA start: virt_end: 0x{:X}", virt_end); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | auto block_end_predecessor{std::prev(block_end_successor)}; | 55 | auto block_end_predecessor{std::prev(block_end_successor)}; |
| @@ -124,7 +124,7 @@ MAP_MEMBER(void)::MapLocked(VaType virt, PaType phys, VaType size, ExtraBlockInf | |||
| 124 | 124 | ||
| 125 | // Check that the start successor is either the end block or something in between | 125 | // Check that the start successor is either the end block or something in between |
| 126 | if (block_start_successor->virt > virt_end) { | 126 | if (block_start_successor->virt > virt_end) { |
| 127 | UNREACHABLE_MSG("Unsorted block in AS map: virt: 0x{:X}", block_start_successor->virt); | 127 | ASSERT_MSG(false, "Unsorted block in AS map: virt: 0x{:X}", block_start_successor->virt); |
| 128 | } else if (block_start_successor->virt == virt_end) { | 128 | } else if (block_start_successor->virt == virt_end) { |
| 129 | // We need to create a new block as there are none spare that we would overwrite | 129 | // We need to create a new block as there are none spare that we would overwrite |
| 130 | blocks.insert(block_start_successor, Block(virt, phys, extra_info)); | 130 | blocks.insert(block_start_successor, Block(virt, phys, extra_info)); |
| @@ -149,14 +149,15 @@ MAP_MEMBER(void)::UnmapLocked(VaType virt, VaType size) { | |||
| 149 | VaType virt_end{virt + size}; | 149 | VaType virt_end{virt + size}; |
| 150 | 150 | ||
| 151 | if (virt_end > va_limit) { | 151 | if (virt_end > va_limit) { |
| 152 | UNREACHABLE_MSG( | 152 | ASSERT_MSG(false, |
| 153 | "Trying to map a block past the VA limit: virt_end: 0x{:X}, va_limit: 0x{:X}", virt_end, | 153 | "Trying to map a block past the VA limit: virt_end: 0x{:X}, va_limit: 0x{:X}", |
| 154 | va_limit); | 154 | virt_end, va_limit); |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | auto block_end_successor{std::lower_bound(blocks.begin(), blocks.end(), virt_end)}; | 157 | auto block_end_successor{std::lower_bound(blocks.begin(), blocks.end(), virt_end)}; |
| 158 | if (block_end_successor == blocks.begin()) { | 158 | if (block_end_successor == blocks.begin()) { |
| 159 | UNREACHABLE_MSG("Trying to unmap a block before the VA start: virt_end: 0x{:X}", virt_end); | 159 | ASSERT_MSG(false, "Trying to unmap a block before the VA start: virt_end: 0x{:X}", |
| 160 | virt_end); | ||
| 160 | } | 161 | } |
| 161 | 162 | ||
| 162 | auto block_end_predecessor{std::prev(block_end_successor)}; | 163 | auto block_end_predecessor{std::prev(block_end_successor)}; |
| @@ -190,7 +191,7 @@ MAP_MEMBER(void)::UnmapLocked(VaType virt, VaType size) { | |||
| 190 | if (eraseEnd != blocks.end() && | 191 | if (eraseEnd != blocks.end() && |
| 191 | (eraseEnd == block_start_successor || | 192 | (eraseEnd == block_start_successor || |
| 192 | (block_start_predecessor->Unmapped() && eraseEnd->Unmapped()))) { | 193 | (block_start_predecessor->Unmapped() && eraseEnd->Unmapped()))) { |
| 193 | UNREACHABLE_MSG("Multiple contiguous unmapped regions are unsupported!"); | 194 | ASSERT_MSG(false, "Multiple contiguous unmapped regions are unsupported!"); |
| 194 | } | 195 | } |
| 195 | 196 | ||
| 196 | blocks.erase(block_start_successor, eraseEnd); | 197 | blocks.erase(block_start_successor, eraseEnd); |
| @@ -217,7 +218,7 @@ MAP_MEMBER(void)::UnmapLocked(VaType virt, VaType size) { | |||
| 217 | return; // The region is unmapped here and doesn't need splitting, bail out early | 218 | return; // The region is unmapped here and doesn't need splitting, bail out early |
| 218 | } else if (block_end_successor == blocks.end()) { | 219 | } else if (block_end_successor == blocks.end()) { |
| 219 | // This should never happen as the end should always follow an unmapped block | 220 | // This should never happen as the end should always follow an unmapped block |
| 220 | UNREACHABLE_MSG("Unexpected Memory Manager state!"); | 221 | ASSERT_MSG(false, "Unexpected Memory Manager state!"); |
| 221 | } else if (block_end_successor->virt != virt_end) { | 222 | } else if (block_end_successor->virt != virt_end) { |
| 222 | // If one block is directly in front then we don't have to add a tail | 223 | // If one block is directly in front then we don't have to add a tail |
| 223 | 224 | ||
| @@ -256,7 +257,7 @@ MAP_MEMBER(void)::UnmapLocked(VaType virt, VaType size) { | |||
| 256 | auto block_start_successor{std::next(block_start_predecessor)}; | 257 | auto block_start_successor{std::next(block_start_predecessor)}; |
| 257 | 258 | ||
| 258 | if (block_start_successor->virt > virt_end) { | 259 | if (block_start_successor->virt > virt_end) { |
| 259 | UNREACHABLE_MSG("Unsorted block in AS map: virt: 0x{:X}", block_start_successor->virt); | 260 | ASSERT_MSG(false, "Unsorted block in AS map: virt: 0x{:X}", block_start_successor->virt); |
| 260 | } else if (block_start_successor->virt == virt_end) { | 261 | } else if (block_start_successor->virt == virt_end) { |
| 261 | // There are no blocks between the start and the end that would let us skip inserting a new | 262 | // There are no blocks between the start and the end that would let us skip inserting a new |
| 262 | // one for head | 263 | // one for head |
| @@ -298,7 +299,7 @@ ALLOC_MEMBER(VaType)::Allocate(VaType size) { | |||
| 298 | auto alloc_end_successor{ | 299 | auto alloc_end_successor{ |
| 299 | std::lower_bound(this->blocks.begin(), this->blocks.end(), alloc_end)}; | 300 | std::lower_bound(this->blocks.begin(), this->blocks.end(), alloc_end)}; |
| 300 | if (alloc_end_successor == this->blocks.begin()) { | 301 | if (alloc_end_successor == this->blocks.begin()) { |
| 301 | UNREACHABLE_MSG("First block in AS map is invalid!"); | 302 | ASSERT_MSG(false, "First block in AS map is invalid!"); |
| 302 | } | 303 | } |
| 303 | 304 | ||
| 304 | auto alloc_end_predecessor{std::prev(alloc_end_successor)}; | 305 | auto alloc_end_predecessor{std::prev(alloc_end_successor)}; |
| @@ -332,7 +333,7 @@ ALLOC_MEMBER(VaType)::Allocate(VaType size) { | |||
| 332 | current_linear_alloc_end = alloc_start + size; | 333 | current_linear_alloc_end = alloc_start + size; |
| 333 | } else { // If linear allocation overflows the AS then find a gap | 334 | } else { // If linear allocation overflows the AS then find a gap |
| 334 | if (this->blocks.size() <= 2) { | 335 | if (this->blocks.size() <= 2) { |
| 335 | UNREACHABLE_MSG("Unexpected allocator state!"); | 336 | ASSERT_MSG(false, "Unexpected allocator state!"); |
| 336 | } | 337 | } |
| 337 | 338 | ||
| 338 | auto search_predecessor{this->blocks.begin()}; | 339 | auto search_predecessor{this->blocks.begin()}; |