src/share/vm/opto/parse2.cpp

changeset 801
8261ee795323
parent 689
3e333d6f35dd
child 1040
98cb887364d3
     1.1 --- a/src/share/vm/opto/parse2.cpp	Mon Sep 15 09:58:26 2008 -0700
     1.2 +++ b/src/share/vm/opto/parse2.cpp	Wed Sep 17 08:29:17 2008 -0700
     1.3 @@ -100,16 +100,17 @@
     1.4  
     1.5    // Do the range check
     1.6    if (GenerateRangeChecks && need_range_check) {
     1.7 -    // Range is constant in array-oop, so we can use the original state of mem
     1.8 -    Node* len = load_array_length(ary);
     1.9      Node* tst;
    1.10      if (sizetype->_hi <= 0) {
    1.11 -      // If the greatest array bound is negative, we can conclude that we're
    1.12 +      // The greatest array bound is negative, so we can conclude that we're
    1.13        // compiling unreachable code, but the unsigned compare trick used below
    1.14        // only works with non-negative lengths.  Instead, hack "tst" to be zero so
    1.15        // the uncommon_trap path will always be taken.
    1.16        tst = _gvn.intcon(0);
    1.17      } else {
    1.18 +      // Range is constant in array-oop, so we can use the original state of mem
    1.19 +      Node* len = load_array_length(ary);
    1.20 +
    1.21        // Test length vs index (standard trick using unsigned compare)
    1.22        Node* chk = _gvn.transform( new (C, 3) CmpUNode(idx, len) );
    1.23        BoolTest::mask btest = BoolTest::lt;
    1.24 @@ -137,9 +138,12 @@
    1.25    // Check for always knowing you are throwing a range-check exception
    1.26    if (stopped())  return top();
    1.27  
    1.28 -  Node* ptr = array_element_address( ary, idx, type, sizetype);
    1.29 +  Node* ptr = array_element_address(ary, idx, type, sizetype);
    1.30  
    1.31    if (result2 != NULL)  *result2 = elemtype;
    1.32 +
    1.33 +  assert(ptr != top(), "top should go hand-in-hand with stopped");
    1.34 +
    1.35    return ptr;
    1.36  }
    1.37  

mercurial