src/share/vm/ci/ciMethod.cpp

changeset 4267
bd7a7ce2e264
parent 4251
18fb7da42534
child 4268
bb33c6fdcf0d
     1.1 --- a/src/share/vm/ci/ciMethod.cpp	Fri Nov 09 08:36:17 2012 -0800
     1.2 +++ b/src/share/vm/ci/ciMethod.cpp	Mon Nov 12 14:03:53 2012 -0800
     1.3 @@ -31,6 +31,7 @@
     1.4  #include "ci/ciMethodData.hpp"
     1.5  #include "ci/ciStreams.hpp"
     1.6  #include "ci/ciSymbol.hpp"
     1.7 +#include "ci/ciReplay.hpp"
     1.8  #include "ci/ciUtilities.hpp"
     1.9  #include "classfile/systemDictionary.hpp"
    1.10  #include "compiler/abstractCompiler.hpp"
    1.11 @@ -139,6 +140,12 @@
    1.12    }
    1.13    if (_interpreter_invocation_count == 0)
    1.14      _interpreter_invocation_count = 1;
    1.15 +  _instructions_size = -1;
    1.16 +#ifdef ASSERT
    1.17 +  if (ReplayCompiles) {
    1.18 +    ciReplay::initialize(this);
    1.19 +  }
    1.20 +#endif
    1.21  }
    1.22  
    1.23  
    1.24 @@ -161,7 +168,8 @@
    1.25  #if defined(COMPILER2) || defined(SHARK)
    1.26    ,
    1.27    _flow(                   NULL),
    1.28 -  _bcea(                   NULL)
    1.29 +  _bcea(                   NULL),
    1.30 +  _instructions_size(-1)
    1.31  #endif // COMPILER2 || SHARK
    1.32  {
    1.33    // Usually holder and accessor are the same type but in some cases
    1.34 @@ -1000,8 +1008,7 @@
    1.35  // ------------------------------------------------------------------
    1.36  // ciMethod::has_compiled_code
    1.37  bool ciMethod::has_compiled_code() {
    1.38 -  VM_ENTRY_MARK;
    1.39 -  return get_Method()->code() != NULL;
    1.40 +  return instructions_size() > 0;
    1.41  }
    1.42  
    1.43  int ciMethod::comp_level() {
    1.44 @@ -1039,14 +1046,18 @@
    1.45  // junk like exception handler, stubs, and constant table, which are
    1.46  // not highly relevant to an inlined method.  So we use the more
    1.47  // specific accessor nmethod::insts_size.
    1.48 -int ciMethod::instructions_size(int comp_level) {
    1.49 -  GUARDED_VM_ENTRY(
    1.50 -    nmethod* code = get_Method()->code();
    1.51 -    if (code != NULL && (comp_level == CompLevel_any || comp_level == code->comp_level())) {
    1.52 -      return code->insts_end() - code->verified_entry_point();
    1.53 -    }
    1.54 -    return 0;
    1.55 -  )
    1.56 +int ciMethod::instructions_size() {
    1.57 +  if (_instructions_size == -1) {
    1.58 +    GUARDED_VM_ENTRY(
    1.59 +                     nmethod* code = get_Method()->code();
    1.60 +                     if (code != NULL && (code->comp_level() == CompLevel_full_optimization)) {
    1.61 +                       _instructions_size = code->insts_end() - code->verified_entry_point();
    1.62 +                     } else {
    1.63 +                       _instructions_size = 0;
    1.64 +                     }
    1.65 +                     );
    1.66 +  }
    1.67 +  return _instructions_size;
    1.68  }
    1.69  
    1.70  // ------------------------------------------------------------------
    1.71 @@ -1166,6 +1177,20 @@
    1.72  
    1.73  #undef FETCH_FLAG_FROM_VM
    1.74  
    1.75 +void ciMethod::dump_replay_data(outputStream* st) {
    1.76 +  ASSERT_IN_VM;
    1.77 +  Method* method = get_Method();
    1.78 +  Klass*  holder = method->method_holder();
    1.79 +  st->print_cr("ciMethod %s %s %s %d %d %d %d %d",
    1.80 +               holder->name()->as_quoted_ascii(),
    1.81 +               method->name()->as_quoted_ascii(),
    1.82 +               method->signature()->as_quoted_ascii(),
    1.83 +               method->invocation_counter()->raw_counter(),
    1.84 +               method->backedge_counter()->raw_counter(),
    1.85 +               interpreter_invocation_count(),
    1.86 +               interpreter_throwout_count(),
    1.87 +               _instructions_size);
    1.88 +}
    1.89  
    1.90  // ------------------------------------------------------------------
    1.91  // ciMethod::print_codes

mercurial