Mercurial > hg > truffle
comparison src/share/vm/opto/parse2.cpp @ 129:c0939256690b
6646019: array subscript expressions become top() with -d64
Summary: stop compilation after negative array allocation
Reviewed-by: never, jrose
author | rasbold |
---|---|
date | Thu, 24 Apr 2008 14:02:13 -0700 |
parents | ba764ed4b6f2 |
children | d1605aabd0a1 1e026f8da827 |
comparison
equal
deleted
inserted
replaced
127:e0bd2e08e3d0 | 129:c0939256690b |
---|---|
103 | 103 |
104 // Do the range check | 104 // Do the range check |
105 if (GenerateRangeChecks && need_range_check) { | 105 if (GenerateRangeChecks && need_range_check) { |
106 // Range is constant in array-oop, so we can use the original state of mem | 106 // Range is constant in array-oop, so we can use the original state of mem |
107 Node* len = load_array_length(ary); | 107 Node* len = load_array_length(ary); |
108 // Test length vs index (standard trick using unsigned compare) | 108 Node* tst; |
109 Node* chk = _gvn.transform( new (C, 3) CmpUNode(idx, len) ); | 109 if (sizetype->_hi <= 0) { |
110 BoolTest::mask btest = BoolTest::lt; | 110 // If the greatest array bound is negative, we can conclude that we're |
111 Node* tst = _gvn.transform( new (C, 2) BoolNode(chk, btest) ); | 111 // compiling unreachable code, but the unsigned compare trick used below |
112 // only works with non-negative lengths. Instead, hack "tst" to be zero so | |
113 // the uncommon_trap path will always be taken. | |
114 tst = _gvn.intcon(0); | |
115 } else { | |
116 // Test length vs index (standard trick using unsigned compare) | |
117 Node* chk = _gvn.transform( new (C, 3) CmpUNode(idx, len) ); | |
118 BoolTest::mask btest = BoolTest::lt; | |
119 tst = _gvn.transform( new (C, 2) BoolNode(chk, btest) ); | |
120 } | |
112 // Branch to failure if out of bounds | 121 // Branch to failure if out of bounds |
113 { BuildCutout unless(this, tst, PROB_MAX); | 122 { BuildCutout unless(this, tst, PROB_MAX); |
114 if (C->allow_range_check_smearing()) { | 123 if (C->allow_range_check_smearing()) { |
115 // Do not use builtin_throw, since range checks are sometimes | 124 // Do not use builtin_throw, since range checks are sometimes |
116 // made more stringent by an optimistic transformation. | 125 // made more stringent by an optimistic transformation. |