[M3devel] fyi: state of C backend

Jay K jay.krell at cornell.edu
Thu Sep 6 10:52:19 CEST 2012


Here is what you can do now, it is maghor progress.

edit cm3cg.common to "unfold nested procs" for all targets

cm3 -keepm3cgcat m3-sys/cm3/AMD64_DARWIN/Makefile.mc -out-c:1.cgcc -m64 -c 1.c

I also added a direct nested function call to Makefile.m3to get more coverage.Makefile.m3 already included taking the address ofa nested function, and an exception or finally block.(It appears that exception/finally blocks are givena parameter by the frontend, which is the static_link,whereas other nested functions are not; maybe I'm confused).

It looks right as far as I've looked.Granted, it is hard to see much of anything.I still have to put in case_jump.It is only valid C, not C++.It is kind of horrendous, but we kind of knew that.  Due to the low level nature of M3CG.  
Approximate plan:  add case_jump   double check if init_float is correct   double check what EVAL function_call() does -- need to be sure we emit it    compile more stuff .. lots of stuff .. will likely hit problems...   link stuff  -- will likely hit problems --  run stuff  -- will likely hit problems ..     things to fix but could be postponed:  a fair number of warnings, about unused helper functions, unused labels  for call_indirect, I cast the function pointer to return-type (*)(),  pretty awful. For C++, return_type (*)(...);  
when it is good and stable and usable:  move static helper functions into m3core   integrate it into cm3 properly 

much later:  use C++ exception handling 

consider: Can C++ be used to more portably efficiently pass the static link? Or it is only useful for one level? Or it only makes a difference on NT/x86? 
Point is...hopefully people can start believing in this thing.Maybe provide feedback, suggest changes.Still there is a ways to go.It is just a step beyond "printing random stuff", in that the random stuffgets a fair amount done, and is compilable, at least for one randomly selectedmodule. (Makefile.m3 is not just a trivial few lines, nor is it some comphrensivestress test as far as I know.)

 - Jay

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120906/367bc90e/attachment-0001.html>


More information about the M3devel mailing list