mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:09:49 +00:00
Clean up VM core libraries by removing dynamic invocations.
Tested: No new behaviour. Covered by prior tests. Change-Id: I739649a53c3982b673b1144e3c5aa98cc75f98a1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263042 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Kallen Tu <kallentu@google.com>
This commit is contained in:
parent
204c03a98e
commit
fee8a22c31
|
@ -42,7 +42,7 @@ class WCharArrayStruct extends ffi::Struct {
|
|||
}
|
||||
class _DummyAllocator extends core::Object implements ffi::Allocator /*hasConstConstructor*/ {
|
||||
[@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasTearOffUses:false,methodOrSetterSelectorId:4,getterSelectorId:5] [@vm.unboxing-info.metadata=(i)->b] method allocate<T extends ffi::NativeType>([@vm.inferred-type.metadata=int] core::int byteCount) → ffi::Pointer<self::_DummyAllocator::allocate::T> {
|
||||
return [@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::Pointer::fromAddress<self::_DummyAllocator::allocate::T>(0);
|
||||
return [@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::Pointer::fromAddress<self::_DummyAllocator::allocate::T>();
|
||||
}
|
||||
[@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasTearOffUses:false,methodOrSetterSelectorId:6,getterSelectorId:7] method free([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::Pointer<ffi::NativeType> pointer) → void {}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class IncompleteArrayStruct extends ffi::Struct {
|
|||
}
|
||||
class _DummyAllocator extends core::Object implements ffi::Allocator /*hasConstConstructor*/ {
|
||||
[@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasTearOffUses:false,methodOrSetterSelectorId:4,getterSelectorId:5] [@vm.unboxing-info.metadata=(i)->b] method allocate<T extends ffi::NativeType>([@vm.inferred-type.metadata=int] core::int byteCount) → ffi::Pointer<self::_DummyAllocator::allocate::T> {
|
||||
return [@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::Pointer::fromAddress<self::_DummyAllocator::allocate::T>(0);
|
||||
return [@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::Pointer::fromAddress<self::_DummyAllocator::allocate::T>();
|
||||
}
|
||||
[@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasTearOffUses:false,methodOrSetterSelectorId:6,getterSelectorId:7] method free([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::Pointer<ffi::NativeType> pointer) → void {}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import "dart:io";
|
|||
class A extends core::Object implements ffi::Finalizable {
|
||||
constructor •() → self::A
|
||||
: super core::Object::•() {
|
||||
let final ffi::NativeFinalizer #t1 = [@vm.inferred-type.metadata=dart.ffi::_NativeFinalizer?] self::_nativeFinalizer in let final ffi::Pointer<ffi::Void> #t2 = [@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::Pointer::fromAddress<ffi::Void>(1) in let final core::int #t3 = [@vm.direct-call.metadata=dart.core::_IntegerImplementation.<<] [@vm.inferred-type.metadata=int (skip check)] 1.{core::int::<<}(32){(core::int) → core::int} in [@vm.direct-call.metadata=dart.ffi::_NativeFinalizer.attach??] [@vm.inferred-type.metadata=!? (skip check)] #t1.{ffi::NativeFinalizer::attach}(this, #t2, this, #t3){(ffi::Finalizable, ffi::Pointer<ffi::Void>, {detach: core::Object?, externalSize: core::int?}) → void};
|
||||
let final ffi::NativeFinalizer #t1 = [@vm.inferred-type.metadata=dart.ffi::_NativeFinalizer?] self::_nativeFinalizer in let final ffi::Pointer<ffi::Void> #t2 = [@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::Pointer::fromAddress<ffi::Void>() in let final core::int #t3 = [@vm.direct-call.metadata=dart.core::_IntegerImplementation.<<] [@vm.inferred-type.metadata=int (skip check)] 1.{core::int::<<}(32){(core::int) → core::int} in [@vm.direct-call.metadata=dart.ffi::_NativeFinalizer.attach??] [@vm.inferred-type.metadata=!? (skip check)] #t1.{ffi::NativeFinalizer::attach}(this, #t2, this, #t3){(ffi::Finalizable, ffi::Pointer<ffi::Void>, {detach: core::Object?, externalSize: core::int?}) → void};
|
||||
_in::reachabilityFence(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class _Vector extends core::Object {
|
|||
constructor •() → self::_Vector
|
||||
: self::_Vector::_offset = 0, self::_Vector::_length = #C1, self::_Vector::_elements = [@vm.inferred-type.metadata=dart.typed_data::_Float64List] typ::Float64List::•(#C1), super core::Object::•()
|
||||
;
|
||||
[@vm.procedure-attributes.metadata=getterCalledDynamically:false,hasTearOffUses:false,methodOrSetterSelectorId:4] [@vm.unboxing-info.metadata=(b)->d] operator []([@vm.inferred-type.metadata=!] core::int i) → core::double
|
||||
[@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasTearOffUses:false,methodOrSetterSelectorId:4] [@vm.unboxing-info.metadata=(i)->d] operator []([@vm.inferred-type.metadata=int] core::int i) → core::double
|
||||
return [@vm.direct-call.metadata=dart.typed_data::_Float64List.[]] [@vm.inferred-type.metadata=dart.core::_Double (skip check)] [@vm.direct-call.metadata=#lib::_Vector._elements] [@vm.inferred-type.metadata=dart.typed_data::_Float64List] this.{self::_Vector::_elements}{core::List<core::double>}.{core::List::[]}([@vm.direct-call.metadata=dart.core::_IntegerImplementation.+] [@vm.inferred-type.metadata=int (skip check)] i.{core::num::+}([@vm.direct-call.metadata=#lib::_Vector._offset] [@vm.inferred-type.metadata=dart.core::_Smi (value: 0)] this.{self::_Vector::_offset}{core::int}){(core::num) → core::int}){(core::int) → core::double};
|
||||
[@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasTearOffUses:false,methodOrSetterSelectorId:5] [@vm.unboxing-info.metadata=(b)->d] operator *([@vm.inferred-type.metadata=#lib::_Vector?] self::_Vector a) → core::double {
|
||||
core::double result = 0.0;
|
||||
|
|
|
@ -706,8 +706,7 @@ class _HttpClientResponse extends _HttpInboundMessageListInt
|
|||
if (onError is void Function(Object, StackTrace)) {
|
||||
onError(e, st);
|
||||
} else {
|
||||
assert(onError is void Function(Object));
|
||||
onError(e);
|
||||
(onError as void Function(Object))(e);
|
||||
}
|
||||
}, onDone: () {
|
||||
_profileData?.finishResponse();
|
||||
|
|
|
@ -77,10 +77,10 @@ class _IOService {
|
|||
if (_receivePort == null) {
|
||||
_receivePort = new RawReceivePort(null, 'IO Service');
|
||||
_replyToPort = _receivePort!.sendPort;
|
||||
_receivePort!.handler = (data) {
|
||||
assert(data is List && data.length == 2);
|
||||
_receivePort!.handler = (List<Object?> data) {
|
||||
assert(data.length == 2);
|
||||
_messageMap.remove(data[0])!.complete(data[1]);
|
||||
_servicePorts._returnPort(data[0]);
|
||||
_servicePorts._returnPort(data[0] as int);
|
||||
if (_messageMap.length == 0) {
|
||||
_finalize();
|
||||
}
|
||||
|
|
|
@ -167,11 +167,12 @@ class _SecureFilterImpl extends NativeFieldWrapperClass1
|
|||
external X509Certificate? get peerCertificate;
|
||||
|
||||
@pragma("vm:external-name", "SecureSocket_RegisterBadCertificateCallback")
|
||||
external void _registerBadCertificateCallback(Function callback);
|
||||
external void _registerBadCertificateCallback(
|
||||
bool Function(X509Certificate) callback);
|
||||
|
||||
Function? badCertificateCallback;
|
||||
bool Function(X509Certificate)? badCertificateCallback;
|
||||
|
||||
void registerBadCertificateCallback(Function callback) {
|
||||
void registerBadCertificateCallback(bool Function(X509Certificate) callback) {
|
||||
badCertificateCallback = callback;
|
||||
_registerBadCertificateCallback(callback);
|
||||
}
|
||||
|
|
|
@ -1295,13 +1295,14 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
|||
InternetAddress get remoteAddress {
|
||||
if (isClosing || isClosed) throw const SocketException.closed();
|
||||
var result = nativeGetRemotePeer();
|
||||
var addr = result[0];
|
||||
var type = new InternetAddressType._from(addr[0]);
|
||||
var addr = result[0] as List<Object?>;
|
||||
var type = new InternetAddressType._from(addr[0] as int);
|
||||
if (type == InternetAddressType.unix) {
|
||||
return _InternetAddress.fromString(addr[1],
|
||||
return _InternetAddress.fromString(addr[1] as String,
|
||||
type: InternetAddressType.unix);
|
||||
}
|
||||
return _InternetAddress(type, addr[1], null, addr[2]);
|
||||
return _InternetAddress(
|
||||
type, addr[1] as String, null, addr[2] as Uint8List);
|
||||
}
|
||||
|
||||
void issueReadEvent() {
|
||||
|
|
|
@ -33,8 +33,8 @@ bool _isWindows = false;
|
|||
@pragma('vm:entry-point')
|
||||
bool _isFuchsia = false;
|
||||
@pragma('vm:entry-point')
|
||||
var _signalWatch = null;
|
||||
var _signalSubscription;
|
||||
Stream<ProcessSignal> Function(ProcessSignal signal)? _signalWatch;
|
||||
StreamSubscription<ProcessSignal>? _signalSubscription;
|
||||
@pragma("vm:entry-point")
|
||||
bool _enableServicePortFallback = false;
|
||||
@pragma("vm:entry-point")
|
||||
|
@ -147,8 +147,9 @@ class _DebuggingSession {
|
|||
|
||||
Future<void> cleanupCallback() async {
|
||||
// Cancel the sigquit subscription.
|
||||
if (_signalSubscription != null) {
|
||||
await _signalSubscription.cancel();
|
||||
final signalSubscription = _signalSubscription;
|
||||
if (signalSubscription != null) {
|
||||
await signalSubscription.cancel();
|
||||
_signalSubscription = null;
|
||||
}
|
||||
final localServer = server;
|
||||
|
@ -159,8 +160,9 @@ Future<void> cleanupCallback() async {
|
|||
print('Error in vm-service shutdown: $e\n$st\n');
|
||||
}
|
||||
}
|
||||
if (_registerSignalHandlerTimer != null) {
|
||||
_registerSignalHandlerTimer!.cancel();
|
||||
final timer = _registerSignalHandlerTimer;
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
_registerSignalHandlerTimer = null;
|
||||
}
|
||||
// Call out to embedder's shutdown callback.
|
||||
|
@ -344,7 +346,8 @@ void _registerSignalHandler() {
|
|||
return;
|
||||
}
|
||||
_registerSignalHandlerTimer = null;
|
||||
if (_signalWatch == null) {
|
||||
final signalWatch = _signalWatch;
|
||||
if (signalWatch == null) {
|
||||
// Cannot register for signals.
|
||||
return;
|
||||
}
|
||||
|
@ -352,7 +355,7 @@ void _registerSignalHandler() {
|
|||
// Cannot register for signals on Windows or Fuchsia.
|
||||
return;
|
||||
}
|
||||
_signalSubscription = _signalWatch(ProcessSignal.sigquit).listen(_onSignal);
|
||||
_signalSubscription = signalWatch(ProcessSignal.sigquit).listen(_onSignal);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
|
||||
|
|
|
@ -1348,7 +1348,7 @@ abstract class _SecureFilter {
|
|||
void init();
|
||||
X509Certificate? get peerCertificate;
|
||||
int processBuffer(int bufferIndex);
|
||||
void registerBadCertificateCallback(Function callback);
|
||||
void registerBadCertificateCallback(bool Function(X509Certificate) callback);
|
||||
void registerHandshakeCompleteCallback(Function handshakeCompleteHandler);
|
||||
void registerKeyLogPort(SendPort port);
|
||||
|
||||
|
|
|
@ -360,7 +360,7 @@ class DevFS {
|
|||
}
|
||||
final pendingWrites = <Future<void>>[];
|
||||
for (int i = 0; i < uris.length; i++) {
|
||||
final file = files[i].cast<String>();
|
||||
final file = (files[i] as List<dynamic>).cast<String>();
|
||||
final decodedFileContents = base64.decode(file[1]);
|
||||
pendingWrites.add(writeFile(uris[i], decodedFileContents));
|
||||
}
|
||||
|
|
|
@ -348,7 +348,8 @@ class VMService extends MessageRouter {
|
|||
return;
|
||||
}
|
||||
final cpuSamplesEvent = eventData['cpuSamples']! as Map<String, dynamic>;
|
||||
final samples = cpuSamplesEvent['samples']!.cast<Map<String, dynamic>>();
|
||||
final samples = (cpuSamplesEvent['samples']! as List<dynamic>)
|
||||
.cast<Map<String, dynamic>>();
|
||||
final updatedSamples = samples
|
||||
.where(
|
||||
(s) => client.profilerUserTagFilters.contains(s['userTag']),
|
||||
|
@ -733,7 +734,8 @@ class VMService extends MessageRouter {
|
|||
|
||||
// TODO(bkonyi): handle "subscribe all" case.
|
||||
final client = message.client!;
|
||||
final userTags = message.params['userTags']!.cast<String>();
|
||||
final userTags =
|
||||
(message.params['userTags']! as List<dynamic>).cast<String>();
|
||||
final tags = userTags.toSet();
|
||||
final newTags = tags.difference(_profilerUserTagSubscriptions);
|
||||
|
||||
|
|
Loading…
Reference in a new issue