Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8293942: [JVMCI] data section entries must be 4-byte aligned on AArch64 #10308

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/hotspot/share/jvmci/jvmciCodeInstaller.cpp
Expand Up @@ -1212,6 +1212,9 @@ void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, HotSpotCo
case PATCH_DATA_SECTION_REFERENCE: {
int data_offset = stream->read_u4("data:offset");
if (0 <= data_offset && data_offset < _constants_size) {
if (!is_aligned(data_offset, CompilerToVM::Data::get_data_section_item_alignment())) {
JVMCI_ERROR("data offset 0x%x is not %d-byte aligned%s", data_offset, relocInfo::addr_unit(), stream->context());
}
pd_patch_DataSectionReference(pc_offset, data_offset, JVMCI_CHECK);
} else {
JVMCI_ERROR("data offset 0x%x points outside data section (size 0x%x)%s", data_offset, _constants_size, stream->context());
Expand Down
7 changes: 7 additions & 0 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.hpp
Expand Up @@ -91,13 +91,20 @@ class CompilerToVM {
static address symbol_init;
static address symbol_clinit;

// Minimum alignment of an offset into CodeBuffer::SECT_CONSTS
static int data_section_item_alignment;

public:
static void initialize(JVMCI_TRAPS);

static int max_oop_map_stack_offset() {
assert(_max_oop_map_stack_offset > 0, "must be initialized");
return Data::_max_oop_map_stack_offset;
}

static int get_data_section_item_alignment() {
return data_section_item_alignment;
}
};

static bool cstring_equals(const char* const& s0, const char* const& s1) {
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp
Expand Up @@ -95,6 +95,8 @@ address CompilerToVM::Data::dpow;
address CompilerToVM::Data::symbol_init;
address CompilerToVM::Data::symbol_clinit;

int CompilerToVM::Data::data_section_item_alignment;

void CompilerToVM::Data::initialize(JVMCI_TRAPS) {
Klass_vtable_start_offset = in_bytes(Klass::vtable_start_offset());
Klass_vtable_length_offset = in_bytes(Klass::vtable_length_offset());
Expand Down Expand Up @@ -133,6 +135,8 @@ void CompilerToVM::Data::initialize(JVMCI_TRAPS) {

_fields_annotations_base_offset = Array<AnnotationArray*>::base_offset_in_bytes();

data_section_item_alignment = relocInfo::addr_unit();

BarrierSet* bs = BarrierSet::barrier_set();
if (bs->is_a(BarrierSet::CardTableBarrierSet)) {
CardTable::CardValue* base = ci_card_table_address();
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/jvmci/vmStructs_jvmci.cpp
Expand Up @@ -100,6 +100,8 @@
static_field(CompilerToVM::Data, symbol_init, address) \
static_field(CompilerToVM::Data, symbol_clinit, address) \
\
static_field(CompilerToVM::Data, data_section_item_alignment, int) \
\
static_field(Abstract_VM_Version, _features, uint64_t) \
\
nonstatic_field(Annotations, _fields_annotations, Array<AnnotationArray*>*) \
Expand Down