Re: TaggedArrays

2012-09-13 Thread Jim Laskey
On 2012-09-13, at 3:00 PM, Mark Roos wrote: > Hi Jim > > When you say you are using TaggedArrays for instances are you boxing the > array in another object > (NashObject -) which holds other object properties? In other words instead > of instances being slots > in an object they are loca

Re: TaggedArrays

2012-09-13 Thread Mark Roos
Hi Jim When you say you are using TaggedArrays for instances are you boxing the array in another object (NashObject -) which holds other object properties? In other words instead of instances being slots in an object they are locations in an Array which is in a slot in the object. As for usi

Re: TaggedArrays

2012-09-13 Thread Jim Laskey
On 2012-09-12, at 11:35 PM, Charles Oliver Nutter wrote: > On Wed, Sep 12, 2012 at 9:06 PM, Charles Oliver Nutter > wrote: >> This is very illustrative, thank you! I never got around to commenting >> on your original email, so I'm taking some time now (I'm also doing a >> talk on "high performa

Re: TaggedArrays

2012-09-13 Thread Jim Laskey
On 2012-09-12, at 11:06 PM, Charles Oliver Nutter wrote: > On Wed, Sep 12, 2012 at 5:24 PM, Jim Laskey wrote: >> The builtin tagged array (TaggedArrayNativeImpl) has no levels of >> indirection, the simple and optimized forms are fall backs. So the >> performance is similar to Java arrays. An

Re: TaggedArrays

2012-09-12 Thread Charles Oliver Nutter
On Wed, Sep 12, 2012 at 9:06 PM, Charles Oliver Nutter wrote: > This is very illustrative, thank you! I never got around to commenting > on your original email, so I'm taking some time now (I'm also doing a > talk on "high performance Ruby" at Golden Gate RubyConf on Friday, so > I'm looking at pe

Re: TaggedArrays

2012-09-12 Thread Charles Oliver Nutter
On Wed, Sep 12, 2012 at 5:24 PM, Jim Laskey wrote: > The builtin tagged array (TaggedArrayNativeImpl) has no levels of > indirection, the simple and optimized forms are fall backs. So the > performance is similar to Java arrays. And yes the code that Rickard > submitted here is for native perfor

Re: TaggedArrays

2012-09-12 Thread Jim Laskey
On 2012-09-12, at 6:18 PM, Mark Roos wrote: > Nice to see progress. > > I was just thinking about the use model for these in my app and found > three obvious uses: > To hold the temps on the stack frame ( TaggedArray of TaggedArrays + > primitives ) Or a tagged array for the stac

Re: TaggedArrays

