<html><head><base href="x-msg://485/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><span class="Apple-style-span" style="font-size: medium; ">On 27 Feb 2010, at 17:12, Jay K wrote:</span></div></span></span></span></span></span></span></span></span></div></span></span></div><div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">ok..I'll maybe reply more later.<br> <br> <br>But what does it mean to<br> <br> <br>load_int(type1, value1)<br></div></span></blockquote><div><br></div><div>Take value, cast to type1 (may involve sign extend from low bits/truncation of high bits), push on stack.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">load_int(type2, value2)<br></div></span></blockquote><div><br></div><div>Take value, cast to type2 (may involve sign extend from low bits/truncation of high bits), push on stack.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">add(type3)<br></div></span></blockquote><div><br></div><div>Add values on stack, interpreted as type3 (perhaps sign extended/truncated), with result of type3.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">It seems like both the values and the operations have types.<br></div></span></blockquote><div><br></div><div>The types say how the bits of the operands are to be interpreted.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">I do try to consider all types, with "ELSE <* ASSERT FALSE *>", be it an if ladder or a switch.<br>Perhaps that is too little thought?<br>I admit, ZType, IType, AType, etc., I can't keep them straight.<br>I "know" that floats are handled specially by m3back and so I can ignore them in most code<br>and that the backend traffics only rarely in 8 or 16 bit types, so the four most interesting<br>types are Int32, Int64, Word32, Word64.<br></div></span></blockquote><div><br></div><div>Correct.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">As well, since my agenda is currently 64bit longint, I just need to add word64/int64 to<br>the existing paths.<br></div></span></blockquote><div><br></div><div>Right.</div><div><br></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; "> (m3back is so geared against int8/word8/int16/word16 that it takes special pain<br>to widen all function results, lest they be generated by a C compiler, and the<br>historical command indict the C compiler's behavior, I edited out the subjectivity;<br>and the 8 bits produced by setccop are always<br>immediately widened; I have to revisit that soon, I think the code can be much better.<br>That is part of the evidence to what it traffics in.)<br></div></span></blockquote><div><br></div><div>Yes, the front-end never usually generates stack values of 8/16 bits. All integer operations are in the 32/64-bit types.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; "> <br> <br> - Jay<br><br><br><hr id="stopSpelling">Subject: Re: [M3devel] max_align<br>From:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>Date: Sat, 27 Feb 2010 16:24:41 -0500<br>CC:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br><br><br><div><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><div style="word-wrap: break-word; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><div><span class="ecxApple-style-span" style="font-size: medium; ">On 27 Feb 2010, at 15:50, Jay K wrote:</span></div></span></span></span></span></span></span></span></span></div></span></span></div><div><br class="ecxApple-interchange-newline"><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; "> > Target.Int values would always be interpreted based on their associated type<br><br> <br> They kind of mostly are?<br> Except..I mean..you know..I bury a size in them, which is a step.<br></div></span></blockquote><div><br></div><div>No, my point was that the front-end generates properly typed operations. The specs for m3middle state that all Target.Int values are to be used for only their low bits as defined by the associated type of the operation. Consider what would happen if we had a C-generating backend. All the integer values would be expressed as emitted by TInt.ToBytes (i.e., just the significant bytes of the value). Then, the operations are defined as implicitly casting those values using the given type. Thus, for:</div><div><br></div><div>add Int.32</div><div><br></div><div>the semantics are:</div><div><br></div><div>take the two operands from the stack, sign-extend their low 32 bits, and perform the addition, with the result interpreted as Int.32.</div><div><br></div><div>e.g., in C, (int)a + (int)b</div><div><br></div><div>So, for your backend code, you don't need the TIntN/TWordN length encoded in the value. The operations define how a Target.Int is to be interpreted. Target.Int is just a bunch of bits that are interpreted according to the type on the operation! You need to choose the proper operation from TInt/TWord to get signed/unsigned, and in some cases (Rotate) to define the bits to be rotated. Then, to get the appropriate result from the Target.Int operations you need to mask/extend the bits of the result correctly to match the sign.</div><div><br></div><div>I hope this is starting to make more sense to you, and help to motivate why I've been so pedantic about the TInt/TWord support!</div><br><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; "> But the signnedness is not buried in them and I might get that wrong sometimes.<br> It is often, you know, the operation and not the type.<br> "Shift is always unsigned."<br> But Add isn't.<br> But with "half range cardinals", I'm not sure it matters.<br> 16_40000000 * 2 overflows the same for INTEGER and CARDINAL<br> LAST(INTEGER) + 1 ditto.<br> <br><br> Some operations do vary and they are handled correctly I think: abs, mul, div.<br> Actually this is somewhat wrong: signed and unsigned multiplication I don't think<br> needs to vary the way it does. They are the same in the lower bits.<br> The compiler doesn't need to be so picky I believe. In particular, in the following C:<br> int F1(int a, int b) { return a * b; }<br> unsigned F2(unsigned a, unsigned b) { return a * b; }<br> __int64 F3(int a, int b) { return a * (__int64)b; }<br> unsigned __int64 F3(unsigned a, unsigned b) { return a * (unsigned __int64)b; }<br> <br><br> only one of them does unsigned multiplication, the last.<br> (and notice that it does it inline with one instruction; something<br> our compiler will be harder pressed to do given the lack of mixed operations!<br> but you could leave it to a smart optimizer)<br> <br><br> > Is64, IsWord, IsInt, Target.FloatType<br> <br><br>In familiar territory (C and C++),<br>I like switches because they "evaluate simultaneously", at least however the compiler can figure it.<br><br> <br>That is:<br> <br><br> if foo == 1 <span class="ecxApple-converted-space"> </span><br> else if foo == 2 <br> else if foo == 3 <span class="ecxApple-converted-space"> </span><br> else if foo == 4 <span class="ecxApple-converted-space"> </span><br> else if foo == 5 <span class="ecxApple-converted-space"> </span><br><br>unless the compiler is very smart is always go to penalize 5 comparisons for "5",<br>plus the compiler might assume I'm meaning to optimize the earlier cases<br>as being more common, but then I have to worry about the ordering<br>to get the common cases earlier whereas<br>if I write<br>switch (foo)<br> case 1: ...<br> case 2: ...<br> case 3: ...<br> case 4: ...<br> case 5: ...<br> <br><br>I'll let the compiler chose between table lookup, linear search, binary search.<br>"table lookup" being "simultaneous evaluation", binary search being nice<br> <br><br>I also don't like "if ladders" because if I'm stepping through unoptimized<br>code line by line, it is tedious.<br>[mostly omitted aside: I go out of my way when writing command line<br>parsers in C to have a switch statement instead of an if/elseif/elseif ladder]<br> <br><br>However<br> In Modula-3, I've gotten warnings when I miss cases, so there is overhead<br> of always writing "else".<br> Partly this because I don't know Modula-3 well.<br></div></span></blockquote><div><br></div><div>You should try to avoid else so that you are forced to handle every case. This is exactly my point. The m3back code has a lot of places that must handle a range of types (e.g., IType, AType, etc.) and using cases forces you to think about all in the range.</div><br><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; "> The use of FloatType[type] was already there, and it is good<br> to have equivalence classes to reduce the number of cases listed<br> and allow for more to be added later, "silently".<br></div></span></blockquote><div><br></div><div>Again, with CASE you can still select for those, without having a cascade of IF.</div><br><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; "><br>I also don't like "data based interfaces", I prefer function calls,<br>that's why Is64 instead of is foo IN Types64.<br> (but FloatType[type] was already there)<br> Granted, I lament the lack of inlining in m3back.<br></div></span></blockquote><div><br></div><div>Function call is overkill. Use the types!</div><br><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; ">I'm worried about nomenclature if/when this is extended to 64bit architectures.<br>I wonder if "Is64" should be "IsLong" or RegisterCount > 1 or something.<br></div></span></blockquote><div><br></div><div>No, because the front-end generates explicit types of the form Int64, Int32, Word64, Word32 for all of the code generated through m3middle. You can rely on those types as being correct.</div><br><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; ">I think I just drifted away from using TInt.Min/Max{8,16,32,64}.<br></div></span></blockquote><div><br></div><div>The whole point here was for you to be explicit about types and ranges. If you know you are performing Int32 addition then you can check that the result is in range for TInt.Min32..TInt.Max32. That's exactly how you should be using TInt and getting away from the TIntN/TWordN kludge.</div><br><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; ">I'll see if any uses remain.<br>Eh maybe just:<br>C:\dev2\cm3.2\m3-sys\m3back\src\M3x86.m3(3846): TWordN.And(imm, TWordN.Max32, immA[0]);<br><br> <br>Some places were in extract/insert, and looked wrong.<br><br> <br>Yes definitely more eyes on m3back appreciated.<br> Heck more eyes on cm3 appreciated! We have way too few. :(<br>There were many style changes along with making things not work.<br>I didn't want to sift through it all so I put it all back.<br>Now to ponder sifting through it more slowly from a working baseline.<br> <br><br>Also I often favor mvar.mvar_type over mvar.type, so I can plain text<br>search for mvar_type, and not just "type".<br></div></span></blockquote><div><br></div><div>I do find that to be overly verbose. WIth a decent IDE it can resolve those definitions (Eclipse M3 plugin anyone?).</div><br><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; "> I realize that you can't throw out all contexta all the time, but,<br> there is something to be said for flatter namespaces.<br>Nothing scales like plain text search.<br>No language aware search work adequately.<br> Let alone the matter of existance of languages x tools.</div></span></blockquote><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; "> <br> <br>I don't think that's a mismash in the first 3, but yes FloatType makes it inconsistent.<br>I would certainly be ok with TypeIsFloat to make it more consistently function call based,<br>thoug I know I put in some cases too -- for the "simultaneous evaluation" property.<br> <br> <br> - Jay<br><br><br><br><br><br><br> <br><hr id="ecxstopSpelling">From:<span class="ecxApple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>Date: Sat, 27 Feb 2010 14:54:40 -0500<br>To:<span class="ecxApple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>CC:<span class="ecxApple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Subject: Re: [M3devel] max_align<br><br>P.S. Sorry for all the push-back from me in m3middle/m3back. I'm feeling like the module police lately. I really do need to take some time to look over your m3back code and see how it can be tidied. Ideally, the Target.Int values would always be interpreted based on their associated type (which from the looks of things gets passed around just about all the places it is needed). That means checking bounds whenever performing operations using TInt (that's why I added TInt.Min/Max{8,16,32,64} and TWord.Max{8,16,32,64}). I did adopt your version of the signed TInt.Extend (which was much the same as my old Chop) and added the equivalent unsigned TWord.Truncate. One quick observation on some of the m3back code: There were a lot of places where I thought you should use CASE on the type instead of conditionals (currently involving a mishmash of Is64, IsWord, IsInt, Target.FloatType, etc. Using CASE has the advantage of warning when you don't handle every case value, and moreover makes the code more readable (uniformly handling each of the type combinations).<div><br><div><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><div style="word-wrap: break-word; "><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><div><font class="ecxecxApple-style-span" color="#0000ff"><font class="ecxecxApple-style-span" face="Gill Sans"><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); "><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); ">Antony Hosking</span></span></font></font><font class="ecxecxApple-style-span" face="Gill Sans"><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; "><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; "><span class="ecxecxApple-converted-space"> </span>|<span class="ecxecxApple-converted-space"> </span></span></span><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; "><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; ">Associate Professor</span></span><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; "><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; "> | Computer Science | Purdue University</span></span></font></div><div><font class="ecxecxApple-style-span" face="GillSans-Light"><span class="ecxecxApple-style-span" style="font-family: GillSans-Light; ">305 N. University Street | West Lafayette | IN 47907 | USA</span></font></div><div><font class="ecxecxApple-style-span" color="#0000ff" face="Gill Sans"><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); "><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); ">Office</span></span></font><font class="ecxecxApple-style-span" face="GillSans-Light"><span class="ecxecxApple-style-span" style="font-family: GillSans-Light; "><span class="ecxecxApple-style-span" style="font-family: GillSans-Light; "> +1 765 494 6001 |<span class="ecxecxApple-converted-space"> </span></span></span></font><font class="ecxecxApple-style-span" color="#0000ff" face="Gill Sans"><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); "><span class="ecxecxApple-style-span" style="font-family: 'Gill Sans'; color: rgb(0, 0, 255); ">Mobile</span></span></font><font class="ecxecxApple-style-span" face="GillSans-Light"><span class="ecxecxApple-style-span" style="font-family: GillSans-Light; "><span class="ecxecxApple-style-span" style="font-family: GillSans-Light; "><span class="ecxecxApple-converted-space"> </span>+1 765 427 5484</span></span></font></div><div><font class="ecxecxApple-style-span" face="GillSans-Light"><br class="ecxecxkhtml-block-placeholder"></font></div></span></span></span></span></span></span></span><br class="ecxecxApple-interchange-newline"></span></div></span></span><br class="ecxecxApple-interchange-newline"></div><br><div><div>On 27 Feb 2010, at 14:11, Jay K wrote:</div><br class="ecxecxApple-interchange-newline"><blockquote><span class="ecxecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxecxhmmessage" style="font-family: Verdana; font-size: 10pt; ">The issue on NT386 I was thinking of is the alignment of temporaries. That probably doesn't matter.<br> We probably don't generate atomic operations against them.<br> I already changed it to 64 for the front/middle ends<br> <br>But right, max_align is wrong for a few targets.<br> <br>I believe max_align ends up being basically target-independent. It is always 64.<br> Types are always aligned on their size.<br>The only exceptions are 68K platforms where max_align is possibly 2 bytes.<br> 68K targets aren't likely to rematerialize ever, though it is on my hypothetical long list.<br> <br> <br>PPC_something prefers a 128 bit aligned jmpbuf, but lower is ok, and max_align isn't applied to the jmpbufs<br>that the compiler generates, and 128 bit alignment can't be specified in Csetjmp.i3 -- seems<br>like a language hole to me.<br> <br> <br>I'd like to "just" do this, but I haven't fired up the relevant targets in a while: FreeBSD/NetBSD/x86.<br> <br> <br> - Jay<br><br> <br>> From:<span class="ecxecxApple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>> Date: Sat, 27 Feb 2010 11:10:32 -0500<br>> To:<span class="ecxecxApple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>> CC:<span class="ecxecxApple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>> Subject: Re: [M3devel] TInt/TWord/N<br>><span class="ecxecxApple-converted-space"> </span><br>> Yes, we do need to fix max_align for 64-bit atomics. I don't know what issues it will shake out though.<br>> On 27 Feb 2010, at 02:34, Jay K wrote:<br>><span class="ecxecxApple-converted-space"> </span><br>> ><span class="ecxecxApple-converted-space"> </span><br>> >> As I understand it your stuff in m3back is mostly working.<br>> >> I took a look at the code there and I see a number of issues<br>> ><span class="ecxecxApple-converted-space"> </span><br>> ><span class="ecxecxApple-converted-space"> </span><br>> > Tony, I don't know of anything that isn't working.<br>> > Please let me know.<br>> > All 64bit operations should work. atomic32 should work.<br>> > Not yet atomic8/16/64, soon.<br>> > Oh there is an alignment issue once atomic64 is there.<br>> > It's present on other platforms too, for different reasons (incorrect max_align).<br>> ><span class="ecxecxApple-converted-space"> </span><br>> ><span class="ecxecxApple-converted-space"> </span><br>> > Thanks,<br>> > - Jay<br>> ><span class="ecxecxApple-converted-space"> </span><br>> ><span class="ecxecxApple-converted-space"> </span><br>> > ----------------------------------------<br>> >> From:<span class="ecxecxApple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>> >> Date: Sat, 27 Feb 2010 01:16:32 -0500<br>> >> To:<span class="ecxecxApple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>> >> CC:<span class="ecxecxApple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>> >> Subject: Re: [M3devel] TInt/TWord/N<br>> >><span class="ecxecxApple-converted-space"> </span><br>> >> The solution is not to push upstream into m3middle.<br>> >> I'll try to find some time to push through what is needed in m3back. I can't promise anything soon. Let's leave things lie for a while. As I understand it your stuff in m3back is mostly working. I took a look at the code there and I see a number of issues. Hopefully I can get a look sometime.<br>> >><span class="ecxecxApple-converted-space"> </span><br>> >> -- T<br>> >><span class="ecxecxApple-converted-space"> </span><br>> >> On 26 Feb 2010, at 23:48, Jay K wrote:<br>> >><span class="ecxecxApple-converted-space"> </span><br>> >>><span class="ecxecxApple-converted-space"> </span><br>> >>> Tony, I just don't understand what is wrong with TIntN, TWordN.<br>> >>> They are what TInt/TWord did for a long time after all. ?<br>> >>> Sometimes we have 4 byte integers, sometimes 8. When 4, we want overflow checking in 4, for every single operation, not just a chop when they end up in a register or such. Right? It seems natural to bundle that up conveniently. And putting them in m3middle didn't seem so contaminating to me, since they layer thinly over Target.Int. Nor do I know what the fix is, short of inlining the repitious conversions and checks.<br>> >>><span class="ecxecxApple-converted-space"> </span><br>> >>><span class="ecxecxApple-converted-space"> </span><br>> >>> - Jay<br>> >>><span class="ecxecxApple-converted-space"> </span><br>> >>><span class="ecxecxApple-converted-space"> </span><br>> >>> ----------------------------------------<br>> >>>> From:<span class="ecxecxApple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>> >>>> Date: Fri, 26 Feb 2010 19:51:15 -0500<br>> >>>> To:<span class="ecxecxApple-converted-space"> </span><a href="mailto:jkrell@elego.de">jkrell@elego.de</a><br>> >>>> CC:<span class="ecxecxApple-converted-space"> </span><a href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</a><br>> >>>> Subject: Re: [M3commit] CVS Update: cm3<br>> >>>><span class="ecxecxApple-converted-space"> </span><br>> >>>> I've just spent most of the day decontaminating m3middle and putting TIntN and TWordN back into m3back as deprecated modules. m3back needs to be fixed to get rid of these. I don't have time to mess with this stuff and I am peeved that I wasted a whole day on this.<br>> >>>><span class="ecxecxApple-converted-space"> </span><br>> >>>> On 26 Feb 2010, at 13:48, Jay Krell wrote:<br>> >>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> CVSROOT: /usr/cvs<br>> >>>>> Changes by: jkrell@birch. 10/02/26 13:48:34<br>> >>>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> Modified files:<br>> >>>>> cm3/m3-sys/m3back/src/: Codex86.i3 Codex86.m3 M3x86.m3<br>> >>>>> M3x86Rep.i3 Stackx86.i3 Stackx86.m3<br>> >>>>> Wrx86.i3 Wrx86.m3 m3makefile<br>> >>>>> cm3/m3-sys/m3middle/src/: TInt.i3 TInt.m3 TIntN.i3 TIntN.m3<br>> >>>>> TWordN.i3 TWordN.m3 Target.i3<br>> >>>>> Target.m3 m3makefile<br>> >>>>> Removed files:<br>> >>>>> cm3/m3-sys/m3back/src/: M3BackInt.i3 M3BackInt.m3 M3BackWord.i3<br>> >>>>> M3BackWord.m3<br>> >>>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> Log message:<br>> >>>>> introduce type Target.IntN which is Int plus a precision<br>> >>>>> just like the old Target.Int<br>> >>>>> (previously M3BackInt.Int)<br>> >>>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> make TIntN and TWordN support it<br>> >>>>> they are just thin wrappers over TInt, TWord<br>> >>>>> previously named M3BackInt, M3BackWord<br>> >>>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> add small amount of support to TInt:<br>> >>>>> SignExtend, SignedTruncate, ZeroExtend, UnsignedTruncate<br>> >>>>> These could, if desired, go into their only users: TIntN, TWordN.<br>> >>>>> (with the understanding that that Target.Int is "revealed" to them.)<br>> >>>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> add maxN, minN fields to Target.Int_type, that are equal to max and min but have a precision<br>> >>>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> NOTE: Don't worry Tony, the vast majority of m3middle, m3front, TInt, Tword are unchanged<br>> >>>>> This is "just" additions.<br>> >>>>> (Moving maintenance cost from m3back to m3middle, if that isn't a no-op.)<br>> >>>>> (Coming up with alternate names for M3BackInt, M3BackWord => TIntN, TWordN)<br>> >>>>> (A little unsatisfactory that N is bytes instead of bits.)<br>> >>>>> (What a fun little exercise that might be, changing Int to be array [0..63] of [0..1] :) )<br>> >>>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> While at it, in TIntN, rename things slightly:<br>> >>>>> FromInt => FromHostInteger<br>> >>>>> ToInt => ToHostInteger<br>> >>>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> "Int" is "Target.Int"<br>> >>>>> "HostInteger" is "INTEGER"<br>> >>>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> again, TInt/TWord/m3front/m3middle not much affected.<br>> >>>>><span class="ecxecxApple-converted-space"> </span><br>> >>>>> One fishy/uncertain thing in all of this, something to test out, is cross builds<br>> >>>>> that target NT386 from 64bit host. Is TIntN.ToHostInteger correct? Or do we<br>> >>>>> really need INTEGER to be 4 bytes throughout m3back?<br>> >>>>> (I know that mklib has little endian dependency.)<br>> >>>><span class="ecxecxApple-converted-space"> </span><br>> >><span class="ecxecxApple-converted-space"> </span><br>><span class="ecxecxApple-converted-space"> </span><br></div></span></blockquote></div><br></div></div></span><br class="ecxApple-interchange-newline"></blockquote></div><br></div></span><br class="Apple-interchange-newline"></blockquote></div><br></body></html>