[K/N] try to reimplement safe points with a load-branch-call

This commit is contained in:
Aleksei.Glushko
2023-04-03 23:09:04 +02:00
committed by Space Team
parent 5b4916a808
commit 5618ee84f8
30 changed files with 236 additions and 301 deletions
@@ -3,6 +3,8 @@
* that can be found in the LICENSE file.
*/
#pragma once
#include "Common.h"
#include "Utils.hpp"
@@ -9,6 +9,7 @@
#include <cstdarg>
#include "std_support/Span.hpp"
#include "CallsChecker.hpp"
#include "Format.h"
#include "Porting.h"
#include "StackTrace.hpp"
@@ -20,6 +21,8 @@ namespace {
THREAD_LOCAL_VARIABLE bool assertionReportInProgress = false;
void PrintAssert(bool allowStacktrace, const char* location, const char* format, std::va_list args) noexcept {
CallsCheckerIgnoreGuard ignoreCallsChecker;
if (assertionReportInProgress) {
// WARNING: avoid anything that can assert ar panic here
konan::consoleErrorf("An attempt to report an assertion lead to another failure:\n");
@@ -129,7 +129,6 @@ int getSourceInfo(void* symbol, SourceInfo *result, int result_len) {
// TODO: this implementation is just a hack, e.g. the result is inexact;
// however it is better to have an inexact stacktrace than not to have any.
NO_INLINE std_support::vector<void*> kotlin::internal::GetCurrentStackTrace(size_t skipFrames) noexcept {
NativeOrUnregisteredThreadGuard guard(true);
#if KONAN_NO_BACKTRACE
return {};
#else
@@ -174,7 +173,6 @@ NO_INLINE std_support::vector<void*> kotlin::internal::GetCurrentStackTrace(size
// TODO: this implementation is just a hack, e.g. the result is inexact;
// however it is better to have an inexact stacktrace than not to have any.
NO_INLINE size_t kotlin::internal::GetCurrentStackTrace(size_t skipFrames, std_support::span<void*> buffer) noexcept {
NativeOrUnregisteredThreadGuard guard(true);
#if KONAN_NO_BACKTRACE
return {};
#else
@@ -276,7 +274,6 @@ KNativePtr adjustAddressForSourceInfo(KNativePtr address) { return address; }
#endif
std_support::vector<std_support::string> kotlin::GetStackTraceStrings(std_support::span<void* const> stackTrace) noexcept {
NativeOrUnregisteredThreadGuard guard(true);
#if KONAN_NO_BACKTRACE
std_support::vector<std_support::string> strings;
strings.push_back("<UNIMPLEMENTED>");