Using my asm-generator with Exypery.

sig siguctua at gmail.com
Tue May 8 04:16:17 UTC 2007


Hi everyone, i'm very interesting in Exupery progress, so i decided to
join this list.

If you may know i implemented a small parser, which translates a
smalltalk source into asm instructions.
(if you missed my post on squeak-dev, you can read it here:
http://computeradvenrutes.blogspot.com/)

I have read some threads in archive and come to conclusion, that
Exupery itself can make a good use of my parser. Many primitives,
which handle smallints/largeints can be coded in smalltalk and then
translated using asm-parser to become low-level primitives.

Then they can be placed in code cache as standalone functions, or what
is more nicer - to be inlined by Exupery when compiling bytecodes of
smalltalk methods!

What is more important - it become easier to manage your low-level
code, and keep all things in same place, without need of recompiling
VM again and again.

All what you need then is to compile source code of some class, get
intermediate form of methods - and use these pieces of code for
inlining when generating a method from bytecode, or put a near/far
calls to it.

Consider following example:

you write the code:
------
PrimitiveSmallIntegers>>add: a with: b
| result |
   self pragma: #inline.  "tell the parser to not generate prologue/epilogue"

" adding pair of smallintegers (assuming a and b is smallintegers!!) "

^ ( result := a + b ) ifNotOverflow: [ result - 1 ] else: [ self call:
#coerceToBigIntsAndAdd:with: with: a with: b ]
-------
and then in

IntermediateGenerator>>generate:add:
^ self parsedMethod: #add:with:  "return inlined form for adding two operands"

It provides an easy way for extending Exupery with all basic numerics
functionality (like big integers/floats), without jungles of hardly to
write and hardly to manage mid-level code.

Do you like my idea?

--
regards
 sig.


More information about the Exupery mailing list