[Top][All Lists]

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

Re: [Tinycc-devel] Dynamic code generation

From: David Mertens
Subject: Re: [Tinycc-devel] Dynamic code generation
Date: Wed, 21 Aug 2013 13:01:05 -0400

John -

On Wed, Aug 21, 2013 at 12:24 PM, <address@hidden> wrote:
Hi David.

On Sun, Aug 18, 2013 at 09:22:04PM -0500, David Mertens wrote:
> John -
> This is *very* interesting. One thing that I have been dreaming about is
> the ability to have some major module partially compile code once and then
> allow the "user" to plug in miscellaneous expressions and finish the
> compilation. It sounds like your patch might allow this sort of
> functionality, or be the first step towards something like that. :-D

Interesting idea. I think you will be restricted to using one state at a time.
States with overlapping lifetimes probably not going to work.
This is just a guess based on whatever I gathered from poking around
the source, havn't tried it myself.

Oh, I see. You are correct about multiple compiler contexts: my own tests with multiple compiler states revealed that TCC doesn't tolerate them. However, you can have multiple post-compiled contexts. This led me to collect lots of compiler state in Perl variables and assemble them together only just before compiling. Still, I like your idea about pausing the compiler and inquiring into its symbol table.

I'll try merging your patch into Alien::TinyCC's src/ dir and run it through a testers version on CPAN to see if it doesn't break anything.
> David
> On Sun, Aug 18, 2013 at 2:56 PM, <address@hidden> wrote:
[.. snip ..]

> > It seems necessary to carry around the entire TCCState when
> > only the memory for the code is really of interest. tcc_delete()
> > deletes the memory provided by the user

This assertion is most likely incorrect. It looks like tcc_delete()
does the right thing.

Haven't looked. I keep the whole thing around until the context's refcount drops to zero. Proper memory management, and thus exercising of libtcc's API, will take a higher importance after (if) this project gets more usage and traction in the Perl community.

Tinycc-devel mailing list


 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

reply via email to

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