From 1e2aa616c9bfeaf09e3df7226e693d23d92d818a Mon Sep 17 00:00:00 2001 From: Evgeny Astigeevich Date: Wed, 8 Apr 2026 15:47:50 +0000 Subject: [PATCH] 8381770: Revert some shared changes done by JDK-8381003 Reviewed-by: kvn --- src/hotspot/share/code/nmethod.cpp | 2 -- src/hotspot/share/code/relocInfo.cpp | 9 +++++++++ src/hotspot/share/code/relocInfo.hpp | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index de2c826667f..a302df418d7 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -1332,7 +1332,6 @@ nmethod::nmethod( code_buffer->copy_values_to(this); post_init(); - ICache::invalidate_range(code_begin(), code_size()); } if (PrintNativeNMethods || PrintDebugInfo || PrintRelocations || PrintDependencies) { @@ -1812,7 +1811,6 @@ nmethod::nmethod( init_immutable_data_ref_count(); post_init(); - ICache::invalidate_range(code_begin(), code_size()); // we use the information of entry points to find out if a method is // static or non static diff --git a/src/hotspot/share/code/relocInfo.cpp b/src/hotspot/share/code/relocInfo.cpp index 25d91edc20f..73e4b6de7b4 100644 --- a/src/hotspot/share/code/relocInfo.cpp +++ b/src/hotspot/share/code/relocInfo.cpp @@ -590,6 +590,15 @@ oop oop_Relocation::oop_value() { return *oop_addr(); } +void oop_Relocation::fix_oop_relocation() { + // TODO: we need to add some assert here that ICache::invalidate_range is called in the code + // which uses this function. + if (!oop_is_immediate()) { + // get the oop from the pool, and re-insert it into the instruction: + set_value(value()); + } +} + void oop_Relocation::verify_oop_relocation() { if (!oop_is_immediate()) { // get the oop from the pool, and re-insert it into the instruction: diff --git a/src/hotspot/share/code/relocInfo.hpp b/src/hotspot/share/code/relocInfo.hpp index bb2b2b5693f..6f1778ef479 100644 --- a/src/hotspot/share/code/relocInfo.hpp +++ b/src/hotspot/share/code/relocInfo.hpp @@ -988,6 +988,8 @@ class oop_Relocation : public DataRelocation { void pack_data_to(CodeSection* dest) override; void unpack_data() override; + void fix_oop_relocation(); // reasserts oop value + void verify_oop_relocation(); address value() override { return *reinterpret_cast(oop_addr()); }