John Wilson wrote:

> On Rémi's recent thread Charlie talked about the advantages of having
> an interpreted mode in a language implementation to allow profiling
> before deciding on code generation strategies. I'm starting a new
> thread to ask implementation questions about this.
> 
> I think this is interesting but I'd like to hear some more about the
> actual mechanics of doing it. There's no problem in writing an
> interpreter, of course. It's pretty trivial for any language which has
> a MOP. The problem I have is how to deal with a class in language X
> which subclasses a non trivial (i.e. not java.lang.Object) Java
> object.
> 
> if I have a Java class
> 
> class C {
>  public void foo() {
>    bar();
>  }
> 
>  public void bar() {
>    // some stuff
>  }
> }
> 
> then I have a X class
> 
> class D extends C {
>   public void bar() {
>     // some other stuff
>   }
> }
> 
> For every instance of D I can instantiate C and delegate calls to it
> in the interpreter. The MOP can use its normal refection black magic
> to get at things like protected instance variables and methods.
> However I can't get the call of bar in foo to call the interpreter
> back.
> ...

I think using naive code generation and AOP is a better way to approach 
this problem.  That wouldn't be constrained by your MOP (or whatever 
interpreter strategy) only being able to deal with the calls it 
dispatches directly.

That is essentially what HotSpot does as well.  Generate simple code 
quickly, profile it, then regenerate with optimization in the critical 
areas.  Coupled with hot class redefinition ala JRebel, you would then 
have a pretty comprehensive solution that could work with many different 
JVM languages.

Jim

--

You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=.


Reply via email to