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 
allocation when using
a 'for' like pattern to index over an array. That is a real performance 
hit for me so I
am looking for a good solution

thanks
mark___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev


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 TaggedArray slots for frames we could use integer dynamically.

Cheers,

-- Jim






On 2012-07-05, at 5:26 PM, Mark Roos wrote:

> 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 allocation 
> when using 
> a 'for' like pattern to index over an array. That is a real performance hit 
> for me so I 
> am looking for a good solution 
> 
> thanks 
> mark___
> mlvm-dev mailing list
> mlvm-dev@openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev


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" constructs we typically use static analysis to reduce 
> to integer.

Not having such kind of analysis is almost a crime.

Jim, do you have a paper explaining the static analysis you use,
I have some trouble to keep mine linear.

> With TaggedArray slots for frames we could use integer dynamically.

yes, but performance will be awful (ok, better than using boxing but 2x 
or 3x slower
than C or Java) if you don't have any kind of type propagation.

>
> Cheers,
>
> -- Jim

cheers,
Rémi

___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev


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 flexible slots without allocating 2x memory.
>> 
>> For "for like" constructs we typically use static analysis to reduce 
>> to integer.
> 
> Not having such kind of analysis is almost a crime.
> 
> Jim, do you have a paper explaining the static analysis you use,
> I have some trouble to keep mine linear.
> 

Marcus Lagergren will be doing a talk at JavaOne on type specific optimizations 
that we use.

>> With TaggedArray slots for frames we could use integer dynamically.
> 
> yes, but performance will be awful (ok, better than using boxing but 2x 
> or 3x slower
> than C or Java) if you don't have any kind of type propagation.

We're seeing 2x using C2, but the benefit is that if you have to roll over into 
another type (ex. box) you can use the same slot.

One subtlety I should point out, the plan is to have the copy method optimized 
to inline small copies, so that constant length copies of 1-4 (or so) will be 
native memory to memory moves.  This means you can move values, 
object/frame/stack to object/frame/stack without any type checking (1-1 with 
C/Java.)

> 
>> 
>> Cheers,
>> 
>> -- Jim
> 
> cheers,
> Rémi
> 
> ___
> mlvm-dev mailing list
> mlvm-dev@openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev


Re: TaggedArrays (Proposal)

2012-07-05 Thread Mark Roos
I see, it looks like you are using them to hold instance vars of objects. 
I was looking for
large arrays/collections.

I have looked at this before in our app but the number of integers used 
like this did not seem to
warrant much concern ( Double Vectors and byte[] are the dominant memory 
users).

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: "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 TaggedArray slots for frames we could use integer 
dynamically.

Cheers,

-- Jim






On 2012-07-05, at 5:26 PM, Mark Roos wrote:

Hi Ji! m 

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 
allocation when using 
a 'for' like pattern to index over an array. That is a real performance 
hit for me so I 
am looking for a good solution 

thanks 
mark___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev