Re: translate Java VM bytecode to native code using GCC backends ?

Per Bothner <bothner@cygnus.com>
19 Feb 1996 23:39:02 -0500

          From comp.compilers

Related articles
translate Java VM bytecode to native code using GCC backends ? pascal@sema-taa.fr (Pascal.Girard) (1996-02-09)
Re: translate Java VM bytecode to native code using GCC backends ? bothner@cygnus.com (1996-02-13)
Re: translate Java VM bytecode to native code using GCC backends ? mad@nak.math.keio.ac.jp (MAEDA Atusi) (1996-02-19)
Re: translate Java VM bytecode to native code using GCC backends ? bothner@cygnus.com (Per Bothner) (1996-02-19)
| List of all articles for this month |

From: Per Bothner <bothner@cygnus.com>
Newsgroups: comp.compilers
Date: 19 Feb 1996 23:39:02 -0500
Organization: Compilers Central
References: 96-02-072 96-02-132 96-02-225
Keywords: Java, interpreter
cc: compilers@iecc.com

> So translator can simply map each slot of Java VM stack into machine
> register, without worrying (much) about branches.


Ah - but what is the *type* of machine register?


What we know is that there is a mapping from (stack index, PC) to
type. So we can create a map from (stack index, PC) to machine
register. We can also "share" registers that have the same type and
stack index. This takes care of "persistence" of stack values.
I.e. we have a map from (stack index, type) to register. An operation
that pushes a value on the stack can be implemented by assigning to
the register found in the (stack index, type)->register map. (A new
register is allocated if necessary.) Popping a value from the stack
uses the register found in the map.


You can consider all pointers to have the same type. I.e. in gcc, for
type you only need to consider the machine mode.


In gcc, instead of a "register" you would use either:
a) A temporary variable (VAR_DECL), allocated in a virtual register; or
b) A virtual register.


The former is preferable, since it allows you to use the tree-level
operations. You probably also want to do some optimizations for
straight-line code to manipulate expression trees rather than always
store values in the (virtual) registers corresponding to their stack
location. One reason you want to do this is that constant folding
(and some other optimizations) are done at the tree level, before the
main optimizations (which are done at the rtl level).


--Per Bothner
Cygnus Support bothner@cygnus.com
--


Post a followup to this message

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