diff --git a/src/hotspot/share/code/vtableStubs.cpp b/src/hotspot/share/code/vtableStubs.cpp index a65852e247f..dbae8b8694f 100644 --- a/src/hotspot/share/code/vtableStubs.cpp +++ b/src/hotspot/share/code/vtableStubs.cpp @@ -262,7 +262,8 @@ inline uint VtableStubs::unsafe_hash(address entry_point) { address vtable_type_addr = vtable_stub_addr + offset_of(VtableStub, _type); address vtable_index_addr = vtable_stub_addr + offset_of(VtableStub, _index); bool is_vtable_stub = *vtable_type_addr == static_cast(VtableStub::Type::vtable_stub); - int vtable_index; + short vtable_index; + static_assert(sizeof(VtableStub::_index) == sizeof(vtable_index), "precondition"); memcpy(&vtable_index, vtable_index_addr, sizeof(vtable_index)); return hash(is_vtable_stub, vtable_index); }