(Resend with description) Re: Request for review (XS): 6837146 Should perform unswitch before maximally unroll in loop transformation
Changpeng Fang
Changpeng.Fang at Sun.COM
Tue May 5 11:23:51 PDT 2009
On 05/04/09 16:34, Tom Rodriguez wrote:
> This seems ok. Was there an example that motivated this change?
>
For the following Test1.java with -XX:CompileOnly=Test1.init, you should see
the loop is not unswitched. However, I could not observe perform difference
with my proposed change even though the loop is unswitched after the change.
Thanks,
Changpeng
class Test1 {
public static void init(int src[], int dst[], int unknown) {
// initialize the arrays
for (int i =0; i<4; i++) {
dst[i] = i;
if(unknown >= 5)
src[i] = i;
}
}
public static void test() {
int[] src = new int[4];
int[] dst = new int[4];
init(src, dst, 5);
}
public static void main(String[] args) {
long start = System.currentTimeMillis();
for (int i=0; i< 2000000; i++) {
test();
}
long end = System.currentTimeMillis();
System.out.println(end-start);
}
}
> On May 4, 2009, at 3:49 PM, Changpeng Fang wrote:
>
>> http://cr.openjdk.java.net/~cfang/6837146/webrev.00/
>>
>> Problem Summary:
>> The concern is the ordering of maximally unroll and unswitch of a
>> loop in loop transformation.
>> Current implementation is that maximally unroll is performed before
>> loop unswitch. The problem
>> is if a loop is maximally unrolled (fully unrolled), it will never be
>> unswitched. This will leave
>> many conditional statements (blocks) in the code which should not
>> appear if the loop can be
>> unswitched.
>>
>> Proposed Solution:
>> Change the ordering of unswitch and maximally_unroll in loop
>> transformation. After unswitch,
>> the loop should still be able to be maximally unrolled.
>>
>> Thanks,
>>
>> Changpeng
>>
>>
>>
>> On 05/04/09 15:05, Changpeng Fang wrote:
>>> http://cr.openjdk.java.net/~cfang/6837146/webrev.00/
>>>
>>> Summary: Change the ordering of do_unswitch and do_maximally_unroll
>>> in loop transformation.
>>>
>>> Thanks,
>>>
>>> Changpeng
>>>
>>
>
More information about the hotspot-compiler-dev
mailing list