< prev index next >

src/hotspot/share/c1/c1_LIRGenerator.cpp

Print this page
rev 54084 : 8220502: Inefficient pre-sizing of PhiResolverState arrays in c1_LIRGenerator
Reviewed-by: neliasso

@@ -51,22 +51,17 @@
 
 #ifndef PATCHED_ADDR
 #define PATCHED_ADDR  (max_jint)
 #endif
 
-void PhiResolverState::reset(int max_vregs) {
-  // Initialize array sizes
-  _virtual_operands.at_put_grow(max_vregs - 1, NULL, NULL);
-  _virtual_operands.trunc_to(0);
-  _other_operands.at_put_grow(max_vregs - 1, NULL, NULL);
-  _other_operands.trunc_to(0);
-  _vreg_table.at_put_grow(max_vregs - 1, NULL, NULL);
-  _vreg_table.trunc_to(0);
+void PhiResolverState::reset() {
+  _virtual_operands.clear();
+  _other_operands.clear();
+  _vreg_table.clear();
 }
 
 
-
 //--------------------------------------------------------------
 // PhiResolver
 
 // Resolves cycles:
 //

@@ -76,17 +71,17 @@
 // and orders moves:
 //
 //  r2 := r3  becomes  r1 := r2
 //  r1 := r2           r2 := r3
 
-PhiResolver::PhiResolver(LIRGenerator* gen, int max_vregs)
+PhiResolver::PhiResolver(LIRGenerator* gen)
  : _gen(gen)
  , _state(gen->resolver_state())
  , _temp(LIR_OprFact::illegalOpr)
 {
   // reinitialize the shared state arrays
-  _state.reset(max_vregs);
+  _state.reset();
 }
 
 
 void PhiResolver::emit_move(LIR_Opr src, LIR_Opr dest) {
   assert(src->is_valid(), "");

@@ -1019,12 +1014,11 @@
     BlockBegin* sux = bb->sux_at(0);
     assert(sux->number_of_preds() > 0, "invalid CFG");
 
     // a block with only one predecessor never has phi functions
     if (sux->number_of_preds() > 1) {
-      int max_phis = cur_state->stack_size() + cur_state->locals_size();
-      PhiResolver resolver(this, _virtual_register_number + max_phis * 2);
+      PhiResolver resolver(this);
 
       ValueStack* sux_state = sux->state();
       Value sux_value;
       int index;
 
< prev index next >