<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I'm implementing M3CG_Ops.m3.<br>I don't trust m3tk -- it isn't the compiler.<br>I'm somewhat familiar with m3cg.<br>Given another M3CG, I know how to plug in to cm3, config files, etc.<br>(e.g. add a new target, AMD64_NT, that will use this. :) )<br><br><br>On the other hand...I have a little more insight this morning.<br>Variables have an "uplevel" parameter -- are they accessed from nested functions.<br>I should be able to link variables to their containing procedure, and therefore its level.<br>So "load(var)" I guess can be:<br><br>text := "" <br>for i := current_level to var.proc.level do (* typically an empty loop *) <br> text := text & "_static_link->" <br>end; <br>if uplevel AND current_level = var.proc.level (* relatively rare *) <br> text := text & "_locals."; <br>end; <br> text := text & var.name; <br><br>or somesuch.<br><br><br>I think I should get back to M3C with the assumption I don't need multiple passes...fil in more pieces..see where I get...<br>
<br>- Jay<br><br><br><div><div id="SkyDrivePlaceholder"></div>> To: jay.krell@cornell.edu<br>> CC: hosking@cs.purdue.edu; m3devel@elegosoft.com<br>> Subject: Re: [M3devel] why this loop/multipass stuff<br>> Date: Wed, 22 Aug 2012 07:41:09 -0700<br>> From: mika@async.caltech.edu<br>> <br>> Jay I've been following what you've been writing with one eye.<br>> <br>> But I'm not clear exactly what framework you're fitting into. Are you<br>> processing the output of m3front?<br>> <br>> There's always m3tk. Since it is claimed it was used to write a compiler<br>> it ought to be able to process MODULEs but I've only ever used it to<br>> process INTERFACEs. What's the story about that?<br>> <br>> Mika<br>> <br>> Tony Hosking writes:<br>> ><br>> >--Apple-Mail=_ED26DAAF-73B8-4147-B1C9-82D48C3720BF<br>> >Content-Transfer-Encoding: quoted-printable<br>> >Content-Type: text/plain;<br>> > charset=iso-8859-1<br>> ><br>> ><br>> >Antony Hosking | Associate Professor | Computer Science | Purdue =<br>> >University<br>> >305 N. University Street | West Lafayette | IN 47907 | USA<br>> >Mobile +1 765 427 5484<br>> ><br>> ><br>> ><br>> ><br>> ><br>> >On Aug 22, 2012, at 10:24 AM, Jay K <jay.krell@cornell.edu> wrote:<br>> ><br>> >> why this loop/multipass stuff<br>> >>=20<br>> >>=20<br>> >> So people understand where I'm going here -- and Tony asked. I had =<br>> >already written this up..<br>> >>=20<br>> >>=20<br>> >>=20<br>> >> 1) in the past working on m3cc/parse.c, I found that "declare"s<br>> >> weren't always "topologically sorted".<br>> >>=20<br>> >>=20<br>> >> That is, like, I might see:<br>> >>=20<br>> >> given TYPE T1 =3D INTEGER;<br>> >> TYPE T2 =3D RECORD =3D a:T1; END;<br>> >>=20<br>> >>=20<br>> >> I might have seen type T1 declared before T2, or not.<br>> >> I'm not sure if it was record/fields or other relationships.<br>> >> I just remember that building up a map of typeid to data, and<br>> >> looking up it when needed, didn't always work, with one pass.<br>> >>=20<br>> >>=20<br>> >> So what I did is that I was willing to "skip" declares<br>> >> that referred to typeids I hadn't seen yet, and then loop<br>> >> again, hoping for progress at each loop (fewer skips).<br>> ><br>> >Was this all in aid of building up proper type descriptors?<br>> ><br>> >> 2) It looks like declare_local/temp don't all come in<br>> >> "at the start" of a procedure. I'm not sure if I'm generating<br>> >> C or C++, but if I'm generating C, it helps to have declare_local/temp<br>> >> right after begin_procedure/block. Multiple passes let me make that<br>> >> so, without changing m3front.<br>> >> (Upon further looking..it seems this is mostly done right, but<br>> >> not for "try" blocks; maybe reasonable to change m3front here.).<br>> >>=20<br>> >>=20<br>> >> Now, generating C++ is an option, and I'm ignoring all declares<br>> >> currently anyway, so these don't force the matter, but:<br>> >>=20<br>> >>=20<br>> >> 3) nested functions.<br>> >> If a function contains any nested functions, I want to put all of<br>> >> its locals in a local struct, and use the address of that struct<br>> >> as the "static link". Or at least the locals that are referenced<br>> >> by nested functions.<br>> ><br>> >Preferably these only, or else you will cause all locals to be in memory =<br>> >instead of registers.<br>> ><br>> >> As well, m3front contains options as to<br>> >> the order of outputing functions. It uses one order for m3back and<br>> >> a different order for m3cc. I wouldn't mind if M3C.m3 worked either<br>> >> way.<br>> >>=20<br>> >>=20<br>> >> There are possibly other benefits that could be derived from multiple =<br>> >passes.<br>> >> Nothing offhand though.<br>> >>=20<br>> >>=20<br>> >> - Jay<br>> ><br>> ><br>> >--Apple-Mail=_ED26DAAF-73B8-4147-B1C9-82D48C3720BF<br>> >Content-Transfer-Encoding: quoted-printable<br>> >Content-Type: text/html;<br>> > charset=iso-8859-1<br>> ><br>> ><html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =<br>> >charset=3Diso-8859-1"><base href=3D"x-msg://3740/"></head><body =<br>> >style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =<br>> >-webkit-line-break: after-white-space; "><br><div><br>> ><span class=3D"Apple-style-span" style=3D"border-collapse: separate; =<br>> >color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; =<br>> >font-variant: normal; font-weight: normal; letter-spacing: normal; =<br>> >line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: =<br>> >0px; text-transform: none; white-space: normal; widows: 2; word-spacing: =<br>> >0px; -webkit-border-horizontal-spacing: 0px; =<br>> >-webkit-border-vertical-spacing: 0px; =<br>> >-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =<br>> >auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span =<br>> >class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =<br>> >rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =<br>> >normal; font-variant: normal; font-weight: normal; letter-spacing: =<br>> >normal; line-height: normal; orphans: 2; text-indent: 0px; =<br>> >text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; =<br>> >-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =<br>> >0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =<br>> >auto; -webkit-text-stroke-width: 0px; "><div style=3D"word-wrap: =<br>> >break-word; -webkit-nbsp-mode: space; -webkit-line-break: =<br>> >after-white-space; "><span class=3D"Apple-style-span" =<br>> >style=3D"border-collapse: separate; -webkit-border-horizontal-spacing: =<br>> >0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); =<br>> >font-family: Helvetica; font-size: 12px; font-style: normal; =<br>> >font-variant: normal; font-weight: normal; letter-spacing: normal; =<br>> >line-height: normal; -webkit-text-decorations-in-effect: none; =<br>> >text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; =<br>> >orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div =<br>> >style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =<br>> >-webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =<br>> >style=3D"border-collapse: separate; -webkit-border-horizontal-spacing: =<br>> >0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); =<br>> >font-family: Helvetica; font-size: 12px; font-style: normal; =<br>> >font-variant: normal; font-weight: normal; letter-spacing: normal; =<br>> >line-height: normal; -webkit-text-decorations-in-effect: none; =<br>> >text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; =<br>> >orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span =<br>> >class=3D"Apple-style-span" style=3D"border-collapse: separate; =<br>> >-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =<br>> >0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; =<br>> >font-style: normal; font-variant: normal; font-weight: normal; =<br>> >letter-spacing: normal; line-height: normal; =<br>> >-webkit-text-decorations-in-effect: none; text-indent: 0px; =<br>> >-webkit-text-size-adjust: auto; text-transform: none; orphans: 2; =<br>> >white-space: normal; widows: 2; word-spacing: 0px; "><span =<br>> >class=3D"Apple-style-span" style=3D"border-collapse: separate; =<br>> >-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =<br>> >0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; =<br>> >font-style: normal; font-variant: normal; font-weight: normal; =<br>> >letter-spacing: normal; line-height: normal; =<br>> >-webkit-text-decorations-in-effect: none; text-indent: 0px; =<br>> >-webkit-text-size-adjust: auto; text-transform: none; orphans: 2; =<br>> >white-space: normal; widows: 2; word-spacing: 0px; "><span =<br>> >class=3D"Apple-style-span" style=3D"border-collapse: separate; =<br>> >-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =<br>> >0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; =<br>> >font-style: normal; font-variant: normal; font-weight: normal; =<br>> >letter-spacing: normal; line-height: normal; =<br>> >-webkit-text-decorations-in-effect: none; text-indent: 0px; =<br>> >-webkit-text-size-adjust: auto; text-transform: none; orphans: 2; =<br>> >white-space: normal; widows: 2; word-spacing: 0px; "><span =<br>> >class=3D"Apple-style-span" style=3D"border-collapse: separate; =<br>> >-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =<br>> >0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; =<br>> >font-style: normal; font-variant: normal; font-weight: normal; =<br>> >letter-spacing: normal; line-height: normal; =<br>> >-webkit-text-decorations-in-effect: none; text-indent: 0px; =<br>> >-webkit-text-size-adjust: auto; text-transform: none; orphans: 2; =<br>> >white-space: normal; widows: 2; word-spacing: 0px; "><span =<br>> >class=3D"Apple-style-span" style=3D"border-collapse: separate; =<br>> >-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =<br>> >0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; =<br>> >font-style: normal; font-variant: normal; font-weight: normal; =<br>> >letter-spacing: normal; line-height: normal; =<br>> >-webkit-text-decorations-in-effect: none; text-indent: 0px; =<br>> >-webkit-text-size-adjust: auto; text-transform: none; orphans: 2; =<br>> >white-space: normal; widows: 2; word-spacing: 0px; "><span =<br>> >class=3D"Apple-style-span" style=3D"border-collapse: separate; =<br>> >-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =<br>> >0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; =<br>> >font-style: normal; font-variant: normal; font-weight: normal; =<br>> >letter-spacing: normal; line-height: normal; =<br>> >-webkit-text-decorations-in-effect: none; text-indent: 0px; =<br>> >-webkit-text-size-adjust: auto; text-transform: none; orphans: 2; =<br>> >white-space: normal; widows: 2; word-spacing: 0px; "><span =<br>> >class=3D"Apple-style-span" style=3D"border-collapse: separate; =<br>> >-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =<br>> >0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; =<br>> >font-style: normal; font-variant: normal; font-weight: normal; =<br>> >letter-spacing: normal; line-height: normal; =<br>> >-webkit-text-decorations-in-effect: none; text-indent: 0px; =<br>> >-webkit-text-size-adjust: auto; text-transform: none; orphans: 2; =<br>> >white-space: normal; widows: 2; word-spacing: 0px; "><div><font =<br>> >class=3D"Apple-style-span" color=3D"#0000FF"><font =<br>> >class=3D"Apple-style-span" face=3D"Gill Sans"><span =<br>> >class=3D"Apple-style-span" style=3D"color: rgb(0, 0, 255); font-family: =<br>> >'Gill Sans'; "><span class=3D"Apple-style-span" style=3D"color: rgb(0, =<br>> >0, 255); font-family: 'Gill Sans'; ">Antony =<br>> >Hosking</span></span></font></font><font class=3D"Apple-style-span" =<br>> >face=3D"Gill Sans"><span class=3D"Apple-style-span" style=3D"font-family: =<br>> >'Gill Sans'; "><span class=3D"Apple-style-span" style=3D"font-family: =<br>> >'Gill Sans'; "><span class=3D"Apple-converted-space"> </span>|<span =<br>> >class=3D"Apple-converted-space"> </span></span></span><span =<br>> >class=3D"Apple-style-span" style=3D"font-family: 'Gill Sans'; "><span =<br>> >class=3D"Apple-style-span" style=3D"font-family: 'Gill Sans'; =<br>> >">Associate Professor</span></span><span class=3D"Apple-style-span" =<br>> >style=3D"font-family: 'Gill Sans'; "><span class=3D"Apple-style-span" =<br>> >style=3D"font-family: 'Gill Sans'; "> | Computer Science | Purdue =<br>> >University</span></span></font></div><div><font class=3D"Apple-style-span"=<br>> > face=3D"GillSans-Light"><span class=3D"Apple-style-span" =<br>> >style=3D"font-family: GillSans-Light; ">305 N. University Street | West =<br>> >Lafayette | IN 47907 | USA</span></font></div><div><font =<br>> >class=3D"Apple-style-span" color=3D"#0000FF" face=3D"Gill Sans"><span =<br>> >class=3D"Apple-style-span" style=3D"color: rgb(0, 0, 255); font-family: =<br>> >'Gill Sans'; "><span class=3D"Apple-style-span" style=3D"color: rgb(0, =<br>> >0, 255); font-family: 'Gill Sans'; ">Mobile</span></span></font><font =<br>> >class=3D"Apple-style-span" face=3D"GillSans-Light"><span =<br>> >class=3D"Apple-style-span" style=3D"font-family: GillSans-Light; "><span =<br>> >class=3D"Apple-style-span" style=3D"font-family: GillSans-Light; "><span =<br>> >class=3D"Apple-converted-space"> </span>+1 765 427 =<br>> >5484</span></span></font></div><div><font class=3D"Apple-style-span" =<br>> >face=3D"GillSans-Light"><br =<br>> >class=3D"khtml-block-placeholder"></font></div></span></span></span></span=<br>> >></span></span></span><br =<br>> >class=3D"Apple-interchange-newline"></span></div></span></div></span><br =<br>> >class=3D"Apple-interchange-newline"></span><br =<br>> >class=3D"Apple-interchange-newline"><br>> ></div><br>> ><br><div><div>On Aug 22, 2012, at 10:24 AM, Jay K <<a =<br>> >href=3D"mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a>> =<br>> >wrote:</div><br class=3D"Apple-interchange-newline"><blockquote =<br>> >type=3D"cite"><div class=3D"hmmessage" style=3D"font-size: 12pt; =<br>> >font-family: Calibri; font-style: normal; font-variant: normal; =<br>> >font-weight: normal; letter-spacing: normal; line-height: normal; =<br>> >orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: =<br>> >none; white-space: normal; widows: 2; word-spacing: 0px; =<br>> >-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div =<br>> >dir=3D"ltr">why this loop/multipass stuff<br><br><br>So people =<br>> >understand where I'm going here -- and Tony asked. I had already written =<br>> >this up..<br><br><br><br>1) in the past working on m3cc/parse.c, I found =<br>> >that "declare"s<br>weren't always "topologically =<br>> >sorted".<br><br><br>That is, like, I might see:<br><br>given TYPE T1 =3D =<br>> >INTEGER;<br>TYPE T2 =3D RECORD =3D a:T1; END;<br><br><br>I might have =<br>> >seen type T1 declared before T2, or not.<br>I'm not sure if it was =<br>> >record/fields or other relationships.<br>I just remember that building =<br>> >up a map of typeid to data, and<br>looking up it when needed, didn't =<br>> >always work, with one pass.<br><br><br>So what I did is that I was =<br>> >willing to "skip" declares<br>that referred to typeids I hadn't seen =<br>> >yet, and then loop<br>again, hoping for progress at each loop (fewer =<br>> >skips).<br></div></div></blockquote><div><br></div><div>Was this all in =<br>> >aid of building up proper type descriptors?</div><br><blockquote =<br>> >type=3D"cite"><div class=3D"hmmessage" style=3D"font-size: 12pt; =<br>> >font-family: Calibri; font-style: normal; font-variant: normal; =<br>> >font-weight: normal; letter-spacing: normal; line-height: normal; =<br>> >orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: =<br>> >none; white-space: normal; widows: 2; word-spacing: 0px; =<br>> >-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div =<br>> >dir=3D"ltr">2) It looks like declare_local/temp don't all come in<br>"at =<br>> >the start" of a procedure. I'm not sure if I'm generating<br>C or C++, =<br>> >but if I'm generating C, it helps to have declare_local/temp<br>right =<br>> >after begin_procedure/block. Multiple passes let me make that<br>so, =<br>> >without changing m3front.<br>(Upon further looking..it seems this is =<br>> >mostly done right, but<br>not for "try" blocks; maybe reasonable to =<br>> >change m3front here.).<br><br><br>Now, generating C++ is an option, and =<br>> >I'm ignoring all declares<br>currently anyway, so these don't force the =<br>> >matter, but:<br><br><br>3) nested functions.<br>If a function contains =<br>> >any nested functions, I want to put all of<br>its locals in a local =<br>> >struct, and use the address of that struct<br>as the "static link". Or =<br>> >at least the locals that are referenced<br>by nested =<br>> >functions.</div></div></blockquote><div><br></div><div>Preferably these =<br>> >only, or else you will cause all locals to be in memory instead of =<br>> >registers.</div><br><blockquote type=3D"cite"><div class=3D"hmmessage" =<br>> >style=3D"font-size: 12pt; font-family: Calibri; font-style: normal; =<br>> >font-variant: normal; font-weight: normal; letter-spacing: normal; =<br>> >line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: =<br>> >0px; text-transform: none; white-space: normal; widows: 2; word-spacing: =<br>> >0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; =<br>> >"><div dir=3D"ltr">As well, m3front contains options as to<br>the order =<br>> >of outputing functions. It uses one order for m3back and<br>a different =<br>> >order for m3cc. I wouldn't mind if M3C.m3 worked =<br>> >either<br>way.<br><br><br>There are possibly other benefits that could =<br>> >be derived from multiple passes.<br>Nothing offhand =<br>> >though.<br><br><br> - =<br>> >Jay<br></div></div></blockquote></div><br></body></html>=<br>> ><br>> >--Apple-Mail=_ED26DAAF-73B8-4147-B1C9-82D48C3720BF--<br></div> </div></body>
</html>