hotspot/src/share/vm/opto/stringopts.hpp
changeset 33628 09241459a8b8
parent 12623 09fcb0dc71ad
child 36077 fa6d92de1c70
equal deleted inserted replaced
33627:c5b7455f846e 33628:09241459a8b8
     1 /*
     1 /*
     2  * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
     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.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    27 
    27 
    28 #include "opto/node.hpp"
    28 #include "opto/node.hpp"
    29 #include "opto/phaseX.hpp"
    29 #include "opto/phaseX.hpp"
    30 
    30 
    31 class StringConcat;
    31 class StringConcat;
       
    32 class IdealVariable;
    32 
    33 
    33 class PhaseStringOpts : public Phase {
    34 class PhaseStringOpts : public Phase {
    34   friend class StringConcat;
    35   friend class StringConcat;
    35 
    36 
    36  private:
    37  private:
    38 
    39 
    39   // List of dead nodes to clean up aggressively at the end
    40   // List of dead nodes to clean up aggressively at the end
    40   Unique_Node_List dead_worklist;
    41   Unique_Node_List dead_worklist;
    41 
    42 
    42   // Memory slices needed for code gen
    43   // Memory slices needed for code gen
    43   int char_adr_idx;
    44   int byte_adr_idx;
    44 
    45 
    45   // Integer.sizeTable - used for int to String conversion
    46   // Integer.sizeTable - used for int to String conversion
    46   ciField* size_table_field;
    47   ciField* size_table_field;
    47 
    48 
    48   // A set for use by various stages
    49   // A set for use by various stages
    62   Node* fetch_static_field(GraphKit& kit, ciField* field);
    63   Node* fetch_static_field(GraphKit& kit, ciField* field);
    63 
    64 
    64   // Compute the number of characters required to represent the int value
    65   // Compute the number of characters required to represent the int value
    65   Node* int_stringSize(GraphKit& kit, Node* value);
    66   Node* int_stringSize(GraphKit& kit, Node* value);
    66 
    67 
    67   // Copy the characters representing value into char_array starting at start
    68   // Simplified version of Integer.getChars
    68   void int_getChars(GraphKit& kit, Node* value, Node* char_array, Node* start, Node* end);
    69   void getChars(GraphKit& kit, Node* arg, Node* dst_array, BasicType bt, Node* end, Node* final_merge, Node* final_mem, int merge_index = 0);
    69 
    70 
    70   // Copy of the contents of the String str into char_array starting at index start.
    71   // Copy the characters representing arg into dst_array starting at start
    71   Node* copy_string(GraphKit& kit, Node* str, Node* char_array, Node* start);
    72   Node* int_getChars(GraphKit& kit, Node* arg, Node* dst_array, Node* dst_coder, Node* start, Node* size);
       
    73 
       
    74   // Copy contents of the String str into dst_array starting at index start.
       
    75   Node* copy_string(GraphKit& kit, Node* str, Node* dst_array, Node* dst_coder, Node* start);
       
    76 
       
    77   // Copy 'count' bytes/chars from src_array to dst_array starting at index start
       
    78   void arraycopy(GraphKit& kit, IdealKit& ideal, Node* src_array, Node* dst_array, BasicType elembt, Node* start, Node* count);
       
    79 
       
    80   // Copy contents of constant src_array to dst_array by emitting individual stores
       
    81   void copy_constant_string(GraphKit& kit, IdealKit& ideal, ciTypeArray* src_array, IdealVariable& count,
       
    82                             bool src_is_byte, Node* dst_array, Node* dst_coder, Node* start);
       
    83 
       
    84   // Copy contents of a Latin1 encoded string from src_array to dst_array
       
    85   void copy_latin1_string(GraphKit& kit, IdealKit& ideal, Node* src_array, IdealVariable& count,
       
    86                           Node* dst_array, Node* dst_coder, Node* start);
       
    87 
       
    88   // Copy the char into dst_array at index start.
       
    89   Node* copy_char(GraphKit& kit, Node* val, Node* dst_array, Node* dst_coder, Node* start);
       
    90 
       
    91   // Allocate a byte array of specified length.
       
    92   Node* allocate_byte_array(GraphKit& kit, IdealKit* ideal, Node* length);
       
    93 
       
    94   // Returns the coder of a constant string
       
    95   jbyte get_constant_coder(GraphKit& kit, Node* str);
       
    96 
       
    97   // Returns the length of a constant string
       
    98   int get_constant_length(GraphKit& kit, Node* str);
    72 
    99 
    73   // Clean up any leftover nodes
   100   // Clean up any leftover nodes
    74   void record_dead_node(Node* node);
   101   void record_dead_node(Node* node);
    75   void remove_dead_nodes();
   102   void remove_dead_nodes();
    76 
   103