Author Topic: Invoke smartness  (Read 1859 times)


  • Member
  • ***
  • Posts: 447
  • ObjAsm32 + ObjAsm64 = ObjAsm
    • ObjAsm
Invoke smartness
« on: October 21, 2017, 10:14:32 PM »

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.
Code: [Select]
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
Code: [Select]
invoke TestProc rdx, rcx, ...Maybe there is a problem elsewhere but if possible, it would be a big plus point for UASM.

Regards, Biterider


  • Member
  • ****
  • Posts: 799
    • Uasm
Re: Invoke smartness
« Reply #1 on: October 23, 2017, 08:51:44 PM »

This is now fixed in 2.43

Will be out soon :)