< prev index next >

src/share/vm/opto/stringopts.cpp

Print this page




1586     } else {
1587       // length now contains the number of characters needed for the
1588       // char[] so create a new AllocateArray for the char[]
1589       {
1590         PreserveReexecuteState preexecs(&kit);
1591         // The original jvms is for an allocation of either a String or
1592         // StringBuffer so no stack adjustment is necessary for proper
1593         // reexecution.  If we deoptimize in the slow path the bytecode
1594         // will be reexecuted and the char[] allocation will be thrown away.
1595         kit.jvms()->set_should_reexecute(true);
1596         char_array = kit.new_array(__ makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_CHAR))),
1597                                    length, 1);
1598       }
1599 
1600       // Mark the allocation so that zeroing is skipped since the code
1601       // below will overwrite the entire array
1602       AllocateArrayNode* char_alloc = AllocateArrayNode::Ideal_array_allocation(char_array, _gvn);
1603       char_alloc->maybe_set_complete(_gvn);
1604 
1605       // Now copy the string representations into the final char[]

1606       Node* start = __ intcon(0);
1607       for (int argi = 0; argi < sc->num_arguments(); argi++) {
1608         Node* arg = sc->argument(argi);
1609         switch (sc->mode(argi)) {
1610           case StringConcat::IntMode: {
1611             Node* end = __ AddI(start, string_sizes->in(argi));
1612             // getChars words backwards so pass the ending point as well as the start
1613             int_getChars(kit, arg, char_array, start, end);
1614             start = end;
1615             break;
1616           }
1617           case StringConcat::StringNullCheckMode:
1618           case StringConcat::StringMode: {
1619             start = copy_string(kit, arg, char_array, start);
1620             break;
1621           }
1622           case StringConcat::CharMode: {
1623             __ store_to_memory(kit.control(), kit.array_element_address(char_array, start, T_CHAR),
1624                                arg, T_CHAR, char_adr_idx, MemNode::unordered);
1625             start = __ AddI(start, __ intcon(1));




1586     } else {
1587       // length now contains the number of characters needed for the
1588       // char[] so create a new AllocateArray for the char[]
1589       {
1590         PreserveReexecuteState preexecs(&kit);
1591         // The original jvms is for an allocation of either a String or
1592         // StringBuffer so no stack adjustment is necessary for proper
1593         // reexecution.  If we deoptimize in the slow path the bytecode
1594         // will be reexecuted and the char[] allocation will be thrown away.
1595         kit.jvms()->set_should_reexecute(true);
1596         char_array = kit.new_array(__ makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_CHAR))),
1597                                    length, 1);
1598       }
1599 
1600       // Mark the allocation so that zeroing is skipped since the code
1601       // below will overwrite the entire array
1602       AllocateArrayNode* char_alloc = AllocateArrayNode::Ideal_array_allocation(char_array, _gvn);
1603       char_alloc->maybe_set_complete(_gvn);
1604 
1605       // Now copy the string representations into the final char[]
1606       char_array = __ shenandoah_write_barrier(char_array);
1607       Node* start = __ intcon(0);
1608       for (int argi = 0; argi < sc->num_arguments(); argi++) {
1609         Node* arg = sc->argument(argi);
1610         switch (sc->mode(argi)) {
1611           case StringConcat::IntMode: {
1612             Node* end = __ AddI(start, string_sizes->in(argi));
1613             // getChars words backwards so pass the ending point as well as the start
1614             int_getChars(kit, arg, char_array, start, end);
1615             start = end;
1616             break;
1617           }
1618           case StringConcat::StringNullCheckMode:
1619           case StringConcat::StringMode: {
1620             start = copy_string(kit, arg, char_array, start);
1621             break;
1622           }
1623           case StringConcat::CharMode: {
1624             __ store_to_memory(kit.control(), kit.array_element_address(char_array, start, T_CHAR),
1625                                arg, T_CHAR, char_adr_idx, MemNode::unordered);
1626             start = __ AddI(start, __ intcon(1));


< prev index next >