[K/N] Refactor GC logging and statistics

Same code is now used for GC logging in all gc versions.

^KT-53064
This commit is contained in:
Pavel Kunyavskiy
2022-10-04 14:57:21 +02:00
committed by Space Team
parent c4e2901a1d
commit 0959255379
22 changed files with 646 additions and 201 deletions
+4 -14
View File
@@ -6,25 +6,15 @@
#include "Logging.hpp"
#include <array>
#if __has_include(<optional>)
#include <optional>
#elif __has_include(<experimental/optional>)
// TODO: Remove when wasm32 is gone.
#include <experimental/optional>
namespace std {
template <typename T>
using optional = std::experimental::optional<T>;
inline constexpr auto nullopt = std::experimental::nullopt;
} // namespace std
#else
#error "No <optional>"
#endif
#include "Format.h"
#include "KAssert.h"
#include "Porting.h"
#include "std_support/Map.hpp"
#include "std_support/String.hpp"
#include "std_support/Optional.hpp"
using namespace kotlin;
@@ -115,7 +105,7 @@ private:
class StderrLogger : public logging::internal::Logger {
public:
void Log(logging::Level level, std_support::span<const char* const> tags, std::string_view message) const noexcept override {
NO_EXTERNAL_CALLS_CHECK void Log(logging::Level level, std_support::span<const char* const> tags, std::string_view message) const noexcept override {
konan::consoleErrorUtf8(message.data(), message.size());
}
};
@@ -0,0 +1,18 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
#if __has_include(<optional>)
#include <optional>
#elif __has_include(<experimental/optional>)
// TODO: Remove when wasm32 is gone.
#include <experimental/optional>
namespace std {
template <typename T>
using optional = std::experimental::optional<T>;
inline constexpr auto nullopt = std::experimental::nullopt;
} // namespace std
#else
#error "No <optional>"
#endif
@@ -25,3 +25,4 @@ Adjustments:
`std_support::kdelete` as a replacement for operator `delete` for objects created with custom `new`.
* `Deque.hpp`, `ForwardList.hpp`, `List.hpp`, `Map.hpp`, `Set.hpp`, `String.hpp`, `UnorderedMap.hpp`, `UnorderedSet.hpp`, `Vector.hpp` -
standard containers and `std_support::string` that default to using `std_support::allocator`.
* `Optional.hpp` - wrapper choosing correct way to include on different platforms.