Last Comment Bug 615473 - Make ctypes.stdcall_abi and ctypes.winapi_abi aliases to the sole ABI on Win64
: Make ctypes.stdcall_abi and ctypes.winapi_abi aliases to the sole ABI on Win64
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: js-ctypes (show other bugs)
: Trunk
: x86_64 Windows 7
-- normal (vote)
: mozilla8
Assigned To: Siddharth Agarwal [:sid0] (inactive)
:
: Jason Orendorff [:jorendorff]
Mentors:
http://mxr.mozilla.org/comm-central/s...
Depends on:
Blocks: support-win64-thunderbird
  Show dependency treegraph
 
Reported: 2010-11-29 22:26 PST by Makoto Kato [:m_kato]
Modified: 2011-08-11 05:24 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch that aliases stdcall_abi and winapi_abi to the win64 API (untested) (705 bytes, patch)
2011-06-16 15:52 PDT, Siddharth Agarwal [:sid0] (inactive)
no flags Details | Diff | Splinter Review
patch with tests, v1 (11.82 KB, patch)
2011-06-16 17:29 PDT, Siddharth Agarwal [:sid0] (inactive)
dwitte: review+
m_kato: feedback+
Details | Diff | Splinter Review

Description User image Makoto Kato [:m_kato] 2010-11-29 22:26:03 PST
ctypes.winapi_abi is for Win32 only.  Even if Win64, it is used in mailTestUtils.js.
Comment 1 User image Siddharth Agarwal [:sid0] (inactive) 2011-02-16 00:44:34 PST
So depending on whether I'm running on win32 or win64, I'm supposed to write the ctypes definitions differently? Ouch, that sucks -- could we simply change the meaning of winapi_abi on win64 instead?
Comment 2 User image Makoto Kato [:m_kato] 2011-02-16 01:02:53 PST
(In reply to comment #1)
> So depending on whether I'm running on win32 or win64, I'm supposed to write
> the ctypes definitions differently? Ouch, that sucks -- could we simply change
> the meaning of winapi_abi on win64 instead?

no winapi_abi on ctypes for Win64.  

But we consider to add winapi_abi as alias for compatibility of windows.
Comment 3 User image Siddharth Agarwal [:sid0] (inactive) 2011-02-16 01:13:45 PST
Yeah, that's what I meant. I'm still calling a Windows API, so it makes sense that winapi_abi is an alias to the x64 calling convention.
Comment 4 User image Siddharth Agarwal [:sid0] (inactive) 2011-06-16 15:52:07 PDT
Created attachment 539916 [details] [diff] [review]
patch that aliases stdcall_abi and winapi_abi to the win64 API (untested)

What do you think? I've set off a Firefox x64 build.
Comment 5 User image Siddharth Agarwal [:sid0] (inactive) 2011-06-16 17:29:12 PDT
Created attachment 539949 [details] [diff] [review]
patch with tests, v1

The justification for stdcall being an alias to the win64 ABI is that that's how it's interpreted by MSVC: http://msdn.microsoft.com/en-us/library/zxk0tw93. "On Itanium Processor Family (IPF) and x64 processors, __stdcall is accepted and ignored by the compiler; on IPF, by convention, parameters are passed in register."
Comment 6 User image Siddharth Agarwal [:sid0] (inactive) 2011-06-16 17:39:14 PDT
Similarly, since WINAPI is defined as __stdcall per <http://msdn.microsoft.com/en-us/library/aa383751>, WINAPI effectively becomes an alias too. I think this fundamentally makes sense because it allows the exact same code to run across Windows x86 and x64.
Comment 7 User image dwitte@gmail.com 2011-06-16 17:41:15 PDT
So for a given WINAPI function, will its binary signature be identical between Win32 and Win64? DWORDS, pointer sizes, the works?
Comment 8 User image Siddharth Agarwal [:sid0] (inactive) 2011-06-16 18:03:14 PDT
The binary signature won't be identical, but so won't the binary version of the signature on the JS side. As long as you're not doing something stupid like storing pointers in longs, things should still match up on both ends.

Changing product/component/summary to fit patch.
Comment 9 User image Siddharth Agarwal [:sid0] (inactive) 2011-08-10 10:33:14 PDT
review ping? :)
Comment 10 User image dwitte@gmail.com 2011-08-10 10:39:11 PDT
Comment on attachment 539949 [details] [diff] [review]
patch with tests, v1

Looks good. r=dwitte
Comment 11 User image Siddharth Agarwal [:sid0] (inactive) 2011-08-10 12:34:57 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/d856045de3bc
Comment 12 User image Siddharth Agarwal [:sid0] (inactive) 2011-08-10 12:36:31 PDT
Uh, not fixed yet. oops.
Comment 13 User image Mounir Lamouri (:mounir) 2011-08-11 04:37:36 PDT
Merged:
http://hg.mozilla.org/mozilla-central/rev/d856045de3bc
Comment 14 User image Siddharth Agarwal [:sid0] (inactive) 2011-08-11 05:24:06 PDT
(this bug is definitely Windows-only)

Note You need to log in before you can comment on or make changes to this bug.