Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion runtime-light/core/kphp-core-impl/kphp-core-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@
// Distributed under the GPL v3 License, see LICENSE.notice.txt

#include "runtime-common/core/runtime-core.h"
#include "runtime-light/k2-platform/k2-api.h"
#include "runtime-light/state/instance-state.h"
#include "runtime-light/stdlib/diagnostics/logs.h"

namespace {

constexpr string_size_type initial_minimum_string_buffer_length = 1024;
constexpr string_size_type initial_maximum_string_buffer_length = (1 << 24);

} // namespace

RuntimeContext& RuntimeContext::get() noexcept {
return InstanceState::get().runtime_context;
if (auto* instance_state_ptr{k2::instance_state()}; instance_state_ptr != nullptr) [[likely]] {
return instance_state_ptr->runtime_context;
}
kphp::log::error("unexpected access to RuntimeContext");
}

void RuntimeContext::init() noexcept {
Expand Down
Loading