<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 20 Apr 2015, at 16:35, Nicolai Hess &lt;<a href="mailto:nicolaihess@web.de" class="">nicolaihess@web.de</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">2015-04-20 16:20 GMT+02:00 Eliot Miranda<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank" class="">eliot.miranda@gmail.com</a>&gt;</span>:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">&nbsp;<br class=""><div dir="auto" class=""><div class="">Hi Nicolai,<br class=""></div><div class=""><br class="">On Apr 19, 2015, at 3:36 AM, Nicolai Hess &lt;<a href="mailto:nicolaihess@web.de" target="_blank" class="">nicolaihess@web.de</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><span class=""></span></div></blockquote><blockquote type="cite" class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">2015-04-18 18:35 GMT+02:00 Eliot Miranda<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank" class="">eliot.miranda@gmail.com</a>&gt;</span>:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">&nbsp;<br class=""><div dir="auto" class=""><div class="">Hi Nicolai,</div><div class=""><br class=""></div><div class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>I'm rather excited that you're interested in this.&nbsp; Perhaps we (you, Esteban, Clément and I) could meet in a google hangout to discuss soon?</div><div class=""><br class=""></div><div class="">As Esteban said I was able to demonstrate threaded calls on Mac.&nbsp; CoInterpreterMT is the subclass of&nbsp;<span class="">CoInterpreter that adds support for threading. But the code is out-of-date.&nbsp; So some work is needed to get back to where I was.&nbsp; But to have someone focused on this is the key.&nbsp; I don't think we have someone with the cycles yet and if you're that person (and can talk to&nbsp;</span><span class="">Esteban, Clément and I, and maybe Ronie and Doug McPherson and Thierry) then I'm sure we can get it working soon.&nbsp; Spur has the necessary pinning support for example.</span><br class=""></div></div></blockquote><div class=""><br class=""></div><div class="">Well, I am not sure I can be a help :)<br class=""></div><div class="">And I spend my main time for fixing issues in the core image.<span class="Apple-converted-space">&nbsp;</span><br class="">But I would like to help if I can.<br class=""></div></div></div></div></blockquote><div class=""><br class=""></div>Good, thanks!<div class=""><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">About the CoInterpreterMT, is it possible to get this working with the NB additions?&nbsp;</div></div></div></div></blockquote><br class="">Of course, but NB has several issues<div class="">- it isn't cross-platform</div><div class="">- it isn't secure (it makes the entire heap executable)</div><div class="">- it is yet another JIT while we have a cross-platform one which can more easily integrate FFI marshaling code with Smalltalk code</div></div></div></blockquote><div class=""><br class=""></div><div class="">I had some hard time fighting with old doc about FFI / uncertain state of current FFI (which version works with what VM ). And finally NB was<br class=""></div><div class="">the one I find that works good with Pharo and has some very well examples and existing working projects.<span class="Apple-converted-space">&nbsp;</span><br class=""></div><div class="">I'll switch to whatever new FFI (without the above issues) will come after NB. But right now, I don't know what are my options, is<br class=""></div><div class="">there anything else I can use?<br class=""></div><div class=""><br class="">&nbsp;</div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="auto" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">It would be great but it sounds too simple, but would it work if we use a MT VM with NB additions and<br class=""></div><div class="">change the NB callback entry/leave code to make calls to ownVM and disownVM<span class="Apple-converted-space">&nbsp;</span><br class="">(for callbacks defined in the main vm thread, but called by some native code in another thread) ?<br class=""></div></div></div></div></blockquote><div class=""><br class=""></div>Hmmm are NB callbacks different from Alien callbacks?&nbsp; IIRC, NB uses the Alien callback machinery.&nbsp; Igor, did you reimplement callback entry fir NB or reuse my code?&nbsp; If not, what was the motivation to not use the existing infrastructure?<div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">I am not sure if we need spurs pinning support here, because the current NB implementation works without it.</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">What would happen if one made an FFI call that included a ByteArray passed by reference which is used by the called code as a buffer and that code called back and in the callback the GC ran and moved the buffer then?</div><div class=""><br class=""></div><div class="">What would happen if one&nbsp;<span class="">made an FFI call that included a ByteArray passed by reference which is used by the called code as a buffer</span><span class="">&nbsp;and a thread switch occurred and the system ran the GC which moved the buffer while the first thread was using the buffer?</span></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Sure, but arent NB objects marked as ExternalObjects?<br class=""></div></div></div></blockquote><div><br class=""></div><div>Not all.&nbsp;</div><div>if you work with pointers, you’re ok because you just take the number representing the address. But as soon as you want to interact with the data pointed, you need a move into image (for example, into a ByteArray, or a String). That’s a copy function…&nbsp;</div><div><br class=""></div><div>Esteban</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">&nbsp;</div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="auto" class=""><div class=""><div class=""><div class=""><div class=""><br class=""><span class="">Eliot (phone)</span></div><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="auto" class=""><div class=""><br class="">Eliot (phone)</div><div class=""><br class="">On Apr 18, 2015, at 9:24 AM, Nicolai Hess &lt;<a href="mailto:nicolaihess@web.de" target="_blank" class="">nicolaihess@web.de</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><span class=""></span></div></blockquote><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">Thank you Esteban,<br class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">2015-04-18 9:36 GMT+02:00 Esteban Lorenzano<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:estebanlm@gmail.com" target="_blank" class="">estebanlm@gmail.com</a>&gt;</span>:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">&nbsp;<br class=""><div style="word-wrap: break-word;" class="">Hi,&nbsp;<div class=""><br class=""></div><div class="">So… “multithread” is a complicated issue. Pharo as most Smalltalks is designed thinking is as monolithic so if you are trying to make the image to work in different processes… it will not be easy at all :)</div><div class="">Time ago Eliot did a prototype (more than a prototype in fact, but still far from “production ready”) to have Threaded FFI and I’m quite sure this is the way to go, at least as a 1st milestone.&nbsp;</div><div class=""><br class=""></div><div class="">I already have a process building this experimental VM:</div><div class=""><br class=""></div><div class=""><a href="https://ci.inria.fr/pharo/view/VM/job/CogMTVM/" target="_blank" class="">https://ci.inria.fr/pharo/view/VM/job/CogMTVM/</a></div></div></blockquote><div class=""><br class=""></div><div class="">But this one does not include NativeBoost support. Do we have a build with MT and NB?<br class=""></div><div class="">&nbsp;</div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><br class=""></div><div class="">(No idea why windows build failed last two times… this can be a random fail).</div><div class=""><br class=""></div><div class="">I do not remember exactly the changes needed in the image to take advantage of it… it was just an instVar in Process, I think, but then FFI package was adapted to take advantage of this… no idea where it is now (if is already incorporated in latest FFI, which we have).</div><div class=""><br class=""></div><div class="">Then, after this… I imagine the callback mechanism can be adapted to work in multithread environments but probably we will need something like isolates from Dart to provide some degree of multithread processing without killing the image (but I’m just thinking in loud here, this can be a really bad idea, and probably there are other ways to do this better… I will let Eliot to explain better).&nbsp;</div><div class=""><br class=""></div><div class=""><b class="">TL;DR:<span class="Apple-converted-space">&nbsp;</span></b>Start for the CogMTVM, is the way to go.</div><div class=""><br class=""></div><div class="">cheers,&nbsp;</div><div class="">Esteban</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 17 Apr 2015, at 09:06, Nicolai Hess &lt;<a href="mailto:nicolaihess@web.de" target="_blank" class="">nicolaihess@web.de</a>&gt; wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class="">Hi,<span class="Apple-converted-space">&nbsp;</span><br class=""><br class=""></div>I've tried to build a pharovm with multithread support. I changed the config in the<span class="Apple-converted-space">&nbsp;</span><br class=""></div>pharo generator.image to use the cogmt config and was able to build a vm.<br class=""></div>But this vm crashes on startup. (windows7)<br class=""><br class="">Is this the right way and did anyone got this to work (windows or linux)?<br class=""><br class=""></div>And can this work to make NB callbacks working for multithreaded libraries.<br class=""></div><br class="">(I made some simple bindings for the gstreamer lib with NB, this works<br class=""></div>for simple calls (create element/change state). But I guess this won't work<br class=""></div>for any gstreamer function that requests a callback that may b e called from<br class=""></div>a different thread)<br class=""><br class=""></div>Would this be the right way to do:<br class=""></div>- build a vm with MT support<br class=""></div>- guard the NB callback entry/leave code with the ownVM()/disownVM() call.<br class=""><br class=""></div>Or is there more to do.<br class=""><br class=""></div><div class="">Thanks in advance<br class=""></div><br class=""><br class=""></div>nicolai</div></div></blockquote></div></div></div></blockquote></div></div></div></div></div></blockquote></div></blockquote></div></div></div></blockquote></div></div></div></div></blockquote></div></div></blockquote></div><br class=""></body></html>