src/share/vm/runtime/rframe.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/runtime

src/share/vm/runtime/rframe.cpp

Print this page




  35 
  36 static RFrame*const  noCaller    = (RFrame*) 0x1;               // no caller (i.e., initial frame)
  37 static RFrame*const  noCallerYet = (RFrame*) 0x0;               // caller not yet computed
  38 
  39 RFrame::RFrame(frame fr, JavaThread* thread, RFrame*const callee) :
  40   _fr(fr), _thread(thread), _callee(callee), _num(callee ? callee->num() + 1 : 0) {
  41   _caller = (RFrame*)noCallerYet;
  42   _invocations = 0;
  43   _distance = 0;
  44 }
  45 
  46 void RFrame::set_distance(int d) {
  47   assert(is_compiled() || d >= 0, "should be positive");
  48   _distance = d;
  49 }
  50 
  51 InterpretedRFrame::InterpretedRFrame(frame fr, JavaThread* thread, RFrame*const callee)
  52 : RFrame(fr, thread, callee) {
  53   RegisterMap map(thread, false);
  54   _vf     = javaVFrame::cast(vframe::new_vframe(&_fr, &map, thread));
  55   _method = methodHandle(thread, _vf->method());
  56   assert(   _vf->is_interpreted_frame(), "must be interpreted");
  57   init();
  58 }
  59 
  60 InterpretedRFrame::InterpretedRFrame(frame fr, JavaThread* thread, methodHandle m)
  61 : RFrame(fr, thread, NULL) {
  62   RegisterMap map(thread, false);
  63   _vf     = javaVFrame::cast(vframe::new_vframe(&_fr, &map, thread));
  64   _method = m;
  65 
  66   assert(   _vf->is_interpreted_frame(),  "must be interpreted");
  67   init();
  68 }
  69 
  70 CompiledRFrame::CompiledRFrame(frame fr, JavaThread* thread, RFrame*const  callee)
  71 : RFrame(fr, thread, callee) {
  72   init();
  73 }
  74 
  75 CompiledRFrame::CompiledRFrame(frame fr, JavaThread* thread)
  76 : RFrame(fr, thread, NULL) {
  77   init();
  78 }
  79 
  80 DeoptimizedRFrame::DeoptimizedRFrame(frame fr, JavaThread* thread, RFrame*const  callee)


 123   return _method->code_size();    // fix this
 124   //return _method->estimated_inline_cost(_receiverKlass);
 125 }
 126 
 127 int CompiledRFrame::cost() const {
 128   nmethod* nm = top_method()->code();
 129   if (nm != NULL) {
 130     return nm->insts_size();
 131   } else {
 132     return top_method()->code_size();
 133   }
 134 }
 135 
 136 void CompiledRFrame::init() {
 137   RegisterMap map(thread(), false);
 138   vframe* vf = vframe::new_vframe(&_fr, &map, thread());
 139   assert(vf->is_compiled_frame(), "must be compiled");
 140   _nm = compiledVFrame::cast(vf)->code();
 141   vf = vf->top();
 142   _vf = javaVFrame::cast(vf);
 143   _method = methodHandle(thread(), CodeCache::find_nmethod(_fr.pc())->method());
 144   assert(_method(), "should have found a method");
 145 #ifndef PRODUCT
 146   _invocations = _method->compiled_invocation_count();
 147 #endif
 148 }
 149 
 150 void InterpretedRFrame::init() {
 151   _invocations = _method->invocation_count() + _method->backedge_count();
 152 }
 153 
 154 void RFrame::print(const char* kind) {
 155 #ifndef PRODUCT
 156 #ifdef COMPILER2
 157   int cnt = top_method()->interpreter_invocation_count();
 158 #else
 159   int cnt = top_method()->invocation_count();
 160 #endif
 161   tty->print("%3d %s ", _num, is_interpreted() ? "I" : "C");
 162   top_method()->print_short_name(tty);
 163   tty->print_cr(": inv=%5d(%d) cst=%4d", _invocations, cnt, cost());
 164 #endif


  35 
  36 static RFrame*const  noCaller    = (RFrame*) 0x1;               // no caller (i.e., initial frame)
  37 static RFrame*const  noCallerYet = (RFrame*) 0x0;               // caller not yet computed
  38 
  39 RFrame::RFrame(frame fr, JavaThread* thread, RFrame*const callee) :
  40   _fr(fr), _thread(thread), _callee(callee), _num(callee ? callee->num() + 1 : 0) {
  41   _caller = (RFrame*)noCallerYet;
  42   _invocations = 0;
  43   _distance = 0;
  44 }
  45 
  46 void RFrame::set_distance(int d) {
  47   assert(is_compiled() || d >= 0, "should be positive");
  48   _distance = d;
  49 }
  50 
  51 InterpretedRFrame::InterpretedRFrame(frame fr, JavaThread* thread, RFrame*const callee)
  52 : RFrame(fr, thread, callee) {
  53   RegisterMap map(thread, false);
  54   _vf     = javaVFrame::cast(vframe::new_vframe(&_fr, &map, thread));
  55   _method = _vf->method();
  56   assert(   _vf->is_interpreted_frame(), "must be interpreted");
  57   init();
  58 }
  59 
  60 InterpretedRFrame::InterpretedRFrame(frame fr, JavaThread* thread, Method* m)
  61 : RFrame(fr, thread, NULL) {
  62   RegisterMap map(thread, false);
  63   _vf     = javaVFrame::cast(vframe::new_vframe(&_fr, &map, thread));
  64   _method = m;
  65 
  66   assert(   _vf->is_interpreted_frame(),  "must be interpreted");
  67   init();
  68 }
  69 
  70 CompiledRFrame::CompiledRFrame(frame fr, JavaThread* thread, RFrame*const  callee)
  71 : RFrame(fr, thread, callee) {
  72   init();
  73 }
  74 
  75 CompiledRFrame::CompiledRFrame(frame fr, JavaThread* thread)
  76 : RFrame(fr, thread, NULL) {
  77   init();
  78 }
  79 
  80 DeoptimizedRFrame::DeoptimizedRFrame(frame fr, JavaThread* thread, RFrame*const  callee)


 123   return _method->code_size();    // fix this
 124   //return _method->estimated_inline_cost(_receiverKlass);
 125 }
 126 
 127 int CompiledRFrame::cost() const {
 128   nmethod* nm = top_method()->code();
 129   if (nm != NULL) {
 130     return nm->insts_size();
 131   } else {
 132     return top_method()->code_size();
 133   }
 134 }
 135 
 136 void CompiledRFrame::init() {
 137   RegisterMap map(thread(), false);
 138   vframe* vf = vframe::new_vframe(&_fr, &map, thread());
 139   assert(vf->is_compiled_frame(), "must be compiled");
 140   _nm = compiledVFrame::cast(vf)->code();
 141   vf = vf->top();
 142   _vf = javaVFrame::cast(vf);
 143   _method = CodeCache::find_nmethod(_fr.pc())->method();
 144   assert(_method, "should have found a method");
 145 #ifndef PRODUCT
 146   _invocations = _method->compiled_invocation_count();
 147 #endif
 148 }
 149 
 150 void InterpretedRFrame::init() {
 151   _invocations = _method->invocation_count() + _method->backedge_count();
 152 }
 153 
 154 void RFrame::print(const char* kind) {
 155 #ifndef PRODUCT
 156 #ifdef COMPILER2
 157   int cnt = top_method()->interpreter_invocation_count();
 158 #else
 159   int cnt = top_method()->invocation_count();
 160 #endif
 161   tty->print("%3d %s ", _num, is_interpreted() ? "I" : "C");
 162   top_method()->print_short_name(tty);
 163   tty->print_cr(": inv=%5d(%d) cst=%4d", _invocations, cnt, cost());
 164 #endif
src/share/vm/runtime/rframe.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File