diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index 177be6e59f7..d36430ad0c0 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -4687,7 +4687,9 @@ void C2_MacroAssembler::convertF2I(BasicType dst_bt, BasicType src_bt, Register } } - auto stub = C2CodeStub::make(dst, src, slowpath_target, 23, convertF2I_slowpath); + // Using the APX extended general purpose registers increases the instruction encoding size by 4 bytes. + int max_size = dst->encoding() <= 15 ? 23 : 27; + auto stub = C2CodeStub::make(dst, src, slowpath_target, max_size, convertF2I_slowpath); jcc(Assembler::equal, stub->entry()); bind(stub->continuation()); }