Re: Almost JIT

fjh@cs.mu.OZ.AU (Fergus Henderson)
19 Jan 1999 00:53:22 -0500

          From comp.compilers

Related articles
Almost JIT sunsetsw@ix.netcom.com (James R Byer) (1999-01-15)
Re: Almost JIT phil@ultimate.com (Phil Budne) (1999-01-17)
Re: Almost JIT fjh@cs.mu.OZ.AU (1999-01-19)
Re: Almost JIT fjh@cs.mu.OZ.AU (1999-01-19)
| List of all articles for this month |
From: fjh@cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.compilers
Date: 19 Jan 1999 00:53:22 -0500
Organization: Computer Science, The University of Melbourne
References: 99-01-042
Keywords: code, 386, comment

"James R Byer" <sunsetsw@ix.netcom.com> writes:


>Does anyone have any C coding examples for Windows95/NT or can suggest where
>I should continue searching for examples of code which dynamically generates
>machine instructions and at some point executes them?


GNU C, which is available for Windows95/NT via
<http://sourceware.cygnus.com/cygwin/>, does a very limited amount
of dynamic code generation when compiling code that takes the address
of a nested function. (Nested functions are a GNU C extension to
standard C.) You can take an example such as the following,
compile it, and examine the generated assembly code.


void bar(void (*f)(void));
int foo(void) {
int x = 0;
void nested(void) { x++; }
bar(&nested);
return x;
}
void bar(void (*f)(void)) { (*f)(); }


--
Fergus Henderson <fjh@cs.mu.oz.au>
WWW: <http://www.cs.mu.oz.au/~fjh>
PGP: finger fjh@128.250.37.3
[The x86 code from the 2.7.2.1 I have here looks like it won't work if
bar recursively calls foo. -John]


Post a followup to this message

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