<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
It isn't heap-based!<br> And saying it "leaks" is misleading. It doesn't leak how most people would consider "leak".<br> It calls _alloca. If you call _alloca in a loop, you get more and more storage, until you return from the function.<br> I understand this. Tony understand it. But calling it "leak" will mislead almost everyone else.<br>It should be ok now. But still only a temporary solution. We have to either move all the back<br>to the old way, or make the new way work.<br><br><br>As we have two implementations of many things, it is common for one or the other to break.<br>The fix is really not difficult. We can't be stuck like this on everything.<br>But granted, m3front remains confusing to me, so I am stuck for a bit<br>doing this much better.<br><br>Anyway, my time is now significantly reallocated, so it all matters less.<br><br> - Jay<br><br><hr id="stopSpelling">From: hosking@cs.purdue.edu<br>Date: Fri, 11 Feb 2011 16:29:43 -0500<br>To: rcolebur@SCIRES.COM<br>CC: m3devel@elegosoft.com<br>Subject: Re: [M3devel] threading on Windows?<br><br>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">Randy,<div><br></div><div>I am in complete agreement with you.</div><div><br><div>
<span class="ecxApple-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; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="ecxApple-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; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;"><span class="ecxApple-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; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="ecxApple-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; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="ecxApple-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; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="ecxApple-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; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="ecxApple-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; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="ecxApple-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; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="ecxApple-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; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="ecxApple-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; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div><font class="ecxApple-style-span" color="#0000ff"><font class="ecxApple-style-span" face="Gill Sans"><span class="ecxApple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans';"><span class="ecxApple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans';">Antony Hosking</span></span></font></font><font class="ecxApple-style-span" face="Gill Sans"><span class="ecxApple-style-span" style="font-family: 'Gill Sans';"><span class="ecxApple-style-span" style="font-family: 'Gill Sans';"><span class="ecxApple-converted-space"> </span>|<span class="ecxApple-converted-space"> </span></span></span><span class="ecxApple-style-span" style="font-family: 'Gill Sans';"><span class="ecxApple-style-span" style="font-family: 'Gill Sans';">Associate Professor</span></span><span class="ecxApple-style-span" style="font-family: 'Gill Sans';"><span class="ecxApple-style-span" style="font-family: 'Gill Sans';"> | Computer Science | Purdue University</span></span></font></div><div><font class="ecxApple-style-span" face="GillSans-Light"><span class="ecxApple-style-span" style="font-family: GillSans-Light;">305 N. University Street | West Lafayette | IN 47907 | USA</span></font></div><div><font class="ecxApple-style-span" color="#0000ff" face="Gill Sans"><span class="ecxApple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans';"><span class="ecxApple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans';">Office</span></span></font><font class="ecxApple-style-span" face="GillSans-Light"><span class="ecxApple-style-span" style="font-family: GillSans-Light;"><span class="ecxApple-style-span" style="font-family: GillSans-Light;"> +1 765 494 6001 |<span class="ecxApple-converted-space"> </span></span></span></font><font class="ecxApple-style-span" color="#0000ff" face="Gill Sans"><span class="ecxApple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans';"><span class="ecxApple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans';">Mobile</span></span></font><font class="ecxApple-style-span" face="GillSans-Light"><span class="ecxApple-style-span" style="font-family: GillSans-Light;"><span class="ecxApple-style-span" style="font-family: GillSans-Light;"><span class="ecxApple-converted-space"> </span>+1 765 427 5484</span></span></font></div><div><font class="ecxApple-style-span" face="GillSans-Light"><br class="ecxkhtml-block-placeholder"></font></div></span></span></span></span></span></span></span><br class="ecxApple-interchange-newline"></span></div></span></span><br class="ecxApple-interchange-newline">
</div>
<br><div><div>On Feb 11, 2011, at 4:26 PM, Coleburn, Randy wrote:</div><br class="ecxApple-interchange-newline"><blockquote><span class="ecxApple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; font-size: medium;"><div style="word-wrap: break-word;" lang="EN-US"><div class="ecxWordSection1" style="page: WordSection1;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Tony:</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Thank you very much for this explanation.</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">So, it appears that the changes introduced to support the new “heap-based jmpbuf allocation” have introduced at least 2 problems that must be solved if we are to move forward on the Windows platform, namely:</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif; text-indent: -0.25in;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"><span>1.<span style="font: 7pt 'Times New Roman';"> <span class="ecxApple-converted-space"> </span></span></span></span><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Space leak problem.</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif; text-indent: -0.25in;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"><span>2.<span style="font: 7pt 'Times New Roman';"> <span class="ecxApple-converted-space"> </span></span></span></span><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Binding to appropriate “alloca” routine on Windows platform.</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Assuming we want to retain this new heap-based jmpbuf allocation capability, someone needs to solve these 2 problems for the Windows platform.</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">I will begin looking at the code and see if I can make some progress on these 2 problems. Before I “do” anything, I’ll run my proposed solution thru the m3devel group first. Any further insights you or Jay can give in helping me work on the solution are welcome and appreciated.</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Finally, let me also suggest that we all may need to revisit the conversation we had on this forum many months back about contributors making sure their changes are tested not to cause major breaks before committing them to HEAD branch. </span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Seems to me that if the “heap based jumpbuf allocation scheme” was known not to be compatible with Windows, that it should have been checked in on a different experimental branch until all the kinks could be worked out for all platforms.</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Otherwise, without some mechanism to warn everyone of known problems on the HEAD branch, folks can easily download stuff that renders their implementation broken.</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">If my understanding of HEAD is not the prevailing one, I for one would like clarification as to what is STABLE for checkout and use and what is UNSTABLE.</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Regards,</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Randy Coleburn</span></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div><div><div style="border-style: solid none none; border-top: 1pt solid rgb(181, 196, 223); padding: 3pt 0in 0in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><b><span style="font-size: 10pt; font-family: Tahoma,sans-serif;">From:</span></b><span style="font-size: 10pt; font-family: Tahoma,sans-serif;"><span class="ecxApple-converted-space"> </span>Tony Hosking [mailto:hosking@cs.purdue.edu]<span class="ecxApple-converted-space"> </span><br><b>Sent:</b><span class="ecxApple-converted-space"> </span>Thursday, February 10, 2011 4:26 PM<br><b>To:</b><span class="ecxApple-converted-space"> </span>Coleburn, Randy<br><b>Cc:</b><span class="ecxApple-converted-space"> </span>m3devel<br><b>Subject:</b><span class="ecxApple-converted-space"> </span>Re: [M3devel] threading on Windows?</span></div></div></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">Hi Randy,</div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">A far as I know, the changes are as follows.</div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">TRY blocks using setjmp/longjmp to implement the exception handling each require statically one instance of a jmpbuf. Historically, the storage for this was reserved as stack local storage (using CG.Declare_param) of the target-dependent jmpbuf size. This meant having to declare the jmp_buf accurately for the target. What Jay did was to replace the stack local with a scalar pointer local variable (also using Declare_param), and to call alloca to obtain a pointer to stack allocated jmpbuf storage. The idea was to add a level of indirection, and have the size of the jmpbuf obtained from a C variable initialized appropriately, so that targets need no longer declare their jmpbuf_size. This was intended to make porting easier. There are several problems here. First, the local pointer variable needs to be initialized *once* on entry to the procedure to the value NIL, so that we check for NIL on the first invocation of the TRY and alloca only in that case. The problem is that currently that initialization is not being performed *once* but instead on each invocation of the TRY so loops with TRY blocks in them currently have a space leak.</div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">The other problem was how to bind to the appropriate alloca routine. Ideally it should be inlined, and on Windows this is achieved by calling a *different* function, not called alloca. My suggestion is that making the alloca call a runtime hook will allow targets to easily redirect to the correct function. On non-Windows targets using the gcc-based backend all works out because alloca is a gcc intrinsic function that gets inlined.</div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">To fix the space leak problem I proposed that Marker in the M3 compiler front end m3front should track, per-procedure, the jmpbuf pointer variables as it parses or checks the program, and have a callback to initialize them at the top of the procedure during code generation. I don't think this will involve much work, but I don't currently have any spare cycles to spend on it.</div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div></div><div><p class="ecxMsoNormal" style="margin-right: 0in; margin-bottom: 12pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">-- Tony</p><div><div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span class="ecxapple-style-span"><span style="font-size: 9pt; font-family: 'Gill Sans',serif; color: blue;">Antony Hosking</span></span><span class="ecxapple-converted-space"><span style="font-size: 9pt; font-family: 'Gill Sans',serif; color: black;"> </span></span><span class="ecxapple-style-span"><span style="font-size: 9pt; font-family: 'Gill Sans',serif; color: black;">|</span></span><span class="ecxapple-converted-space"><span style="font-size: 9pt; font-family: 'Gill Sans',serif; color: black;"> </span></span><span class="ecxapple-style-span"><span style="font-size: 9pt; font-family: 'Gill Sans',serif; color: black;">Associate Professor | Computer Science | Purdue University</span></span><span style="font-size: 9pt; font-family: Helvetica,sans-serif; color: black;"></span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span class="ecxapple-style-span"><span style="font-size: 9pt; font-family: GillSans-Light,serif; color: black;">305 N. University Street | West Lafayette | IN 47907 | USA</span></span><span style="font-size: 9pt; font-family: Helvetica,sans-serif; color: black;"></span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span class="ecxapple-style-span"><span style="font-size: 9pt; font-family: 'Gill Sans',serif; color: blue;">Office</span></span><span class="ecxapple-style-span"><span style="font-size: 9pt; font-family: GillSans-Light,serif; color: black;"> +1 765 494 6001 |</span></span><span class="ecxapple-converted-space"><span style="font-size: 9pt; font-family: GillSans-Light,serif; color: black;"> </span></span><span class="ecxapple-style-span"><span style="font-size: 9pt; font-family: 'Gill Sans',serif; color: blue;">Mobile</span></span><span class="ecxapple-converted-space"><span style="font-size: 9pt; font-family: GillSans-Light,serif; color: black;"> </span></span><span class="ecxapple-style-span"><span style="font-size: 9pt; font-family: GillSans-Light,serif; color: black;">+1 765 427 5484</span></span><span style="font-size: 9pt; font-family: Helvetica,sans-serif; color: black;"></span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 9pt; font-family: Helvetica,sans-serif; color: black;"> </span></div></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 9pt; font-family: Helvetica,sans-serif; color: black;"><br><br></span></div></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div><div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">On Feb 10, 2011, at 3:59 PM, Coleburn, Randy wrote:</div></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><br><br></div><div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Jay / Tony:</span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">I am seeing in this thread that the approach to fixing the problem is not yet agreed upon.</span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">I will be glad to help in any way I can, but right now, I am “in the dark”, both as to what change was introduced that caused the problem, and the various potential solution paths. All I know is that it has been broken for a number of weeks now.</span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">I know Jay has asked for help, and I am willing to help, but it may cost him or you some time/effort in getting me up to speed on what went wrong and the pros/cons of potential solutions. If you choose to help enlighten me, I pledge to try and put that knowledge to good use both now and in the future. Otherwise, I will have to wait for one of you to solve the problem.</span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">BTW, when I look at the linker error reports for the various packages, I’m seeing several different symbols that don’t resolve, not just the one dealing with memory allocation.</span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Regards,</span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Randy</span></div></div><div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></div></div><div><div style="border-style: solid none none; padding: 3pt 0in 0in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><b><span style="font-size: 10pt; font-family: Tahoma,sans-serif;">From:</span></b><span class="ecxapple-converted-space"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;"> </span></span><span style="font-size: 10pt; font-family: Tahoma,sans-serif;">Tony Hosking [mailto:hosking@cs.purdue.edu]<span class="ecxapple-converted-space"> </span><br><b>Sent:</b><span class="ecxapple-converted-space"> </span>Thursday, February 10, 2011 3:33 PM<br><b>To:</b><span class="ecxapple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu" style="color: blue; text-decoration: underline;">jay.krell@cornell.edu</a><br><b>Cc:</b><span class="ecxapple-converted-space"> </span>Coleburn, Randy; m3devel<br><b>Subject:</b><span class="ecxapple-converted-space"> </span>Re: [M3devel] threading on Windows?</span></div></div></div></div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div></div><p class="ecxMsoNormal" style="margin-right: 0in; margin-bottom: 12pt; margin-left: 1in; font-size: 12pt; font-family: 'Times New Roman',serif;">Why is it better? Because rebinding to a different function is just a matter of changing an INTERFACE in the libraries, rather than hacking the compiler.</p><div><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">On Feb 10, 2011, at 6:01 AM,<span class="ecxapple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu" style="color: blue; text-decoration: underline;">jay.krell@cornell.edu</a><span class="ecxapple-converted-space"> </span>wrote:</div></div></div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><br><br><br></div></div><div><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">1. I never understood why this any better.<br>2. It how things are currently.</div></div></div><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">3. Why not m3cg.alloca? (but see #2)</div></div></div><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><br> - Jay/iPad</div></div></div><div><p class="ecxMsoNormal" style="margin-right: 0in; margin-bottom: 12pt; margin-left: 1in; font-size: 12pt; font-family: 'Times New Roman',serif;"><br>On Feb 9, 2011, at 9:48 PM, Tony Hosking <<a href="mailto:hosking@cs.purdue.edu" style="color: blue; text-decoration: underline;">hosking@cs.purdue.edu</a>> wrote:</p></div><blockquote style="margin-bottom: 5pt;"><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">What happened to fixing this with runtime hooks?</div></div><div><p class="ecxMsoNormal" style="margin-right: 0in; margin-bottom: 12pt; margin-left: 1in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </p><div><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;">On Feb 9, 2011, at 11:40 PM, Jay K wrote:</div></div></div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><br><br><br></div></div><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;">Of course not.<br>It is a made-up function that the frontend generates a call to.<br>That it never previously did.<br>Using the general function call interface.<br>You need to add a special case, in the general function call code, to do something different and specific<br>for this specific function.<br> <br> <br> - Jay <br> </span></div></div><div style="margin-left: 0.5in;"><div class="ecxMsoNormal" style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;"><hr align="center" size="2" width="100%"></span></div></div><p class="ecxMsoNormal" style="margin-right: 0in; margin-bottom: 12pt; margin-left: 1in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;">From:<span class="ecxapple-converted-space"> </span><a href="mailto:rcolebur@SCIRES.COM" style="color: blue; text-decoration: underline;">rcolebur@SCIRES.COM</a><br>To:<span class="ecxapple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu" style="color: blue; text-decoration: underline;">jay.krell@cornell.edu</a>;<span class="ecxapple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com" style="color: blue; text-decoration: underline;">m3devel@elegosoft.com</a><br>Date: Wed, 9 Feb 2011 22:28:45 -050<br>Subject: Re: [M3devel] threading on Windows?</span></p><div><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Jay:</span></div></div></div><p class="ecxmsonormal" style="margin-right: 0in; margin-left: 1in; font-size: 12pt; font-family: 'Times New Roman',serif; margin-bottom: 0.0001pt;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></p><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">I looked thru the 4,618 lines of M3x86.m3, but I don’t see any reference to “m3_alloca” or even “alloc” in this file.</span></div></div></div><p class="ecxmsonormal" style="margin-right: 0in; margin-left: 1in; font-size: 12pt; font-family: 'Times New Roman',serif; margin-bottom: 0.0001pt;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></p><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Regards,</span></div></div></div><div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Randy</span></div></div></div><p class="ecxmsonormal" style="margin-right: 0in; margin-left: 1in; font-size: 12pt; font-family: 'Times New Roman',serif; margin-bottom: 0.0001pt;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></p><div><div style="border-style: solid none none; padding: 3pt 0in 0in;"><div style="margin-left: 0.5in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><b><span style="font-size: 10pt; font-family: Tahoma,sans-serif;">From:</span></b><span class="ecxapple-converted-space"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;"> </span></span><span style="font-size: 10pt; font-family: Tahoma,sans-serif;"><a href="mailto:jayk123@hotmail.com" style="color: blue; text-decoration: underline;">jayk123@hotmail.com</a><span class="ecxapple-converted-space"> </span>[mailto:jayk123@hotmail.com]<span class="ecxapple-converted-space"> </span><b>On Behalf Of<span class="ecxapple-converted-space"> </span></b>Jay K<br><b>Sent:</b><span class="ecxapple-converted-space"> </span>Wednesday, February 09, 2011 9:01 PM<br><b>To:</b><span class="ecxapple-converted-space"> </span>Coleburn, Randy; m3devel<br><b>Subject:</b><span class="ecxapple-converted-space"> </span>RE: [M3devel] threading on Windows?</span></div></div></div></div></div><p class="ecxmsonormal" style="margin-right: 0in; margin-left: 1.5in; font-size: 12pt; font-family: 'Times New Roman',serif; margin-bottom: 0.0001pt;"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;"> </span></p><div style="margin-left: 0.5in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;">In m3back/src/M3x86.m3.<br> <br> - Jay<br><br> </span></div></div></div><div style="margin-left: 0.5in;"><div style="margin-left: 0.5in;"><div class="ecxMsoNormal" style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;"><hr align="center" size="2" width="100%"></span></div></div></div><p class="ecxmsonormal" style="margin-right: 0in; margin-left: 1.5in; font-size: 12pt; font-family: 'Times New Roman',serif; margin-bottom: 12pt;"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;">From:<span class="ecxapple-converted-space"> </span><a href="mailto:rcolebur@SCIRES.COM" style="color: blue; text-decoration: underline;">rcolebur@SCIRES.COM</a><br>To:<span class="ecxapple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com" style="color: blue; text-decoration: underline;">m3devel@elegosoft.com</a><br>Date: Wed, 9 Feb 2011 18:22:56 -0500<br>Subject: Re: [M3devel] threading on Windows?</span></p><div><div style="margin-left: 0.5in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">I am certainly willing to work on the problem, but need more context info about what caused it in order to know how to resolve.</span></div></div></div><div style="margin-left: 0.5in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">All I know is that everything was working fine until I checked out the HEAD repository.</span></div></div></div><div style="margin-left: 0.5in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">When you say “special case” calls “m3_alloca”, where do I go about finding this “special case”?</span></div></div></div><div style="margin-left: 0.5in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Are we talking Modula-3 code, C code, Assembler, what? What package/module?</span></div></div></div><div style="margin-left: 0.5in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Regards,</span></div></div></div><div style="margin-left: 0.5in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);">Randy</span></div></div></div><p class="ecxmsonormal" style="margin-right: 0in; margin-left: 1.5in; font-size: 12pt; font-family: 'Times New Roman',serif; margin-bottom: 0.0001pt;"><span style="font-size: 11pt; font-family: Calibri,sans-serif; color: rgb(31, 73, 125);"> </span></p><div><div style="border-style: solid none none; padding: 3pt 0in 0in;"><div style="margin-left: 1in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><b><span style="font-size: 10pt; font-family: Tahoma,sans-serif;">From:</span></b><span class="ecxapple-converted-space"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;"> </span></span><span style="font-size: 10pt; font-family: Tahoma,sans-serif;"><a href="mailto:jayk123@hotmail.com" style="color: blue; text-decoration: underline;">jayk123@hotmail.com</a><span class="ecxapple-converted-space"> </span>[mailto:jayk123@hotmail.com]<span class="ecxapple-converted-space"> </span><b>On Behalf Of<span class="ecxapple-converted-space"> </span></b>Jay K<br><b>Sent:</b><span class="ecxapple-converted-space"> </span>Wednesday, February 09, 2011 5:59 PM<br><b>To:</b><span class="ecxapple-converted-space"> </span>Coleburn, Randy; Mika Nystrom; m3devel<br><b>Subject:</b><span class="ecxapple-converted-space"> </span>RE: [M3devel] threading on Windows?</span></div></div></div></div></div><p class="ecxmsonormal" style="margin-right: 0in; margin-left: 2in; font-size: 12pt; font-family: 'Times New Roman',serif; margin-bottom: 0.0001pt;"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;"> </span></p><div style="margin-left: 1in;"><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"><span style="font-size: 10pt; font-family: Tahoma,sans-serif;">Maybe someone else can do it?<br>The fix is: special case calls to the function "m3_alloca".<br>Change it to call "_chkstk" (or maybe "chkstk", whatever works).<br>The one parameter is an unsigned 32bit quantity, passed in eax, and the return value is a pointer, returned in esp.<br>To some extent I drag my feet hoping anyone else might become motivated enough to do it and start learning how.<br> <br> - Jay<br> <br>> From:<span class="ecxapple-converted-space"> </span><a href="mailto:rcolebur@SCIRES.COM" style="color: blue; text-decoration: underline;">rcolebur@SCIRES.COM</a><br>> To:<span class="ecxapple-converted-space"> </span><a href="mailto:mika@async.caltech.edu" style="color: blue; text-decoration: underline;">mika@async.caltech.edu</a>;<span class="ecxapple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com" style="color: blue; text-decoration: underline;">m3devel@elegosoft.com</a><br>> Date: Wed, 9 Feb 2011 17:25:20 -0500<br>> Subject: Re: [M3devel] threading on Windows?<br>><span class="ecxapple-converted-space"> </span><br>> Mika:<br>><span class="ecxapple-converted-space"> </span><br>> Sorry, but my Windows build is broken. Jay seems to indicate he is working on a "fix" and that this fix is relatively simple, but so far no solution has been checked in.<br>><span class="ecxapple-converted-space"> </span><br>> I've been wanting to run your program ever since you first checked it in, but that was about same time the HEAD branch update introduced a build problem. Problem is an unresolved symbol during link.<br>><span class="ecxapple-converted-space"> </span><br>> As soon as I can get the build problem resolved, I'll try out your test program.<br>><span class="ecxapple-converted-space"> </span><br>> Regards,<br>> Randy Coleburn<br>><span class="ecxapple-converted-space"> </span><br>> -----Original Message-----<br>> From: Mika Nystrom [mailto:mika@async.caltech.edu]<span class="ecxapple-converted-space"> </span><br>> Sent: Wednesday, February 09, 2011 5:01 PM<br>> To:<span class="ecxapple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com" style="color: blue; text-decoration: underline;">m3devel@elegosoft.com</a><br>> Subject: [M3devel] threading on Windows?<br>><span class="ecxapple-converted-space"> </span><br>> Hi m3devel,<br>><span class="ecxapple-converted-space"> </span><br>> I'm just curious if anyone out there who's running CM3 on Windows has had<br>> a chance to try my thread testing program yet. Current status on Unix<br>> (Linux, FreeBSD) appears to be that there are problems in pthreads (but<br>> I think only under heavy load) and that user threading works perfectly.<br>> So I now wonder how things are on the third threading platform (Windows).<br>> The thread testing program is at m3-libs/m3core/tests/thread .<br>><span class="ecxapple-converted-space"> </span><br>> (Note however that there is a memory leak in TRY-EXCEPT in the current<br>> head so don't try to update everything to the CVS head. The previous<br>> release should be OK.)<br>><span class="ecxapple-converted-space"> </span><br>> Also has anyone else noticed that debugging information has recently<br>> broken? m3gdb is very unhappy on all platforms for me...<br>><span class="ecxapple-converted-space"> </span><br>> Mika</span></div></div></div></div></div></div></div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div></div></div></div></blockquote></div></div><div style="margin-left: 0.5in;"><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div></div></div></div><div style="margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0.5in; font-size: 12pt; font-family: 'Times New Roman',serif;"> </div></div></div></div></span></blockquote></div><br></div> </body>
</html>