block_of_code: Fix inaccurate size reporting in SpaceRemaining

Typo: getCode should be getCurr: Instead of comparing against the current pointer,
we were incorrectly comparing against the start of memory
This commit is contained in:
Merry 2022-02-26 16:09:11 +00:00
parent 123efbbfbe
commit 19a423034e

View file

@ -190,8 +190,8 @@ void BlockOfCode::ClearCache() {
size_t BlockOfCode::SpaceRemaining() const { size_t BlockOfCode::SpaceRemaining() const {
ASSERT(prelude_complete); ASSERT(prelude_complete);
const u8* current_near_ptr = in_far_code ? reinterpret_cast<const u8*>(near_code_ptr) : getCode<const u8*>(); const u8* current_near_ptr = in_far_code ? reinterpret_cast<const u8*>(near_code_ptr) : getCurr<const u8*>();
const u8* current_far_ptr = in_far_code ? getCode<const u8*>() : reinterpret_cast<const u8*>(far_code_ptr); const u8* current_far_ptr = in_far_code ? getCurr<const u8*>() : reinterpret_cast<const u8*>(far_code_ptr);
if (current_near_ptr >= far_code_begin) if (current_near_ptr >= far_code_begin)
return 0; return 0;
if (current_far_ptr >= &top_[maxSize_]) if (current_far_ptr >= &top_[maxSize_])