< prev index next >

src/share/vm/opto/stringopts.cpp

Print this page


   1 /*
   2  * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1941           default:
1942             ShouldNotReachHere();
1943         }
1944       }
1945     }
1946 
1947     // If we're not reusing an existing String allocation then allocate one here.
1948     result = sc->string_alloc();
1949     if (result == NULL) {
1950       PreserveReexecuteState preexecs(&kit);
1951       // The original jvms is for an allocation of either a String or
1952       // StringBuffer so no stack adjustment is necessary for proper
1953       // reexecution.
1954       kit.jvms()->set_should_reexecute(true);
1955       result = kit.new_instance(__ makecon(TypeKlassPtr::make(C->env()->String_klass())));
1956     }
1957 
1958     // Initialize the string
1959     kit.store_String_value(kit.control(), result, dst_array);
1960     kit.store_String_coder(kit.control(), result, coder);











1961   } else {
1962     result = C->top();
1963   }
1964   // hook up the outgoing control and result
1965   kit.replace_call(sc->end(), result);
1966 
1967   // Unhook any hook nodes
1968   string_sizes->disconnect_inputs(NULL, C);
1969   sc->cleanup();
1970 }
   1 /*
   2  * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1941           default:
1942             ShouldNotReachHere();
1943         }
1944       }
1945     }
1946 
1947     // If we're not reusing an existing String allocation then allocate one here.
1948     result = sc->string_alloc();
1949     if (result == NULL) {
1950       PreserveReexecuteState preexecs(&kit);
1951       // The original jvms is for an allocation of either a String or
1952       // StringBuffer so no stack adjustment is necessary for proper
1953       // reexecution.
1954       kit.jvms()->set_should_reexecute(true);
1955       result = kit.new_instance(__ makecon(TypeKlassPtr::make(C->env()->String_klass())));
1956     }
1957 
1958     // Initialize the string
1959     kit.store_String_value(kit.control(), result, dst_array);
1960     kit.store_String_coder(kit.control(), result, coder);
1961 
1962     // Do not let stores that initialize this object be reordered with
1963     // a subsequent store that would make this object accessible by
1964     // other threads.
1965     // Record what AllocateNode this StoreStore protects so that
1966     // escape analysis can go from the MemBarStoreStoreNode to the
1967     // AllocateNode and eliminate the MemBarStoreStoreNode if possible
1968     // based on the escape status of the AllocateNode.
1969     AllocateNode* alloc = AllocateNode::Ideal_allocation(result, _gvn);
1970     assert(alloc != NULL, "should be newly allocated");
1971     kit.insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out(AllocateNode::RawAddress));
1972   } else {
1973     result = C->top();
1974   }
1975   // hook up the outgoing control and result
1976   kit.replace_call(sc->end(), result);
1977 
1978   // Unhook any hook nodes
1979   string_sizes->disconnect_inputs(NULL, C);
1980   sc->cleanup();
1981 }
< prev index next >