Skip to content

Commit

Permalink
8329332: Remove CompiledMethod and CodeBlobLayout classes
Browse files Browse the repository at this point in the history
Reviewed-by: vlivanov, stefank
  • Loading branch information
Vladimir Kozlov committed Apr 4, 2024
1 parent 28216aa commit 83eba86
Show file tree
Hide file tree
Showing 118 changed files with 2,114 additions and 2,580 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/cpu/aarch64/continuationEntry_aarch64.inline.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -35,7 +35,7 @@
inline frame ContinuationEntry::to_frame() const {
static CodeBlob* cb = CodeCache::find_blob_fast(entry_pc());
assert(cb != nullptr, "");
assert(cb->as_compiled_method()->method()->is_continuation_enter_intrinsic(), "");
assert(cb->as_nmethod()->method()->is_continuation_enter_intrinsic(), "");
return frame(entry_sp(), entry_sp(), entry_fp(), entry_pc(), cb);
}

Expand Down
20 changes: 10 additions & 10 deletions src/hotspot/cpu/aarch64/frame_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
return false;
}

CompiledMethod* nm = sender_blob->as_compiled_method_or_null();
nmethod* nm = sender_blob->as_nmethod_or_null();
if (nm != nullptr) {
if (nm->is_deopt_mh_entry(sender_pc) || nm->is_deopt_entry(sender_pc) ||
nm->method()->is_method_handle_intrinsic()) {
Expand All @@ -234,7 +234,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
// because the return address counts against the callee's frame.

if (sender_blob->frame_size() <= 0) {
assert(!sender_blob->is_compiled(), "should count return address at least");
assert(!sender_blob->is_nmethod(), "should count return address at least");
return false;
}

Expand All @@ -243,7 +243,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
// should not be anything but the call stub (already covered), the interpreter (already covered)
// or an nmethod.

if (!sender_blob->is_compiled()) {
if (!sender_blob->is_nmethod()) {
return false;
}

Expand Down 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 = CompiledMethod::get_deopt_original_pc(this);
address original_pc = nmethod::get_deopt_original_pc(this);
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -426,7 +426,7 @@ frame frame::sender_for_upcall_stub_frame(RegisterMap* map) const {
// Verifies the calculated original PC of a deoptimization PC for the
// given unextended SP.
#ifdef ASSERT
void frame::verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp) {
void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp) {
frame fr;

// This is ugly but it's better than to change {get,set}_original_pc
Expand All @@ -449,12 +449,12 @@ void frame::adjust_unextended_sp() {
// returning to any of these call sites.

if (_cb != nullptr) {
CompiledMethod* sender_cm = _cb->as_compiled_method_or_null();
if (sender_cm != nullptr) {
nmethod* sender_nm = _cb->as_nmethod_or_null();
if (sender_nm != nullptr) {
// If the sender PC is a deoptimization point, get the original PC.
if (sender_cm->is_deopt_entry(_pc) ||
sender_cm->is_deopt_mh_entry(_pc)) {
verify_deopt_original_pc(sender_cm, _unextended_sp);
if (sender_nm->is_deopt_entry(_pc) ||
sender_nm->is_deopt_mh_entry(_pc)) {
verify_deopt_original_pc(sender_nm, _unextended_sp);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/aarch64/frame_aarch64.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -153,7 +153,7 @@

#ifdef ASSERT
// Used in frame::sender_for_{interpreter,compiled}_frame
static void verify_deopt_original_pc( CompiledMethod* nm, intptr_t* unextended_sp);
static void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp);
#endif

public:
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {
inline void frame::setup(address pc) {
adjust_unextended_sp();

address original_pc = CompiledMethod::get_deopt_original_pc(this);
address original_pc = nmethod::get_deopt_original_pc(this);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
assert(_cb == nullptr || _cb->as_compiled_method()->insts_contains_inclusive(_pc),
assert(_cb == nullptr || _cb->as_nmethod()->insts_contains_inclusive(_pc),
"original PC must be in the main code section of the compiled method (or must be immediately following it)");
} else {
if (_cb == SharedRuntime::deopt_blob()) {
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 = CompiledMethod::get_deopt_original_pc(this);
address original_pc = nmethod::get_deopt_original_pc(this);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -240,8 +240,8 @@ inline int frame::frame_size() const {
}

inline int frame::compiled_frame_stack_argsize() const {
assert(cb()->is_compiled(), "");
return (cb()->as_compiled_method()->method()->num_stack_arg_slots() * VMRegImpl::stack_slot_size) >> LogBytesPerWord;
assert(cb()->is_nmethod(), "");
return (cb()->as_nmethod()->method()->num_stack_arg_slots() * VMRegImpl::stack_slot_size) >> LogBytesPerWord;
}

inline void frame::interpreted_frame_oop_map(InterpreterOopMap* mask) const {
Expand Down Expand Up @@ -417,7 +417,7 @@ inline frame frame::sender_for_compiled_frame(RegisterMap* map) const {
// Tell GC to use argument oopmaps for some runtime stubs that need it.
// For C1, the runtime stub might not have oop maps, so set this flag
// outside of update_register_map.
if (!_cb->is_compiled()) { // compiled frames do not use callee-saved registers
if (!_cb->is_nmethod()) { // compiled frames do not use callee-saved registers
map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));
if (oop_map() != nullptr) {
_oop_map->update_register_map(this, map);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ static bool is_always_within_branch_range(Address entry) {
// Non-compiled methods stay forever in CodeCache.
// We check whether the longest possible branch is within the branch range.
assert(CodeCache::find_blob(target) != nullptr &&
!CodeCache::find_blob(target)->is_compiled(),
!CodeCache::find_blob(target)->is_nmethod(),
"runtime call of compiled method");
const address right_longest_branch_start = CodeCache::high_bound() - NativeInstruction::instruction_size;
const address left_longest_branch_start = CodeCache::low_bound();
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/aarch64/relocInfo_aarch64.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand All @@ -25,7 +25,7 @@

#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "code/compiledMethod.hpp"
#include "code/nmethod.hpp"
#include "code/relocInfo.hpp"
#include "nativeInst_aarch64.hpp"
#include "oops/oop.inline.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -35,7 +35,7 @@ template <ChunkFrames frame_kind>
inline bool StackChunkFrameStream<frame_kind>::is_in_frame(void* p0) const {
assert(!is_done(), "");
intptr_t* p = (intptr_t*)p0;
int argsize = is_compiled() ? (_cb->as_compiled_method()->method()->num_stack_arg_slots() * VMRegImpl::stack_slot_size) >> LogBytesPerWord : 0;
int argsize = is_compiled() ? (_cb->as_nmethod()->method()->num_stack_arg_slots() * VMRegImpl::stack_slot_size) >> LogBytesPerWord : 0;
int frame_size = _cb->frame_size() + argsize;
return p == sp() - frame::sender_sp_offset || ((p - unextended_sp()) >= 0 && (p - unextended_sp()) < frame_size);
}
Expand Down
26 changes: 13 additions & 13 deletions src/hotspot/cpu/arm/frame_arm.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -80,7 +80,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
// ok. adapter blobs never have a frame complete and are never ok.

if (!_cb->is_frame_complete_at(_pc)) {
if (_cb->is_compiled() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
return false;
}
}
Expand Down Expand Up @@ -179,7 +179,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
// because the return address counts against the callee's frame.

if (sender_blob->frame_size() <= 0) {
assert(!sender_blob->is_compiled(), "should count return address at least");
assert(!sender_blob->is_nmethod(), "should count return address at least");
return false;
}

Expand All @@ -188,7 +188,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
// should not be anything but the call stub (already covered), the interpreter (already covered)
// or an nmethod.

if (!sender_blob->is_compiled()) {
if (!sender_blob->is_nmethod()) {
return false;
}

Expand Down 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 = CompiledMethod::get_deopt_original_pc(this);
address original_pc = nmethod::get_deopt_original_pc(this);
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
Expand Down Expand Up @@ -332,7 +332,7 @@ bool frame::upcall_stub_frame_is_first() const {
// given unextended SP. The unextended SP might also be the saved SP
// for MethodHandle call sites.
#ifdef ASSERT
void frame::verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp, bool is_method_handle_return) {
void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp, bool is_method_handle_return) {
frame fr;

// This is ugly but it's better than to change {get,set}_original_pc
Expand All @@ -357,19 +357,19 @@ void frame::adjust_unextended_sp() {
// simplest way to tell whether we are returning to such a call site
// is as follows:

CompiledMethod* sender_cm = (_cb == nullptr) ? nullptr : _cb->as_compiled_method_or_null();
if (sender_cm != nullptr) {
nmethod* sender_nm = (_cb == nullptr) ? nullptr : _cb->as_nmethod_or_null();
if (sender_nm != nullptr) {
// If the sender PC is a deoptimization point, get the original
// PC. For MethodHandle call site the unextended_sp is stored in
// saved_fp.
if (sender_cm->is_deopt_mh_entry(_pc)) {
DEBUG_ONLY(verify_deopt_mh_original_pc(sender_cm, _fp));
if (sender_nm->is_deopt_mh_entry(_pc)) {
DEBUG_ONLY(verify_deopt_mh_original_pc(sender_nm, _fp));
_unextended_sp = _fp;
}
else if (sender_cm->is_deopt_entry(_pc)) {
DEBUG_ONLY(verify_deopt_original_pc(sender_cm, _unextended_sp));
else if (sender_nm->is_deopt_entry(_pc)) {
DEBUG_ONLY(verify_deopt_original_pc(sender_nm, _unextended_sp));
}
else if (sender_cm->is_method_handle_return(_pc)) {
else if (sender_nm->is_method_handle_return(_pc)) {
_unextended_sp = _fp;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/cpu/arm/frame_arm.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -93,8 +93,8 @@

#ifdef ASSERT
// Used in frame::sender_for_{interpreter,compiled}_frame
static void verify_deopt_original_pc( CompiledMethod* nm, intptr_t* unextended_sp, bool is_method_handle_return = false);
static void verify_deopt_mh_original_pc(CompiledMethod* nm, intptr_t* unextended_sp) {
static void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp, bool is_method_handle_return = false);
static void verify_deopt_mh_original_pc(nmethod* nm, intptr_t* unextended_sp) {
verify_deopt_original_pc(nm, unextended_sp, true);
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/arm/frame_arm.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ 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 = CompiledMethod::get_deopt_original_pc(this);
address original_pc = nmethod::get_deopt_original_pc(this);
if (original_pc != nullptr) {
_pc = original_pc;
assert(_cb->as_compiled_method()->insts_contains_inclusive(_pc),
assert(_cb->as_nmethod()->insts_contains_inclusive(_pc),
"original PC must be in the main code section of the the compiled method (or must be immediately following it)");
_deopt_state = is_deoptimized;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/ppc/continuationEntry_ppc.inline.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -35,7 +35,7 @@
inline frame ContinuationEntry::to_frame() const {
static CodeBlob* cb = CodeCache::find_blob_fast(entry_pc());
assert(cb != nullptr, "");
assert(cb->as_compiled_method()->method()->is_continuation_enter_intrinsic(), "");
assert(cb->as_nmethod()->method()->is_continuation_enter_intrinsic(), "");
return frame(entry_sp(), entry_pc(), entry_sp(), entry_fp(), cb);
}

Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/cpu/ppc/frame_ppc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -90,7 +90,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
// so we just assume they are OK.
// Adapter blobs never have a complete frame and are never OK
if (!_cb->is_frame_complete_at(_pc)) {
if (_cb->is_compiled() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) {
return false;
}
}
Expand Down Expand Up @@ -280,15 +280,15 @@ 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 = CompiledMethod::get_deopt_original_pc(this);
address original_pc = nmethod::get_deopt_original_pc(this);
if (original_pc != nullptr) {
assert(original_pc == old_pc, "expected original PC to be stored before patching");
_deopt_state = is_deoptimized;
_pc = original_pc;
} else {
_deopt_state = not_deoptimized;
}
assert(!is_compiled_frame() || !_cb->as_compiled_method()->is_deopt_entry(_pc), "must be");
assert(!is_compiled_frame() || !_cb->as_nmethod()->is_deopt_entry(_pc), "must be");

#ifdef ASSERT
{
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/cpu/ppc/frame_ppc.inline.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -61,11 +61,11 @@ inline void frame::setup(kind knd) {
}
}

address original_pc = CompiledMethod::get_deopt_original_pc(this);
address original_pc = nmethod::get_deopt_original_pc(this);
if (original_pc != nullptr) {
_pc = original_pc;
_deopt_state = is_deoptimized;
assert(_cb == nullptr || _cb->as_compiled_method()->insts_contains_inclusive(_pc),
assert(_cb == nullptr || _cb->as_nmethod()->insts_contains_inclusive(_pc),
"original PC must be in the main code section of the compiled method (or must be immediately following it)");
} else {
if (_cb == SharedRuntime::deopt_blob()) {
Expand Down Expand Up @@ -329,7 +329,7 @@ inline frame frame::sender_for_compiled_frame(RegisterMap *map) const {
// Tell GC to use argument oopmaps for some runtime stubs that need it.
// For C1, the runtime stub might not have oop maps, so set this flag
// outside of update_register_map.
if (!_cb->is_compiled()) { // compiled frames do not use callee-saved registers
if (!_cb->is_nmethod()) { // compiled frames do not use callee-saved registers
map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));
if (oop_map() != nullptr) {
_oop_map->update_register_map(this, map);
Expand Down Expand Up @@ -368,8 +368,8 @@ inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {
}

inline int frame::compiled_frame_stack_argsize() const {
assert(cb()->is_compiled(), "");
return (cb()->as_compiled_method()->method()->num_stack_arg_slots() * VMRegImpl::stack_slot_size) >> LogBytesPerWord;
assert(cb()->is_nmethod(), "");
return (cb()->as_nmethod()->method()->num_stack_arg_slots() * VMRegImpl::stack_slot_size) >> LogBytesPerWord;
}

inline void frame::interpreted_frame_oop_map(InterpreterOopMap* mask) const {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/ppc/nativeInst_ppc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -460,7 +460,7 @@ void NativeDeoptInstruction::verify() {
bool NativeDeoptInstruction::is_deopt_at(address code_pos) {
if (!Assembler::is_illtrap(code_pos)) return false;
CodeBlob* cb = CodeCache::find_blob(code_pos);
if (cb == nullptr || !cb->is_compiled()) return false;
if (cb == nullptr || !cb->is_nmethod()) return false;
nmethod *nm = (nmethod *)cb;
// see NativeInstruction::is_sigill_not_entrant_at()
return nm->verified_entry_point() != code_pos;
Expand Down

1 comment on commit 83eba86

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.