[Vm-dev] [Pharo-dev] [ANN] PharoNOS

Igor Stasenko siguctua at gmail.com
Thu Mar 23 01:15:27 UTC 2017


On 23 March 2017 at 00:03, Ronie Salgado <roniesalg at gmail.com> wrote:

>
> Hi,
>
> With the experimental Lowcode backend for the UFFI, it is possible to call
> functions with almost arbitrary calling conventions. For some of the
> special assembly instructions that are required by this project, I could
> add the following extra instruction:
>  - storeIntoSpecialRegister: {CR0, CR1, CR2, CR3, CR4, CR5, GDT, LDT, IDT)
>  - loadFromSpecialRegister:
>  - loadFromIOPortU?Int{8,16,32}:
>  - storeIntoIOPortU?Int{8,16,32}:
>
> As for the interruptions, there are far trickier because they can be
> triggered in any time. They probably would require some special trampoline
> for storing/restoring the VM state, something similar to the callbacks.
>
> Currently I am finishing a refactoring of the Lowcode register allocator,
> so the Lowcode VM is out of service for this week :) .
>
> Hey, guys, i'd like to stress, that AsmJit
>> is quite standalone part of NB, and nothing prevents you to use it in own
>> way, not the way NB was..
>> Because NB was born to make nice integration between machine code and VM
>> , and providing FFI,
>> and as a demonstration that generating machine code IS possible and quite
>> doable from within an image.
>>
>> But there's a tons of ways how you could generate machine code, and then
>> use it outside the scope of FFI.
>> You could just make own llittle primitive, that just makes a call on
>> arbitrary address, and put your generated code on it.. Voila.
>> Again, you could store generated code not in method(s) trailer , but
>> somewhere else.. it just up to you, after all.
>> For instance i had parts that were storing generated code directly in
>> COG's JITter, replacing its primitive section.
>> So, that make a nice integration with JIT, that just using your code as a
>> primitive for given method..
>> All is doable, when you working at lowest level, you just need to think
>> how to expose it in convenient way.
>>
>
> For GPU compilation, I implemented a SSA based intermediate representation
> very similar to the one used by LLVM. As a experiment, I did a very basic
> machine code generator which can produce relocatable ELF32 and ELF64 object
> files, which can be linked with any C library or program. With this I
> managed to implement a basic ahead of time compiled Smalltalk runtime.
>
> Before starting that backend, I took a look on AsmJit and the VirtualCPU
> and I did not like the dependencies and some details about the stack.
> However, now I do not like the low level backend so I started refactoring
> into a separate package, but I still think that I should take yet another
> look to AsmJit and the VirtualCPU, so I am wondering where is actually
> located the latest version of these two projects.
>
> IIRC, the stack (but more precisely - temporaries) management in AsmJIT
are implemented in own classes, that doing the job of allocating stack
space and assigning each temporary to specific place on stack.
As well, as calling convention. Nothing prevents you from adding own by
implementing their protocol(s).
Or you may leave it as a whole, except that then you'll have to handle it
by yourself. And of course, it is already there, since initial version has
no such functionality at all,
all you have to do is to tell:
asm noStackFrame.
And so, it will leave you without it.

As for where it located - see at smalltalkhub , if i remember Max  were
working on that and made quite complete coverage of ARM instruction set. (
http://smalltalkhub.com/#!/~maxmattone/AsmJit-ARM)
I don't remember if we merged the ARM support into main branch.. But i
think you can figure it out.

P.S. ohh, you see.. it just never ending quest to keep dispelling people's
perception, that there's something impossible or wrong with these things
or that's there are something that won't make things possible.. So, they
choose to go with C :)

Best regards,
> Ronie
>
>
-- 
Best regards,
Igor Stasenko.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20170323/3d3dea7f/attachment.html>


More information about the Vm-dev mailing list