Skip to content

Commit

Permalink
8293942: [JVMCI] data section entries must be 4-byte aligned on AArch64
Browse files Browse the repository at this point in the history
Reviewed-by: never
  • Loading branch information
Doug Simon committed Sep 19, 2022
1 parent 6e23b43 commit 8ff2c26
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/hotspot/share/jvmci/jvmciCodeInstaller.cpp
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

1 comment on commit 8ff2c26

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.