[K/N][test] Disable tail calls optimization for stack trace tests
Without disable_tail_calls attribute Clang optimizes these methods on macos_aarch64 replacing invocation (BL) with simple branch (B) that makes stacktrace have no test methods.
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
|
||||
#define NO_EXTERNAL_CALLS_CHECK __attribute__((annotate("no_external_calls_check")))
|
||||
|
||||
#define OPTNONE __attribute__((optnone))
|
||||
|
||||
#if KONAN_NO_THREADS
|
||||
#define THREAD_LOCAL_VARIABLE
|
||||
#else
|
||||
|
||||
@@ -20,24 +20,24 @@ using namespace kotlin;
|
||||
|
||||
namespace {
|
||||
|
||||
// Disable optimizations for these functions to avoid inlining and tail recursion optimization.
|
||||
template <size_t Capacity = kDynamicCapacity>
|
||||
NO_INLINE StackTrace<Capacity> GetStackTrace1(size_t skipFrames = 0) {
|
||||
OPTNONE StackTrace<Capacity> GetStackTrace1(size_t skipFrames = 0) {
|
||||
return StackTrace<Capacity>::current(skipFrames);
|
||||
}
|
||||
|
||||
template <size_t Capacity = kDynamicCapacity>
|
||||
NO_INLINE StackTrace<Capacity> GetStackTrace2(size_t skipFrames = 0) {
|
||||
OPTNONE StackTrace<Capacity> GetStackTrace2(size_t skipFrames = 0) {
|
||||
return GetStackTrace1<Capacity>(skipFrames);
|
||||
}
|
||||
|
||||
template <size_t Capacity = kDynamicCapacity>
|
||||
NO_INLINE StackTrace<Capacity> GetStackTrace3(size_t skipFrames = 0) {
|
||||
OPTNONE StackTrace<Capacity> GetStackTrace3(size_t skipFrames = 0) {
|
||||
return GetStackTrace2<Capacity>(skipFrames);
|
||||
}
|
||||
|
||||
// Disable optimizations for these functions to avoid inlining and tail recursion optimization.
|
||||
template <size_t Capacity = kDynamicCapacity>
|
||||
[[clang::optnone]] StackTrace<Capacity> GetDeepStackTrace(size_t depth) {
|
||||
OPTNONE StackTrace<Capacity> GetDeepStackTrace(size_t depth) {
|
||||
if (depth <= 1) {
|
||||
return StackTrace<Capacity>::current();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user