From 916476d8b9a8d80bc47bd5382764e270d1293fc1 Mon Sep 17 00:00:00 2001 From: Vlad Tsyrklevich Date: Fri, 13 Jul 2018 19:48:35 +0000 Subject: [PATCH] SafeStack: Add builtins to read unsafe stack top/bottom Summary: Introduce built-ins to read the unsafe stack top and bottom. The unsafe stack top is required to implement garbage collection scanning for Oilpan. Currently there is already a built-in 'get_unsafe_stack_start' to read the bottom of the unsafe stack, but I chose to duplicate this API because 'start' is ambiguous (e.g. Oilpan uses WTF::GetStackStart to read the safe stack top.) Reviewers: pcc Reviewed By: pcc Subscribers: llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D49152 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337037 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/SafeStack.rst | 16 ++++++++++++++-- include/clang/Basic/Builtins.def | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/SafeStack.rst b/docs/SafeStack.rst index f01b75f5cb..866a8060aa 100644 --- a/docs/SafeStack.rst +++ b/docs/SafeStack.rst @@ -165,11 +165,23 @@ never be stored on the heap, as it would leak the location of the SafeStack. This builtin function returns current unsafe stack pointer of the current thread. +``__builtin___get_unsafe_stack_bottom()`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This builtin function returns a pointer to the bottom of the unsafe stack of the +current thread. + +``__builtin___get_unsafe_stack_top()`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This builtin function returns a pointer to the top of the unsafe stack of the +current thread. + ``__builtin___get_unsafe_stack_start()`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This builtin function returns a pointer to the start of the unsafe stack of the -current thread. +Deprecated: This builtin function is an alias for +``__builtin___get_unsafe_stack_bottom()``. Design ====== diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index 39105a9b37..edd823754a 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -1412,6 +1412,8 @@ BUILTIN(__builtin_dump_struct, "ivC*v*", "tn") // Safestack builtins BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn") +BUILTIN(__builtin___get_unsafe_stack_bottom, "v*", "Fn") +BUILTIN(__builtin___get_unsafe_stack_top, "v*", "Fn") BUILTIN(__builtin___get_unsafe_stack_ptr, "v*", "Fn") // Nontemporal loads/stores builtins -- 2.40.0