<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Please leave it the way it is as an install-time option. -DNOPTHREAD enables user threads.<div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 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; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 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; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-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; border-spacing: 0px 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; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-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; border-spacing: 0px 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; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-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; border-spacing: 0px 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; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-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; border-spacing: 0px 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; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-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; border-spacing: 0px 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; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-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; border-spacing: 0px 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; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-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; border-spacing: 0px 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; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><br></div></span></span></span></span></span></span></span></span></div></span></div><div><div>On 16 Jan 2009, at 20:28, Jay wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><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; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">I was able to easily build this alternate library, just by creating one small m3makefile and optionally editing one other very little.<br>I wasn't able to find a way to get it used, other than maybe shipping it on top of the "real" m3core.<br>A compiler hack that knows to replace package "m3core" with "m3coreuserthreads" may be appropriate.<br> I can look into that.<br>But I still don't know why not function pointers.<br>Plenty else to do in the meantime (Cygwin/pthreads, portability, a bunch of ports..).<br> <br> - Jay<br><br><br><hr id="stopSpelling"><br>From:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>CC:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Subject: RE: [M3devel] how to switch between user and kernel threads..<br>Date: Thu, 15 Jan 2009 04:15:43 +0000<br><br>That would't affected here.<br> All the calls within ThreadPThread to within ThreadPThread would remain direct and inlinable.<br> They would be to the "ThreadPThread" interface, and not the "Thread" interface, would be my intent.<br> <br>How about across modules?<br> I expect any call from outside ThreadPThread to within ThreadPThread to never be inlined, at least not when dynamic linking and with static linking (or within the package/library) not unless there is "whole program optimization" aka "link time code generation" with static linking, which does exist out there.<br> <br> - Jay<br><br><br><br><hr id="EC_stopSpelling"><br><br>From:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>Date: Thu, 15 Jan 2009 14:18:16 +1100<br>CC:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Subject: Re: [M3devel] how to switch between user and kernel threads..<br><br>We do get inlining within modules by virtue of the gcc-backend at -O3.<br><br><div><div><br></div><div><div><div><div>On 15 Jan 2009, at 14:03, Jay wrote:</div><br class="EC_EC_Apple-interchange-newline"><blockquote><span class="EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div class="EC_EC_hmmessage" style="font-size: 10pt; font-family: Verdana; ">The installer?<br>I thought the granularity was at the time of linking an executable.<br>I personally thought a command line parameter would be reasonable.<br> <br> <br>Why not function pointers?<br>It is a simple straightforward method to implement.<br>It should add one instruction per call.<br>It does reduce inlinability but I'm sure we aren't getting any such such inlinability anyway.<br>Dynamic linking already kills inlinability, as does separate compilation of modules in most systems.<br> <br> <br>I'm not sure how the types work out in such a scheme, but probably assuming Thread.T is already a reference type, it can become ADDRESS and then loopholed to ThreadPosix.T or ThreadPThread.T.<br> <br> <br>Function pointers are also the easiest method to build. I'm not sure what the others are.<br>I can try making m3-libs/m3coreuserthreads that contains only m3makefiles.<br>Probably it can say:<br>LibraryName = "m3coreuserthreads"<br>include_dir("../m3core/m3makefile")<br> <br> <br>and m3core/m3makefile can say<br>if not defined("LibraryName")<br> LibraryName = "m3core"<br>end<br>Library(LibraryName)<br> <br> <br>If that works, not bad.<br> <br> <br>And then cm3 or the config file can translate m3core to m3coreuserthreads at some point.<br> <br> <br> - Jay<br><br><br><hr id="EC_EC_stopSpelling"><br>From:<span class="EC_EC_Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>To:<span class="EC_EC_Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>Date: Thu, 15 Jan 2009 11:31:17 +1100<br>CC:<span class="EC_EC_Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Subject: Re: [M3devel] how to switch between user and kernel threads..<br><br><br><div>No function pointers please. Let the installer decide whether to use native or user threads.</div><div><div><div><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div style="word-wrap: break-word; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div><br></div></span></span></span></span></span></span></span></span></div></span></div><div><div>On 15 Jan 2009, at 08:30, Jay wrote:</div><br class="EC_EC_EC_Apple-interchange-newline"><blockquote><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div class="EC_EC_EC_hmmessage" style="font-size: 10pt; font-family: Verdana; ">I'll wait.<br>So, build two different m3core.lib/a/so/dylib?<br>m3core and m3coreuserthreads<br> <br>Compile both thread directories, if the platform supports it, and<br>call quake make_lib twice with slightly different parameters?<br>An m3core specific hack in the config file or cm3?<br>Easy enough in the config file.<br>Very m3core specific.<br>I suppose you could argue that quake isn't a generic build system,<br>but it is Modula-3's build system, and that m3core is really special.<br> <br>The result btw, would likely be no change at all to any *.i3 or *.m3 file.<br> <br>I still think function pointers are the way to go.<br>Even with function pointers, the changes to *.i3 and *.m3 would be very minor.<br>Just the export list would vary.<br>And new *.i3 files introduced.<br> <br> - Jay<br><br><br><hr id="EC_EC_EC_stopSpelling"><br>From:<span class="EC_EC_EC_Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>To:<span class="EC_EC_EC_Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>Date: Wed, 14 Jan 2009 21:31:22 +1100<br>CC:<span class="EC_EC_EC_Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Subject: Re: [M3devel] how to switch between user and kernel threads..<br><br>I don't want dynamic switching. A link-time switch is just fine.<br><div><br></div><div>Also, please don't go messing about with this right now -- I have changes pending for the threads system that will be harder to integrate if you change with it further.<div><div><span class="EC_EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div style="word-wrap: break-word; "><span class="EC_EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div><br></div></span></span></span></span></span></span></span></span></div></span></div><div><div>On 14 Jan 2009, at 20:14, Jay wrote:</div><br class="EC_EC_EC_EC_Apple-interchange-newline"><blockquote><span class="EC_EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div class="EC_EC_EC_EC_hmmessage" style="font-size: 10pt; font-family: Verdana; ">Are people really against using function pointers for this?<br>Either changing the interface to have function pointer variables (I'm not sure Modula-3 allows this, but in C you can fairly transparently replace functions with function pointers; client code just keeps working; it breaks down in C++ with overloading), or having a set of functions that just call/jump through function pointers? There would be no if, no conditional branches.<br> <br>Dynamic linking on Windows always goes through function pointers already.<br> So while yes it adds another instruction, it is already never getting inlined.<br>Don't other platforms do that too?<br>Or they patch every call site?<br> <br>I'm not sure otherwise of a simple method.<br>Easiest might be to have a parallel directory structure to m3core, with just m3core files.<br>That would wastefully rebuild all of m3core a second time, for just a small amount of variation.<br> <br>I think function pointers are the way to go here.<br> <br> - Jay<br><br><br><br><br><br></div></span></blockquote></div><br></div></div></div></span><br class="EC_EC_EC_Apple-interchange-newline"></blockquote></div><br></div></div></div></span><br class="EC_EC_Apple-interchange-newline"></blockquote></div><br></div></div></div></div></span><br class="Apple-interchange-newline"></blockquote></div><br></div></body></html>