You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Natalya Golovleva <na...@gmail.com> on 2006/11/17 12:21:26 UTC

[drlvm][jit][ia-32]escape analysis based scalar replacement

Hello all,



JIT Development Tasks list among other tasks contains new optimization - 
EA-based scalar replacement.



EA determinates for every reference object used in the method its state: 
local, argument escaped and global escaped.

Escape analysis (EA) is already committed to harmony.



Scalar replacement optimization may be done for local objects (class 
instances and arrays) that satisfy to:

-        class should not have finalizer, class instance initializer should 
not have side effects;

-        optimized array may have only one array element usage.



I am going to implement EA-based scalar replacement for IA-32.



The proposal is:

  1.. to perform scalar replacement for specified above local objects.
  2.. using devirtualization and inlining change method code to create the 
object only when it is used as a parameter of virtual call and perform 
scalar replacement for branches with inlined direct calls.


Any comments are welcome.



Thank you,

Natalya.




Re: [drlvm][jit][ia-32]escape analysis based scalar replacement

Posted by Pavel Ozhdikhin <pa...@gmail.com>.
I'm sorry, I incorrectly used the word "headroom". I meant we need a couple
of tests to make sure that
1. The optimization does what it is intended to do
2. The committer may check that the patch was applied correctly
You proposed one good tests and another can be with creation a number of
arrays with only one element accessed afterwards. This might be either
between using arrays and locals or comparison of benchmarks before/after
optimizations.

Thanks,
Pavel


On 11/20/06, Xiao-Feng Li <xi...@gmail.com> wrote:
>
> Are there any good ways for a microbenchmark to show the headroom of
> scalar replacement? I personally think it's a known good optimization
> in compiler community. Probably one can give two test cases, one has
> intensive object fields accesses, while another has mostly local
> primitive typed variables accesses. They are carefully designed so  as
> to reflect the difference made scalar replacement.
>
> Thanks,
> xiaofeng
>
> On 11/17/06, Pavel Ozhdikhin <pa...@gmail.com> wrote:
> > Natalya,
> >
> > Thanks for the proposal.
> > I think you should start with opening a new JIRA issue, copy the
> description
> > of the optimization there and submit some micro-benchmarks showing the
> > headroom for optimization.  Later we'll use this JIRA for discussng code
> > patches.
> >
> > One question:
> >
> > > -        optimized array may have only one array element usage.
> >
> > What prevents array objects with, say, 2 elements used from being
> optimized?
> >
> > Thanks,
> > Pavel
> >
> > On 11/17/06, Natalya Golovleva <na...@gmail.com> wrote:
> > >
> > > Hello all,
> > >
> > >
> > >
> > > JIT Development Tasks list among other tasks contains new optimization
> -
> > > EA-based scalar replacement.
> > >
> > >
> > >
> > > EA determinates for every reference object used in the method its
> state:
> > > local, argument escaped and global escaped.
> > >
> > > Escape analysis (EA) is already committed to harmony.
> > >
> > >
> > >
> > > Scalar replacement optimization may be done for local objects (class
> > > instances and arrays) that satisfy to:
> > >
> > > -        class should not have finalizer, class instance initializer
> > > should
> > > not have side effects;
> > >
> > > -        optimized array may have only one array element usage.
> > >
> > >
> > >
> > > I am going to implement EA-based scalar replacement for IA-32.
> > >
> > >
> > >
> > > The proposal is:
> > >
> > > 1.. to perform scalar replacement for specified above local objects.
> > > 2.. using devirtualization and inlining change method code to create
> the
> > > object only when it is used as a parameter of virtual call and perform
> > > scalar replacement for branches with inlined direct calls.
> > >
> > >
> > > Any comments are welcome.
> > >
> > >
> > >
> > > Thank you,
> > >
> > > Natalya.
> > >
> > >
> > >
> > >
> >
> >
>

Re: [drlvm][jit][ia-32]escape analysis based scalar replacement

Posted by Xiao-Feng Li <xi...@gmail.com>.
Are there any good ways for a microbenchmark to show the headroom of
scalar replacement? I personally think it's a known good optimization
in compiler community. Probably one can give two test cases, one has
intensive object fields accesses, while another has mostly local
primitive typed variables accesses. They are carefully designed so  as
to reflect the difference made scalar replacement.

Thanks,
xiaofeng

