src/share/vm/oops/methodData.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8031320_8u Sdiff src/share/vm/oops

src/share/vm/oops/methodData.cpp

Print this page
rev 5968 : 8031320: Use Intel RTM instructions for locks
Summary: Use RTM for inflated locks and stack locks.
Reviewed-by: iveresov, twisti, roland, dcubed


   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  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"

  27 #include "interpreter/bytecode.hpp"
  28 #include "interpreter/bytecodeStream.hpp"
  29 #include "interpreter/linkResolver.hpp"
  30 #include "memory/heapInspection.hpp"
  31 #include "oops/methodData.hpp"
  32 #include "prims/jvmtiRedefineClasses.hpp"
  33 #include "runtime/compilationPolicy.hpp"
  34 #include "runtime/deoptimization.hpp"
  35 #include "runtime/handles.inline.hpp"
  36 
  37 // ==================================================================
  38 // DataLayout
  39 //
  40 // Overlay for generic profiling data.
  41 
  42 // Some types of data layouts need a length field.
  43 bool DataLayout::needs_array_len(u1 tag) {
  44   return (tag == multi_branch_data_tag) || (tag == arg_info_data_tag) || (tag == parameters_type_data_tag);
  45 }
  46 


1131   // In that situation, _hint_di is never used, but at
1132   // least well-defined.
1133   _hint_di = first_di();
1134 
1135   post_initialize(&stream);
1136 
1137   set_size(object_size);
1138 }
1139 
1140 void MethodData::init() {
1141   _invocation_counter.init();
1142   _backedge_counter.init();
1143   _invocation_counter_start = 0;
1144   _backedge_counter_start = 0;
1145   _num_loops = 0;
1146   _num_blocks = 0;
1147   _highest_comp_level = 0;
1148   _highest_osr_comp_level = 0;
1149   _would_profile = true;
1150 















1151   // Initialize flags and trap history.
1152   _nof_decompiles = 0;
1153   _nof_overflow_recompiles = 0;
1154   _nof_overflow_traps = 0;
1155   clear_escape_info();
1156   assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align");
1157   Copy::zero_to_words((HeapWord*) &_trap_hist,
1158                       sizeof(_trap_hist) / sizeof(HeapWord));
1159 }
1160 
1161 // Get a measure of how much mileage the method has on it.
1162 int MethodData::mileage_of(Method* method) {
1163   int mileage = 0;
1164   if (TieredCompilation) {
1165     mileage = MAX2(method->invocation_count(), method->backedge_count());
1166   } else {
1167     int iic = method->interpreter_invocation_count();
1168     if (mileage < iic)  mileage = iic;
1169     MethodCounters* mcs = method->method_counters();
1170     if (mcs != NULL) {




   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  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "compiler/compilerOracle.hpp"
  28 #include "interpreter/bytecode.hpp"
  29 #include "interpreter/bytecodeStream.hpp"
  30 #include "interpreter/linkResolver.hpp"
  31 #include "memory/heapInspection.hpp"
  32 #include "oops/methodData.hpp"
  33 #include "prims/jvmtiRedefineClasses.hpp"
  34 #include "runtime/compilationPolicy.hpp"
  35 #include "runtime/deoptimization.hpp"
  36 #include "runtime/handles.inline.hpp"
  37 
  38 // ==================================================================
  39 // DataLayout
  40 //
  41 // Overlay for generic profiling data.
  42 
  43 // Some types of data layouts need a length field.
  44 bool DataLayout::needs_array_len(u1 tag) {
  45   return (tag == multi_branch_data_tag) || (tag == arg_info_data_tag) || (tag == parameters_type_data_tag);
  46 }
  47 


1132   // In that situation, _hint_di is never used, but at
1133   // least well-defined.
1134   _hint_di = first_di();
1135 
1136   post_initialize(&stream);
1137 
1138   set_size(object_size);
1139 }
1140 
1141 void MethodData::init() {
1142   _invocation_counter.init();
1143   _backedge_counter.init();
1144   _invocation_counter_start = 0;
1145   _backedge_counter_start = 0;
1146   _num_loops = 0;
1147   _num_blocks = 0;
1148   _highest_comp_level = 0;
1149   _highest_osr_comp_level = 0;
1150   _would_profile = true;
1151 
1152 #if INCLUDE_RTM_OPT
1153   _rtm_state = NoRTM; // No RTM lock eliding by default
1154   if (UseRTMLocking &&
1155       !CompilerOracle::has_option_string(_method, "NoRTMLockEliding")) {
1156     if (CompilerOracle::has_option_string(_method, "UseRTMLockEliding") || !UseRTMDeopt) {
1157       // Generate RTM lock eliding code without abort ratio calculation code.
1158       _rtm_state = UseRTM;
1159     } else if (UseRTMDeopt) {
1160       // Generate RTM lock eliding code and include abort ratio calculation
1161       // code if UseRTMDeopt is on.
1162       _rtm_state = ProfileRTM;
1163     }
1164   }
1165 #endif
1166 
1167   // Initialize flags and trap history.
1168   _nof_decompiles = 0;
1169   _nof_overflow_recompiles = 0;
1170   _nof_overflow_traps = 0;
1171   clear_escape_info();
1172   assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align");
1173   Copy::zero_to_words((HeapWord*) &_trap_hist,
1174                       sizeof(_trap_hist) / sizeof(HeapWord));
1175 }
1176 
1177 // Get a measure of how much mileage the method has on it.
1178 int MethodData::mileage_of(Method* method) {
1179   int mileage = 0;
1180   if (TieredCompilation) {
1181     mileage = MAX2(method->invocation_count(), method->backedge_count());
1182   } else {
1183     int iic = method->interpreter_invocation_count();
1184     if (mileage < iic)  mileage = iic;
1185     MethodCounters* mcs = method->method_counters();
1186     if (mcs != NULL) {


src/share/vm/oops/methodData.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File