Re: basic question about runtime query parsing

Chris Dollin <kers@hpl.hp.com>
26 Jul 2005 13:19:18 -0400

          From comp.compilers

Related articles
[2 earlier articles]
Re: basic question about runtime query parsing skandgoe@gwdg.de (Skandinavisches Seminar) (2005-07-12)
Re: basic question about runtime query parsing wyrmwif@tsoft.org (SM Ryan) (2005-07-12)
Re: basic question about runtime query parsing gneuner2@comcast.net (George Neuner) (2005-07-12)
Re: basic question about runtime query parsing kers@hpl.hp.com (Chris Dollin) (2005-07-17)
Re: basic question about runtime query parsing lfinsto1@gwdg.de (Laurence Finston) (2005-07-22)
Re: basic question about runtime query parsing shahbazc@gmail.com (falcon) (2005-07-22)
Re: basic question about runtime query parsing kers@hpl.hp.com (Chris Dollin) (2005-07-26)
Re: basic question about runtime query parsing lfinsto1@gwdg.de (Laurence Finston) (2005-07-28)
Re: basic question about runtime query parsing kers@hpl.hp.com (Chris Dollin) (2005-07-31)
Re: basic question about runtime query parsing skandgoe@gwdg.de (Skandinavisches Seminar) (2005-08-01)
Re: basic question about runtime query parsing marcov@stack.nl (Marco van de Voort) (2005-08-03)
Re: basic question about runtime query parsing kers@hpl.hp.com (Chris Dollin) (2005-08-03)
| List of all articles for this month |

From: Chris Dollin <kers@hpl.hp.com>
Newsgroups: comp.compilers
Date: 26 Jul 2005 13:19:18 -0400
Organization: HPLB
References: 05-07-045 05-07-056 05-07-066 05-07-079
Keywords: code, practice
Posted-Date: 26 Jul 2005 13:19:18 EDT

Laurence Finston wrote:


> On Sun, 17 Jul 2005, Chris Dollin wrote:
>
>> Skandinavisches Seminar wrote:
>>
>>> I don't believe that compilation "on the fly" is possible with C.
>>
>> It's certainly possible: it's just not *portable*.
>
> [...]
>
>> Not true; you can generate a dynamic-linked library and dlopen it.
>
> Thanks for the information. I'll have to look up 'dlopen'. However,
> even if it's possible, I think there's probably an easier and safer
> solution for most programming tasks. I don't dispute that it could be
> useful for some special ones.


dlopen [etc], as I understand it, is the basis for [or access to]
POSIX dynamic linking. If you don't need or want run-time code
generation of some kind, of course you don't need to use dlopen
to implement it ...


> It seems to me that such a program would be difficult to debug, since
> you wouldn't just have to worry about errors in the program itself,
> but also compilation, linking, and run-time errors in the generated
> code, all of which would occur during the "outer" program's run-time.


I don't see as those are particularly difficult to handle; you have to
be prepared for the dynamically linked code to fail, just as its possible
for statically-linked code to fail. You have, somehow, to ensure that
the compilation stage and dlopen stage failures are trapped in whatever
way your application traps errors.


But:


> Depending on the possible complexity of the generated code, I think
> that it could easily become practically impossible to test.


That's a real issue, of course.


> And if, as you say, it wouldn't be
> portable anyway, what would be the point?


It may be portable enough. If you're prepared to stick to POSIX
systems.


>> So, not only is it possible: it's been done, and yonks ago.
>
> I don't think it signifies that it was done a long time ago.


I only meant to imply "this does not require a modern technology".


  People
> used to do lots of tricky things to cope with the limitations of the
> computers of the time. Self-modifying code, for example. I don't
> think anyone thinks this is a good idea anymore,


Run-time code generation eg JIT.


--
Chris "electric hedgehog" Dollin
predicting self-predictors' predictions is predictably unpredictable.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.