#56 64bit code generation incorrect

None
pending
nobody
None
5
2013-10-27
2012-01-20
Anonymous
No

A procedure with a :DWORD parameter is incorrectly stored to shadow-space on the stack as R9 instead of R9d. Prime example would be WinMain
where CmdShow:DWORD as the fourth parameter uses R9 instead of R9d.

Code generation around INVOKE is incorrect in that RSP should be modified by the callee and not the caller. This should allow the DEBUG output to be compatible with Visual Studio 2010 which cannot track locals/parameters from a JWASM debug compiled binary.

Discussion

  • japheth
    japheth
    2012-07-02

    > A procedure with a :DWORD parameter is incorrectly stored to shadow-space on the stack as R9 instead of R9d

    Hm, this is questionable. If the parameter has type DWORD, then the upper 32-bits of the shadow space are "undefined". Hence it's no problem to write the full 64-bit register instead of the 32-bit variant.

    Having said that, it might still be considered to write the 32-bit register - not because it is "incorrect", but because this will "save" one byte ( the 48h prefix isn't needed ). However, this is a simple and small optimization and has lower priority.

    > Code generation around INVOKE is incorrect in that RSP should be modified by the callee and not the caller.

    Sorry, I don't understand what you mean. You'll have to be more specific. IMO the caller does exactly with RSP what it is supposed to do.

     
  • japheth
    japheth
    2012-08-17

    • status: open --> pending
     
  • japheth
    japheth
    2013-10-27

    Ticket moved from /p/jwasm/bugs/182/