Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/parse2.cpp @ 23799:535618ab1c04
6675699: need comprehensive fix for unconstrained ConvI2L with narrowed type
Summary: Emit CastII to make narrow ConvI2L dependent on the corresponding range check.
Reviewed-by: kvn, roland
author | thartmann |
---|---|
date | Wed, 27 Jan 2016 09:02:51 +0100 |
parents | eb8b5cc64669 |
children | d109bda16490 |
comparison
equal
deleted
inserted
replaced
23571:16f7b676725a | 23799:535618ab1c04 |
---|---|
152 } | 152 } |
153 } | 153 } |
154 // Check for always knowing you are throwing a range-check exception | 154 // Check for always knowing you are throwing a range-check exception |
155 if (stopped()) return top(); | 155 if (stopped()) return top(); |
156 | 156 |
157 Node* ptr = array_element_address(ary, idx, type, sizetype); | 157 // Make array address computation control dependent to prevent it |
158 // from floating above the range check during loop optimizations. | |
159 Node* ptr = array_element_address(ary, idx, type, sizetype, control()); | |
158 | 160 |
159 if (result2 != NULL) *result2 = elemtype; | 161 if (result2 != NULL) *result2 = elemtype; |
160 | 162 |
161 assert(ptr != top(), "top should go hand-in-hand with stopped"); | 163 assert(ptr != top(), "top should go hand-in-hand with stopped"); |
162 | 164 |
455 // The key_val input must be converted to a pointer offset and scaled. | 457 // The key_val input must be converted to a pointer offset and scaled. |
456 // Compare Parse::array_addressing above. | 458 // Compare Parse::array_addressing above. |
457 #ifdef _LP64 | 459 #ifdef _LP64 |
458 // Clean the 32-bit int into a real 64-bit offset. | 460 // Clean the 32-bit int into a real 64-bit offset. |
459 // Otherwise, the jint value 0 might turn into an offset of 0x0800000000. | 461 // Otherwise, the jint value 0 might turn into an offset of 0x0800000000. |
460 const TypeLong* lkeytype = TypeLong::make(CONST64(0), num_cases-1, Type::WidenMin); | 462 const TypeInt* ikeytype = TypeInt::make(0, num_cases-1, Type::WidenMin); |
461 key_val = _gvn.transform( new (C) ConvI2LNode(key_val, lkeytype) ); | 463 // Make I2L conversion control dependent to prevent it from |
464 // floating above the range check during loop optimizations. | |
465 key_val = C->constrained_convI2L(&_gvn, key_val, ikeytype, control()); | |
462 #endif | 466 #endif |
467 | |
463 // Shift the value by wordsize so we have an index into the table, rather | 468 // Shift the value by wordsize so we have an index into the table, rather |
464 // than a switch value | 469 // than a switch value |
465 Node *shiftWord = _gvn.MakeConX(wordSize); | 470 Node *shiftWord = _gvn.MakeConX(wordSize); |
466 key_val = _gvn.transform( new (C) MulXNode( key_val, shiftWord)); | 471 key_val = _gvn.transform( new (C) MulXNode( key_val, shiftWord)); |
467 | 472 |