[squeak-dev] [ANN] NativeBoost source released

Ian Trudel ian.trudel at gmail.com
Tue Apr 27 19:54:48 UTC 2010


Hello Igor!

I don't know why nobody gives you feedback. I haven't tried
NativeBoost yet but the concept is really good. Documentation has
always been a problem in Squeak and I'd like to make a small
contribution. Don't be offended, I have translated your FAQ in plain
English. See below. It's donated under whatever license you want it to
be.

Enjoy,
Ian.
-- 
http://mecenia.blogspot.com/


#summary Frequently Asked Questions

*Q: Which platforms are supported by NativeBoost?*

NativeBoost plug-in is currently available on Win32 platform only.
Unix (x86) and Mac platforms will be subsequently supported in the
future. Implementing other architectures will be straightforward since
the plug-in is small and simple.

Nativeboost requires a platform with a VM able to control memory
regions and render them executable.

*Q: Which Smalltalk dialects are compatible with NativeBoost?*

Any Squeak-based fork supporting the format for new compiled method
trailers may be compatible with NativeBoost. Squeak 4.1 and Pharo 1.1
are currently compatible.

*Q: How to enable NativeBoost?*

A VM built with NativeBoost plug-in is required, though one could use
a VM that allows to execute code from object memory and NativeBoost
plug-in built as an external plug-in.

A small change is required in your image in order to support
NativeBoost. Encoding, decoding and holding native code requires a new
trailer on methods and thus changes has to be brought to
CompiledMethodTrailer.

The method holding native code should use a special primitive to
render it runnable:
 <primitive: 'primitiveNativeCall' module: 'NativeBoostPlugin'>

See further instructions on the [Installation page link here].

*Q: Why did you choose [http://source.squeak.org/FFI.html FFI] over
[http://www.squeaksource.com/Alien.html Alien]?*

There are some dependencies with FFI-Kernel and FFI is mainly used for
testing purpose. NativeBoost will eventually run native code without
any framework and will have its own implementation to generate foreign
function calls.

*Q: What is the internal representation used to convert into assembly?*

There is no code translation performed by the VM and code is ran
exactly as provided. NativeBoost however implements a foreign function
interface using AsmJit to generate native code. There is currently no
platform independent syntax in AsmJit and the code provided to its
engine is mostly direct instructions.

*Q: What does this do that I didn't know I wanted to do?*

NativeBoost allows you to virtually do anything you want that does
involve direct access to the CPU without any intermediary layers (e.g.
OS, VM, compiler, etc).

*Q: What are the additional benefits from using NativeBoost over any
other plug-ins?*

Every VM plug-in requires compilation into an internal or external
plug-in, which will require to deploy a new VM or plug-ins alongside a
given project. This is a time-consuming development process. Depending
on third party plug-ins and its functionalities may bring a
considerable overhead on a schedule. Developing and maintaining
internal or external plug-ins may be tedious and requires extensive
knowledge of the VM, and may require to regularly synchronize with the
official Squeak VM.

Using NativeBoost allows you to directly communicate with the
underlying operating system, other FFI implementations, and/or
implementing your own set of primitives in native code rather than
developing a custom VM.


*Q: How fast is native code using NativeBoost compared to Smalltalk code?*

There is no benchmark available at the moment. Smalltalk code has a
noticeable overhead because it is interpreted by a VM whereas native
code is directly ran onto the CPU. It is more productive to develop in
Smalltalk but the resulting performance is slower. The execution
performance using native code is faster but it requires writing code
in assembly language.

*Q: How NativeBoost compares to [http://www.squeaksource.com/Exupery Exupery]?*

NativeBoost and Exupery projects complement each other but they have
different objectives.

Exupery strives for optimizing overall virtual machine performances
and dynamically translates Smalltalk methods and other VM semantics
into native code through a JITter; and the resulting code is
subsequently ran natively onto the CPU.

NativeBoost allows developers to implement primitives by dynamically
generating native code and communicating directly to the hardware,
operating system, external libraries, and so forth.

*Q: How do I send a message or evaluate a block passed as argument?*

NativeBoost does not support this feature and native code is
comparable to primitives in its usage.

*Q: How do I access the VM state/functionality?*

NativeBoost integrates VM support through NBInterpreterProxy class,
which allows one to call interpreterProxy as it would normally be
accomplished in a plug-in. It as a distinct advantage over its
counterparts because native code can be used readily once a method has
been accepted and compiled into its Smalltalk environment.



More information about the Squeak-dev mailing list