Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/frame_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
*pc_addr = signed_pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {
inline void frame::setup(address pc) {
adjust_unextended_sp();

address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -178,7 +178,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) {
_cb = CodeCache::find_blob(_pc);
adjust_unextended_sp();

address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/arm/frame_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
*pc_addr = pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/arm/frame_arm.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ inline void frame::init(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, add
adjust_unextended_sp();
DEBUG_ONLY(_frame_index = -1;)

address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
_pc = original_pc;
assert(_cb->as_nmethod()->insts_contains_inclusive(_pc),
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/frame_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
own_abi()->lr = (uint64_t)pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/frame_ppc.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ inline void frame::setup(kind knd) {
}
}

address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/frame_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
*pc_addr = pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/frame_riscv.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ inline void frame::init(intptr_t* ptr_sp, intptr_t* ptr_fp, address pc) {
inline void frame::setup(address pc) {
adjust_unextended_sp();

address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -170,7 +170,7 @@ inline frame::frame(intptr_t* ptr_sp, intptr_t* ptr_fp) {
_cb = CodeCache::find_blob(_pc);
adjust_unextended_sp();

address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/s390/frame_s390.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
own_abi()->return_pc = (uint64_t)pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
// assert(original_pc == _pc, "expected original to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/s390/frame_s390.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ inline void frame::setup() {
assert(_on_heap || (is_aligned(_sp, alignment_in_bytes) && is_aligned(_fp, alignment_in_bytes)),
"invalid alignment sp:" PTR_FORMAT " unextended_sp:" PTR_FORMAT " fp:" PTR_FORMAT, p2i(_sp), p2i(_unextended_sp), p2i(_fp));

address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/frame_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void frame::patch_pc(Thread* thread, address pc) {
DEBUG_ONLY(address old_pc = _pc;)
*pc_addr = pc;
_pc = pc; // must be set before call to get_deopt_original_pc
address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/x86/frame_x86.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {
inline void frame::setup(address pc) {
adjust_unextended_sp();

address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -164,7 +164,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) {
_cb = CodeCache::find_blob(_pc);
adjust_unextended_sp();

address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = get_deopt_original_pc();
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/ci/ciEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ void ciEnv::register_method(ciMethod* target,
task()->comp_level(), method_name);
}
// Allow the code to be executed
MutexLocker ml(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
MutexLocker ml(NMethodState_lock, Mutex::_no_safepoint_check_flag);
if (nm->make_in_use()) {
method->set_code(method, nm);
}
Expand All @@ -1172,7 +1172,7 @@ void ciEnv::register_method(ciMethod* target,
lt.print("Installing osr method (%d) %s @ %d",
task()->comp_level(), method_name, entry_bci);
}
MutexLocker ml(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
MutexLocker ml(NMethodState_lock, Mutex::_no_safepoint_check_flag);
if (nm->make_in_use()) {
method->method_holder()->add_osr_nmethod(nm);
}
Expand Down
44 changes: 22 additions & 22 deletions src/hotspot/share/code/codeCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,8 @@ CodeBlob* CodeCache::find_blob(void* start) {

nmethod* CodeCache::find_nmethod(void* start) {
CodeBlob* cb = find_blob(start);
assert(cb != nullptr, "did not find an nmethod");
return cb->as_nmethod();
assert(cb == nullptr || cb->is_nmethod(), "did not find an nmethod");
return (nmethod*)cb;
}

void CodeCache::blobs_do(void f(CodeBlob* nm)) {
Expand All @@ -679,15 +679,15 @@ void CodeCache::blobs_do(void f(CodeBlob* nm)) {

void CodeCache::nmethods_do(void f(nmethod* nm)) {
assert_locked_or_safepoint(CodeCache_lock);
NMethodIterator iter(NMethodIterator::all_blobs);
NMethodIterator iter(NMethodIterator::all);
while(iter.next()) {
f(iter.method());
}
}

void CodeCache::metadata_do(MetadataClosure* f) {
assert_locked_or_safepoint(CodeCache_lock);
NMethodIterator iter(NMethodIterator::all_blobs);
NMethodIterator iter(NMethodIterator::all);
while(iter.next()) {
iter.method()->metadata_do(f);
}
Expand Down Expand Up @@ -877,7 +877,7 @@ void CodeCache::arm_all_nmethods() {
// Mark nmethods for unloading if they contain otherwise unreachable oops.
void CodeCache::do_unloading(bool unloading_occurred) {
assert_locked_or_safepoint(CodeCache_lock);
NMethodIterator iter(NMethodIterator::all_blobs);
NMethodIterator iter(NMethodIterator::all);
while(iter.next()) {
iter.method()->do_unloading(unloading_occurred);
}
Expand All @@ -899,7 +899,7 @@ void CodeCache::blobs_do(CodeBlobClosure* f) {

void CodeCache::verify_clean_inline_caches() {
#ifdef ASSERT
NMethodIterator iter(NMethodIterator::only_not_unloading);
NMethodIterator iter(NMethodIterator::not_unloading);
while(iter.next()) {
nmethod* nm = iter.method();
nm->verify_clean_inline_caches();
Expand Down Expand Up @@ -978,7 +978,7 @@ CodeCache::UnlinkingScope::~UnlinkingScope() {
void CodeCache::verify_oops() {
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
VerifyOopClosure voc;
NMethodIterator iter(NMethodIterator::only_not_unloading);
NMethodIterator iter(NMethodIterator::not_unloading);
while(iter.next()) {
nmethod* nm = iter.method();
nm->oops_do(&voc);
Expand Down Expand Up @@ -1006,8 +1006,8 @@ int CodeCache::nmethod_count(CodeBlobType code_blob_type) {

int CodeCache::nmethod_count() {
int count = 0;
for (GrowableArrayIterator<CodeHeap*> heap = _nmethod_heaps->begin(); heap != _nmethod_heaps->end(); ++heap) {
count += (*heap)->nmethod_count();
for (CodeHeap* heap : *_nmethod_heaps) {
count += heap->nmethod_count();
}
return count;
}
Expand Down Expand Up @@ -1173,7 +1173,7 @@ bool CodeCache::has_nmethods_with_dependencies() {

void CodeCache::clear_inline_caches() {
assert_locked_or_safepoint(CodeCache_lock);
NMethodIterator iter(NMethodIterator::only_not_unloading);
NMethodIterator iter(NMethodIterator::not_unloading);
while(iter.next()) {
iter.method()->clear_inline_caches();
}
Expand All @@ -1182,7 +1182,7 @@ void CodeCache::clear_inline_caches() {
// Only used by whitebox API
void CodeCache::cleanup_inline_caches_whitebox() {
assert_locked_or_safepoint(CodeCache_lock);
NMethodIterator iter(NMethodIterator::only_not_unloading);
NMethodIterator iter(NMethodIterator::not_unloading);
while(iter.next()) {
iter.method()->cleanup_inline_caches_whitebox();
}
Expand Down Expand Up @@ -1210,7 +1210,7 @@ static void check_live_nmethods_dependencies(DepChange& changes) {

// Iterate over live nmethods and check dependencies of all nmethods that are not
// marked for deoptimization. A particular dependency is only checked once.
NMethodIterator iter(NMethodIterator::only_not_unloading);
NMethodIterator iter(NMethodIterator::not_unloading);
while(iter.next()) {
nmethod* nm = iter.method();
// Only notify for live nmethods
Expand Down Expand Up @@ -1318,7 +1318,7 @@ void CodeCache::mark_dependents_for_evol_deoptimization(DeoptimizationScope* deo
// So delete old method table and create a new one.
reset_old_method_table();

NMethodIterator iter(NMethodIterator::all_blobs);
NMethodIterator iter(NMethodIterator::all);
while(iter.next()) {
nmethod* nm = iter.method();
// Walk all alive nmethods to check for old Methods.
Expand All @@ -1333,7 +1333,7 @@ void CodeCache::mark_dependents_for_evol_deoptimization(DeoptimizationScope* deo

void CodeCache::mark_all_nmethods_for_evol_deoptimization(DeoptimizationScope* deopt_scope) {
assert(SafepointSynchronize::is_at_safepoint(), "Can only do this at a safepoint!");
NMethodIterator iter(NMethodIterator::all_blobs);
NMethodIterator iter(NMethodIterator::all);
while(iter.next()) {
nmethod* nm = iter.method();
if (!nm->method()->is_method_handle_intrinsic()) {
Expand All @@ -1354,7 +1354,7 @@ void CodeCache::mark_directives_matches(bool top_only) {
Thread *thread = Thread::current();
HandleMark hm(thread);

NMethodIterator iter(NMethodIterator::only_not_unloading);
NMethodIterator iter(NMethodIterator::not_unloading);
while(iter.next()) {
nmethod* nm = iter.method();
methodHandle mh(thread, nm->method());
Expand All @@ -1372,7 +1372,7 @@ void CodeCache::recompile_marked_directives_matches() {

// Try the max level and let the directives be applied during the compilation.
int comp_level = CompilationPolicy::highest_compile_level();
RelaxedNMethodIterator iter(RelaxedNMethodIterator::only_not_unloading);
RelaxedNMethodIterator iter(RelaxedNMethodIterator::not_unloading);
while(iter.next()) {
nmethod* nm = iter.method();
methodHandle mh(thread, nm->method());
Expand Down Expand Up @@ -1413,7 +1413,7 @@ void CodeCache::recompile_marked_directives_matches() {
// Mark methods for deopt (if safe or possible).
void CodeCache::mark_all_nmethods_for_deoptimization(DeoptimizationScope* deopt_scope) {
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
NMethodIterator iter(NMethodIterator::only_not_unloading);
NMethodIterator iter(NMethodIterator::not_unloading);
while(iter.next()) {
nmethod* nm = iter.method();
if (!nm->is_native_method()) {
Expand All @@ -1425,7 +1425,7 @@ void CodeCache::mark_all_nmethods_for_deoptimization(DeoptimizationScope* deopt_
void CodeCache::mark_for_deoptimization(DeoptimizationScope* deopt_scope, Method* dependee) {
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);

NMethodIterator iter(NMethodIterator::only_not_unloading);
NMethodIterator iter(NMethodIterator::not_unloading);
while(iter.next()) {
nmethod* nm = iter.method();
if (nm->is_dependent_on_method(dependee)) {
Expand All @@ -1435,7 +1435,7 @@ void CodeCache::mark_for_deoptimization(DeoptimizationScope* deopt_scope, Method
}

void CodeCache::make_marked_nmethods_deoptimized() {
RelaxedNMethodIterator iter(RelaxedNMethodIterator::only_not_unloading);
RelaxedNMethodIterator iter(RelaxedNMethodIterator::not_unloading);
while(iter.next()) {
nmethod* nm = iter.method();
if (nm->is_marked_for_deoptimization() && !nm->has_been_deoptimized() && nm->can_be_deoptimized()) {
Expand Down Expand Up @@ -1647,7 +1647,7 @@ void CodeCache::print_internals() {
int *buckets = NEW_C_HEAP_ARRAY(int, bucketLimit, mtCode);
memset(buckets, 0, sizeof(int) * bucketLimit);

NMethodIterator iter(NMethodIterator::all_blobs);
NMethodIterator iter(NMethodIterator::all);
while(iter.next()) {
nmethod* nm = iter.method();
if(nm->method() != nullptr && nm->is_java_method()) {
Expand Down Expand Up @@ -1838,7 +1838,7 @@ void CodeCache::print_summary(outputStream* st, bool detailed) {
void CodeCache::print_codelist(outputStream* st) {
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);

NMethodIterator iter(NMethodIterator::only_not_unloading);
NMethodIterator iter(NMethodIterator::not_unloading);
while (iter.next()) {
nmethod* nm = iter.method();
ResourceMark rm;
Expand Down Expand Up @@ -1881,7 +1881,7 @@ void CodeCache::write_perf_map(const char* filename) {
return;
}

AllCodeBlobsIterator iter(AllCodeBlobsIterator::only_not_unloading);
AllCodeBlobsIterator iter(AllCodeBlobsIterator::not_unloading);
while (iter.next()) {
CodeBlob *cb = iter.method();
ResourceMark rm;
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/code/codeCache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,13 @@ class CodeCache : AllStatic {
// The relaxed iterators only hold the CodeCache_lock across next calls
template <class T, class Filter, bool is_relaxed> class CodeBlobIterator : public StackObj {
public:
enum LivenessFilter { all_blobs, only_not_unloading };
enum LivenessFilter { all, not_unloading };

private:
CodeBlob* _code_blob; // Current CodeBlob
GrowableArrayIterator<CodeHeap*> _heap;
GrowableArrayIterator<CodeHeap*> _end;
bool _only_not_unloading;
bool _not_unloading; // Those nmethods that are not unloading

void initialize_iteration(T* nm) {
}
Expand All @@ -360,7 +360,7 @@ template <class T, class Filter, bool is_relaxed> class CodeBlobIterator : publi
}

// Filter is_unloading as required
if (_only_not_unloading) {
if (_not_unloading) {
nmethod* nm = _code_blob->as_nmethod_or_null();
if (nm != nullptr && nm->is_unloading()) {
continue;
Expand All @@ -373,7 +373,7 @@ template <class T, class Filter, bool is_relaxed> class CodeBlobIterator : publi

public:
CodeBlobIterator(LivenessFilter filter, T* nm = nullptr)
: _only_not_unloading(filter == only_not_unloading)
: _not_unloading(filter == not_unloading)
{
if (Filter::heaps() == nullptr) {
// The iterator is supposed to shortcut since we have
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/code/compiledIC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ void CompiledDirectCall::set_to_clean() {
void CompiledDirectCall::set(const methodHandle& callee_method) {
nmethod* code = callee_method->code();
nmethod* caller = CodeCache::find_nmethod(instruction_address());
assert(caller != nullptr, "did not find caller nmethod");

bool to_interp_cont_enter = caller->method()->is_continuation_enter_intrinsic() &&
ContinuationEntry::is_interpreted_call(instruction_address());
Expand Down Expand Up @@ -378,11 +379,13 @@ bool CompiledDirectCall::is_call_to_interpreted() const {
// It is a call to interpreted, if it calls to a stub. Hence, the destination
// must be in the stub part of the nmethod that contains the call
nmethod* nm = CodeCache::find_nmethod(instruction_address());
assert(nm != nullptr, "did not find nmethod");
return nm->stub_contains(destination());
}

bool CompiledDirectCall::is_call_to_compiled() const {
nmethod* caller = CodeCache::find_nmethod(instruction_address());
assert(caller != nullptr, "did not find caller nmethod");
CodeBlob* dest_cb = CodeCache::find_blob(destination());
return !caller->stub_contains(destination()) && dest_cb->is_nmethod();
}
Expand Down
Loading