src/hotspot/share/opto/phaseX.cpp
changeset 51333 f6641fcf7b7e
parent 50180 ffa644980dff
child 51485 0c7040d1d1ca
equal deleted inserted replaced
51332:c25572739e7c 51333:f6641fcf7b7e
    42 
    42 
    43 //=============================================================================
    43 //=============================================================================
    44 #define NODE_HASH_MINIMUM_SIZE    255
    44 #define NODE_HASH_MINIMUM_SIZE    255
    45 //------------------------------NodeHash---------------------------------------
    45 //------------------------------NodeHash---------------------------------------
    46 NodeHash::NodeHash(uint est_max_size) :
    46 NodeHash::NodeHash(uint est_max_size) :
       
    47   _a(Thread::current()->resource_area()),
    47   _max( round_up(est_max_size < NODE_HASH_MINIMUM_SIZE ? NODE_HASH_MINIMUM_SIZE : est_max_size) ),
    48   _max( round_up(est_max_size < NODE_HASH_MINIMUM_SIZE ? NODE_HASH_MINIMUM_SIZE : est_max_size) ),
    48   _a(Thread::current()->resource_area()),
    49   _inserts(0), _insert_limit( insert_limit() ),
    49   _table( NEW_ARENA_ARRAY( _a , Node* , _max ) ), // (Node**)_a->Amalloc(_max * sizeof(Node*)) ),
    50   _table( NEW_ARENA_ARRAY( _a , Node* , _max ) ) // (Node**)_a->Amalloc(_max * sizeof(Node*)) ),
    50   _inserts(0), _insert_limit( insert_limit() )
    51 #ifndef PRODUCT
    51 #ifndef PRODUCT
    52   , _grows(0),_look_probes(0), _lookup_hits(0), _lookup_misses(0),
    52   ,_look_probes(0), _lookup_hits(0), _lookup_misses(0),
    53   _insert_probes(0), _delete_probes(0), _delete_hits(0), _delete_misses(0),
    53   _delete_probes(0), _delete_hits(0), _delete_misses(0),
    54    _total_inserts(0), _total_insert_probes(0)
    54   _total_insert_probes(0), _total_inserts(0),
       
    55   _insert_probes(0), _grows(0)
       
    56 #endif
    55 #endif
    57 {
    56 {
    58   // _sentinel must be in the current node space
    57   // _sentinel must be in the current node space
    59   _sentinel = new ProjNode(NULL, TypeFunc::Control);
    58   _sentinel = new ProjNode(NULL, TypeFunc::Control);
    60   memset(_table,0,sizeof(Node*)*_max);
    59   memset(_table,0,sizeof(Node*)*_max);
    61 }
    60 }
    62 
    61 
    63 //------------------------------NodeHash---------------------------------------
    62 //------------------------------NodeHash---------------------------------------
    64 NodeHash::NodeHash(Arena *arena, uint est_max_size) :
    63 NodeHash::NodeHash(Arena *arena, uint est_max_size) :
       
    64   _a(arena),
    65   _max( round_up(est_max_size < NODE_HASH_MINIMUM_SIZE ? NODE_HASH_MINIMUM_SIZE : est_max_size) ),
    65   _max( round_up(est_max_size < NODE_HASH_MINIMUM_SIZE ? NODE_HASH_MINIMUM_SIZE : est_max_size) ),
    66   _a(arena),
    66   _inserts(0), _insert_limit( insert_limit() ),
    67   _table( NEW_ARENA_ARRAY( _a , Node* , _max ) ),
    67   _table( NEW_ARENA_ARRAY( _a , Node* , _max ) )
    68   _inserts(0), _insert_limit( insert_limit() )
    68 #ifndef PRODUCT
    69 #ifndef PRODUCT
    69   , _grows(0),_look_probes(0), _lookup_hits(0), _lookup_misses(0),
    70   ,_look_probes(0), _lookup_hits(0), _lookup_misses(0),
    70   _insert_probes(0), _delete_probes(0), _delete_hits(0), _delete_misses(0),
    71   _delete_probes(0), _delete_hits(0), _delete_misses(0),
    71    _total_inserts(0), _total_insert_probes(0)
    72   _total_insert_probes(0), _total_inserts(0),
       
    73   _insert_probes(0), _grows(0)
       
    74 #endif
    72 #endif
    75 {
    73 {
    76   // _sentinel must be in the current node space
    74   // _sentinel must be in the current node space
    77   _sentinel = new ProjNode(NULL, TypeFunc::Control);
    75   _sentinel = new ProjNode(NULL, TypeFunc::Control);
    78   memset(_table,0,sizeof(Node*)*_max);
    76   memset(_table,0,sizeof(Node*)*_max);
   888 #endif
   886 #endif
   889 
   887 
   890 //=============================================================================
   888 //=============================================================================
   891 //------------------------------PhaseIterGVN-----------------------------------
   889 //------------------------------PhaseIterGVN-----------------------------------
   892 // Initialize hash table to fresh and clean for +VerifyOpto
   890 // Initialize hash table to fresh and clean for +VerifyOpto
   893 PhaseIterGVN::PhaseIterGVN( PhaseIterGVN *igvn, const char *dummy ) : PhaseGVN(igvn,dummy), _worklist( ),
   891 PhaseIterGVN::PhaseIterGVN( PhaseIterGVN *igvn, const char *dummy ) : PhaseGVN(igvn,dummy),
       
   892                                                                       _delay_transform(false),
   894                                                                       _stack(C->live_nodes() >> 1),
   893                                                                       _stack(C->live_nodes() >> 1),
   895                                                                       _delay_transform(false) {
   894                                                                       _worklist( ) {
   896 }
   895 }
   897 
   896 
   898 //------------------------------PhaseIterGVN-----------------------------------
   897 //------------------------------PhaseIterGVN-----------------------------------
   899 // Initialize with previous PhaseIterGVN info; used by PhaseCCP
   898 // Initialize with previous PhaseIterGVN info; used by PhaseCCP
   900 PhaseIterGVN::PhaseIterGVN( PhaseIterGVN *igvn ) : PhaseGVN(igvn),
   899 PhaseIterGVN::PhaseIterGVN( PhaseIterGVN *igvn ) : PhaseGVN(igvn),
   901                                                    _worklist( igvn->_worklist ),
   900                                                    _delay_transform(igvn->_delay_transform),
   902                                                    _stack( igvn->_stack ),
   901                                                    _stack( igvn->_stack ),
   903                                                    _delay_transform(igvn->_delay_transform)
   902                                                    _worklist( igvn->_worklist )
   904 {
   903 {
   905 }
   904 }
   906 
   905 
   907 //------------------------------PhaseIterGVN-----------------------------------
   906 //------------------------------PhaseIterGVN-----------------------------------
   908 // Initialize with previous PhaseGVN info from Parser
   907 // Initialize with previous PhaseGVN info from Parser
   909 PhaseIterGVN::PhaseIterGVN( PhaseGVN *gvn ) : PhaseGVN(gvn),
   908 PhaseIterGVN::PhaseIterGVN( PhaseGVN *gvn ) : PhaseGVN(gvn),
   910                                               _worklist(*C->for_igvn()),
   909                                               _delay_transform(false),
   911 // TODO: Before incremental inlining it was allocated only once and it was fine. Now that
   910 // TODO: Before incremental inlining it was allocated only once and it was fine. Now that
   912 //       the constructor is used in incremental inlining, this consumes too much memory:
   911 //       the constructor is used in incremental inlining, this consumes too much memory:
   913 //                                            _stack(C->live_nodes() >> 1),
   912 //                                            _stack(C->live_nodes() >> 1),
   914 //       So, as a band-aid, we replace this by:
   913 //       So, as a band-aid, we replace this by:
   915                                               _stack(C->comp_arena(), 32),
   914                                               _stack(C->comp_arena(), 32),
   916                                               _delay_transform(false)
   915                                               _worklist(*C->for_igvn())
   917 {
   916 {
   918   uint max;
   917   uint max;
   919 
   918 
   920   // Dead nodes in the hash table inherited from GVN were not treated as
   919   // Dead nodes in the hash table inherited from GVN were not treated as
   921   // roots during def-use info creation; hence they represent an invisible
   920   // roots during def-use info creation; hence they represent an invisible