2012-09-12 Thread Mark Roos
Nice to see progress. I was just thinking about the use model for these in my app and found three obvious uses: To hold the temps on the stack frame ( TaggedArray of TaggedArrays + primitives ) To hold the instance vars of a class To collect arguments for a method send (

Re: TaggedArrays (Proposal)

2012-07-07 Thread Charles Oliver Nutter
On Sat, Jul 7, 2012 at 1:45 PM, Rémi Forax wrote: > Exception are not expensive if you throw them and just catch them (and > don't use them) in the same inlining horizon, > so you can use them to implement non Java control flow without thinking > too much. Important to note here that if they don'

Re: TaggedArrays (Proposal)

2012-07-07 Thread Mark Roos
/2012 10:10 AM Subject:Re: TaggedArrays (Proposal) Sent by:mlvm-dev-boun...@openjdk.java.net On Jul 7, 2012, at 1:56 AM, Rémi Forax wrote: > You have also to figure out how to get two return values from a method call, > but exceptions are your best friend here. Can you g

Re: TaggedArrays (Proposal)

2012-07-07 Thread Mark Roos
Thanks Rémi, good example is big compared to the code of the generated assembler so the JIT may decide to not inline something I assume that changing the maxInline will fix this if its an issue You have also to figure out how to get two return values from a method call, but exceptions are you

Re: TaggedArrays (Proposal)

2012-07-07 Thread Dain Sundstrom
Wow. That dramatically changes my mental model of exceptions in the JVM. This is going to dramatically simplify some of my code. thanks -dain On Jul 7, 2012, at 11:48 AM, Vitaly Davidovich wrote: > Here's a blog post from John Rose explaining that exception throwing compiles > to a goto in

Re: TaggedArrays (Proposal)

2012-07-07 Thread Vitaly Davidovich
Here's a blog post from John Rose explaining that exception throwing compiles to a goto in cases like this: https://blogs.oracle.com/jrose/entry/longjumps_considered_inexpensive Sent from my phone On Jul 7, 2012 2:43 PM, "Rémi Forax" wrote: > On 07/07/2012 07:02 PM, Dain Sundstrom wrote: > > On

Re: TaggedArrays (Proposal)

2012-07-07 Thread Rémi Forax
On 07/07/2012 07:02 PM, Dain Sundstrom wrote: > On Jul 7, 2012, at 1:56 AM, Rémi Forax wrote: > >> You have also to figure out how to get two return values from a method call, >> but exceptions are your best friend here. > Can you give an example of what you mean here? Also, from all the > presen

Re: TaggedArrays (Proposal)

2012-07-07 Thread Dain Sundstrom
On Jul 7, 2012, at 1:56 AM, Rémi Forax wrote: > You have also to figure out how to get two return values from a method call, > but exceptions are your best friend here. Can you give an example of what you mean here? Also, from all the presentations I've seen on the JVM, exceptions are very expe

Re: TaggedArrays (Proposal)

2012-07-07 Thread Rémi Forax
On 07/07/2012 04:54 AM, Mark Roos wrote: > Hi Rémi, you mention > And now the trick, there is a nice way (several in fact) to explain to > the JIT > that even if the bytecode contains tests, if the variable contains > effectively an int, > it's a good idea to remove them. > > Ok, in Smalltalk the

Re: TaggedArrays (Proposal)

2012-07-06 Thread Mark Roos
Hi Rémi, you mention And now the trick, there is a nice way (several in fact) to explain to the JIT that even if the bytecode contains tests, if the variable contains effectively an int, it's a good idea to remove them. Ok, in Smalltalk there are some methods which are usually integer ops so i

Re: TaggedArrays (Proposal)

2012-07-06 Thread Rémi Forax
On 07/06/2012 08:48 PM, Mark Roos wrote: > From Rémi on static analysis for loops > > Not having such kind of analysis is almost a crime. > > For a language like Smalltalk I was thinking that having such an analysis > would be the work of the gods. > > With user overridable methods, reflect

Re: TaggedArrays (Proposal)

2012-07-06 Thread Mark Roos
>From Rémi on static analysis for loops Not having such kind of analysis is almost a crime. For a language like Smalltalk I was thinking that having such an analysis would be the work of the gods. With user overridable methods, reflection and run time code creation I have only found a f

Re: TaggedArrays (Proposal)

2012-07-05 Thread Mark Roos
). thanks mark From: Jim Laskey To: Da Vinci Machine Project Date: 07/05/2012 01:51 PM Subject:Re: TaggedArrays (Proposal) Sent by:mlvm-dev-boun...@openjdk.java.net Fairly common patterns like var p = { fontsize: 15, lineheight: 22, color: 0x000, fontfamily

Re: TaggedArrays (Proposal)

2012-07-05 Thread Jim Laskey
On 2012-07-05, at 9:26 PM, Rémi Forax wrote: > On 07/05/2012 10:42 PM, Jim Laskey wrote: >> Fairly common patterns like >> >> var p = { >> fontsize: 15, >> lineheight: 22, >> color: 0x000, >> fontfamily: "Georgia, FreeSerif, Times, serif" >> }; >> >> p.color = "white"; >> >> We need flexi

Re: TaggedArrays (Proposal)

2012-07-05 Thread Rémi Forax
On 07/05/2012 10:42 PM, Jim Laskey wrote: > Fairly common patterns like > > var p = { > fontsize: 15, > lineheight: 22, > color: 0x000, > fontfamily: "Georgia, FreeSerif, Times, serif" > }; > > p.color = "white"; > > We need flexible slots without allocating 2x memory. > > For "for like" c

Re: TaggedArrays (Proposal)

2012-07-05 Thread Jim Laskey
Fairly common patterns like var p = { fontsize: 15, lineheight: 22, color: 0x000, fontfamily: "Georgia, FreeSerif, Times, serif" }; p.color = "white"; We need flexible slots without allocating 2x memory. For "for like" constructs we typically use static analysis to reduce to integer.

Re: TaggedArrays (Proposal)

2012-07-05 Thread Mark Roos
Hi Jim I was wondering if you could post the use case that led you develop the TaggedArray? I looked over our Smalltalk app and I could not see an obvious pattern where mixing primitives and references in a collection is common. On a similar note I was curious how you are avoiding the integer

Re: TaggedArrays (Proposal)

2012-07-04 Thread Jim Laskey
Note: The POC was implemented in JNI. Sent from my iPhone 4 On 2012-07-04, at 6:12 AM, Jim Laskey wrote: > I think we can handle that. Give us a few to get at least one of the native > versions working (C2/server - intel) > > Sent from my iPhone 4 > > On 2012-07-04, at 6:03 AM, Rémi Forax

Re: TaggedArrays (Proposal)

2012-07-04 Thread Jim Laskey
I think we can handle that. Give us a few to get at least one of the native versions working (C2/server - intel) Sent from my iPhone 4 On 2012-07-04, at 6:03 AM, Rémi Forax wrote: > On 07/04/2012 03:18 AM, Jim Laskey wrote: >> Actually it's built on a modified 7. Getting it into a 7 release is

Re: TaggedArrays (Proposal)

2012-07-04 Thread Rémi Forax
On 07/04/2012 03:18 AM, Jim Laskey wrote: > Actually it's built on a modified 7. Getting it into a 7 release is a > community issue. I think tagged values comes under JSR-292, so some of > the process is covered. Not sure what the other steps involve. And of > course the API/implementation needs

Re: TaggedArrays (Proposal)

2012-07-03 Thread Jim Laskey
Actually it's built on a modified 7. Getting it into a 7 release is a community issue. I think tagged values comes under JSR-292, so some of the process is covered. Not sure what the other steps involve. And of course the API/implementation needs to be picked on a bit too. Sent from my iPhone

Re: TaggedArrays (Proposal)

2012-07-03 Thread Mark Roos
Hi Jim, You made a comment: implementation for platforms not supporting TaggedArrays (and JDK 1.7) Are you saying that a native version fo jdk1.7 is not possible, or just that you have not got around to it? regards mark ___ mlvm-dev mailin

Re: TaggedArrays (Proposal)

2012-07-03 Thread Thomas Wuerthinger
Jim, can you also make the native part (in particular the JNI implementation) available? We'd like to experiment with it in the context of the GraalVM repository. Thx, thomas On 02.07.2012 15:05, Jim Laskey wrote: During a week in the rarefied air of Stockholm back in May, a sleepless nigh

Re: TaggedArrays (Proposal)

2012-07-02 Thread Krystal Mok
@Howard Your suggestion could pretty much work if the underlying VM is using a conservative collector, where it'd actually include a set of filters to check if a value is a (or "looks like a") real reference. There are also a couple of runtimes that implements exact GC by tagging values, but most

Re: TaggedArrays (Proposal)

2012-07-02 Thread Howard Lovatt
@Kris, I was assuming that the tag would be sufficient for the JVM since 'real' references would be aligned and hence naturally not tagged. But I don't know enough about the JVM and hence you could well be correct. -- Howard. On 3 July 2012 15:40, Krystal Mok wrote: > On Tue, Jul 3, 2012 at 1:28

Re: TaggedArrays (Proposal)

2012-07-02 Thread Krystal Mok
On Tue, Jul 3, 2012 at 1:28 PM, Howard Lovatt wrote: > I like the idea and something along these lines would be a great addition > to the standard library, which I will come back to as a PS. > > In com.sun.misc.Unsafe there are already getLong(Object, int) and > setLong(Object, int, long) methods

Re: TaggedArrays (Proposal)

2012-07-02 Thread Howard Lovatt
I like the idea and something along these lines would be a great addition to the standard library, which I will come back to as a PS. In com.sun.misc.Unsafe there are already getLong(Object, int) and setLong(Object, int, long) methods and the same for Object. No doubt if we used getLong and setLon

Re: TaggedArrays (Proposal)

2012-07-02 Thread Charles Oliver Nutter
A couple quick thoughts from my end. JRuby does maintain a couple parallel stacks for "out of band" data that crosses method activations, and I have explored using a large array as well for closure scopes. Currently, JRuby has a set of different-sized heap scopes for up to 4 local variables and t

Re: TaggedArrays (Proposal)

2012-07-02 Thread Mark Roos
Hi Jim, some free from thinking. My implementation does not have a parallel stack so I am using the java stack frame to hold temps and pass arguments. Even so I can see how I would use a TaggedArray. Instead of using jvm var slots I would have one slot with a Tagged Array in it to hold my m

Re: TaggedArrays (Proposal)

2012-07-02 Thread Jim Laskey
Mark, I'll walk into the trap of offering a solution. While I'm not familiar with your implementation of SmallTalk, the array example might work like this (generic/loose java) // language stack public static TaggedArray stack = TaggedArrays.allocate(1024*1024); public s

Re: TaggedArrays (Proposal)

2012-07-02 Thread Mark Roos
>From Jim It occurred to me on that sleepless Monday night, that the solution for most dynamic languages could be so much simpler. First, we have to look at what it is we really need. Ultimately it's about boxing. We want to avoid allocating memory whenever we need to store a primitive value

Re: TaggedArrays (Proposal)

2012-07-02 Thread Rémi Forax
On 07/02/2012 04:11 PM, ravenex wrote: > Very cool stuff, Jim and Rickard! > I guess people are going to start missing NaN encoded tagged > value/pointers now that there's something real to play with ;-) > > @Remi The subclass suggestion sounds a lot like Maxine's Hybrid > objects, where named fi

Re: TaggedArrays (Proposal)

2012-07-02 Thread ravenex
, 2012 10:21 PM To: "Da Vinci Machine Project"; Subject: Re: TaggedArrays (Proposal) We had been using NaN encodings in Nashorn but moving away from it because of 32-bit FP emulation issues. If you use a sNaN, 32-bit FP emulation converts sNaN to qNaN on load and creates a mess

Re: TaggedArrays (Proposal)

2012-07-02 Thread Jim Laskey
. Even without changing > the API, this kind of transformation could easily be intrinsified in the > JITs, not a big worry. Cheers, Raven -- Original > -- From: "Rémi Fora"; Date: Mon, Jul 2, 2012 09:57 PM To: > "mlvm-dev"; Subject:

Re: TaggedArrays (Proposal)

2012-07-02 Thread ravenex
at runtime. Even without changing the API, this kind of transformation could easily be intrinsified in the JITs, not a big worry. Cheers, Raven -- Original -- From: "Rémi Fora"; Date: Mon, Jul 2, 2012 09:57 PM To: "mlvm-dev"; Subject: Re: TaggedA

Re: TaggedArrays (Proposal)

2012-07-02 Thread Jim Laskey
On 2012-07-02, at 10:57 AM, Rémi Forax wrote: > On 07/02/2012 03:05 PM, Jim Laskey wrote: >> During a week in the rarefied air of Stockholm back in May, a >> sleepless night got me thinking. The day after that, the thinking >> became a reality. I've been sitting on the code since, not sure wh

Re: TaggedArrays (Proposal)

2012-07-02 Thread Rémi Forax
On 07/02/2012 03:05 PM, Jim Laskey wrote: > During a week in the rarefied air of Stockholm back in May, a > sleepless night got me thinking. The day after that, the thinking > became a reality. I've been sitting on the code since, not sure what > to do next. So..., why not start the month lea