From 18cd16d2eae2ee624827eb86621f3a4ffd98fe8c Mon Sep 17 00:00:00 2001 From: Boris Ulasevich Date: Fri, 29 Jul 2022 06:21:48 +0000 Subject: [PATCH] 8291003: ARM32: constant_table.size assertion Reviewed-by: shade --- src/hotspot/cpu/arm/arm.ad | 3 ++- src/hotspot/share/asm/codeBuffer.hpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hotspot/cpu/arm/arm.ad b/src/hotspot/cpu/arm/arm.ad index fb44a373fd136..214e3b27cdfba 100644 --- a/src/hotspot/cpu/arm/arm.ad +++ b/src/hotspot/cpu/arm/arm.ad @@ -236,7 +236,8 @@ void MachConstantBaseNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const { Register r = as_Register(ra_->get_encode(this)); CodeSection* consts_section = __ code()->consts(); - int consts_size = consts_section->align_at_start(consts_section->size()); + // constants section size is aligned according to the align_at_start settings of the next section + int consts_size = CodeSection::align_at_start(consts_section->size(), CodeBuffer::SECT_INSTS); assert(constant_table.size() == consts_size, "must be: %d == %d", constant_table.size(), consts_size); // Materialize the constant table base. diff --git a/src/hotspot/share/asm/codeBuffer.hpp b/src/hotspot/share/asm/codeBuffer.hpp index e96f9c07e7686..4cad3b4d30e3f 100644 --- a/src/hotspot/share/asm/codeBuffer.hpp +++ b/src/hotspot/share/asm/codeBuffer.hpp @@ -261,12 +261,12 @@ class CodeSection { // Slop between sections, used only when allocating temporary BufferBlob buffers. static csize_t end_slop() { return MAX2((int)sizeof(jdouble), (int)CodeEntryAlignment); } - csize_t align_at_start(csize_t off, int section) const { + static csize_t align_at_start(csize_t off, int section) { return (csize_t) align_up(off, alignment(section)); } csize_t align_at_start(csize_t off) const { - return (csize_t) align_up(off, alignment(_index)); + return align_at_start(off, _index); } // Ensure there's enough space left in the current section.