Re: Boxed types and constat propagation

2012-04-25 Thread Mark Roos
Hi Christian you mention the only way I can think of to make this available to users is an annotation. Since I am writing my own bytecodes/classes I am not limited to how the java language might do this. If there is a way for me to tweak the class file to pass the request to hotspot th

Re: Boxed types and constat propagation

2012-04-25 Thread Christian Thalinger
On Apr 25, 2012, at 11:03 AM, Mark Roos wrote: > From Christian > > Although something that John and I talked about yesterday could help here: > immutable (or stable) arrays. We might add some optimization for this soon > since we'd need it for bound arguments in our new JSR 292 implementat

Re: Boxed types and constat propagation

2012-04-25 Thread Mark Roos
>From Christian Although something that John and I talked about yesterday could help here: immutable (or stable) arrays. We might add some optimization for this soon since we'd need it for bound arguments in our new JSR 292 implementation. I also have a somewhat large ( 5K) cache of my boxe

Re: Boxed types and constat propagation

2012-04-25 Thread Rémi Forax
On 04/25/2012 07:23 PM, Fredrik Öhrström wrote: >>> That's a lot of optimization that I otherwise wouldn't have to do, if >>> only boxed types and constant propagation worked well, but yeah, I see >>> how it can work now. > Clearly the C1/C2 compiler needs to be improved. In the meantime > you have

Re: Boxed types and constat propagation

2012-04-25 Thread Kohsuke Kawaguchi
On 04/25/2012 10:23 AM, Fredrik Öhrström wrote: >>> That's a lot of optimization that I otherwise wouldn't have to do, if >>> only boxed types and constant propagation worked well, but yeah, I see >>> how it can work now. > > Clearly the C1/C2 compiler needs to be improved. In the meantime > you

Re: Boxed types and constat propagation

2012-04-25 Thread Fredrik Öhrström
>> That's a lot of optimization that I otherwise wouldn't have to do, if >> only boxed types and constant propagation worked well, but yeah, I see >> how it can work now. Clearly the C1/C2 compiler needs to be improved. In the meantime you have to work around their limitations. > BTW, I've patche

Re: Boxed types and constat propagation

2012-04-25 Thread Rémi Forax
On 04/25/2012 06:38 PM, Christian Thalinger wrote: > On Apr 23, 2012, at 4:29 PM, Rémi Forax wrote: > >> On 04/24/2012 12:57 AM, Kohsuke Kawaguchi wrote: >>> On 04/23/2012 11:18 AM, Rémi Forax wrote: > So again, I don't see how shifting from method handle tree to byte > code generation woul

Re: Boxed types and constat propagation

2012-04-25 Thread Christian Thalinger
On Apr 23, 2012, at 4:29 PM, Rémi Forax wrote: > On 04/24/2012 12:57 AM, Kohsuke Kawaguchi wrote: >> On 04/23/2012 11:18 AM, Rémi Forax wrote: So again, I don't see how shifting from method handle tree to byte code generation would somehow make this non-issue. >>> >>> In fact, it's eas

Re: Boxed types and constat propagation

2012-04-23 Thread Rémi Forax
On 04/24/2012 01:43 AM, Kohsuke Kawaguchi wrote: > > Any chance you can share that patch with us? It'd give me some > pointers into poking around JDK code, now that I learned how to build > it... Sure, it's easy, in ciField.cpp, there is a method named trust_final_non_static_fields(), you can a

Re: Boxed types and constat propagation

2012-04-23 Thread Kohsuke Kawaguchi
Any chance you can share that patch with us? It'd give me some pointers into poking around JDK code, now that I learned how to build it... On 04/23/2012 04:29 PM, Rémi Forax wrote: > On 04/24/2012 12:57 AM, Kohsuke Kawaguchi wrote: >> On 04/23/2012 11:18 AM, Rémi Forax wrote: So again, I

Re: Boxed types and constat propagation

2012-04-23 Thread Rémi Forax
On 04/24/2012 12:57 AM, Kohsuke Kawaguchi wrote: > On 04/23/2012 11:18 AM, Rémi Forax wrote: >>> So again, I don't see how shifting from method handle tree to byte >>> code generation would somehow make this non-issue. >> >> In fact, it's easy to know that a.foo() is a boolean because >> && can

