--- old/src/hotspot/cpu/x86/templateTable_x86.cpp 2017-12-13 15:36:03.436788839 -0500 +++ new/src/hotspot/cpu/x86/templateTable_x86.cpp 2017-12-13 15:36:03.204787688 -0500 @@ -2677,10 +2677,24 @@ } #endif if (state == qtos) { - const Register thread1 = NOT_LP64(rcx) LP64_ONLY(r15_thread); - __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::return_value), rax); - NOT_LP64(__ get_thread(thread1)); - __ get_vm_result(rax, thread1); +#ifndef _LP64 + ShouldNotReachHere(); +#else + Label not_buffered; + __ lea(r14, ExternalAddress(VTBuffer::_base)); + __ cmpptr(rax, r14); + __ jcc(Assembler::below, not_buffered); + __ lea(r14, ExternalAddress(VTBuffer::_end)); + __ cmpptr(rax, r14); + __ jcc(Assembler::aboveEqual, not_buffered); + if (ReturnValuesInThreadLocalBuffer) { + __ movptr((Address(r15_thread, JavaThread::return_buffered_value_offset())), rax); + } else { + __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::reallocate_value_in_heap), rax); + __ get_vm_result(rax, r15_thread); + } + __ bind(not_buffered); +#endif } // Narrow result if state is itos but result type is smaller.