You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[vm,aot] Use inferred type arguments to remove type checks
When TFA is able to infer type arguments, write _exact type_ into
the inferred types metadata.
Use inferred exact type in the VM: load it from metadata and
attach to a field if necessary. CompileType is extended to hold
exact type if it is known.
In the instruction canonicalizer, if type arguments are loaded from
a value which has a known exact type, then replace this LoadField with
Constant type arguments from exact type.
This allows VM to use inferred type arguments to remove parameter
type checks.
TEST=runtime/tests/vm/dart/eliminate_type_check_using_exact_type_il_test.dart
Closes#61083
Change-Id: I766c5e8c49be406f3e12d38e8d966e5813500c4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440064
Commit-Queue: Alexander Markov <[email protected]>
Reviewed-by: Slava Egorov <[email protected]>
final ffi::Pointer<self::WChar> p = let final core::int #t1 = [@vm.inferred-type.metadata=dart.core::_Smi] self::WChar::#sizeOf in [@vm.direct-call.metadata=#lib::_DummyAllocator.allocate] [@vm.inferred-type.metadata=dart.ffi::Pointer (skip check)] #C33.{ffi::Allocator::allocate}<self::WChar>(){(core::int, {alignment: core::int?}) → ffi::Pointer<self::WChar>};
final ffi::Pointer<self::WCharStruct> p = let final core::int #t3 = [@vm.inferred-type.metadata=dart.core::_Smi] self::WCharStruct::#sizeOf in [@vm.direct-call.metadata=#lib::_DummyAllocator.allocate] [@vm.inferred-type.metadata=dart.ffi::Pointer (skip check)] #C33.{ffi::Allocator::allocate}<self::WCharStruct>(){(core::int, {alignment: core::int?}) → ffi::Pointer<self::WCharStruct>};
122
-
[@vm.direct-call.metadata=#lib::WCharStruct.a0] [@vm.inferred-type.metadata=!? (skip check)] new self::WCharStruct::#fromTypedDataBase(_in::unsafeCast<ffi::Pointer<self::WCharStruct>>(p)).{self::WCharStruct::a0} = 1;
122
+
[@vm.direct-call.metadata=#lib::WCharStruct.a0] [@vm.inferred-type.metadata=? (skip check)] new self::WCharStruct::#fromTypedDataBase(_in::unsafeCast<ffi::Pointer<self::WCharStruct>>(p)).{self::WCharStruct::a0} = 1;
123
123
core::print([@vm.direct-call.metadata=#lib::WCharStruct.a0] [@vm.inferred-type.metadata=int] new self::WCharStruct::#fromTypedDataBase(_in::unsafeCast<ffi::Pointer<self::WCharStruct>>(p)).{self::WCharStruct::a0}{core::int});
124
-
[@vm.direct-call.metadata=#lib::WCharStruct.a0] [@vm.inferred-type.metadata=!? (skip check)] new self::WCharStruct::#fromTypedDataBase(_in::unsafeCast<ffi::Pointer<self::WCharStruct>>(p)).{self::WCharStruct::a0} = 2;
124
+
[@vm.direct-call.metadata=#lib::WCharStruct.a0] [@vm.inferred-type.metadata=? (skip check)] new self::WCharStruct::#fromTypedDataBase(_in::unsafeCast<ffi::Pointer<self::WCharStruct>>(p)).{self::WCharStruct::a0} = 2;
125
125
core::print([@vm.direct-call.metadata=#lib::WCharStruct.a0] [@vm.inferred-type.metadata=int] new self::WCharStruct::#fromTypedDataBase(_in::unsafeCast<ffi::Pointer<self::WCharStruct>>(p)).{self::WCharStruct::a0}{core::int});
0 commit comments