[M3devel] posix/nt/32/64/endian platforms for C backend?

Jay K jay.krell at cornell.edu
Fri Aug 14 22:39:10 CEST 2015


Now that jmpbuf size is factored out.I'm wondering if, for the C backend, we can have a total of 6-8 targets.

  L64_UNIX (little endian 64bit posix/pthreads/Xwindows)   L32_UNIX (little endian 32bit posix/pthreads/Xwindows)   B64_UNIX (big endian 64bit posix/pthreads/Xwindows)   B32_UNIX (big endian 32bit posix/pthreads/Xwindows)   L64_NT   (little endian Win64 threads/gui)   L32_NT   (little endian Win32 threads/gui)   Xbox 360 is big endian, but nevermind that?   Windows CE has any big endian targets?   Call then WIN instead of NT?  I find "endian" too long and "L" too short. 

No more of this Darwin/OpenBSD/FreeBSD/Solaris/NetBSD/DragonflyBSD stuff?For the C backend.

There is a missing element here.What m3core/src/thread/PTHREAD does -- different source files for OpenBSD/FreeBSD/Apple/etc.

To address those, well, I'd surround each file with an #ifdef, and eitherconcatenate them all in git, or in the quake file, if using the C backendreference one file that #includes them all -- and says h_file for the constituents or such.Thereby making one common quake path at least for the C backend.There is slight extra I/O cost implied that the current scheme avoids.

Longer term I'd like just one target for C, but that might be difficult/impossible.Whereas this seems tractable.

Now, unfortunately, there might be more "cartesian factors".e.g. Win32 gui + pthreads. You can do that with Cygwin.e.g. has_stack_walker

But I'm hoping to avoid the last.Hopefully has_stack_walker is modeled by higher levelm3cg calls, at the very least: "call_setjmp_if_no_stack_walker"that then flow into the C through #ifdefs.

Hypothetically:

 C output  #ifdef _WIN32 .. or whatever platforms have stack walkers, will be most eventually  #define call_setjmp(buf) (0)  #else #define call_setjmp(buf) setjmp(buf) #endif 
used within an if. Something like that.
  or even #ifdef __cpluspls and...

i.e. the frontend can issue "both" sets of CG and later one C compilationignores "half" of them. If we output C++ this is simpler, just use its mechanism.

Anyway, that is getting ahead of things, the stack walker aspect.

Introduce those 6 targets?

Yes I know there is one or two more things in Target.m3 to deal with -- standard structsis the same for all C backend. I'll send mail on the other.

Too confusing?Not good enough -- given more than one?

Keep all the targets so we can write config files that say i386-apple-gcc, amd64-gnu-linux-gcc?

 - Jay
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20150814/248e4963/attachment-0001.html>


More information about the M3devel mailing list