[M3devel] calling conventions (small proposal)
Darko
darko at darko.org
Sun Feb 21 21:09:28 CET 2010
This is a good idea. An alternate proposal would be to put the calling conventions in an external file, but this change would seem to be the simplest and in line with the stated definition of pragamas.
On 21/02/2010, at 10:52 PM, Jay K wrote:
1) All platforms should accept, but silently ignore, the NT386/I386_CYGWIN/etc. calling conventions:
at least __stdcall, and __cdecl
Probably all the synonyms: C, WINAPI, CALLBACK, WINAPIV, APIENTRY, APIPRIVATE, PASCAL,
This is a very small change.
This is will allow:
a) possibly merging the two nearly identical OpenGL.i3 files
b) implementing functions in Modula-3 that are portable, but use __stdcall, possibly for perf
I intend to that for hand.c's replacement, soon.
Maybe experiment as to the perf.
__stdcall is supposed to be faster, because the code is smaller.
But __cdecl might be able to compete by using stores to the stack instead of pushes?
I'd have to see how that compares in size, and it does increase stack usage some.
Probably not worth large scale experimenting/changing, but maybe nice to mark
new functions/interfaces as __stdcall (see next point).
I was actually thinking of trying flat out changing the default, but I think that is too difficult,
what with all the C<=>Modula-3 transitions. And not worth it given other
more valuable work to do.
2) The calling convention pragmas should be allowed on an interface, to set
the default for an interface.
2b) and I guess as well on a module, for unexported functions
I assert that other than __stdcall and __cdecl on NT386, nothing else is
particularly interesting here. There is __fastcall, maybe interesting.
It has different meanings to different compilers.
I'd rather keep this all fairly constrained.
No other platform has more than one calling convention, so this doesn't
have be to further generalized. Besides, as long as no platform uses
the same name to mean multiple things, ok.
Mac68K Classic?
Mac68K CFM?
Win16?
MS-DOS?
(I did recently acquire a working Mac68K, as well it is easily
run on a modern PPC Mac; far down the list, but...)
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100222/2c948b07/attachment-0002.html>
More information about the M3devel
mailing list