Closed Bug 71802 Opened 25 years ago Closed 22 years ago

OS/2 - should have calling convention for XPCOM methods

Categories

(Core :: XPCOM, defect)

x86
OS/2
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: achimha, Assigned: mkaply)

References

Details

On OS/2, NS_IMETHOD is defined in /Mozilla/xpcom/base/nsCom.h as #define NS_IMETHOD virtual nsresult For VACPP this is result in the _Optlink calling convention to be used (fastest x86 calling convention using registers as much as possible, then stack). _Optlink is proprietary to VACPP. If we build using emx/gcc, some other calling convention will be used. The bottomline of this is that without a calling convention such as _System attached to this, it will be IMPOSSIBLE to write components using another compiler than VACPP for a VACPP Mozilla (i.e. IBM's version) and it will be impossible to write components that work both for an emx and vacpp build. The problem now is that AFAIK, VACPP does not allow to change calling convention for methods in classes. Don't know if it is still true for 3.6.5. It is a serious problem though.
I have done more research. It is true that VACPP 3.08 does not allow any other calling convention for C++ methods than its proprietary _Optlink. However, version 3.6.5 (the one we use) allows any calling convention to be used. So this change looks doable. I'm cc'ing scc and cls to make sure that I have a correct understanding of how XPCOM works and that my conclusion regarding the requirement to have well defined and cross-compiler calling conventions for XPCOM methods. Mike: this change will make things a bit slower but I think it is unevitable. XPCOM is rather a thin (== fast) layer on top of C++, unlike f.ex. SOM (== CORBA) which has a complete function dispatcher...
This change would also require xptcall to be totally changed for vacpp as it works for _Optlink. It might be possible to just slightly adopt the Win32 xptcall glue code if using the __stdcall convention.
Blocks: 72050
I've changed the nsCom.h methods to use _System to workaround bustage. I guess this means we'll have to rewrite xptcall tomorrow.
After much investigation, we have determined that it is not possible to move things to another calling convention. In particular, there are hundreds of APIs within Mozilla that do not properly use the NSI_* macros, so their calling convention is always set to the compiler default (in this case _Optlink). Should we specify _Optlink in nsCom.h to ake it clear that is what we are using?
IMHO, we should gradually fix those hundreds of APIs with incorrect declaration. Provided it is possible to find all of them and not have to rely on trial an error. Not a high priority though.
We're never going to fix this and I am tired of it hanging around.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.