Using my asm-generator with Exypery.

sig siguctua at gmail.com
Tue May 8 15:57:44 UTC 2007


On 09/05/07, Guillermo Adrián Molina <guille at losmolina.com.ar> wrote:
> Excellent news, I could use some of that.
> I am trying to write a new ST implementation, compiling ST methods to
> machine code with exupery. But some parts (ie primitives) are still in C,
> may be I can use some of your code and translate my kernel to ST.
>
There are assembler instructions which currently not supported by
Exupery, so it may be problematic to get fully equivalent code in asm
for some primitives.
For instance, mov instructions support only 32 mem/reg operand size.
Also, NOT, XOR is missing (without these instruction i can't invert
operand, because logical set of instructions is not fully defined. If
there will be NOT, i can use it to do XOR, if there will be XOR i can
do NOT, but i cannot invert without at least one of them).
I would also like to see support of calls with relative offset, so i
can link all compiled functions in single byte array and properly set
relative calls where its needed.

I found only one way how to load a compiled code into executable
memory: its a 'loadCode' primitive.
It loads a given bytearray to code cache and returns a pointer to it.
The problem is, that i don't see a way how i can modify bytes in
already loaded chunk of code (for relocating calls).

BAH! I just thought, that problem can be simply solved by loading at
startup a small asm subroutine which will allow me to do that :)
simple assembly function accepting 2 arguments - pointer and value.. :)
See, how life can be easier: i have a way for extending functionality
based on what i have! I don't need to climb down to C and write
another plugin/primitive :)

> What is the state of your project? (unfinished, testing, etc)

Current state is unfinished. I must polish some things and add extra
functionality.
Parser is functional (at least by my analysis it generates correct
intermediate for given methods). To test it in action i'll need to
install exupery plugin. Btw, if someone can share a ready to use
squeak win32 executable with it, things will go faster..

> If I understood alright, your project is useful to translate Interpreter
> (including primitives) and object memory, ok? (maybe translating  all the
> VM to asm instead of C?)

No. And yes.
In other words, its not dictates you what will you do with your code.
You can run it, or simply fileout. Do anything you want :)
Of course, if you wish to replace some primitives with asm, this can
be done easily.


More information about the Exupery mailing list