harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Egor Pasko <egor.pa...@gmail.com>
Subject Re: [drlvm][jitrino]Are there any static type checking and type propagation?
Date Mon, 02 Jul 2007 06:37:42 GMT
On the 0x307 day of Apache Harmony Xiao-Feng Li wrote:
> On 7/2/07, clara <clarazhang@gmail.com> wrote:
> > Each operand has type info in JIT IR, and I think the type is decided
> > according to the declarations.
> > However, the runtime type of some operands can be decided in compilation.
> > Are there any optpasses which do some type inference or analyzing?
> >
> > For example, the below are 3 classes, according to analyzing the code, we
> > know the runtime type of e is Body$Enumerate.
> >
> > public class BH
> > {
> >     Tree root = new Tree();
> >     ...
> >     public static final void main(String args[])
> >    {
> >        for (Enumeration e = root.bodies(); e.hasMoreElements(); )
> >         ...
> >    }
> > }
> > class Tree
> > {
> >     ...
> >     private Body       bodyTab;
> >     final Enumeration bodies()
> >    {
> >       return bodyTab.elements();
> >    }
> >    ...
> >
> > }
> > final class Body extends Node
> > {
> >     final Enumeration elements()
> >    {
> >       // a local class that implements the enumerator
> >       class Enumerate implements Enumeration {
> >          private Body current;
> >          public Enumerate() { this.current = Body.this; }
> >          public boolean hasMoreElements() { return (current != null);  }
> >          public Object nextElement() {
> >             Object retval = current;
> >             current = current.next;
> >              return retval;
> >         }
> >       }
> >       return new Enumerate();
> >    }
> >
> > }
> 
> Clara, now I understand what you meant. It is about cross-procedure
> type propagation. I guess this should be done with IPA. I do not know
> about how Jitrino deals with it. In Open64 (ORC) for speculative
> analysis, we used inlining to propagate the information automatically.

Yep, Jitrino loves to inline final methods. And here it would know the
exact type. If there are several variants of a type on some call site,
then the target type can be 'predicted' using profile information and
then devirtualized (with a 'guard') upto the exact type. This
optimization is limited and per-callsite.

So, Jitrino does not perform inter-procedural type prediction
optimization except one: the "Lazy Exception" optimization that allows
to bypass constructing exception if it is not used in catch blocks of
other methods. (In this case I would also prefer to aggressively
inline the hottest throw-catch paths with partial inlining, to make
code less bloated)


-- 
Egor Pasko


Mime
View raw message