src/share/vm/code/nmethod.cpp

changeset 1636
24128c2ffa87
parent 1635
ba263cfb7611
child 1637
5f24d0319e54
equal deleted inserted replaced
1635:ba263cfb7611 1636:24128c2ffa87
1 /* 1 /*
2 * Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
590 _compiler = NULL; 590 _compiler = NULL;
591 // We have no exception handler or deopt handler make the 591 // We have no exception handler or deopt handler make the
592 // values something that will never match a pc like the nmethod vtable entry 592 // values something that will never match a pc like the nmethod vtable entry
593 _exception_offset = 0; 593 _exception_offset = 0;
594 _deoptimize_offset = 0; 594 _deoptimize_offset = 0;
595 _deoptimize_mh_offset = 0;
596 _orig_pc_offset = 0; 595 _orig_pc_offset = 0;
597 #ifdef HAVE_DTRACE_H 596 #ifdef HAVE_DTRACE_H
598 _trap_offset = 0; 597 _trap_offset = 0;
599 #endif // def HAVE_DTRACE_H 598 #endif // def HAVE_DTRACE_H
600 _stub_offset = data_offset(); 599 _stub_offset = data_offset();
681 _compiler = NULL; 680 _compiler = NULL;
682 // We have no exception handler or deopt handler make the 681 // We have no exception handler or deopt handler make the
683 // values something that will never match a pc like the nmethod vtable entry 682 // values something that will never match a pc like the nmethod vtable entry
684 _exception_offset = 0; 683 _exception_offset = 0;
685 _deoptimize_offset = 0; 684 _deoptimize_offset = 0;
686 _deoptimize_mh_offset = 0;
687 _trap_offset = offsets->value(CodeOffsets::Dtrace_trap); 685 _trap_offset = offsets->value(CodeOffsets::Dtrace_trap);
688 _orig_pc_offset = 0; 686 _orig_pc_offset = 0;
689 _stub_offset = data_offset(); 687 _stub_offset = data_offset();
690 _consts_offset = data_offset(); 688 _consts_offset = data_offset();
691 _scopes_data_offset = data_offset(); 689 _scopes_data_offset = data_offset();
794 _stub_offset = instructions_offset() + code_buffer->total_offset_of(code_buffer->stubs()->start()); 792 _stub_offset = instructions_offset() + code_buffer->total_offset_of(code_buffer->stubs()->start());
795 793
796 // Exception handler and deopt handler are in the stub section 794 // Exception handler and deopt handler are in the stub section
797 _exception_offset = _stub_offset + offsets->value(CodeOffsets::Exceptions); 795 _exception_offset = _stub_offset + offsets->value(CodeOffsets::Exceptions);
798 _deoptimize_offset = _stub_offset + offsets->value(CodeOffsets::Deopt); 796 _deoptimize_offset = _stub_offset + offsets->value(CodeOffsets::Deopt);
799 _deoptimize_mh_offset = _stub_offset + offsets->value(CodeOffsets::DeoptMH);
800 _consts_offset = instructions_offset() + code_buffer->total_offset_of(code_buffer->consts()->start()); 797 _consts_offset = instructions_offset() + code_buffer->total_offset_of(code_buffer->consts()->start());
801 _scopes_data_offset = data_offset(); 798 _scopes_data_offset = data_offset();
802 _scopes_pcs_offset = _scopes_data_offset + round_to(debug_info->data_size (), oopSize); 799 _scopes_pcs_offset = _scopes_data_offset + round_to(debug_info->data_size (), oopSize);
803 _dependencies_offset = _scopes_pcs_offset + adjust_pcs_size(debug_info->pcs_size()); 800 _dependencies_offset = _scopes_pcs_offset + adjust_pcs_size(debug_info->pcs_size());
804 _handler_table_offset = _dependencies_offset + round_to(dependencies->size_in_bytes (), oopSize); 801 _handler_table_offset = _dependencies_offset + round_to(dependencies->size_in_bytes (), oopSize);
2032 if (nm == NULL) return; 2029 if (nm == NULL) return;
2033 Atomic::dec(&nm->_lock_count); 2030 Atomic::dec(&nm->_lock_count);
2034 guarantee(nm->_lock_count >= 0, "unmatched nmethod lock/unlock"); 2031 guarantee(nm->_lock_count >= 0, "unmatched nmethod lock/unlock");
2035 } 2032 }
2036 2033
2037 2034 bool nmethod::is_deopt_pc(address pc) {
2038 // ----------------------------------------------------------------------------- 2035 bool ret = pc == deopt_handler_begin();
2039 // nmethod::get_deopt_original_pc 2036 return ret;
2040 //
2041 // Return the original PC for the given PC if:
2042 // (a) the given PC belongs to a nmethod and
2043 // (b) it is a deopt PC
2044 address nmethod::get_deopt_original_pc(const frame* fr) {
2045 if (fr->cb() == NULL) return NULL;
2046
2047 nmethod* nm = fr->cb()->as_nmethod_or_null();
2048 if (nm != NULL && nm->is_deopt_pc(fr->pc()))
2049 return nm->get_original_pc(fr);
2050
2051 return NULL;
2052 } 2037 }
2053 2038
2054 2039
2055 // ----------------------------------------------------------------------------- 2040 // -----------------------------------------------------------------------------
2056 // MethodHandle 2041 // MethodHandle
2417 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) { 2402 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) {
2418 if (block_begin == entry_point()) stream->print_cr("[Entry Point]"); 2403 if (block_begin == entry_point()) stream->print_cr("[Entry Point]");
2419 if (block_begin == verified_entry_point()) stream->print_cr("[Verified Entry Point]"); 2404 if (block_begin == verified_entry_point()) stream->print_cr("[Verified Entry Point]");
2420 if (block_begin == exception_begin()) stream->print_cr("[Exception Handler]"); 2405 if (block_begin == exception_begin()) stream->print_cr("[Exception Handler]");
2421 if (block_begin == stub_begin()) stream->print_cr("[Stub Code]"); 2406 if (block_begin == stub_begin()) stream->print_cr("[Stub Code]");
2422 if (block_begin == deopt_handler_begin()) stream->print_cr("[Deopt Handler Code]");
2423 if (block_begin == deopt_mh_handler_begin()) stream->print_cr("[Deopt MH Handler Code]");
2424 if (block_begin == consts_begin()) stream->print_cr("[Constants]"); 2407 if (block_begin == consts_begin()) stream->print_cr("[Constants]");
2425 if (block_begin == entry_point()) { 2408 if (block_begin == entry_point()) {
2426 methodHandle m = method(); 2409 methodHandle m = method();
2427 if (m.not_null()) { 2410 if (m.not_null()) {
2428 stream->print(" # "); 2411 stream->print(" # ");

mercurial