On 11/17/06, Pavel Ozhdikhin <pa...@gmail.com> wrote:
> Natalya,
>
> Thanks for the proposal.
> I think you should start with opening a new JIRA issue, copy the description
> of the optimization there and submit some micro-benchmarks showing the
> headroom for optimization.  Later we'll use this JIRA for discussng code
> patches.
>
> One question:
>
> > -        optimized array may have only one array element usage.
>
> What prevents array objects with, say, 2 elements used from being optimized?
>
> Thanks,
> Pavel
>
> On 11/17/06, Natalya Golovleva <na...@gmail.com> wrote:
> >
> > Hello all,
> >
> >
> >
> > JIT Development Tasks list among other tasks contains new optimization -
> > EA-based scalar replacement.
> >
> >
> >
> > EA determinates for every reference object used in the method its state:
> > local, argument escaped and global escaped.
> >
> > Escape analysis (EA) is already committed to harmony.
> >
> >
> >
> > Scalar replacement optimization may be done for local objects (class
> > instances and arrays) that satisfy to:
> >
> > -        class should not have finalizer, class instance initializer
> > should
> > not have side effects;
> >
> > -        optimized array may have only one array element usage.
> >
> >
> >
> > I am going to implement EA-based scalar replacement for IA-32.
> >
> >
> >
> > The proposal is:
> >
> > 1.. to perform scalar replacement for specified above local objects.
> > 2.. using devirtualization and inlining change method code to create the
> > object only when it is used as a parameter of virtual call and perform
> > scalar replacement for branches with inlined direct calls.
> >
> >
> > Any comments are welcome.
> >
> >
> >
> > Thank you,
> >
> > Natalya.
> >
> >
> >
> >
>
>

Re: [drlvm][jit][ia-32]escape analysis based scalar replacement

Posted by Natalya Golovleva <na...@gmail.com>.
Pavel,
array element is defined in EA when an element address is calculated. If 
element address is calculated twice it isn't clear is this the same element 
or these elements are different as array elements are unnamed. Therefore 
only local arrays with one element usage may be optimized.
Thank you,
Natalya

"Pavel Ozhdikhin" <pa...@gmail.com> wrote in message 
news:469bff730611170421o78f60bf0o6defb8ff8a429250@mail.gmail.com...
> Natalya,
>
> Thanks for the proposal.
> I think you should start with opening a new JIRA issue, copy the 
> description
> of the optimization there and submit some micro-benchmarks showing the
> headroom for optimization.  Later we'll use this JIRA for discussng code
> patches.
>
> One question:
>
>> -        optimized array may have only one array element usage.
>
> What prevents array objects with, say, 2 elements used from being 
> optimized?
>
> Thanks,
> Pavel
>
> On 11/17/06, Natalya Golovleva <na...@gmail.com> wrote:
>>
>> Hello all,
>>
>>
>>
>> JIT Development Tasks list among other tasks contains new optimization -
>> EA-based scalar replacement.
>>
>>
>>
>> EA determinates for every reference object used in the method its state:
>> local, argument escaped and global escaped.
>>
>> Escape analysis (EA) is already committed to harmony.
>>
>>
>>
>> Scalar replacement optimization may be done for local objects (class
>> instances and arrays) that satisfy to:
>>
>> -        class should not have finalizer, class instance initializer
>> should
>> not have side effects;
>>
>> -        optimized array may have only one array element usage.
>>
>>
>>
>> I am going to implement EA-based scalar replacement for IA-32.
>>
>>
>>
>> The proposal is:
>>
>> 1.. to perform scalar replacement for specified above local objects.
>> 2.. using devirtualization and inlining change method code to create the
>> object only when it is used as a parameter of virtual call and perform
>> scalar replacement for branches with inlined direct calls.
>>
>>
>> Any comments are welcome.
>>
>>
>>
>> Thank you,
>>
>> Natalya.
>>
>>
>>
>>
> 




Re: [drlvm][jit][ia-32]escape analysis based scalar replacement

Posted by Pavel Ozhdikhin <pa...@gmail.com>.
Natalya,

Thanks for the proposal.
I think you should start with opening a new JIRA issue, copy the description
of the optimization there and submit some micro-benchmarks showing the
headroom for optimization.  Later we'll use this JIRA for discussng code
patches.

One question:

> -        optimized array may have only one array element usage.

What prevents array objects with, say, 2 elements used from being optimized?

Thanks,
Pavel

On 11/17/06, Natalya Golovleva <na...@gmail.com> wrote:
>
> Hello all,
>
>
>
> JIT Development Tasks list among other tasks contains new optimization -
> EA-based scalar replacement.
>
>
>
> EA determinates for every reference object used in the method its state:
> local, argument escaped and global escaped.
>
> Escape analysis (EA) is already committed to harmony.
>
>
>
> Scalar replacement optimization may be done for local objects (class
> instances and arrays) that satisfy to:
>
> -        class should not have finalizer, class instance initializer
> should
> not have side effects;
>
> -        optimized array may have only one array element usage.
>
>
>
> I am going to implement EA-based scalar replacement for IA-32.
>
>
>
> The proposal is:
>
> 1.. to perform scalar replacement for specified above local objects.
> 2.. using devirtualization and inlining change method code to create the
> object only when it is used as a parameter of virtual call and perform
> scalar replacement for branches with inlined direct calls.
>
>
> Any comments are welcome.
>
>
>
> Thank you,
>
> Natalya.
>
>
>
>