[M3devel] higher level M3CG modeling of jmpbuf/setjmp/longjmp or exception handling?

Jay K jay.krell at cornell.edu
Thu Jul 30 02:38:49 CEST 2015


I don't have one precise proposal, but somehow,jmpbuf/setjmp/longjmp should be represented in a higher level in m3cgor maybe "even higher level", exception handling.

There are multiple optimization opportunties and multipleopportunities to move/remove target-dependent code.


In particular m3middle/m3front should not know jmpbuf size.Generated C should not have jmpbuf sizes embedded in it.

gcc has a "builtin" jmpbuf/setjmp/longjmp notion, for use by exceptionhandling, that llvm replicates, that is optimized, like to notsave/restore unused registers.

Or, yes, there is my alloca proposal, which doesn't solve as much, but does help.

In particular, the C backend just wants to know something is a "jmpbuf"so it can #include <setjmp.h> in the generated code and produce ajmpbuf instead of an array of bytes and call setjmp/longjmp or _setjmp/_longjmp.

Or even better, a C++ backend wants to somehow module Modula-3 exceptionsas C++ exceptions.

Or, possibly, the Win32 C backend could model Modula-3 exceptions using"structured exception handling" -- advantage over C++ exceptions is portabilityto kernel mode.

Thoughts? - Jay

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20150730/9ebaac62/attachment-0001.html>


More information about the M3devel mailing list