Bug 141903

Summary: Add calleeSaveRegisters() implementation for ARM Traditional
Product: WebKit Reporter: Csaba Osztrogonác <ossy>
Component: New BugsAssignee: Csaba Osztrogonác <ossy>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, ossy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 108645    
Attachments:
Description Flags
Patch none

Description Csaba Osztrogonác 2015-02-23 05:45:14 PST
Add calleeSaveRegisters() implementation for ARM Traditional
Comment 1 Csaba Osztrogonác 2015-02-23 05:45:28 PST
Created attachment 247112 [details]
Patch
Comment 2 Csaba Osztrogonác 2015-02-23 06:00:00 PST
AAPCS (http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf) says that r4-r11 are callee-saved registers,
only the role of r9 isn't clear.

"The role of register r9 is platform specific. A virtual platform may assign
any role to this register and must document this usage. For example, it may
designate it as the static base (SB) in a position-independent data model,
or it may designate it as the thread register (TR) in an environment with
thread-local storage. The usage of this register may require that the value
held is persistent across all calls. A virtual platform that has no need for
such a special register may designate r9 as an additional callee-saved variable
register, v6."

But it seems GCC ARM EABI handles r9 as callee-saved register:
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/arm/arm.h#L775

I checked some disassembly of example codes and JSC too,
and can confirm that r4-r11 registers are callee-saved.
Comment 3 Csaba Osztrogonác 2015-02-23 06:13:21 PST
You omitted the fp/r7 from ARM Thumb2 callee-saved register list:
http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/jit/RegisterSet.cpp#L84

But registersToPreserve() explicitly removes fp from the list:
http://trac.webkit.org/browser/branches/jsCStack/Source/JavaScriptCore/jit/RegisterPreservationWrapperGenerator.cpp#L37

I think it is confusing to omit r11/fp on ARM Traditional and r7/fp
on ARM Thumb2, since these registers are general callee-saved registers.
ARM EABI doesn't specify a dedicated frame pointer, additionally GCC omits
using frame pointer with O1.
Comment 4 WebKit Commit Bot 2015-02-26 01:20:43 PST
Comment on attachment 247112 [details]
Patch

Clearing flags on attachment: 247112

Committed r180667: <http://trac.webkit.org/changeset/180667>
Comment 5 WebKit Commit Bot 2015-02-26 01:20:47 PST
All reviewed patches have been landed.  Closing bug.