[squeak-dev] A small idea how to get closer to hardware with small efforts :)

Hans-Martin Mosner hmm at heeg.de
Mon Apr 5 12:53:21 UTC 2010

Igor Stasenko schrieb:
> Hello again,
> it is about running a native code , stored in compiled methods.
> All we need is:
> a) allow code execution for object memory. On most platforms this is
> trivial - just pass additional flags to virtual memory allocation
> functions.
> b) add a single primitive 'call a native code'
> c) use a special compiled method trailer, which will store the native
> code inside itself

That's a very nice route to follow. You might be amused to know that I
tried something along that line about 12 years ago:
My approach was to translate methods with some simple type annotations
into corresponding native code which was then stored in the image and
executed mostly as in your sketch.
Alas, my computer at that time was a Macintosh Performa 6200 which was
not exactly a speed wonder, and then there was not enough time to squash
a bug in the register coloring algorithm, and then the project went
With the current number of very bright people around, I'm pretty sure
that a second stab at that problem can yield more tangible results.

About setting a piece of memory to executable:
Your version of windows probably does not use the NX bit to prevent code
execution in data areas. Newer windows versions do. Other processor
architectures have separate instruction and data cases, and there you'd
need to flush the caches after you've generated code or moved it around.
This should be designed into such an approach.


More information about the Squeak-dev mailing list