[Top][All Lists]

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

[Lightning] Re: Copying generated functions

From: Alban Bedel
Subject: [Lightning] Re: Copying generated functions
Date: Sat, 8 Mar 2008 19:15:14 +0100

On Tue, 26 Feb 2008 08:33:15 -0500
"Sandro Magi" <address@hidden> wrote:

> For instance, the initial buffer could be stack-allocated, then copied
> to a malloc'd buffer. Cheap and easy. The only pitfalls I can think of
> here, are absolute jumps within the buffer which are then invalidated
> because of the reocation. Does Lightning generate such code?

My asm knowledge is limited to i386, however I doubt that any sane cpu
design would miss relative jump. So I doubt that local jumps will ever
be a big problem. However function call might well be a problem.

In my compiler I use a malloced buffer that is reallocated when more
space is needed. For the local jumps I just store offset to the code
start instead of raw pointers. For functions call I simply rewrite
all the prepare/pusharg/call sequence at the very end. It sure would be
nicer if lightning just had a macro to patch the called address, but
that do the job.


reply via email to

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