« Return to Thread: [scala-tools] Compiler books

Re: [scala-tools] Compiler books

by Miles Sabin :: Rate this Message:

Reply to Author | View in Thread

On Sun, Jun 28, 2009 at 11:26 PM, Erkki Lindpere<erkki@...> wrote:
> * I think scalar replacement is what it's called -- given the type
> Vector2(x: Float, y: Float) { /* operations */ }, I want to replace
> 1) local variables:
>  val v = new Vector2(1f, 2f)  -->  val v$x = 1f; val v$y = 2f
> 2) any operations on Vectors with operations on Floats
> 3) any escaping vectors with new Vector2(v$x, v$y) -- most of the time they
> will not escape
>
> Or should I just wait until JIT can do this better? :)

Before trying to do this by hand, have you tried the
-XX:+DoEscapeAnalysis option of recent Sun JVMs?

Cheers,


Miles

--
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin

 « Return to Thread: [scala-tools] Compiler books