src/share/vm/code/nmethod.cpp

changeset 1635
ba263cfb7611
parent 1590
4e6abf09f540
child 1636
24128c2ffa87
     1.1 --- a/src/share/vm/code/nmethod.cpp	Thu Jan 28 20:41:37 2010 -0800
     1.2 +++ b/src/share/vm/code/nmethod.cpp	Fri Jan 29 12:13:05 2010 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * Copyright 1997-2010 Sun Microsystems, Inc.  All Rights Reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -592,6 +592,7 @@
    1.11      // values something that will never match a pc like the nmethod vtable entry
    1.12      _exception_offset        = 0;
    1.13      _deoptimize_offset       = 0;
    1.14 +    _deoptimize_mh_offset    = 0;
    1.15      _orig_pc_offset          = 0;
    1.16  #ifdef HAVE_DTRACE_H
    1.17      _trap_offset             = 0;
    1.18 @@ -682,6 +683,7 @@
    1.19      // values something that will never match a pc like the nmethod vtable entry
    1.20      _exception_offset        = 0;
    1.21      _deoptimize_offset       = 0;
    1.22 +    _deoptimize_mh_offset    = 0;
    1.23      _trap_offset             = offsets->value(CodeOffsets::Dtrace_trap);
    1.24      _orig_pc_offset          = 0;
    1.25      _stub_offset             = data_offset();
    1.26 @@ -794,6 +796,7 @@
    1.27      // Exception handler and deopt handler are in the stub section
    1.28      _exception_offset        = _stub_offset + offsets->value(CodeOffsets::Exceptions);
    1.29      _deoptimize_offset       = _stub_offset + offsets->value(CodeOffsets::Deopt);
    1.30 +    _deoptimize_mh_offset    = _stub_offset + offsets->value(CodeOffsets::DeoptMH);
    1.31      _consts_offset           = instructions_offset() + code_buffer->total_offset_of(code_buffer->consts()->start());
    1.32      _scopes_data_offset      = data_offset();
    1.33      _scopes_pcs_offset       = _scopes_data_offset   + round_to(debug_info->data_size         (), oopSize);
    1.34 @@ -2031,9 +2034,21 @@
    1.35    guarantee(nm->_lock_count >= 0, "unmatched nmethod lock/unlock");
    1.36  }
    1.37  
    1.38 -bool nmethod::is_deopt_pc(address pc) {
    1.39 -  bool ret =  pc == deopt_handler_begin();
    1.40 -  return ret;
    1.41 +
    1.42 +// -----------------------------------------------------------------------------
    1.43 +// nmethod::get_deopt_original_pc
    1.44 +//
    1.45 +// Return the original PC for the given PC if:
    1.46 +// (a) the given PC belongs to a nmethod and
    1.47 +// (b) it is a deopt PC
    1.48 +address nmethod::get_deopt_original_pc(const frame* fr) {
    1.49 +  if (fr->cb() == NULL)  return NULL;
    1.50 +
    1.51 +  nmethod* nm = fr->cb()->as_nmethod_or_null();
    1.52 +  if (nm != NULL && nm->is_deopt_pc(fr->pc()))
    1.53 +    return nm->get_original_pc(fr);
    1.54 +
    1.55 +  return NULL;
    1.56  }
    1.57  
    1.58  
    1.59 @@ -2404,6 +2419,8 @@
    1.60    if (block_begin == verified_entry_point())    stream->print_cr("[Verified Entry Point]");
    1.61    if (block_begin == exception_begin())         stream->print_cr("[Exception Handler]");
    1.62    if (block_begin == stub_begin())              stream->print_cr("[Stub Code]");
    1.63 +  if (block_begin == deopt_handler_begin())     stream->print_cr("[Deopt Handler Code]");
    1.64 +  if (block_begin == deopt_mh_handler_begin())  stream->print_cr("[Deopt MH Handler Code]");
    1.65    if (block_begin == consts_begin())            stream->print_cr("[Constants]");
    1.66    if (block_begin == entry_point()) {
    1.67      methodHandle m = method();

mercurial