[M3devel] calling conventions (small proposal)

Jay K jay.krell at cornell.edu
Sun Feb 21 12:52:21 CET 2010


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/20100221/23ce0197/attachment-0001.html>


More information about the M3devel mailing list