Re: Boxed types and constat propagation

2012-04-23 Thread Kohsuke Kawaguchi
On 04/23/2012 11:18 AM, Rémi Forax wrote: >> So again, I don't see how shifting from method handle tree to byte >> code generation would somehow make this non-issue. > > In fact, it's easy to know that a.foo() is a boolean because > && can be only applied on booleans so the invokedynamic call >

Re: Boxed types and constat propagation

2012-04-23 Thread Rémi Forax
On 04/23/2012 06:37 PM, Kohsuke Kawaguchi wrote: > 2012/4/22 Rémi Forax: >>> So as you can see, 30 and 12 are not recognized as constants. >> You're right, 30 and 12 are not recognized as int constant >> but they are recognized as java/lang/Integer constant. >> >> 0x7f785ca29706: mov$0x7d66

Re: Boxed types and constat propagation

2012-04-23 Thread Charles Oliver Nutter
On Mon, Apr 23, 2012 at 4:57 PM, Kohsuke Kawaguchi wrote: > Let me try my question in another way, given this context. > > In p.11 of Nahi's JRuby/invokedynamic presentation [1], I see that > JRuby already does something to make Ruby constants (or "variables > that gets updated less frequently" as

Re: Boxed types and constat propagation

2012-04-23 Thread Kohsuke Kawaguchi
2012/4/23 Charles Oliver Nutter : > On Sun, Apr 22, 2012 at 2:12 AM, Rémi Forax wrote: >> You are the first as far as I know to use only a tree of method handles >> to implement expressions. The rest of us generates bytecodes >> and have a compiler that does constant propagation. > > JRuby doesn't

Re: Boxed types and constat propagation

2012-04-23 Thread Kohsuke Kawaguchi
Thanks for sharing your experience. That's interesting. Now that you mention it, I can kind of see how the boxing overhead doesn't affect Hanoi that much. It only deals with a small set of integers, so they'll be all quickly on CPU cache (along with the lookup table). And if I remember Hanoi corre

Re: Boxed types and constat propagation

2012-04-23 Thread Kohsuke Kawaguchi
2012/4/22 Rémi Forax : >> So as you can see, 30 and 12 are not recognized as constants. > > You're right, 30 and 12 are not recognized as int constant > but they are recognized as java/lang/Integer constant. > > 0x7f785ca29706: mov    $0x7d66619d8,%r10  ;   {oop(a 'java/ang/nteger' = > 30)} >

Re: Boxed types and constat propagation

2012-04-22 Thread Rémi Forax
On 04/23/2012 12:34 AM, Charles Oliver Nutter wrote: > On Sun, Apr 22, 2012 at 2:12 AM, Rémi Forax wrote: >> You are the first as far as I know to use only a tree of method handles >> to implement expressions. The rest of us generates bytecodes >> and have a compiler that does constant propagation

Re: Boxed types and constat propagation

2012-04-22 Thread Charles Oliver Nutter
On Sun, Apr 22, 2012 at 2:12 AM, Rémi Forax wrote: > You are the first as far as I know to use only a tree of method handles > to implement expressions. The rest of us generates bytecodes > and have a compiler that does constant propagation. JRuby doesn't do any constant propagation in our existi

Re: Boxed types and constat propagation

2012-04-21 Thread Rémi Forax
See inlined comments :) On 04/22/2012 12:02 AM, Kohsuke Kawaguchi wrote: > Hi, > > I was inspired by the talk by Charles in JAX 2012 and was playing with > invokedynamic a bit. I'm observing what seems like a constant > propagation failure, which I'd imagine would affect some important use > cases

Re: Boxed types and constat propagation

2012-04-21 Thread Mark Roos
>From Kohsuke Kawaguchi email - How do other language implementers cope with this? We are doing a Smalltalk implementation and have seen that the handling of 'boxed' integers is a possible performance issue. I say possible because while it is an obvious issue for integer intensive operations (

Boxed types and constat propagation

2012-04-21 Thread Kohsuke Kawaguchi
Hi, I was inspired by the talk by Charles in JAX 2012 and was playing with invokedynamic a bit. I'm observing what seems like a constant propagation failure, which I'd imagine would affect some important use cases, so I wanted to check if I'm not doing something stupid. I've used Apache JEXL [1]