[vm/ffi] Change internal loads and stores to take no type arguments

Change-Id: Iab7131b5a61282470f339df81b339ceb4fe75962
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136183
Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Daco Harkes 2020-02-18 12:16:16 +00:00
parent 01f4479372
commit 953377a1fc
3 changed files with 50 additions and 88 deletions

View file

@ -1211,13 +1211,6 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfRecognizedMethod(
const auto& native_rep = compiler::ffi::NativeType::FromTypedDataClassId(
ffi_type_arg_cid, zone_);
// Check Dart signature type.
const auto& receiver_type =
AbstractType::Handle(function.ParameterTypeAt(0));
const auto& type_args = TypeArguments::Handle(receiver_type.arguments());
const auto& type_arg = AbstractType::Handle(type_args.TypeAt(0));
ASSERT(ffi_type_arg_cid == type_arg.type_class_id());
ASSERT(function.NumParameters() == 2);
LocalVariable* arg_pointer = parsed_function_->RawParameterVariable(0);
LocalVariable* arg_offset = parsed_function_->RawParameterVariable(1);
@ -1297,13 +1290,6 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfRecognizedMethod(
const auto& native_rep = compiler::ffi::NativeType::FromTypedDataClassId(
ffi_type_arg_cid, zone_);
// Check Dart signature type.
const auto& receiver_type =
AbstractType::Handle(function.ParameterTypeAt(0));
const auto& type_args = TypeArguments::Handle(receiver_type.arguments());
const auto& type_arg = AbstractType::Handle(type_args.TypeAt(0));
ASSERT(ffi_type_arg_cid == type_arg.type_class_id());
LocalVariable* arg_pointer = parsed_function_->RawParameterVariable(0);
LocalVariable* arg_offset = parsed_function_->RawParameterVariable(1);
LocalVariable* arg_value = parsed_function_->RawParameterVariable(2);
@ -1319,10 +1305,6 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfRecognizedMethod(
const auto& pointer_type_arg =
AbstractType::Handle(pointer_type_args.TypeAt(0));
// The method _storePointer is a top level generic function, not an
// instance method on a generic class.
ASSERT(!type_arg.IsInstantiated(kFunctions));
ASSERT(type_arg.IsInstantiated(kCurrentClass));
// But we type check it as a method on a generic class at runtime.
body += LoadLocal(arg_value);
body += LoadLocal(arg_pointer);

View file

@ -122,79 +122,69 @@ int _abi()
// allocating a Pointer with in elementAt/offsetBy. Allocating these pointers
// and GCing new spaces takes a lot of the benchmark time. The next speedup is
// getting rid of these allocations by inlining these functions.
int _loadInt8(Pointer<Int8> pointer, int offsetInBytes) native "Ffi_loadInt8";
int _loadInt8(Pointer pointer, int offsetInBytes) native "Ffi_loadInt8";
int _loadInt16(Pointer<Int16> pointer, int offsetInBytes)
native "Ffi_loadInt16";
int _loadInt16(Pointer pointer, int offsetInBytes) native "Ffi_loadInt16";
int _loadInt32(Pointer<Int32> pointer, int offsetInBytes)
native "Ffi_loadInt32";
int _loadInt32(Pointer pointer, int offsetInBytes) native "Ffi_loadInt32";
int _loadInt64(Pointer<Int64> pointer, int offsetInBytes)
native "Ffi_loadInt64";
int _loadInt64(Pointer pointer, int offsetInBytes) native "Ffi_loadInt64";
int _loadUint8(Pointer<Uint8> pointer, int offsetInBytes)
native "Ffi_loadUint8";
int _loadUint8(Pointer pointer, int offsetInBytes) native "Ffi_loadUint8";
int _loadUint16(Pointer<Uint16> pointer, int offsetInBytes)
native "Ffi_loadUint16";
int _loadUint16(Pointer pointer, int offsetInBytes) native "Ffi_loadUint16";
int _loadUint32(Pointer<Uint32> pointer, int offsetInBytes)
native "Ffi_loadUint32";
int _loadUint32(Pointer pointer, int offsetInBytes) native "Ffi_loadUint32";
int _loadUint64(Pointer<Uint64> pointer, int offsetInBytes)
native "Ffi_loadUint64";
int _loadUint64(Pointer pointer, int offsetInBytes) native "Ffi_loadUint64";
int _loadIntPtr(Pointer<IntPtr> pointer, int offsetInBytes)
native "Ffi_loadIntPtr";
int _loadIntPtr(Pointer pointer, int offsetInBytes) native "Ffi_loadIntPtr";
double _loadFloat(Pointer<Float> pointer, int offsetInBytes)
native "Ffi_loadFloat";
double _loadFloat(Pointer pointer, int offsetInBytes) native "Ffi_loadFloat";
double _loadDouble(Pointer<Double> pointer, int offsetInBytes)
native "Ffi_loadDouble";
double _loadDouble(Pointer pointer, int offsetInBytes) native "Ffi_loadDouble";
Pointer<S> _loadPointer<S extends NativeType>(
Pointer<Pointer<S>> pointer, int offsetInBytes) native "Ffi_loadPointer";
Pointer pointer, int offsetInBytes) native "Ffi_loadPointer";
S _loadStruct<S extends Struct>(Pointer<S> pointer, int index)
native "Ffi_loadStruct";
void _storeInt8(Pointer<Int8> pointer, int offsetInBytes, int value)
void _storeInt8(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeInt8";
void _storeInt16(Pointer<Int16> pointer, int offsetInBytes, int value)
void _storeInt16(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeInt16";
void _storeInt32(Pointer<Int32> pointer, int offsetInBytes, int value)
void _storeInt32(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeInt32";
void _storeInt64(Pointer<Int64> pointer, int offsetInBytes, int value)
void _storeInt64(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeInt64";
void _storeUint8(Pointer<Uint8> pointer, int offsetInBytes, int value)
void _storeUint8(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeUint8";
void _storeUint16(Pointer<Uint16> pointer, int offsetInBytes, int value)
void _storeUint16(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeUint16";
void _storeUint32(Pointer<Uint32> pointer, int offsetInBytes, int value)
void _storeUint32(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeUint32";
void _storeUint64(Pointer<Uint64> pointer, int offsetInBytes, int value)
void _storeUint64(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeUint64";
void _storeIntPtr(Pointer<IntPtr> pointer, int offsetInBytes, int value)
void _storeIntPtr(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeIntPtr";
void _storeFloat(Pointer<Float> pointer, int offsetInBytes, double value)
void _storeFloat(Pointer pointer, int offsetInBytes, double value)
native "Ffi_storeFloat";
void _storeDouble(Pointer<Double> pointer, int offsetInBytes, double value)
void _storeDouble(Pointer pointer, int offsetInBytes, double value)
native "Ffi_storeDouble";
void _storePointer<S extends NativeType>(Pointer<Pointer<S>> pointer,
int offsetInBytes, Pointer<S> value) native "Ffi_storePointer";
void _storePointer<S extends NativeType>(Pointer pointer, int offsetInBytes,
Pointer<S> value) native "Ffi_storePointer";
Pointer<Int8> _elementAtInt8(Pointer<Int8> pointer, int index) =>
Pointer.fromAddress(pointer.address + 1 * index);

View file

@ -120,79 +120,69 @@ int _abi()
// allocating a Pointer with in elementAt/offsetBy. Allocating these pointers
// and GCing new spaces takes a lot of the benchmark time. The next speedup is
// getting rid of these allocations by inlining these functions.
int _loadInt8(Pointer<Int8> pointer, int offsetInBytes) native "Ffi_loadInt8";
int _loadInt8(Pointer pointer, int offsetInBytes) native "Ffi_loadInt8";
int _loadInt16(Pointer<Int16> pointer, int offsetInBytes)
native "Ffi_loadInt16";
int _loadInt16(Pointer pointer, int offsetInBytes) native "Ffi_loadInt16";
int _loadInt32(Pointer<Int32> pointer, int offsetInBytes)
native "Ffi_loadInt32";
int _loadInt32(Pointer pointer, int offsetInBytes) native "Ffi_loadInt32";
int _loadInt64(Pointer<Int64> pointer, int offsetInBytes)
native "Ffi_loadInt64";
int _loadInt64(Pointer pointer, int offsetInBytes) native "Ffi_loadInt64";
int _loadUint8(Pointer<Uint8> pointer, int offsetInBytes)
native "Ffi_loadUint8";
int _loadUint8(Pointer pointer, int offsetInBytes) native "Ffi_loadUint8";
int _loadUint16(Pointer<Uint16> pointer, int offsetInBytes)
native "Ffi_loadUint16";
int _loadUint16(Pointer pointer, int offsetInBytes) native "Ffi_loadUint16";
int _loadUint32(Pointer<Uint32> pointer, int offsetInBytes)
native "Ffi_loadUint32";
int _loadUint32(Pointer pointer, int offsetInBytes) native "Ffi_loadUint32";
int _loadUint64(Pointer<Uint64> pointer, int offsetInBytes)
native "Ffi_loadUint64";
int _loadUint64(Pointer pointer, int offsetInBytes) native "Ffi_loadUint64";
int _loadIntPtr(Pointer<IntPtr> pointer, int offsetInBytes)
native "Ffi_loadIntPtr";
int _loadIntPtr(Pointer pointer, int offsetInBytes) native "Ffi_loadIntPtr";
double _loadFloat(Pointer<Float> pointer, int offsetInBytes)
native "Ffi_loadFloat";
double _loadFloat(Pointer pointer, int offsetInBytes) native "Ffi_loadFloat";
double _loadDouble(Pointer<Double> pointer, int offsetInBytes)
native "Ffi_loadDouble";
double _loadDouble(Pointer pointer, int offsetInBytes) native "Ffi_loadDouble";
Pointer<S> _loadPointer<S extends NativeType>(
Pointer<Pointer<S>> pointer, int offsetInBytes) native "Ffi_loadPointer";
Pointer pointer, int offsetInBytes) native "Ffi_loadPointer";
S _loadStruct<S extends Struct>(Pointer<S> pointer, int index)
native "Ffi_loadStruct";
void _storeInt8(Pointer<Int8> pointer, int offsetInBytes, int value)
void _storeInt8(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeInt8";
void _storeInt16(Pointer<Int16> pointer, int offsetInBytes, int value)
void _storeInt16(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeInt16";
void _storeInt32(Pointer<Int32> pointer, int offsetInBytes, int value)
void _storeInt32(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeInt32";
void _storeInt64(Pointer<Int64> pointer, int offsetInBytes, int value)
void _storeInt64(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeInt64";
void _storeUint8(Pointer<Uint8> pointer, int offsetInBytes, int value)
void _storeUint8(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeUint8";
void _storeUint16(Pointer<Uint16> pointer, int offsetInBytes, int value)
void _storeUint16(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeUint16";
void _storeUint32(Pointer<Uint32> pointer, int offsetInBytes, int value)
void _storeUint32(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeUint32";
void _storeUint64(Pointer<Uint64> pointer, int offsetInBytes, int value)
void _storeUint64(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeUint64";
void _storeIntPtr(Pointer<IntPtr> pointer, int offsetInBytes, int value)
void _storeIntPtr(Pointer pointer, int offsetInBytes, int value)
native "Ffi_storeIntPtr";
void _storeFloat(Pointer<Float> pointer, int offsetInBytes, double value)
void _storeFloat(Pointer pointer, int offsetInBytes, double value)
native "Ffi_storeFloat";
void _storeDouble(Pointer<Double> pointer, int offsetInBytes, double value)
void _storeDouble(Pointer pointer, int offsetInBytes, double value)
native "Ffi_storeDouble";
void _storePointer<S extends NativeType>(Pointer<Pointer<S>> pointer,
int offsetInBytes, Pointer<S> value) native "Ffi_storePointer";
void _storePointer<S extends NativeType>(Pointer pointer, int offsetInBytes,
Pointer<S> value) native "Ffi_storePointer";
Pointer<Int8> _elementAtInt8(Pointer<Int8> pointer, int index) =>
Pointer.fromAddress(pointer.address + 1 * index);