> On 19 Mar 2017, at 21:46, jan.struz <public+ph...@struz.cz> wrote:
> 
> Hi Stef,
> what I want, is NativeBoost for Pharo 5+. Because we could do this:
> 
> primInPortByte: portNumber 
>       <primitive: 'primitiveNativeCall' module: 'NativeBoostPlugin' error: 
> errorCode>
> 
>       ^ self nbCallout function: #(uint8 ( uint16 portNumber )) emit: [:gen | 
>                       | asm result proxy | 
>                       asm := gen asm.
>                       proxy := gen proxy.
>                       result := gen reserveTemp.
>                       asm
>                               pop: asm EDX;   "EDX = portNumber"
>                               push: asm EDI;  "save EDI"
>                               mov: result to: asm EDI; "EDI = temp address 
> for result"
>                               db: 16rEC;              "IN AL, DX"
>                               pop: asm EDI.  "restore EDI"
>                       gen releaseTemps: 1.
>               ].
> 
> This is a rewrite of one method from C source(calling asm) in internal 
> SqueakNOSPlugin into NativeBoost Smalltalk code. It calls privileged (kernel 
> mode only) instruction to directly access HW I/O - disk access.
> I have tried to run it, and it worked fine. However there is one little 
> problem. NativeBoost needs method source, which is stored where? On the disk 
> it wants to access... Solution - the source code can be embedded into 
> compiled method trailer - this is only way to make it work. The first run 
> will generate native code, and replaces the embedded source, so you can't 
> touch the method anymore (at runtime)... so it is not perfect.
> This is how SqueakNOSPlugin can be removed entirelly. But I'm afraid nobody 
> can play with it in Pharo7 images…

well… NB for Pharo5 will not be there unless someone takes it and make it work. 
And even then, it will not go back to the image… but it would be very nice to 
have it as a loadable package. 

Now, to make it work “as is” on Pharo5+ you will also need to modify somethings 
in the VM, for example make the memory executable… and there are security 
observations against it so the “original” way will need an important refactor 
(to execute NB methods in a special segment).

And I’m sure there are a lot of more stuff there I’m not thinking about, being 
8:30am here ;)

Esteban

> Save The World!
> 
> View this message in context: Re: [ANN] PharoNOS 
> <http://forum.world.st/ANN-PharoNOS-tp4939247p4939313.html>
> Sent from the Pharo Smalltalk Developers mailing list archive 
> <http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html> at 
> Nabble.com.

Reply via email to