Closed Bug 1657135 Opened 6 months ago Closed 5 months ago

add xptcall routines for aarch64 macOS

Categories

(Core :: XPCOM, task, P2)

ARM64
macOS
task

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

References

(Blocks 1 open bug)

Details

Attachments

(6 files)

This would almost be straightforward to copy over from the aarch64 Linux support, except that Apple's aarch64 calling convention -- at least on iOS, and I don't imagine Apple would change this for macOS -- deviates from the generic standard in two significant ways:

  • Function arguments passed on the stack do not consume 8 bytes apiece, they only consume the space necessary for them (subject to alignment restrictions).
  • Caller performs sign/zero extension for arguments < 32 bits, rather than the callee.

I think the second deviation makes our life much easier, but the first one is potentially annoying.

These changes are consistent with what we do in other
files (xptcstubs_arm.cpp) and also make everything compile.

Assignee: nobody → nfroyd
Status: NEW → ASSIGNED

These files will all compile, but things will break at runtime because the
convention for stack arguments is slightly different on Darwin. We'll fix
that in the next patch or two.

Depends on D87004

Through some sleight-of-hand, we can treat argument allocation in aarch64's
xptcinvoke exactly the same for integer and floating-point arguments. This
change isn't so important now, but it centralizes the allocation of stack
slots, which is important for making this code handle Apple's calling
conventions.

Depends on D87005

ARM has a common calling standard for all operating systems running on
ARM64, and Apple platforms almost follow it, except for a few rules which
aren't relative to xptcall, plus one significant exception: arguments
spilled to the stack only occupy the space they need to. So in the common
calling standard, a uint16_t would occupy eight bytes when it is passed on
the stack, whereas on Apple platforms, it only occupies two bytes.

Depends on D87006

We have to rename the files; they need to be preprocessed due to various
different assembler and object file conventions.

Depends on D87007

Attachment #9169912 - Attachment description: Bug 1657135 - add appropriate Apple-specific syntax bits in aarch64 C stubs; r=#xpcom-reviewers,glandium → Bug 1657135 - add appropriate Apple-specific syntax bits in aarch64 C stubs
Attachment #9169913 - Attachment description: Bug 1657135 - compile the correct files for xptcall on arm64 macOS; r=#xpcom-reviewers,glandium → Bug 1657135 - compile the correct files for xptcall on arm64 macOS
Attachment #9169914 - Attachment description: Bug 1657135 - unify integer and floating-point argument allocation; r=#xpcom-reviewers,glandium → Bug 1657135 - unify integer and floating-point argument allocation
Attachment #9169916 - Attachment description: Bug 1657135 - make arm64 xptcinvoke handle both aapcs and apple stack conventions; r=#xpcom-reviewers,glandium → Bug 1657135 - make arm64 xptcinvoke handle both aapcs and apple stack conventions
Attachment #9169917 - Attachment description: Bug 1657135 - make aarch64 assembly glue suitable for compiling with macOS; r=#xpcom-reviewers,glandium → Bug 1657135 - make aarch64 assembly glue suitable for compiling with macOS
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/1ef1dd6379d1
add appropriate Apple-specific syntax bits in aarch64 C stubs r=xpcom-reviewers,nika
https://hg.mozilla.org/integration/autoland/rev/a7ce18db1c01
compile the correct files for xptcall on arm64 macOS r=glandium,xpcom-reviewers,nika
https://hg.mozilla.org/integration/autoland/rev/fdb21f59c0b1
unify integer and floating-point argument allocation r=xpcom-reviewers,nika
https://hg.mozilla.org/integration/autoland/rev/bb0d64c2a6bb
make arm64 xptcinvoke handle both aapcs and apple stack conventions r=xpcom-reviewers,nika,froydnj
https://hg.mozilla.org/integration/autoland/rev/30267a93822f
make aarch64 assembly glue suitable for compiling with macOS r=glandium,xpcom-reviewers,nika
https://hg.mozilla.org/integration/autoland/rev/b3b212539baa
make arm64 xptcstubs handle both aapcs and apple stack conventions. r=froydnj
You need to log in before you can comment on or make changes to this bug.