Fix saving/restoring return address on ARM
commit8b369cd87869bc12ba9808b0877d09e055085c55
authorGuilherme Ottoni <ottoni@fb.com>
Thu, 4 Aug 2022 08:22:45 +0000 (4 01:22 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 4 Aug 2022 08:22:45 +0000 (4 01:22 -0700)
treee87af14bc501dd4de74f13679121c7bced5e9863
parentf741881d946569a9944a350139dd00a382d5970a
Fix saving/restoring return address on ARM

Summary:
The Vasm code being generated assumed the return address is pushed/popped
onto/from the native stack, which is not true on ARM.  The phplogue Vasm
instruction already abstracts saving the return address from the CPU's
return-address location into a VM frame's m_savedRip, so use it instead of
popping the address from the native stack.  There was no corresponding Vasm
instruction for restoring the return address into the proper CPU location, so
this diff adds a `restorerip` instruction and uses it.

Reviewed By: jano, mofarrell

Differential Revision: D38411692

fbshipit-source-id: ebff6c91dc89173fb0b5486c69ad373fbfffc23d
hphp/runtime/vm/jit/irlower-branch.cpp
hphp/runtime/vm/jit/unique-stubs.cpp
hphp/runtime/vm/jit/vasm-arm.cpp
hphp/runtime/vm/jit/vasm-info.cpp
hphp/runtime/vm/jit/vasm-instr.cpp
hphp/runtime/vm/jit/vasm-instr.h
hphp/runtime/vm/jit/vasm-x64.cpp