changeset 1335:576e77447e3c

6923002: assert(false,"this call site should not be polymorphic") Summary: Clear the total count when a receiver information is cleared. Reviewed-by: never, jrose
author kvn
date Sun, 07 Feb 2010 12:15:06 -0800
parents 3f5b7efb9642
children f516d5d7a019
files src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp src/cpu/sparc/vm/interp_masm_sparc.cpp src/cpu/sparc/vm/sharedRuntime_sparc.cpp src/cpu/x86/vm/c1_LIRAssembler_x86.cpp src/cpu/x86/vm/interp_masm_x86_32.cpp src/cpu/x86/vm/interp_masm_x86_64.cpp src/share/vm/ci/ciMethod.cpp src/share/vm/oops/methodDataOop.hpp src/share/vm/opto/doCall.cpp src/share/vm/opto/runtime.cpp src/share/vm/runtime/arguments.cpp
diffstat 11 files changed, 54 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Sun Feb 07 12:15:06 2010 -0800
@@ -2730,9 +2730,6 @@
   }
 
   Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()) - mdo_offset_bias);
-  __ lduw(counter_addr, tmp1);
-  __ add(tmp1, DataLayout::counter_increment, tmp1);
-  __ stw(tmp1, counter_addr);
   Bytecodes::Code bc = method->java_code_at_bci(bci);
   // Perform additional virtual call profiling for invokevirtual and
   // invokeinterface bytecodes
@@ -2822,15 +2819,23 @@
         __ set(DataLayout::counter_increment, tmp1);
         __ st_ptr(tmp1, mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i)) -
                   mdo_offset_bias);
-        if (i < (VirtualCallData::row_limit() - 1)) {
-          __ br(Assembler::always, false, Assembler::pt, update_done);
-          __ delayed()->nop();
-        }
+        __ br(Assembler::always, false, Assembler::pt, update_done);
+        __ delayed()->nop();
         __ bind(next_test);
       }
+      // Receiver did not match any saved receiver and there is no empty row for it.
+      // Increment total counter to indicate polymorphic case.
+      __ lduw(counter_addr, tmp1);
+      __ add(tmp1, DataLayout::counter_increment, tmp1);
+      __ stw(tmp1, counter_addr);
 
       __ bind(update_done);
     }
+  } else {
+    // Static call
+    __ lduw(counter_addr, tmp1);
+    __ add(tmp1, DataLayout::counter_increment, tmp1);
+    __ stw(tmp1, counter_addr);
   }
 }
 
--- a/src/cpu/sparc/vm/interp_masm_sparc.cpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp	Sun Feb 07 12:15:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1733,7 +1733,7 @@
           brx(Assembler::zero, false, Assembler::pn, found_null);
           delayed()->nop();
           // Receiver did not match any saved receiver and there is no empty row for it.
-          // Increment total counter to indicate polimorphic case.
+          // Increment total counter to indicate polymorphic case.
           increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch);
           ba(false, done);
           delayed()->nop();
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Sun Feb 07 12:15:06 2010 -0800
@@ -851,10 +851,10 @@
       __ set(reg2offset(r_1) + extraspace + bias, ld_off);
 #else
       int ld_off = reg2offset(r_1) + extraspace + bias;
+#endif // _LP64
 #ifdef ASSERT
       G1_forced = true;
 #endif // ASSERT
-#endif // _LP64
       r_1 = G1_scratch->as_VMReg();// as part of the load/store shuffle
       if (!r_2->is_valid()) __ ld (base, ld_off, G1_scratch);
       else                  __ ldx(base, ld_off, G1_scratch);
@@ -865,9 +865,11 @@
       if (sig_bt[i] == T_OBJECT || sig_bt[i] == T_ARRAY) {
         store_c2i_object(r, base, st_off);
       } else if (sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) {
+#ifndef _LP64
         if (TieredCompilation) {
           assert(G1_forced || sig_bt[i] != T_LONG, "should not use register args for longs");
         }
+#endif // _LP64
         store_c2i_long(r, base, st_off, r_2->is_stack());
       } else {
         store_c2i_int(r, base, st_off);
--- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Sun Feb 07 12:15:06 2010 -0800
@@ -3279,7 +3279,7 @@
         __ bind(next_test);
       }
       // Receiver did not match any saved receiver and there is no empty row for it.
-      // Increment total counter to indicate polimorphic case.
+      // Increment total counter to indicate polymorphic case.
       __ addl(counter_addr, DataLayout::counter_increment);
 
       __ bind(update_done);
