<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>The alloca approach is fairly sound, w/o this change. However in the "cake and eat it too" dept..the C backend could instead say: </div><div>#include setjmp.h</div><div>.</div><div>.</div><div>.</div><div>jmp_buf x;</div><div><br></div><div><br></div><div>thereby still not knowing the size of a jmp_buf but generating correct portable slightly more efficient code. Also doing a better job of telling the C compiler that setjmp is being used -- rather than e.g. declaring setjmp ourselves, which I think is somewhat dubious, though faster to compile...</div><div><br></div><div><br></div><div>I admit that the efficiency still stinks & we have much greater efficiency goals here.</div><div><br></div><div><br></div><div><br></div><div> - Jay</div><div><br>On Aug 3, 2015, at 7:05 PM, Antony Hosking <<a href="mailto:hosking@purdue.edu">hosking@purdue.edu</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1">Remind me again what the issue is with the alloca approach?<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 2, 2015, at 1:36 PM, Jay K <<a href="mailto:jay.krell@cornell.edu" class="">jay.krell@cornell.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="">I propose the following:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""> - A flag to m3front indicating if the backend "knows" what a jmpbuf is.</div><div class=""><br class=""></div><div class=""> - extend M3CG.Type = { int8, uint8, ... addr ... struct }</div><div class=""><span style="font-size: 12pt;" class="">   by adding a jmpbuf element</span></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""> - if the backend "knows" what a jmpbuf is, then, vs. the current code,</div><div class="">   the frontend shall just declare a jmpbuf per try, leaving the backend</div><div class="">   to size it, and w/o using the upcoming alloca approach.</div><div class="">   </div><div class=""><br class=""></div><div class=""> - if the backend does not "know" what a jmpbuf is, then, well, there</div><div class="">   is the current approach of making a sized struct, or my approach</div><div class="">   that is almost working where we use alloca. The frontend</div><div class="">   will not output cgtype.jmpbuf unless the backend "knows" what it is.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">   ok?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The information as to the backend's knowledge of a jmpbuf shall be</div><div class="">yet another internal m3front flag, like what guides nested function</div><div class="">output order.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I was going to propose something slightly different, like</div><div class="">m3front always use this new jmpbuf type, and existing backends</div><div class="">can just change it "back" to struct. The problem with that approach..</div><div class="">it works easily with the current code, but does not address</div><div class="">my upcoming alloca(sizeof_jmpbuf) change.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">In this way, what the C backend will do is:</div><div class=""> #include <setjmp.h> </div><div class=""> jmp_buf buf1; </div><div class=""> jmp_buf buf2; </div><div class=""> etc.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">leaving the size of the jmpbuf completely absent in the generated code,</div><div class="">and allocating in the slightly more efficient way than alloca.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Exception handling is special, so accomodating this seems reasonable.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Yes, it might be temporary, replaced by libunwind stuff.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thank you,</div><div class=""> - Jay</div></div><span style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">M3devel mailing list</span><br style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:M3devel@elegosoft.com" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">M3devel@elegosoft.com</a><br style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel</a></div></blockquote></div><br class=""></div></div></blockquote></body></html>