[PATCH] D40857: [AArch64][Darwin] Add new ARM64 stack probing function for Darwin

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 23:38:35 PST 2017


mstorsjo added inline comments.


================
Comment at: lib/builtins/CMakeLists.txt:447
 set(aarch64_SOURCES
+  aarch64/chkstk_darwin.S
   ${GENERIC_TF_SOURCES}
----------------
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.


================
Comment at: lib/builtins/aarch64/chkstk_darwin.S:23
+        sub     x10, x10, #PAGE_SZ
+        ldr     x11, [x10]
+        sub     w9, w9, #PAGE_SZ
----------------
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.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D40857





More information about the llvm-commits mailing list