--- a/src/cpu/x86/vm/interp_masm_x86_32.cpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp	Sun Feb 07 12:15:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1308,7 +1308,7 @@
         if (is_virtual_call) {
           jccb(Assembler::zero, found_null);
           // Receiver did not match any saved receiver and there is no empty row for it.
-          // Increment total counter to indicate polimorphic case.
+          // Increment total counter to indicate polymorphic case.
           increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
           jmp(done);
           bind(found_null);
--- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Sun Feb 07 12:15:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1341,7 +1341,7 @@
         if (is_virtual_call) {
           jccb(Assembler::zero, found_null);
           // Receiver did not match any saved receiver and there is no empty row for it.
-          // Increment total counter to indicate polimorphic case.
+          // Increment total counter to indicate polymorphic case.
           increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
           jmp(done);
           bind(found_null);
--- a/src/share/vm/ci/ciMethod.cpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/share/vm/ci/ciMethod.cpp	Sun Feb 07 12:15:06 2010 -0800
@@ -445,7 +445,8 @@
                (morphism == ciCallProfile::MorphismLimit && count == 0)) {
 #ifdef ASSERT
              if (count > 0) {
-               tty->print_cr("bci: %d", bci);
+               this->print_short_name(tty);
+               tty->print_cr(" @ bci:%d", bci);
                this->print_codes();
                assert(false, "this call site should not be polymorphic");
              }
--- a/src/share/vm/oops/methodDataOop.hpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/share/vm/oops/methodDataOop.hpp	Sun Feb 07 12:15:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -545,6 +545,10 @@
     return cell_offset(counter_cell_count);
   }
 
+  void set_count(uint count) {
+    set_uint_at(count_off, count);
+  }
+
 #ifndef PRODUCT
   void print_data_on(outputStream* st);
 #endif
@@ -692,6 +696,23 @@
 
   void clear_row(uint row) {
     assert(row < row_limit(), "oob");
+    // Clear total count - indicator of polymorphic call site.
+    // The site may look like as monomorphic after that but
+    // it allow to have more accurate profiling information because
+    // there was execution phase change since klasses were unloaded.
+    // If the site is still polymorphic then MDO will be updated
+    // to reflect it. But it could be the case that the site becomes
+    // only bimorphic. Then keeping total count not 0 will be wrong.
+    // Even if we use monomorphic (when it is not) for compilation
+    // we will only have trap, deoptimization and recompile again
+    // with updated MDO after executing method in Interpreter.
+    // An additional receiver will be recorded in the cleaned row
+    // during next call execution.
+    //
+    // Note: our profiling logic works with empty rows in any slot.
+    // We do sorting a profiling info (ciCallProfile) for compilation.
+    //
+    set_count(0);
     set_receiver(row, NULL);
     set_receiver_count(row, 0);
   }
--- a/src/share/vm/opto/doCall.cpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/share/vm/opto/doCall.cpp	Sun Feb 07 12:15:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,7 +70,7 @@
   CompileLog* log = this->log();
   if (log != NULL) {
     int rid = (receiver_count >= 0)? log->identify(profile.receiver(0)): -1;
-    int r2id = (profile.morphism() == 2)? log->identify(profile.receiver(1)):-1;
+    int r2id = (rid != -1 && profile.has_receiver(1))? log->identify(profile.receiver(1)):-1;
     log->begin_elem("call method='%d' count='%d' prof_factor='%g'",
                     log->identify(call_method), site_count, prof_factor);
     if (call_is_virtual)  log->print(" virtual='1'");
--- a/src/share/vm/opto/runtime.cpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/share/vm/opto/runtime.cpp	Sun Feb 07 12:15:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -708,7 +708,7 @@
     *(mdp + count_off) = DataLayout::counter_increment;
   } else {
     // Receiver did not match any saved receiver and there is no empty row for it.
-    // Increment total counter to indicate polimorphic case.
+    // Increment total counter to indicate polymorphic case.
     intptr_t* count_p = (intptr_t*)(((byte*)(data)) + in_bytes(CounterData::count_offset()));
     *count_p += DataLayout::counter_increment;
   }
--- a/src/share/vm/runtime/arguments.cpp	Fri Feb 05 11:07:40 2010 -0800
+++ b/src/share/vm/runtime/arguments.cpp	Sun Feb 07 12:15:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2500,6 +2500,9 @@
     SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false));
   }
 
+  // Tiered compilation is undefined with C1.
+  TieredCompilation = false;
+
 #else
   if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) {
     FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1);