Re: Almost JIT

Phil Budne <phil@ultimate.com>
17 Jan 1999 20:48:48 -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: Phil Budne <phil@ultimate.com>
Newsgroups: comp.compilers
Date: 17 Jan 1999 20:48:48 -0500
Organization: Compilers Central
References: 99-01-042
Keywords: code

> 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?
>
> A JIT compiler would be great but I'm afraid it would be overkill and very
> complicated to follow.
>
> Jim
> [Generating code on the fly on an x86 in the usual flat address mode is
> easy. Just store the code in malloc'ed memory and jump to it. -John]


This made me think of "vcode: a portable, very fast dynamic code
generation system" at http://pdos.lcs.mit.edu/~engler/pldi96-abstract.html


        Appeared in SIGPLAN Conference on Programming Language Design and
        Implementation (PLDI '96), Philadelphia, PA, May 1996.


        Abstract


        We present vcode, a portable, extensible, very fast dynamic code
        generation system. An important feature of vcode is that it
        generates machine code ``in-place'' without the use of
        intermediate data structures. Eliminating the need to construct
        and consume an intermediate representation at runtime makes vcode
        both efficient and extensible. vcode dynamically generates code at
        an approximate cost of six to ten instructions per generated
        instruction, making it over an order of magnitude faster than the
        most efficient general-purpose code generation system in the
        literature.


        Dynamic code generation is relatively well known within the
        compiler community. However, due in large part to the lack of a
        publicly available dynamic code generation system, it has remained
        a curiosity rather than a widely used technique. A practical
        contribution of this work is the free, unrestricted distribution
        of the vcode system, which currently runs on the MIPS, SPARC, and
        Alpha architectures.


I was certain that x86 was supported, but couldn't find anything
except a mention of a port the x86 on the tickc page ('C is a C
variant that uses vcode for dynamic code generation). Looking in the
tcc-1.0b9.tgz distribution has a vcode-x86 directory. Both the vcode
and vcode-x86 in tcc appear to be based on older distributions of
vcode.


Post a followup to this message

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