Hi Jakob,

On Thu, Jun 09, 2011 at 11:18:29AM +0200, Alexander Burger wrote:
> > Also - I find the general idea of using picolisp as an embedded control
> > language inside other applications interesting, not just this special
> > platform.
> 
> So it would be nice to get pil32 or pil64 running.

If you want to stick with miniPicoLisp, there is another idea:

We can release the restriction that code must be aligned to certain byte
bondaries if you encode the function pointers differently.

For that, you change in "mini/src/pico.h"

   #define evSubr(f,x)     (*(fun)(num(f) & ~2))(x)

to

   #define evSubr(f,x)     (*(fun)(num(f) >> 2))(x)

and in "mini/src/main.c" in the boxSubr() function omit the check

   if (num(f) & 3)
      giveup("Unaligned Function");

and change the line

   return (any)(num(f) | 2);

to

   return (any)((num(f) << 2) + 2);

I didn't test it, but you see the point: Instead of using the tagged
function pointer, the pointer value is shifted left by to bits and then
tagged.

There is a drawback, though: This mechanism assumes that functions
reside in the lowest quarter of the address space. So it depends on the
runtime environment whether it works or not.


BTW, are you aware of Tomas Hlavaty's FFI for miniPicoLisp?

@Tomas, does this still exist?

   http://logand.com/mplisp/src/mod/ffi.l

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to