swift
c73e3c1e - [NFC] Destructure AsyncFunctionPointer in getAsyncFunctionAndSize.

Commit
5 years ago
[NFC] Destructure AsyncFunctionPointer in getAsyncFunctionAndSize. In irgen::getAsyncFunctionAndSize, an AsyncFunctionPointer is destructured into one or both of (1) the underlying function pointer and (2) the async context size. Previously, the underlying function pointer was obtained via calling FunctionPointer::getPointer, which function did the work of casting the function pointer to an AsyncFunctionPointer, loading the relative function address from it, and using that relative address to obtain the function pointer. The size, then, if it was also obtained, was obtained by again casting the function pointer to an AsyncFunctionPointer and loading a field from it. To avoid this repetition, here, the relevant portion of the body of FunctionPointer::getPointer is inlined. Now only a single cast to AsyncFunctionPointerPtrTy is required and one or both fields can be loaded from it. The real benefit of this change is as follows: when these function pointers are authenticated as is required to dereference it on arm64e, the authentication will only need to be performed once rather than once for the function pointer and once for the size.
Author
Committer
Parents
Loading