Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/native/clr/host/host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ void Host::Java_mono_android_Runtime_initInternal (
FastTiming::initialize ((Logger::log_timing_categories() & LogTimingCategories::FastBare) != LogTimingCategories::FastBare);

if (FastTiming::enabled ()) [[unlikely]] {
_timing = std::make_shared<Timing> ();
_timing = new Timing ();
internal_timing.start_event (TimingEventKind::TotalRuntimeInit);
}

Expand Down
11 changes: 4 additions & 7 deletions src/native/clr/host/internal-pinvokes-clr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ _monodroid_lookup_replacement_method_info (const char *jniSourceType, const char

managed_timing_sequence* monodroid_timing_start (const char *message)
{
// Technically a reference here is against the idea of shared pointers, but
// in this instance it's fine since we know we won't be storing the pointer
// and this way things are slightly faster.
std::shared_ptr<Timing> const &timing = Host::get_timing ();
if (!timing) {
Timing *timing = Host::get_timing ();
if (timing == nullptr) {
return nullptr;
}

Expand All @@ -64,8 +61,8 @@ void monodroid_timing_stop (managed_timing_sequence *sequence, const char *messa
return;
}

std::shared_ptr<Timing> const &timing = Host::get_timing ();
if (!timing) [[unlikely]] {
Timing *timing = Host::get_timing ();
if (timing == nullptr) [[unlikely]] {
return;
}

Expand Down
6 changes: 4 additions & 2 deletions src/native/clr/include/host/host.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace xamarin::android {
static void Java_mono_android_Runtime_registerNatives (JNIEnv *env, jclass nativeClass) noexcept;
static void propagate_uncaught_exception (JNIEnv *env, jobject javaThread, jthrowable javaException) noexcept;

static auto get_timing () -> std::shared_ptr<Timing>
static auto get_timing () noexcept -> Timing*
{
return _timing;
}
Expand Down Expand Up @@ -54,7 +54,9 @@ namespace xamarin::android {
private:
static inline void *clr_host = nullptr;
static inline unsigned int domain_id = 0;
static inline std::shared_ptr<Timing> _timing{};
// Allocated once, if fast timing is enabled, and intentionally never freed: the instance
// is used for the whole lifetime of the process and released by the OS when it exits.
static inline Timing *_timing = nullptr;
static inline bool found_assembly_store = false;
static inline jnienv_register_jni_natives_fn jnienv_register_jni_natives = nullptr;
static inline jnienv_propagate_uncaught_exception_fn jnienv_propagate_uncaught_exception = nullptr;
Expand Down
Loading