The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: Biterider on October 21, 2017, 10:14:32 PM

Title: Invoke smartness
Post by: Biterider on October 21, 2017, 10:14:32 PM

Hi
I discovered how smart the invoke macro is.  :t
I experimented to see what is detected and what not and found a situation that is not properly handled.
When a register is trashed, in most cases an error is shown, but in this case not. The rdx is loaded when the lea instruction is executed and subsequently r8 is loaded with this new value but not the intended one.
TestProc proc arg1:QWORD, arg2:QWORD, arg3:QWORD
invoke TestProc, r8, addr pObject_1, rdx

Thinking about this topic, I believe we are giving up to fast. In contrast to the stack passing strategy where you are more or less forced to push the parameters in a given sequence, passing them using registers gives you another degree of freedom. In most cases you can alter the register loading sequence to avoid the premature trashing of a parameter. XCHG RDX, RCX is another alternative for
invoke TestProc rdx, rcx, ...
Maybe there is a problem elsewhere but if possible, it would be a big plus point for UASM.


Regards, Biterider
Title: Re: Invoke smartness
Post by: johnsa on October 23, 2017, 08:51:44 PM
Hi,

This is now fixed in 2.43

Will be out soon :)