Closed bitRAKE closed 2 years ago
In hindsight this might be to catch a corner case I'm not seeing.
Do you want it to be optimized in this way?
macro mov_ecx_mov_edx_value_offset_ebx_plus_FreeMemory_left_right {
mov ecx,[ebx+FreeMemory.left]
mov edx,[ebx+FreeMemory.right]
}
; ...
mov_ecx_mov_edx_value_offset_ebx_plus_FreeMemory_left_right
mov [ecx+FreeMemory.right],eax
mov [edx+FreeMemory.left],eax
mov_ecx_mov_edx_value_offset_ebx_plus_FreeMemory_left_right
I was thinking that loading ECX/EDX again was not needed. I guess there is a situation where the nodes pointed to by ECX/EDX could also be the node pointed to by EBX?
I think this was done because of some technical quirk. Try compiling and running without the second pair and see what happens.
https://github.com/tgrysztar/fasmg/blob/e6f827d605b42ec8bd3be39d83aeb5ec65125f64/core/source/malloc.inc#L213-L218
Duplicate lines look superfluous?