News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Invoke smartness

Started by Biterider, October 21, 2017, 10:14:32 PM

Previous topic - Next topic

Biterider


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

johnsa

Hi,

This is now fixed in 2.43

Will be out soon :)