< prev index next >

src/share/vm/opto/stringopts.cpp

Print this page




1503   if (!dcon || dbyte) {
1504     // Destination is Latin1. Copy each byte of src_array into dst_array.
1505     Node* index = start;
1506     for (int i = 0; i < length; i++) {
1507       Node* adr = kit.array_element_address(dst_array, index, T_BYTE);
1508       Node* val = __ ConI(src_array->byte_at(i));
1509       __ store(__ ctrl(), adr, val, T_BYTE, byte_adr_idx, MemNode::unordered);
1510       index = __ AddI(index, __ ConI(1));
1511     }
1512   }
1513   if (!dcon) {
1514     __ else_();
1515   }
1516   if (!dcon || !dbyte) {
1517     // Destination is UTF16. Copy each char of src_array into dst_array.
1518     Node* index = start;
1519     for (int i = 0; i < length; i++) {
1520       Node* adr = kit.array_element_address(dst_array, index, T_BYTE);
1521       jchar val;
1522       if (src_is_byte) {
1523         val = src_array->byte_at(i);
1524       } else {
1525         val = readChar(src_array, i++);
1526       }
1527       __ store(__ ctrl(), adr, __ ConI(val), T_CHAR, byte_adr_idx, MemNode::unordered);
1528       index = __ AddI(index, __ ConI(2));
1529     }
1530     if (src_is_byte) {
1531       // Multiply count by two since we now need two bytes per char
1532       __ set(count, __ ConI(2 * length));
1533     }
1534   }
1535   if (!dcon) {
1536     __ end_if();
1537   }
1538 }
1539 
1540 // Compress copy contents of the byte/char String str into dst_array starting at index start.
1541 Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* dst_array, Node* dst_coder, Node* start) {
1542   Node* src_array = kit.load_String_value(kit.control(), str);
1543 




1503   if (!dcon || dbyte) {
1504     // Destination is Latin1. Copy each byte of src_array into dst_array.
1505     Node* index = start;
1506     for (int i = 0; i < length; i++) {
1507       Node* adr = kit.array_element_address(dst_array, index, T_BYTE);
1508       Node* val = __ ConI(src_array->byte_at(i));
1509       __ store(__ ctrl(), adr, val, T_BYTE, byte_adr_idx, MemNode::unordered);
1510       index = __ AddI(index, __ ConI(1));
1511     }
1512   }
1513   if (!dcon) {
1514     __ else_();
1515   }
1516   if (!dcon || !dbyte) {
1517     // Destination is UTF16. Copy each char of src_array into dst_array.
1518     Node* index = start;
1519     for (int i = 0; i < length; i++) {
1520       Node* adr = kit.array_element_address(dst_array, index, T_BYTE);
1521       jchar val;
1522       if (src_is_byte) {
1523         val = src_array->byte_at(i) & 0xff;
1524       } else {
1525         val = readChar(src_array, i++);
1526       }
1527       __ store(__ ctrl(), adr, __ ConI(val), T_CHAR, byte_adr_idx, MemNode::unordered);
1528       index = __ AddI(index, __ ConI(2));
1529     }
1530     if (src_is_byte) {
1531       // Multiply count by two since we now need two bytes per char
1532       __ set(count, __ ConI(2 * length));
1533     }
1534   }
1535   if (!dcon) {
1536     __ end_if();
1537   }
1538 }
1539 
1540 // Compress copy contents of the byte/char String str into dst_array starting at index start.
1541 Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* dst_array, Node* dst_coder, Node* start) {
1542   Node* src_array = kit.load_String_value(kit.control(), str);
1543 


< prev index next >