[vm] Skip caching of function entry points in Thread in JIT mode
Cached entry points of core library functions are only used
in AOT mode (JIT mode uses Function/Code objects instead of entry
points in order to call those functions).
This change removes storing entry points into the Thread.
It fixes TSAN error which reports a data race between JIT compilation
which installs Code and caching of entry points when scheduling
a thread.
TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/49194
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Ib109118df414cd722001dad363e9e05a94ab0556
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247501
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 0429f80..d20cf54 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -614,12 +614,14 @@
thread->isolate_ = nullptr;
thread->isolate_group_ = this;
thread->field_table_values_ = nullptr;
+#if defined(DART_PRECOMPILED_RUNTIME)
if (object_store() != nullptr) {
#define INIT_ENTRY_POINT(name) \
thread->name##_entry_point_ = Function::EntryPointOf(object_store()->name());
CACHED_FUNCTION_ENTRY_POINTS_LIST(INIT_ENTRY_POINT)
#undef INIT_ENTRY_POINT
}
+#endif // defined(DART_PRECOMPILED_RUNTIME)
ASSERT(heap() != nullptr);
thread->heap_ = heap();
thread->set_os_thread(os_thread);