This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][Darwin] Add new ARM64 stack probing function for Darwin
AbandonedPublic

Authored by aemerson on Dec 5 2017, 2:35 PM.

Details

Summary

[AArch64][Darwin] Add new ARM64 stack probing function for Darwin.

This is the ARM64 equivalent of the Darwin x86 stack probing function and likewise it doesn't modify the stack pointer. However it does have a custom calling convention (uses registers X9-X11).

rdar://25859140

Diff Detail

Event Timeline

aemerson created this revision.Dec 5 2017, 2:35 PM
mstorsjo added inline comments.
lib/builtins/CMakeLists.txt
447

If this file is darwin specific, it would need to be added conditionally to aarch64_SOURCES. In particular, the .weak_definition directive won't assemble when targeting windows.

lib/builtins/aarch64/chkstk_darwin.S
23

You could avoid clobbering x11 altogether by doing ldr xzr, [x10].

Is the initial cmp w9, #PAGE_SZ strictly necessary? The compiler shouldn't emit these calls if the requested amount is less than one page right?

I implemented something very similar to this in D41134 - there, the main loop is 1 instruction shorter. There I also skip touching the final page, assuming that the caller will touch that page before allocating even more stack space, but perhaps that's not an assumption one can make.

aemerson abandoned this revision.May 16 2018, 3:49 AM