src/share/vm/opto/stringopts.hpp

Sat, 16 Mar 2013 07:39:14 -0700

author
morris
date
Sat, 16 Mar 2013 07:39:14 -0700
changeset 4760
96ef09c26978
parent 3760
8f972594effc
child 6876
710a3c8b516e
permissions
-rw-r--r--

8009166: [parfait] Null pointer deference in hotspot/src/share/vm/opto/type.cpp
Summary: add guarantee() to as_instance_type()
Reviewed-by: kvn, twisti

     1 /*
     2  * Copyright (c) 2009, 2012, 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  *
    23  */
    25 #ifndef SHARE_VM_OPTO_STRINGOPTS_HPP
    26 #define SHARE_VM_OPTO_STRINGOPTS_HPP
    28 #include "opto/node.hpp"
    29 #include "opto/phaseX.hpp"
    31 class StringConcat;
    33 class PhaseStringOpts : public Phase {
    34   friend class StringConcat;
    36  private:
    37   PhaseGVN* _gvn;
    39   // List of dead nodes to clean up aggressively at the end
    40   Unique_Node_List dead_worklist;
    42   // Memory slices needed for code gen
    43   int char_adr_idx;
    45   // Integer.sizeTable - used for int to String conversion
    46   ciField* size_table_field;
    48   // A set for use by various stages
    49   VectorSet _visited;
    51   // Collect a list of all SB.toString calls
    52   Node_List collect_toString_calls();
    54   // Examine the use of the SB alloc to see if it can be replace with
    55   // a single string construction.
    56   StringConcat* build_candidate(CallStaticJavaNode* call);
    58   // Replace all the SB calls in concat with an optimization String allocation
    59   void replace_string_concat(StringConcat* concat);
    61   // Load the value of a static field, performing any constant folding.
    62   Node* fetch_static_field(GraphKit& kit, ciField* field);
    64   // Compute the number of characters required to represent the int value
    65   Node* int_stringSize(GraphKit& kit, Node* value);
    67   // Copy the characters representing value into char_array starting at start
    68   void int_getChars(GraphKit& kit, Node* value, Node* char_array, Node* start, Node* end);
    70   // Copy of the contents of the String str into char_array starting at index start.
    71   Node* copy_string(GraphKit& kit, Node* str, Node* char_array, Node* start);
    73   // Clean up any leftover nodes
    74   void record_dead_node(Node* node);
    75   void remove_dead_nodes();
    77   PhaseGVN* gvn() { return _gvn; }
    79   enum {
    80     // max length of constant string copy unrolling in copy_string
    81     unroll_string_copy_length = 6
    82   };
    84  public:
    85   PhaseStringOpts(PhaseGVN* gvn, Unique_Node_List* worklist);
    86 };
    88 #endif // SHARE_VM_OPTO_STRINGOPTS_HPP

mercurial