< prev index next >

src/share/vm/opto/library_call.cpp

Print this page




1567   C->set_has_split_ifs(true); // Has chance for split-if optimization
1568   return true;
1569 }
1570 
1571 //----------------------inline_string_char_access----------------------------
1572 // Store/Load char to/from byte[] array.
1573 // static void StringUTF16.putChar(byte[] val, int index, int c)
1574 // static char StringUTF16.getChar(byte[] val, int index)
1575 bool LibraryCallKit::inline_string_char_access(bool is_store) {
1576   Node* value  = argument(0);
1577   Node* index  = argument(1);
1578   Node* ch = is_store ? argument(2) : NULL;
1579 
1580   // This intrinsic accesses byte[] array as char[] array. Computing the offsets
1581   // correctly requires matched array shapes.
1582   assert (arrayOopDesc::base_offset_in_bytes(T_CHAR) == arrayOopDesc::base_offset_in_bytes(T_BYTE),
1583           "sanity: byte[] and char[] bases agree");
1584   assert (type2aelembytes(T_CHAR) == type2aelembytes(T_BYTE)*2,
1585           "sanity: byte[] and char[] scales agree");
1586 







1587   Node* adr = array_element_address(value, index, T_CHAR);
1588   if (is_store) {
1589     (void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered,
1590                            false, false, true /* mismatched */);
1591   } else {
1592     ch = make_load(control(), adr, TypeInt::CHAR, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered,
1593                    LoadNode::DependsOnlyOnTest, false, false, true /* mismatched */);
1594     set_result(ch);
1595   }
1596   return true;
1597 }
1598 
1599 //--------------------------round_double_node--------------------------------
1600 // Round a double node if necessary.
1601 Node* LibraryCallKit::round_double_node(Node* n) {
1602   if (Matcher::strict_fp_requires_explicit_rounding && UseSSE <= 1)
1603     n = _gvn.transform(new RoundDoubleNode(0, n));
1604   return n;
1605 }
1606 




1567   C->set_has_split_ifs(true); // Has chance for split-if optimization
1568   return true;
1569 }
1570 
1571 //----------------------inline_string_char_access----------------------------
1572 // Store/Load char to/from byte[] array.
1573 // static void StringUTF16.putChar(byte[] val, int index, int c)
1574 // static char StringUTF16.getChar(byte[] val, int index)
1575 bool LibraryCallKit::inline_string_char_access(bool is_store) {
1576   Node* value  = argument(0);
1577   Node* index  = argument(1);
1578   Node* ch = is_store ? argument(2) : NULL;
1579 
1580   // This intrinsic accesses byte[] array as char[] array. Computing the offsets
1581   // correctly requires matched array shapes.
1582   assert (arrayOopDesc::base_offset_in_bytes(T_CHAR) == arrayOopDesc::base_offset_in_bytes(T_BYTE),
1583           "sanity: byte[] and char[] bases agree");
1584   assert (type2aelembytes(T_CHAR) == type2aelembytes(T_BYTE)*2,
1585           "sanity: byte[] and char[] scales agree");
1586 
1587   // Bail when getChar over constants is requested: constant folding would
1588   // reject folding mismatched char access over byte[]. A normal inlining for getChar
1589   // Java method would constant fold nicely instead.
1590   if (!is_store && value->is_Con() && index->is_Con()) {
1591     return false;
1592   }
1593 
1594   Node* adr = array_element_address(value, index, T_CHAR);
1595   if (is_store) {
1596     (void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered,
1597                            false, false, true /* mismatched */);
1598   } else {
1599     ch = make_load(control(), adr, TypeInt::CHAR, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered,
1600                    LoadNode::DependsOnlyOnTest, false, false, true /* mismatched */);
1601     set_result(ch);
1602   }
1603   return true;
1604 }
1605 
1606 //--------------------------round_double_node--------------------------------
1607 // Round a double node if necessary.
1608 Node* LibraryCallKit::round_double_node(Node* n) {
1609   if (Matcher::strict_fp_requires_explicit_rounding && UseSSE <= 1)
1610     n = _gvn.transform(new RoundDoubleNode(0, n));
1611   return n;
1612 }
1613 


< prev index next >