< prev index next >

src/share/vm/opto/stringopts.cpp

Print this page




1443   bool dcon = dst_coder->is_Con();
1444   bool dbyte = dcon ? (dst_coder->get_int() == java_lang_String::CODER_LATIN1) : false;
1445 
1446   if (!dcon) {
1447     __ if_then(dst_coder, BoolTest::eq, __ ConI(java_lang_String::CODER_LATIN1));
1448   }
1449   if (!dcon || dbyte) {
1450     // Destination is Latin1. Simply emit a byte arraycopy.
1451     arraycopy(kit, ideal, src_array, dst_array, T_BYTE, start, __ value(count));
1452   }
1453   if (!dcon) {
1454     __ else_();
1455   }
1456   if (!dcon || !dbyte) {
1457     // Destination is UTF16. Inflate src_array into dst_array.
1458     kit.sync_kit(ideal);
1459     if (Matcher::match_rule_supported(Op_StrInflatedCopy)) {
1460       // Use fast intrinsic
1461       Node* src = kit.array_element_address(src_array, kit.intcon(0), T_BYTE);
1462       Node* dst = kit.array_element_address(dst_array, start, T_BYTE);
1463       kit.inflate_string(src, dst, __ value(count));
1464     } else {
1465       // No intrinsic available, use slow method
1466       kit.inflate_string_slow(src_array, dst_array, start, __ value(count));
1467     }
1468     ideal.sync_kit(&kit);
1469     // Multiply count by two since we now need two bytes per char
1470     __ set(count, __ LShiftI(__ value(count), __ ConI(1)));
1471   }
1472   if (!dcon) {
1473     __ end_if();
1474   }
1475 }
1476 
1477 // Read two bytes from index and index+1 and convert them to a char
1478 static jchar readChar(ciTypeArray* array, int index) {
1479   int shift_high, shift_low;
1480 #ifdef VM_LITTLE_ENDIAN
1481     shift_high = 0;
1482     shift_low = 8;
1483 #else




1443   bool dcon = dst_coder->is_Con();
1444   bool dbyte = dcon ? (dst_coder->get_int() == java_lang_String::CODER_LATIN1) : false;
1445 
1446   if (!dcon) {
1447     __ if_then(dst_coder, BoolTest::eq, __ ConI(java_lang_String::CODER_LATIN1));
1448   }
1449   if (!dcon || dbyte) {
1450     // Destination is Latin1. Simply emit a byte arraycopy.
1451     arraycopy(kit, ideal, src_array, dst_array, T_BYTE, start, __ value(count));
1452   }
1453   if (!dcon) {
1454     __ else_();
1455   }
1456   if (!dcon || !dbyte) {
1457     // Destination is UTF16. Inflate src_array into dst_array.
1458     kit.sync_kit(ideal);
1459     if (Matcher::match_rule_supported(Op_StrInflatedCopy)) {
1460       // Use fast intrinsic
1461       Node* src = kit.array_element_address(src_array, kit.intcon(0), T_BYTE);
1462       Node* dst = kit.array_element_address(dst_array, start, T_BYTE);
1463       kit.inflate_string(src, dst, TypeAryPtr::BYTES, __ value(count));
1464     } else {
1465       // No intrinsic available, use slow method
1466       kit.inflate_string_slow(src_array, dst_array, start, __ value(count));
1467     }
1468     ideal.sync_kit(&kit);
1469     // Multiply count by two since we now need two bytes per char
1470     __ set(count, __ LShiftI(__ value(count), __ ConI(1)));
1471   }
1472   if (!dcon) {
1473     __ end_if();
1474   }
1475 }
1476 
1477 // Read two bytes from index and index+1 and convert them to a char
1478 static jchar readChar(ciTypeArray* array, int index) {
1479   int shift_high, shift_low;
1480 #ifdef VM_LITTLE_ENDIAN
1481     shift_high = 0;
1482     shift_low = 8;
1483 #else


< prev index next >