[Pharo-project] Alien + Cog VM

Eliot Miranda eliot.miranda at gmail.com
Thu Nov 11 02:40:06 CET 2010


Hi Ken,

On Wed, Nov 10, 2010 at 10:20 AM, Ken Treis <ken at miriamtech.com> wrote:

> What's the status of Alien in the new Cog VM? I was able to load Alien into
> Pharo 1.1.1 running Cog, and some simple callouts worked (e.g. `CRLibrary
> libraryVersionString` in CairoGraphics. But every callout with arguments
> failed in primFFICallResult:.
>
> Alien works perfectly for me in Pharo 1.1 using JMM's VMs when I load the
> Pharo 1.1 version from ConfigurationOfAlien, but I admit I haven't tried
> 1.1.1 in this arrangement.
>
> Is there something that's changed in Cog's Alien primitive implementation?
>

IIRC, the Alien callout code is written assuming stacks grow up (in
MethodContext instances) whereas in the Cog Stack and JIT VMs stacks grow
down.  So the glue in platforms/Cross/plugins/IA32ABI/dabusiness.h needs
rewriting.  Specifically the second loop over the arguments at line 45 needs
to mimic the code at line 17.  (I know, insane; why have two different loops
in the first place?  counting down towards zero can generate slightly faster
code than counting up towards a limit; you need one less register).

But I'm hoping that the ALien callouts will die the death soon.  I have
Alien callbacks integrated with the FFI and of course the ALien data
manipulation code works fine.  So if you're eager to have Alien callouts
work see whether the above change fixes things, in which case I can
integrate the fix.  But if you're not so eager you could wait for me to push
out the FFI changes, but that could take a few weeks.

HTH
Eliot

>
> --
> Ken Treis
> Miriam Technologies, Inc.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20101110/e2afbf06/attachment.htm>


More information about the Pharo-project mailing list