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 there are

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

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 presentations

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 fo...@univ-mlv.fr wrote: On 07/07/2012 07:02 PM, Dain Sundstrom

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 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

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

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, reflection and

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

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-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. With

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 to

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 fo...@univ-mlv.fr wrote: On 07/04/2012 03:18 AM, Jim Laskey wrote: Actually it's built on a modified 7. Getting it into

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

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

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-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 what

Re: TaggedArrays (Proposal)

2012-07-02 Thread ravenex
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) On 07/02/2012 03:05 PM

Re: TaggedArrays (Proposal)

2012-07-02 Thread Jim Laskey
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) On 07/02/2012 03:05 PM, Jim Laskey wrote: During a week

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 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

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

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

Re: TaggedArrays (Proposal)

2012-07-02 Thread Krystal Mok
On Tue, Jul 3, 2012 at 1:28 PM, Howard Lovatt howard.lov...@gmail.comwrote: 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,

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 rednaxel...@gmail.com wrote: On

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