From 88e31067761a80e9287f0541538c6b16a7f34be4 Mon Sep 17 00:00:00 2001 From: Boris Ulasevich Date: Tue, 19 Nov 2024 00:54:27 +0300 Subject: [PATCH] remove _code_end_offset --- src/hotspot/share/code/codeBlob.cpp | 5 ++--- src/hotspot/share/code/codeBlob.hpp | 9 +++------ src/hotspot/share/runtime/vmStructs.cpp | 1 - .../share/classes/sun/jvm/hotspot/code/CodeBlob.java | 1 - 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/hotspot/share/code/codeBlob.cpp b/src/hotspot/share/code/codeBlob.cpp index 4c4e15b7a621d..5606ab142ac18 100644 --- a/src/hotspot/share/code/codeBlob.cpp +++ b/src/hotspot/share/code/codeBlob.cpp @@ -78,7 +78,6 @@ CodeBlob::CodeBlob(const char* name, CodeBlobKind kind, CodeBuffer* cb, int size _relocation_size(align_up(cb->total_relocation_size(), oopSize)), _content_offset(CodeBlob::align_code_offset(header_size)), _code_offset(_content_offset + cb->total_offset_of(cb->insts())), - _code_end_offset(_content_offset + align_up(cb->total_content_size(), oopSize)), _frame_size(frame_size), S390_ONLY(_ctable_offset(0) COMMA) _header_size(header_size), @@ -91,7 +90,8 @@ CodeBlob::CodeBlob(const char* name, CodeBlobKind kind, CodeBuffer* cb, int size assert(is_aligned(_size, oopSize), "unaligned size"); assert(is_aligned(header_size, oopSize), "unaligned size"); assert(is_aligned(_relocation_size, oopSize), "unaligned size"); - assert(_code_end_offset <= _size, "codeBlob is too small: %d > %d", _code_end_offset, _size); + int code_end_offset = _content_offset + align_up(cb->total_content_size(), oopSize); + assert(code_end_offset == _size, "wrong codeBlob size: %d != %d", _size, code_end_offset); assert(code_end() == content_end(), "must be the same - see code_end()"); #ifdef COMPILER1 // probably wrong for tiered @@ -119,7 +119,6 @@ CodeBlob::CodeBlob(const char* name, CodeBlobKind kind, int size, uint16_t heade _relocation_size(0), _content_offset(CodeBlob::align_code_offset(header_size)), _code_offset(_content_offset), - _code_end_offset(size), _frame_size(0), S390_ONLY(_ctable_offset(0) COMMA) _header_size(header_size), diff --git a/src/hotspot/share/code/codeBlob.hpp b/src/hotspot/share/code/codeBlob.hpp index 745637c2eda0d..b0e427806a23d 100644 --- a/src/hotspot/share/code/codeBlob.hpp +++ b/src/hotspot/share/code/codeBlob.hpp @@ -108,7 +108,6 @@ class CodeBlob { int _relocation_size; // size of relocation (could be bigger than 64Kb) int _content_offset; // offset to where content region begins (this includes consts, insts, stubs) int _code_offset; // offset to where instructions region begins (this includes insts, stubs) - int _code_end_offset; // offset to where code region ends int _frame_size; // size of stack frame in words (NOT slots. On x64 these are 64bit words) S390_ONLY(int _ctable_offset;) @@ -183,11 +182,10 @@ class CodeBlob { relocInfo* relocation_begin() const { return (relocInfo*)_mutable_data; } relocInfo* relocation_end() const { return (relocInfo*)((address)relocation_begin() + _relocation_size); } address content_begin() const { return (address) header_begin() + _content_offset; } - address content_end() const { return (address) header_begin() + _code_end_offset; } + address content_end() const { return (address) header_begin() + _size; } address code_begin() const { return (address) header_begin() + _code_offset; } - // code_end == content_end is true for all types of blobs for now, it is also checked in the constructor - address code_end() const { return (address) header_begin() + _code_end_offset; } - address blob_end() const { return (address) header_begin() + _size; } + address code_end() const { return (address) header_begin() + _size; } + address blob_end() const { return (address) header_begin() + _size; } // [relocations, oops, metatada, jvmci_data] stays in _mutable_data address mdata_begin() const { return mutable_data_begin(); } @@ -212,7 +210,6 @@ class CodeBlob { // Only used from CodeCache::free_unused_tail() after the Interpreter blob was trimmed void adjust_size(size_t used) { _size = (int)used; - _code_end_offset = (int)used; } // Containment diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 8fb77e298acfe..65f392373d726 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -556,7 +556,6 @@ nonstatic_field(CodeBlob, _content_offset, int) \ nonstatic_field(CodeBlob, _code_offset, int) \ nonstatic_field(CodeBlob, _frame_complete_offset, int16_t) \ - nonstatic_field(CodeBlob, _code_end_offset, int) \ nonstatic_field(CodeBlob, _frame_size, int) \ nonstatic_field(CodeBlob, _oop_maps, ImmutableOopMapSet*) \ nonstatic_field(CodeBlob, _caller_must_gc_arguments, bool) \ diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java index 517291f0d0db2..a4cf76f8ee87a 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java @@ -70,7 +70,6 @@ private static void initialize(TypeDataBase db) { contentOffsetField = type.getCIntegerField("_content_offset"); codeOffsetField = type.getCIntegerField("_code_offset"); frameCompleteOffsetField = new CIntField(type.getCIntegerField("_frame_complete_offset"), 0); - codeEndOffsetField = type.getCIntegerField("_code_end_offset"); frameSizeField = type.getCIntegerField("_frame_size"); oopMapsField = type.getAddressField("_oop_maps"); mutableDataField = type.getAddressField("_mutable_data");