diff --git a/runtime/vm/compiler/compiler_state.cc b/runtime/vm/compiler/compiler_state.cc index d0834899315..1a8e3b9b6e8 100644 --- a/runtime/vm/compiler/compiler_state.cc +++ b/runtime/vm/compiler/compiler_state.cc @@ -141,7 +141,6 @@ DEFINE_TYPED_LIST_NATIVE_FUNCTION_GETTER(Float64x2, float64x2) return *Lower##_class_; \ } -DEFINE_CLASS_GETTER(TypedData, TypedData, typed_data, TypedData) DEFINE_CLASS_GETTER(TypedData, TypedList, typed_list, _TypedList) #undef DEFINE_CLASS_GETTER diff --git a/runtime/vm/compiler/compiler_state.h b/runtime/vm/compiler/compiler_state.h index 2cd6a392b3a..6820b51d88b 100644 --- a/runtime/vm/compiler/compiler_state.h +++ b/runtime/vm/compiler/compiler_state.h @@ -127,7 +127,6 @@ class CompilerState : public ThreadStackResource { const Function& TypedListSetFloat64x2(); const Class& ErrorClass(); - const Class& TypedDataClass(); const Field& ErrorStackTraceField(); @@ -174,7 +173,6 @@ class CompilerState : public ThreadStackResource { const Class* array_class_ = nullptr; const Class* compound_class_ = nullptr; const Class* struct_class_ = nullptr; - const Class* typed_data_class_ = nullptr; const Class* union_class_ = nullptr; const Field* compound_offset_in_bytes_field_ = nullptr; const Field* compound_typed_data_base_field_ = nullptr; diff --git a/runtime/vm/compiler/ffi/marshaller.cc b/runtime/vm/compiler/ffi/marshaller.cc index c975ef4b377..cf623895062 100644 --- a/runtime/vm/compiler/ffi/marshaller.cc +++ b/runtime/vm/compiler/ffi/marshaller.cc @@ -7,7 +7,6 @@ #include "platform/assert.h" #include "platform/globals.h" #include "vm/class_id.h" -#include "vm/compiler/compiler_state.h" #include "vm/compiler/ffi/frame_rebase.h" #include "vm/compiler/ffi/native_calling_convention.h" #include "vm/compiler/ffi/native_location.h" @@ -194,8 +193,15 @@ bool BaseMarshaller::IsTypedDataPointer(intptr_t arg_index) const { } const auto& type = AbstractType::Handle(zone_, DartType(arg_index)); - return type.type_class() == - Thread::Current()->compiler_state().TypedDataClass().ptr(); + auto* const object_store = Thread::Current()->isolate_group()->object_store(); + auto& typed_data_cls = Class::Handle(zone_, object_store->typed_data_class()); + if (typed_data_cls.IsNull()) { + const auto& lib = Library::Handle(zone_, Library::TypedDataLibrary()); + typed_data_cls = lib.LookupClass(Symbols::TypedData()); + ASSERT(!typed_data_cls.IsNull()); + object_store->set_typed_data_class(typed_data_cls); + } + return type.type_class() == typed_data_cls.ptr(); } static bool IsCompound(Zone* zone, const AbstractType& type) { diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h index 716ebee7723..31f2e5040c9 100644 --- a/runtime/vm/object_store.h +++ b/runtime/vm/object_store.h @@ -213,6 +213,7 @@ class ObjectPointerVisitor; RW(Array, saved_unlinked_calls) \ RW(GrowableObjectArray, megamorphic_cache_table) \ RW(GrowableObjectArray, ffi_callback_code) \ + ARW_AR(Class, typed_data_class) \ RW(Array, ffi_callback_functions) \ /* Roots for JIT/AOT snapshots are up until here (see to_snapshot() below)*/ \ RW(Array, dispatch_table_code_entries) \ diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc index 6fd1c1f16b8..023ca158d2c 100644 --- a/runtime/vm/runtime_entry.cc +++ b/runtime/vm/runtime_entry.cc @@ -1490,10 +1490,6 @@ DEFINE_RUNTIME_ENTRY(FfiCall, 2) { FunctionType::ZoneHandle(zone, function.FfiCSignature()); const bool is_leaf = function.FfiIsLeaf(); - // Used by compiler::ffi::CallMarshaller. - CompilerState compiler_state(thread, /*is_aot=*/FLAG_precompiled_mode, - /*is_optimizing=*/false); - const char* error = nullptr; const auto marshaller_ptr = compiler::ffi::CallMarshaller::FromFunction( zone, function, first_argument_parameter_offset, c_signature, &error);