ARM64 doesn't allow operation to the stack point that aren't 16 byte aligned. Therefore push and pop need to be changed or abandoned. One possibility is push and pop a pair of registers using the store pair (STP) and load pair (LDP) instructions.
Which push/pop instructions do you have in mind? Are you saying that the stack can't be misaligned even for a moment, such that two 8 byte pushes in a row would crash?
(In reply to comment #1) > Which push/pop instructions do you have in mind? > > Are you saying that the stack can't be misaligned even for a moment, such that two 8 byte pushes in a row would crash? ARM64 doesn't have push or pop instructions. There are pre/post indexed memory ops. The stack does need to be 16 byte aligned. I don't know about whether temporary 8 byte alignment is fine. There are load / store pair instructions which we use in the JSC macro assembler for pushToSave() and popToRestore(). There are LLInt push / pop macro ops. They emit push and pop instructions, so I wondered if the clang assembler mapped those to the appropriate memory ops. Turns out the it doesn't. The current LLInt push / pop are currently unused, wrong and should result in a compile error. When implementing the LLInt callToJavaScript(), I added {push,pop}CalleeSaves macro ops that does the right thing for each platform. I followed after the push / pop macro op implementations. Trying to work through the ARM64 compile issues I found there aren't ARM64 pseudo ops for push / pop. I have reimplemented {push,pop}CalleeSaves using store / load pair and it appears to be working fine.
Created attachment 217628 [details] Patch
Committed r159655: <http://trac.webkit.org/changeset/159655>
Reviewed in person by Phil Pizlo.
Does stp decrement the stack pointer register? Does ldp increment it? I'm worried that you're just storing/loading the same locations over and over again.
(In reply to comment #6) > Does stp decrement the stack pointer register? Does ldp increment it? I'm worried that you're just storing/loading the same locations over and over again. The stp is the pre-increment variety with an increment of -16. That is what the "[sp, #-16]!" syntax means. The ldp is the post-increment variety with an increment of 16. The syntax for post increment has the increment amount after the closing ']': "[sp], #16". A little confusing that's for sure.