Everything is a Register!

sig siguctua at gmail.com
Mon May 7 15:18:14 UTC 2007


On 07/05/07, Herbert König <herbertkoenig at gmx.net> wrote:
> Hello Sig,
>
> s> My explo[it]ration of Exupery brings some fruits - an assembler
> s> generator using smalltalk syntax. :)
>
> I like that very much but I didn't manage to find out
> - who will translate the assembler into actual X86 machine code
> - how to run the generated code from Squeak.
>
I'm not finished yet. It require to perform few additional steps to
produce final code: replace returns and add prologue/epilogue to
function corresponding to supplied calling convention.
In case if you using a local calls, there also need to keep track
relocation points, to replace them by concrete absolute address values
when code is placed in fixed memory (Exupery have this already, i just
didn't developped to that point).

In any case you need an Exupery to produce final code, and
ExuperyPlugin if you want to install and run it.
You'd better ask Bryce about that, i don't know details yet (have to
dig details). It may require to add few primitives especially designed
to run my pure assembly.

Or you can write own plugin, which i not recommend to do (Increasing a
code written in C is the worst solution as for me :) ). Its simple
enough to implement by own: allocate fixed system memory with
execution permission, place generated code there and return a pointer
to function entry point. Then you can use FFI to run the code.
Also, some trickery can be used to register the function as primitive.

The consequences of running pure assembler of course laying on solely
on the author. There a high risk that buggy assembler code will
attempt to access protected memory or broke C stack using incorrectly
set calling convention.
But these risks get rewarded considerably :)

> Am I being dense?
>
> Me having still one leg in a world where I replaced C-code by
> handwritten assembler to speed up digital signal processing :-))
>

I'm greatly inspired by Ian Pumiatra COLA/Pepsi project. I want to
free from shackles of C.



More information about the Squeak-dev mailing list