<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br>
<br><div><div>On 2 Jun 2010, at 10:30, Jay K wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>attached is the diff I'm working on.<br><br><br>It works well on a few platforms.<br>I've been using it on AMD64_DARWIN.<br>Cross I386_LINUX, PPC_DARWIN cm3 startup and give<br>  the correct message, which requires exception handling to work.<br><br><br>SOLgnu exception handling doesn't work.<br></div></blockquote><div><br></div><div>Possibly needs a register window flush?  I'm only speculating here.</div><br><blockquote type="cite"><div>MIPS64_OPENBSD internal errors a bunch in the compiler.<br>  Probably don't care. Don't know if it was working before.<br></div></blockquote><blockquote type="cite"><div><font class="Apple-style-span" color="#000000"><br></font>Still to do:<br>  figure out what is up with SOLgnu/SOLsun<br><br><br>Not ideal but I think ok for now:<br>  volatizing all floating point<br>    We already were, though granted possibly with more optimizations.<br>  flag_unit_at_a_time = 0<br><br>  <br>flag_unit_at_a_time isn't "tricky" or subtle,<br>but it does remove a function we want to take the address of.<br>I couldn't find a way to get it to keep the function.<br><br><br>What I think is fine for a while:<br>  flag_tree_vrp = 0;<br>  flag_tree_pre = 0;<br>  flag_tree_fre = 0;<br><br>  <br>Maybe it doesn't take much to let them work?<br>Maybe wait until 4.5 is working and try again there?<br>  In particular pre/fre only fail in one file among m3core/libm3, Formater.m3.<br>  vrp is what silently produces non-working code.<br>  It is either the only one, or one of pre/fre also do.<br>  At least one of pre/fre crash, accessing null pointer.<br><br> <br>and probably also ok for a "while":<br> flag_tree_loop_im = 0<br> flag_schedule_insns = 0<br><br> <br>though for flag_schedule_insns = 0 to fail seems odd,<br>and flag_tree_loop_im only broke in a little code, should<br>probably look at that code.<br><br><br>Oh and I still need to see about fours/badbricks recieving mouse clicks.<br>Mine aren't.<br><br><br>The TREE_ADDRESSABLE change in m3_write_globals was needed to get SOLgnu<br>to compiler. The assert failed.<br><br><br>We might want to have the frontend tell the backend if the<br>target has a stack walker, instead of the logic I have here.<br><br><br>While it is not ideal, I think this will let -O1/2/3 generate code much more like people expect, without<br>constantly reloading registers from the stack.<br><br><br> - Jay<br><br>----------------------------------------<br><blockquote type="cite">From: <a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br></blockquote><blockquote type="cite">To: <a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br></blockquote><blockquote type="cite">CC: <a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br></blockquote><blockquote type="cite">Subject: RE: [M3devel] reducing use of volatile in backend?<br></blockquote><blockquote type="cite">Date: Tue, 1 Jun 2010 21:55:31 +0000<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I've had *a lot* of success here the past few hours.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">There is an assert starting up mentor I need to look at, possibly out of data binaries.<br></blockquote><blockquote type="cite">The one in socket.c assert(lossless_socklen || socklen == null || socklen < 1<<30.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Compiler seems to work.<br></blockquote><blockquote type="cite">Lots of things do break it, so that is something.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Various gui apps startup.<br></blockquote><blockquote type="cite">Some of the gui apps don't work, but nor did older copies I had -- fours, badbricks, and I think columns, wouldn't take any mouse clicks. I have to test older versions. Could be unrelated.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Here is what I have:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The vast vast majority of optimizations can be enabled.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Nearly all uses of volatile can be removed.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Just a few optimizations "need" to be disabled.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">In particular:<br></blockquote><blockquote type="cite">I only have volatile remaining:<br></blockquote><blockquote type="cite">on store after insert_mn (special case)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">floating point (huh? wierd)<br></blockquote><blockquote type="cite">compile errors without this<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">in functions that call setjmp or vfork<br></blockquote><blockquote type="cite">This is very reasonable, but we should try to limit it to not all the variables, only what are accessed after the second return (I'm not sure how that computes for vfork, but for setjmp it makes sense to me.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">on the load/store in loophole<br></blockquote><blockquote type="cite">compile errors without this; perhaps redundant with the floating point check<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">on load link, else it gets uninitialized warning<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Also I found a likely bug.<br></blockquote><blockquote type="cite">In functions that call setjmp/vfork, we volatize already seen parameters and locals, but we don't volatize not yet seen locals (in nested blocks) and temporaries. I fixed that.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The optimizations I disabled, from memory:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">pre - partial redundancy elimination<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">fre - full redundancy elimination (these are related)<br></blockquote><blockquote type="cite">One or both of these causes the compiler to access violate in the optimizer, compiling libm3/Formatter.mc, but otherwise I think they compile m3core and libm3 entirely<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">loop im (induction motion) - caused a compile error in Trestle<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">vrp - value range propagation<br></blockquote><blockquote type="cite">This seems to be the biggest problem, no compile errors but "random" runtime malfunction, usually starting up cm3.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">insn_sched - wierd, caused a compile break<br></blockquote><blockquote type="cite">but insn_sched_after_reload ok<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">That's about it. All the ones with "alias" in them, only like two, I enabled, seemed ok.<br></blockquote><blockquote type="cite">salias and strict_alias. I left strict alias till late in experimentation but really it seems ok.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I can compile the entire system, though I get lots of warnings about uninitialized variables.<br></blockquote><blockquote type="cite">I pass the backend the -Wuninitialized flag.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I test it out more -- the gui non-interaction, the mentor assert, and test other platforms.<br></blockquote><blockquote type="cite">But I think we'll have volatile mostly gone and just a small number of optimizations turned off fairly soon.<br></blockquote><blockquote type="cite">We can iterate more on the remaining optimizations.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Getting good typeinfo would be good so that gdb can debug.<br></blockquote><blockquote type="cite">And maybe so that other than stabs works.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">- Jay<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">----------------------------------------<br></blockquote><blockquote type="cite"><blockquote type="cite">From: <a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">To: <a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Date: Tue, 1 Jun 2010 16:05:30 -0500<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">CC: <a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Subject: Re: [M3devel] reducing use of volatile in backend?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">We don't want to disable optimisations for types where it makes sense<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">to have them. Better to smarten up typebased alias analysis instead so<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">we can get rid of volatile properly.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Sent from my iPhone<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">On Jun 1, 2010, at 12:16 PM, Jay K wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Tony, would we maybe be better off not using volatile everywhere but<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">selectively turning off optimizations in m3_post_options?<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">You know, using volatile probably disables more than necessary?<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I'm experimenting with this.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">- Jay<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote> <span class="Apple-tab-span" style="white-space:pre">      </span><span class="Apple-tab-span" style="white-space:pre">    </span> <span class="Apple-tab-span" style="white-space:pre">   </span>   <span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span>  <span><less-volatile.txt></span></div></blockquote></div><br></body></html>