harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "clara" <clarazh...@gmail.com>
Subject Re: [drlvm][jitrino]Are there any static type checking and type propagation?
Date Mon, 02 Jul 2007 01:55:11 GMT
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();
   }

}

----- Original Message ----- 
From: "Xiao-Feng Li" <xiaofeng.li@gmail.com>
To: <dev@harmony.apache.org>
Sent: Monday, July 02, 2007 9:27 AM
Subject: Re: [drlvm][jitrino]Are there any static type checking and type propagation?


> On 7/1/07, clara <clarazhang@gmail.com> wrote:
>> Hi, all,
>>
>> Are there any static type checking and type propagation in jitrino?
> 
> Clara, what do you mean by static type checking? I think JVM checks
> types during class file verification. It is not necessarily part of
> the JIT. On the other hand, any JIT IR should have typing info
> associated with the operands (or operations). I guess you are not
> talking about this? Maybe you are talking about type preserving
> compilation?
> 
>> If so, how can I use them?
>> Thanks.
>>
>> Yu
>>
> 
> 
> -- 
> http://xiao-feng.blogspot.com
Mime
View raw message