• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Export Word
    • Attachments
    • Page Information

    Loading...
  1. Dashboard
  2. HotSpot
  3. Main
  4. Compiler
  5. PerformanceTechniques
  6. LoopPredication

Page History

Versions Compared

Old Version 26

changes.mady.by.user Changpeng Fang

Saved on Jan 20, 2010

compared with

New Version Current

changes.mady.by.user Changpeng Fang

Saved on Jan 20, 2010

  • Previous Change: Difference between versions 25 and 26
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Loop Predication is an optimization in C2. The general idea is to insert a predicate on the entry path to a loop,
and raise a uncommon trap if the check of the condition fails. The condition checks are promoted from inside the
loop body, and thus the checks inside the loop could be eliminated. Currently, loop predication optimization has
been applied to remove array range check and loop invariant checks (such as null checks and array checks).

  Array Range Check Elimination

    Use loop predicate to remove array range checks in a loop.

original loop

for (int i = init,  i < limit;  i += stride) {  // loop with array range check
    ...
    if (scale*i + offset < a.length) {  // array range check
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8c2f1337-2e12-4f2a-bef5-4da951f248da"><ac:plain-text-body><![CDATA[         ... a[scale*i+offset] ...
]]></ac:plain-text-body></ac:structured-macro>
    } else raise_uncommon_trap();
    ...
}

after loop predication

if ( scale * imax + offset < a.length ) {  // loop predicate. imax is the maximum value of i where init <= i < limit
    for (int i = init,  i < limit;  i += stride) {  // loop without array range check
         ...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="48d34075-e179-4d44-9a12-f3fa0a7de5b4"><ac:plain-text-body><![CDATA[          ... a[scale*i+offset] ...
]]></ac:plain-text-body></ac:structured-macro>
         ...
    }
} else raise_uncommon_trap();

...

   init, limit, offset and array a are loop invariants, and stride and scale are compile time constants.

  Loop Invariant Check Elimination

  Similar to array range check elimination, but the loop invariant check elimination is much simple. The check inside the

...

Existing optimizations that perform elimination of checks inside the loops are iteration range splitting based.  The loop is peeled

...

The major disadvantage of iteration range splitting based check elimination is the dramatic increase in code size due to the copies

...

Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.23
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 162, "requestCorrelationId": "9b4b07a7915b3ae4"}