< prev index next >

src/share/vm/opto/library_call.cpp

Print this page




1486 }
1487 
1488 //----------------------inline_string_char_access----------------------------
1489 // Store/Load char to/from byte[] array.
1490 // static void StringUTF16.putChar(byte[] val, int index, int c)
1491 // static char StringUTF16.getChar(byte[] val, int index)
1492 bool LibraryCallKit::inline_string_char_access(bool is_store) {
1493   Node* value  = argument(0);
1494   Node* index  = argument(1);
1495   Node* ch = is_store ? argument(2) : NULL;
1496 
1497   // This intrinsic accesses byte[] array as char[] array. Computing the offsets
1498   // correctly requires matched array shapes.
1499   assert (arrayOopDesc::base_offset_in_bytes(T_CHAR) == arrayOopDesc::base_offset_in_bytes(T_BYTE),
1500           "sanity: byte[] and char[] bases agree");
1501   assert (type2aelembytes(T_CHAR) == type2aelembytes(T_BYTE)*2,
1502           "sanity: byte[] and char[] scales agree");
1503 
1504   Node* adr = array_element_address(value, index, T_CHAR);
1505   if (is_store) {
1506     (void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered);

1507   } else {
1508     ch = make_load(control(), adr, TypeInt::CHAR, T_CHAR, MemNode::unordered);

1509     set_result(ch);
1510   }
1511   return true;
1512 }
1513 
1514 //--------------------------round_double_node--------------------------------
1515 // Round a double node if necessary.
1516 Node* LibraryCallKit::round_double_node(Node* n) {
1517   if (Matcher::strict_fp_requires_explicit_rounding && UseSSE <= 1)
1518     n = _gvn.transform(new RoundDoubleNode(0, n));
1519   return n;
1520 }
1521 
1522 //------------------------------inline_math-----------------------------------
1523 // public static double Math.abs(double)
1524 // public static double Math.sqrt(double)
1525 // public static double Math.log(double)
1526 // public static double Math.log10(double)
1527 bool LibraryCallKit::inline_math(vmIntrinsics::ID id) {
1528   Node* arg = round_double_node(argument(0));




1486 }
1487 
1488 //----------------------inline_string_char_access----------------------------
1489 // Store/Load char to/from byte[] array.
1490 // static void StringUTF16.putChar(byte[] val, int index, int c)
1491 // static char StringUTF16.getChar(byte[] val, int index)
1492 bool LibraryCallKit::inline_string_char_access(bool is_store) {
1493   Node* value  = argument(0);
1494   Node* index  = argument(1);
1495   Node* ch = is_store ? argument(2) : NULL;
1496 
1497   // This intrinsic accesses byte[] array as char[] array. Computing the offsets
1498   // correctly requires matched array shapes.
1499   assert (arrayOopDesc::base_offset_in_bytes(T_CHAR) == arrayOopDesc::base_offset_in_bytes(T_BYTE),
1500           "sanity: byte[] and char[] bases agree");
1501   assert (type2aelembytes(T_CHAR) == type2aelembytes(T_BYTE)*2,
1502           "sanity: byte[] and char[] scales agree");
1503 
1504   Node* adr = array_element_address(value, index, T_CHAR);
1505   if (is_store) {
1506     (void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered,
1507                            false, false, true /* mismatched */);
1508   } else {
1509     ch = make_load(control(), adr, TypeInt::CHAR, T_CHAR, MemNode::unordered,
1510                    LoadNode::DependsOnlyOnTest, false, false, true /* mismatched */);
1511     set_result(ch);
1512   }
1513   return true;
1514 }
1515 
1516 //--------------------------round_double_node--------------------------------
1517 // Round a double node if necessary.
1518 Node* LibraryCallKit::round_double_node(Node* n) {
1519   if (Matcher::strict_fp_requires_explicit_rounding && UseSSE <= 1)
1520     n = _gvn.transform(new RoundDoubleNode(0, n));
1521   return n;
1522 }
1523 
1524 //------------------------------inline_math-----------------------------------
1525 // public static double Math.abs(double)
1526 // public static double Math.sqrt(double)
1527 // public static double Math.log(double)
1528 // public static double Math.log10(double)
1529 bool LibraryCallKit::inline_math(vmIntrinsics::ID id) {
1530   Node* arg = round_double_node(argument(0));


< prev index next >