[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lightning Bindings

From: Ludovic Courtès
Subject: Re: Lightning Bindings
Date: Tue, 01 Jun 2010 20:02:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hi Noah!

Noah Lavine <address@hidden> writes:

> Here is my understanding of the three approaches:
> The approach in my project was to make machine code a Guile datatype,
> which you could allocate with a special init function and write to
> with writing functions which are just Guile versions of the Lightning
> macros. It could be called as a function through the dynamic FFI.
> The approach in the other guile-lightning project is to represent the
> Lightning code as a Guile list which mirrors the Lightning virtual
> instruction set. When a list is completely built, it would then be
> passed to a special function (written in C) to assemble it. It also
> has some infrastructure for labels and a special method of calling
> these functions, neither of which I understand yet.
> The approach in your plan for JIT, as I understand it, is to implement
> this completely in the C layer. The machine code would be stored as
> part of the representation of a procedure, and would be invisible from
> the Scheme side.


> The reason I did not use the approach of the other guile-lightning, to
> make a list and then assemble it, was that it seemed inelegant and
> possibly slow

It depends on when and how the instruction stream is written.  From a
usability viewpoint, having a simple s-exp for asm instructions is
nice (and elegant, IMO).

OTOH, I find the ‘make-integer-id’ example at
<> quite
elegant too.

BTW, note that end-of-buffer situations must be handled, somehow.  If
the whole call generation procedure is burried in a single C functions,
it can hide these details to the application.  Otherwise, it’d be up to
the application to handle this situation, e.g., by linking two code
buffers together and adding a jump instruction in the first one to the
second one.

Anyway, these are just random thoughts.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]