fasmg icon indicating copy to clipboard operation
fasmg copied to clipboard

duplicate lines?

Open bitRAKE opened this issue 2 years ago • 4 comments

https://github.com/tgrysztar/fasmg/blob/e6f827d605b42ec8bd3be39d83aeb5ec65125f64/core/source/malloc.inc#L213-L218

Duplicate lines look superfluous?

bitRAKE avatar Apr 23 '22 05:04 bitRAKE

In hindsight this might be to catch a corner case I'm not seeing.

bitRAKE avatar Jul 31 '22 03:07 bitRAKE

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

ghost avatar Jul 31 '22 12:07 ghost

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?

bitRAKE avatar Aug 01 '22 19:08 bitRAKE

I think this was done because of some technical quirk. Try compiling and running without the second pair and see what happens.

ghost avatar Aug 02 '22 11:08 ghost