Skip to content

Commit 738effa

Browse files
committed
8254744: Clean-up CodeBlob::align_code_offset
Reviewed-by: mdoerr, eosterlund
1 parent f71e8a6 commit 738effa

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

src/hotspot/share/code/codeBlob.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ const char* CodeBlob::compiler_name() const {
5555

5656
unsigned int CodeBlob::align_code_offset(int offset) {
5757
// align the size to CodeEntryAlignment
58-
return
59-
((offset + (int)CodeHeap::header_size() + (CodeEntryAlignment-1)) & ~(CodeEntryAlignment-1))
60-
- (int)CodeHeap::header_size();
58+
int header_size = (int)CodeHeap::header_size();
59+
return align_up(offset + header_size, CodeEntryAlignment) - header_size;
6160
}
6261

6362

src/hotspot/share/memory/heap.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
#include "utilities/align.hpp"
3131
#include "utilities/powerOfTwo.hpp"
3232

33-
size_t CodeHeap::header_size() {
34-
return sizeof(HeapBlock);
35-
}
36-
37-
3833
// Implementation of Heap
3934

4035
CodeHeap::CodeHeap(const char* name, const int code_blob_type)

src/hotspot/share/memory/heap.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class CodeHeap : public CHeapObj<mtCode> {
187187
virtual CodeBlob* find_blob_unsafe(void* start) const;
188188
size_t alignment_unit() const; // alignment of any block
189189
size_t alignment_offset() const; // offset of first byte of any block, within the enclosing alignment unit
190-
static size_t header_size(); // returns the header size for each heap block
190+
static size_t header_size() { return sizeof(HeapBlock); } // returns the header size for each heap block
191191

192192
size_t segment_size() const { return _segment_size; } // for CodeHeapState
193193
HeapBlock* first_block() const; // for CodeHeapState

0 commit comments

Comments
 (0)