Message board for the users of flat assembler.
> Compiler Internals > [minor] Redundant "out of memory" check. v1.71.06
I notice a low priority problem in ASSEMBLE.ASM
This code appears to be comparing a memory address with the address space flags. Fortunately the current highest possible value for the flags dword is ~0x3xxxx and the lowest possible memory address in Windows is ~0x100000 so the test always passes.
close_virtual_addressing_space: <snip 13 lines> cmp eax,[ebx+8] jbe out_of_memory <snip>
But I also notice that even if the correct offset of [ebx+0x18] is given that the test can never fail anyway. If the virtual block can successfully be filled then it is guaranteed to be able to be moved upwards to the top of memory with the minimum amount of space available of 0xff bytes. If the virtual block is filled more, then a memory error is detected by other code before this code is ever reached.
I would suggest to delete both of those lines. Just to avoid possible future problems if the last byte of the flags dword is ever utilized (or if the third byte gains more status bits). Changing it to [ebx+0x18], while perhaps more correct, is also redundant.
|26 Nov 2012, 15:39||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.