Normalize ARM's link-register-saving convention
commit40100fff5c7976339c5b7e45f432e5e1eb3b5e53
authorOwen Yamauchi <oyamauchi@fb.com>
Fri, 17 Jan 2014 16:24:34 +0000 (17 08:24 -0800)
committerSara Golemon <sgolemon@fb.com>
Tue, 28 Jan 2014 15:49:27 +0000 (28 07:49 -0800)
treeeb8c41730f2366ca85a88c356e286b5055bbb0c4
parent1e23dec9f0b1ce8aaa5833d0527a369c8e254ffd
Normalize ARM's link-register-saving convention

In trying to implement codegen for the Call opcode, I'm running into
problems with the differences between ARM and x64's calling conventions,
specifically with regard to how they save return addresses.

Until now, our ARM code hasn't been treating the link register (the
return address register) like it's supposed to be treated. The register
is technically caller-saved, but normal ARM programs (such as C programs
compiled by gcc) don't save and restore it around callsites. Instead,
non-leaf functions just save it at the very beginning and restore it
just before returning, simply as part of setting up and tearing down the
frame.

What this means for us is that we're now saving it on the stack
immediately on entry to the TC, since, viewed through the traditional
calling-convention lens, the entire TC is a non-leaf function. This
means that we no longer need to save/restore around host calls.

Reviewed By: @edwinsmith

Differential Revision: D1133438
hphp/runtime/vm/jit/code-gen-helpers-arm.cpp
hphp/runtime/vm/jit/service-requests-arm.cpp
hphp/runtime/vm/jit/translator-x64.cpp
hphp/runtime/vm/jit/unique-stubs-arm.cpp