[squeak-dev] Re: [Pharo-project] Need your help filling a FAQ
siguctua at gmail.com
Sun Apr 25 17:31:42 UTC 2010
On 25 April 2010 15:04, Stéphane Ducasse <stephane.ducasse at inria.fr> wrote:
> super cool :)
> - does it work on mac, linux..?
Currently supported is only Win32 platform.
It should be easy to port plugin on any other platform, which based on
Porting plugin on x64 or other archs will require additional work.
Also, it requires a change in VM virtual memory allocation (a memory,
which used for squeak object memory),
to allow execution of native code.
It won't work on platforms, where VM will be unable to control what
regions of memory is executable and what is not (as well as any other
> - how to enable it?
1. Build a VM with NativeBoost plugin, and you have it. Also, plugin
can be made external, so you can use it as any other plugin.
2. On image side , it requires a small change to
CompiledMethodTrailer, to add a new trailer kind for methods, to allow
methods to hold a native code and to easily work with it
You can put any native code (bytes) into a method's trailer from any
sourse. Just make sure that your method using
a NativeBoost's primitive:
<primitive: 'primitiveNativeCall' module: 'NativeBoostPlugin'>
> - why did you choose ffi and not alien?
You don't need either of them to run native code.
FFI stands for Foreign Function Interface, and NativeBoost project
will have own
interface for generating foreign function calls using native code.
It having dependencies from FFI-Kernel package, but ultimately, they
can be avoided.
Its using FFI to simply not duplicate the code and for some testing.
> - does it work on pharo?
It can be used in any fork , where we already having a compiled
methods trailers adopted.
Pharo is supported.
> - what is the representation that you use to convert it to assembly?
> byteocde or ast
> if AST which one? RBAst?
A NativeBoost package using AsmJit library
(http://www.squeaksource.com/AsmJit) for generating native code.
Its been ported from AsmJit project (http://code.google.com/p/asmjit/)
written in C.
By using a small AsmJit library you can emit almost any x86 instruction directly
to generate native code from them.
So, there currently no any platform-neutral DSL (and therefore AST)
for representing a native code in more
platform-neutral and abstract way.
An AsmJit can be used as a basis for making a more advanced/abstract
compiler/parser, as well as one can use
any other JIT implementation which can translate some intermediate
instructions into native code.
Thanks for questions!
Igor Stasenko AKA sig.
More information about the Squeak-dev