From 8db489cb10d26ad199cf9decadde9ca75c828395 Mon Sep 17 00:00:00 2001 From: Samir Jindel Date: Wed, 20 Feb 2019 10:44:21 +0000 Subject: [PATCH] [vm/aot] Remove unnecessary closurization of some entry-points. Change-Id: Ie84529ef3d41d55c29c9a4bf2c84a69e3dbcaa0f Reviewed-on: https://dart-review.googlesource.com/c/93429 Auto-Submit: Samir Jindel Reviewed-by: Alexander Markov Commit-Queue: Samir Jindel --- runtime/bin/common_patch.dart | 2 +- runtime/bin/directory_patch.dart | 2 +- runtime/bin/file_patch.dart | 2 +- runtime/bin/namespace_patch.dart | 2 +- runtime/bin/process_patch.dart | 2 +- runtime/bin/socket_patch.dart | 2 +- runtime/lib/array_patch.dart | 2 +- runtime/lib/async_patch.dart | 8 ++++---- runtime/lib/class_id_fasta.dart | 2 +- runtime/lib/compact_hash.dart | 2 +- runtime/lib/errors_patch.dart | 6 +++--- runtime/lib/ffi_dynamic_library_patch.dart | 2 +- runtime/lib/growable_array.dart | 2 +- runtime/lib/identical_patch.dart | 2 +- runtime/lib/internal_patch.dart | 6 +++--- runtime/lib/invocation_mirror_patch.dart | 4 ++-- runtime/lib/isolate_patch.dart | 16 ++++++++-------- runtime/lib/lib_prefix.dart | 2 +- runtime/lib/map_patch.dart | 2 +- runtime/lib/object_patch.dart | 12 ++++++------ runtime/lib/schedule_microtask_patch.dart | 4 ++-- runtime/lib/string_patch.dart | 4 ++-- runtime/lib/timer_impl.dart | 2 +- sdk/lib/io/stdio.dart | 2 +- sdk/lib/vmservice/vmservice.dart | 2 +- 25 files changed, 47 insertions(+), 47 deletions(-) diff --git a/runtime/bin/common_patch.dart b/runtime/bin/common_patch.dart index 8df07490f36..1bcd0899151 100644 --- a/runtime/bin/common_patch.dart +++ b/runtime/bin/common_patch.dart @@ -55,7 +55,7 @@ class _IOCrypto { static Uint8List getRandomBytes(int count) native "Crypto_GetRandomBytes"; } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") _setupHooks() { VMLibraryHooks.eventHandlerSendData = _EventHandler._sendData; VMLibraryHooks.timerMillisecondClock = _EventHandler._timerMillisecondClock; diff --git a/runtime/bin/directory_patch.dart b/runtime/bin/directory_patch.dart index 8249bbd60b7..7549f72abb4 100644 --- a/runtime/bin/directory_patch.dart +++ b/runtime/bin/directory_patch.dart @@ -67,5 +67,5 @@ Uri _uriBaseClosure() { return new Uri.directory(result); } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") _getUriBaseClosure() => _uriBaseClosure; diff --git a/runtime/bin/file_patch.dart b/runtime/bin/file_patch.dart index a9b36376b9a..338a2600022 100644 --- a/runtime/bin/file_patch.dart +++ b/runtime/bin/file_patch.dart @@ -415,7 +415,7 @@ class _FSEventStreamFileSystemWatcher extends _FileSystemWatcher { } } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) { return new Uint8List.view(source.buffer, offsetInBytes, length); } diff --git a/runtime/bin/namespace_patch.dart b/runtime/bin/namespace_patch.dart index f28c104d69f..d8b7295384e 100644 --- a/runtime/bin/namespace_patch.dart +++ b/runtime/bin/namespace_patch.dart @@ -35,7 +35,7 @@ class _NamespaceImpl extends NativeFieldWrapperClass1 implements _Namespace { @pragma("vm:entry-point") class _Namespace { @patch - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") static void _setupNamespace(var namespace) { _NamespaceImpl._setupNamespace(namespace); } diff --git a/runtime/bin/process_patch.dart b/runtime/bin/process_patch.dart index 373eb7d6ff5..1e5ae1ed391 100644 --- a/runtime/bin/process_patch.dart +++ b/runtime/bin/process_patch.dart @@ -129,7 +129,7 @@ class _SignalController { native "Process_ClearSignalHandler"; } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") Function _getWatchSignalInternal() => _ProcessUtils._watchSignalInternal; @patch diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart index fb7b69d7085..870179c66ed 100644 --- a/runtime/bin/socket_patch.dart +++ b/runtime/bin/socket_patch.dart @@ -1971,7 +1971,7 @@ class _RawDatagramSocket extends Stream void setRawOption(RawSocketOption option) => _socket.setRawOption(option); } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") Datagram _makeDatagram( List data, String address, List in_addr, int port) { return new Datagram(data, new _InternetAddress(address, null, in_addr), port); diff --git a/runtime/lib/array_patch.dart b/runtime/lib/array_patch.dart index 7bea7c9af12..99daf3a85ca 100644 --- a/runtime/lib/array_patch.dart +++ b/runtime/lib/array_patch.dart @@ -65,7 +65,7 @@ class List { // Factory constructing a mutable List from a parser generated List literal. // [elements] contains elements that are already type checked. - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") factory List._fromLiteral(List elements) { if (elements.isEmpty) { return new _GrowableList(0); diff --git a/runtime/lib/async_patch.dart b/runtime/lib/async_patch.dart index c293221674b..f0381ab7e6b 100644 --- a/runtime/lib/async_patch.dart +++ b/runtime/lib/async_patch.dart @@ -120,7 +120,7 @@ void _asyncStarListenHelper(var object, var awaiter) { object._awaiter = awaiter; } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") void _asyncStarMoveNextHelper(var stream) { if (stream is! _StreamImpl) { return; @@ -289,7 +289,7 @@ class _StreamImpl { Function _generator; } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") void _completeOnAsyncReturn(Completer completer, Object value) { completer.complete(value); } @@ -299,11 +299,11 @@ void _completeOnAsyncReturn(Completer completer, Object value) { Object _asyncStackTraceHelper(Function async_op) native "StackTrace_asyncStackTraceHelper"; -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") void _clearAsyncThreadStackTrace() native "StackTrace_clearAsyncThreadStackTrace"; -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") void _setAsyncThreadStackTrace(StackTrace stackTrace) native "StackTrace_setAsyncThreadStackTrace"; diff --git a/runtime/lib/class_id_fasta.dart b/runtime/lib/class_id_fasta.dart index f8579c06159..c95930f2422 100644 --- a/runtime/lib/class_id_fasta.dart +++ b/runtime/lib/class_id_fasta.dart @@ -6,7 +6,7 @@ @pragma("vm:entry-point") class ClassID { - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") @pragma("vm:exact-result-type", "dart:core#_Smi") static int getID(Object value) native "ClassID_getID"; diff --git a/runtime/lib/compact_hash.dart b/runtime/lib/compact_hash.dart index 8123b0fd73b..c5d143d5587 100644 --- a/runtime/lib/compact_hash.dart +++ b/runtime/lib/compact_hash.dart @@ -8,7 +8,7 @@ // This function takes care of rehashing of the linked hashmaps in [objects]. We // do this eagerly after snapshot deserialization. -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") void _rehashObjects(List objects) { final int length = objects.length; for (int i = 0; i < length; ++i) { diff --git a/runtime/lib/errors_patch.dart b/runtime/lib/errors_patch.dart index 1fd86bd3dde..1e61ce61414 100644 --- a/runtime/lib/errors_patch.dart +++ b/runtime/lib/errors_patch.dart @@ -31,7 +31,7 @@ class _AssertionError extends Error implements AssertionError { // AssertionError_throwNew in errors.cc fishes the assertion source code // out of the script. It expects a Dart stack frame from class // _AssertionError. Thus we need a Dart stub that calls the native code. - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") static _throwNew(int assertionStart, int assertionEnd, Object message) { _doThrowNew(assertionStart, assertionEnd, message); } @@ -39,7 +39,7 @@ class _AssertionError extends Error implements AssertionError { static _doThrowNew(int assertionStart, int assertionEnd, Object message) native "AssertionError_throwNew"; - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") static _evaluateAssertion(condition) { if (identical(condition, true) || identical(condition, false)) { return condition; @@ -194,7 +194,7 @@ class NoSuchMethodError { // The compiler emits a call to _throwNew when it cannot resolve a static // method at compile time. The receiver is actually the literal class of the // unresolved method. - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") static void _throwNew(Object receiver, String memberName, int invocation_type, Object typeArguments, List arguments, List argumentNames) { throw new NoSuchMethodError._withType(receiver, memberName, invocation_type, diff --git a/runtime/lib/ffi_dynamic_library_patch.dart b/runtime/lib/ffi_dynamic_library_patch.dart index db458055e88..29e8c886594 100644 --- a/runtime/lib/ffi_dynamic_library_patch.dart +++ b/runtime/lib/ffi_dynamic_library_patch.dart @@ -7,9 +7,9 @@ import "dart:_internal" show patch; DynamicLibrary _open(String name) native "Ffi_dl_open"; @patch +@pragma("vm:entry-point") class DynamicLibrary { @patch - @pragma("vm:entry-point") factory DynamicLibrary.open(String name) { return _open(name); } diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart index e22e8bf9133..876e6df8f21 100644 --- a/runtime/lib/growable_array.dart +++ b/runtime/lib/growable_array.dart @@ -150,7 +150,7 @@ class _GrowableList extends ListBase { void _setIndexed(int index, T value) native "GrowableList_setIndexed"; - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") void add(T value) { var len = length; if (len == _capacity) { diff --git a/runtime/lib/identical_patch.dart b/runtime/lib/identical_patch.dart index 36607fbfde0..7fa895990ab 100644 --- a/runtime/lib/identical_patch.dart +++ b/runtime/lib/identical_patch.dart @@ -9,5 +9,5 @@ bool identical(Object a, Object b) native "Identical_comparison"; @patch -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") int identityHashCode(Object object) => object._identityHashCode; diff --git a/runtime/lib/internal_patch.dart b/runtime/lib/internal_patch.dart index 83359ac875e..1b2bfe66225 100644 --- a/runtime/lib/internal_patch.dart +++ b/runtime/lib/internal_patch.dart @@ -68,7 +68,7 @@ final bool is64Bit = _inquireIs64Bit(); bool _inquireIs64Bit() native "Internal_inquireIs64Bit"; -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") @pragma("vm:exact-result-type", bool) bool _classRangeCheck(int cid, int lowerLimit, int upperLimit) { return cid >= lowerLimit && cid <= upperLimit; @@ -99,13 +99,13 @@ class Lists { // function type arguments (may be null). The result is null if both input // vectors are null or is a newly allocated and canonicalized vector of length // 'totalLen'. -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") _prependTypeArguments(functionTypeArguments, parentTypeArguments, parentLen, totalLen) native "Internal_prependTypeArguments"; // Check that a set of type arguments satisfy the type parameter bounds on a // closure. -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") _boundsCheckForPartialInstantiation(closure, typeArgs) native "Internal_boundsCheckForPartialInstantiation"; diff --git a/runtime/lib/invocation_mirror_patch.dart b/runtime/lib/invocation_mirror_patch.dart index f982d3aa89b..e7e2fe3cee7 100644 --- a/runtime/lib/invocation_mirror_patch.dart +++ b/runtime/lib/invocation_mirror_patch.dart @@ -176,7 +176,7 @@ class _InvocationMirror implements Invocation { this._positionalArguments, this._namedArguments, this._isSuperInvocation, [this._delayedTypeArgumentsLen = 0]); - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") static _allocateInvocationMirror(String functionName, List argumentsDescriptor, List arguments, bool isSuperInvocation, [int type = null]) { @@ -189,7 +189,7 @@ class _InvocationMirror implements Invocation { // indicate 0 type arguments, but the actual number of type arguments are // passed in `delayedTypeArgumentsLen`. If any type arguments are available, // the type arguments vector will be the first entry in `arguments`. - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") static _allocateInvocationMirrorForClosure( String functionName, List argumentsDescriptor, diff --git a/runtime/lib/isolate_patch.dart b/runtime/lib/isolate_patch.dart index a9a6a41df40..5e5c2351ec2 100644 --- a/runtime/lib/isolate_patch.dart +++ b/runtime/lib/isolate_patch.dart @@ -107,7 +107,7 @@ void _isolateScheduleImmediate(void callback()) { _pendingImmediateCallback = callback; } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") void _runPendingImmediateCallback() { if (_pendingImmediateCallback != null) { var callback = _pendingImmediateCallback; @@ -124,7 +124,7 @@ _ImmediateCallback _removePendingImmediateCallback() { /// The embedder can execute this function to get hold of /// [_isolateScheduleImmediate] above. -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") Function _getIsolateScheduleImmediateClosure() { return _isolateScheduleImmediate; } @@ -156,14 +156,14 @@ class _RawReceivePortImpl implements RawReceivePort { _get_sendport() native "RawReceivePortImpl_get_sendport"; // Called from the VM to retrieve the handler for a message. - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") static _lookupHandler(int id) { var result = _handlerMap[id]; return result; } // Called from the VM to dispatch to the handler. - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") static void _handleMessage(Function handler, var message) { // TODO(floitsch): this relies on the fact that any exception aborts the // VM. Once we have non-fatal global exceptions we need to catch errors @@ -197,7 +197,7 @@ class _RawReceivePortImpl implements RawReceivePort { @pragma("vm:entry-point") class _SendPortImpl implements SendPort { /*--- public interface ---*/ - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") void send(var message) { _sendInternal(message); } @@ -227,7 +227,7 @@ typedef _BinaryFunction(Null args, Null message); * initial message. Defers execution of the entry point until the * isolate is in the message loop. */ -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") void _startMainIsolate(Function entryPoint, List args) { _startIsolate( null, // no parent port @@ -245,7 +245,7 @@ void _startMainIsolate(Function entryPoint, List args) { * once support for @pragma("vm:entry_point", "get") as documented in * https://github.com/dart-lang/sdk/issues/35720 lands. */ -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") Function _getStartMainIsolateFunction() { return _startMainIsolate; } @@ -254,7 +254,7 @@ Function _getStartMainIsolateFunction() { * Takes the real entry point as argument and invokes it with the initial * message. */ -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") void _startIsolate( SendPort parentPort, Function entryPoint, diff --git a/runtime/lib/lib_prefix.dart b/runtime/lib/lib_prefix.dart index c8959310550..483a660e121 100644 --- a/runtime/lib/lib_prefix.dart +++ b/runtime/lib/lib_prefix.dart @@ -47,7 +47,7 @@ class _LibraryPrefix { var _outstandingLoadRequests = new List(); // Called from the VM when an outstanding load request has finished. -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") _completeDeferredLoads() { // Determine which outstanding load requests have completed and complete // their completer (with an error or true). For outstanding load requests diff --git a/runtime/lib/map_patch.dart b/runtime/lib/map_patch.dart index a6042061401..07dbc690b57 100644 --- a/runtime/lib/map_patch.dart +++ b/runtime/lib/map_patch.dart @@ -11,7 +11,7 @@ class Map { // The keys are at position 2*n and are already type checked by the parser // in checked mode. // The values are at position 2*n+1 and are not yet type checked. - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") factory Map._fromLiteral(List elements) { var map = new LinkedHashMap(); var len = elements.length; diff --git a/runtime/lib/object_patch.dart b/runtime/lib/object_patch.dart index 20e62c3f5b6..c6dbf5b7651 100644 --- a/runtime/lib/object_patch.dart +++ b/runtime/lib/object_patch.dart @@ -44,7 +44,7 @@ class Object { static String _toString(obj) native "Object_toString"; @patch - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") dynamic noSuchMethod(Invocation invocation) { // TODO(regis): Remove temp constructor identifier 'withInvocation'. throw new NoSuchMethodError.withInvocation(this, invocation); @@ -54,21 +54,21 @@ class Object { @pragma("vm:exact-result-type", "dart:core#_Type") Type get runtimeType native "Object_runtimeType"; - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") @pragma("vm:exact-result-type", bool) static bool _haveSameRuntimeType(a, b) native "Object_haveSameRuntimeType"; // Call this function instead of inlining instanceof, thus collecting // type feedback and reducing code size of unoptimized code. - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") bool _instanceOf(instantiatorTypeArguments, functionTypeArguments, type) native "Object_instanceOf"; // Group of functions for implementing fast simple instance of. - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") bool _simpleInstanceOf(type) native "Object_simpleInstanceOf"; - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") bool _simpleInstanceOfTrue(type) => true; - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") bool _simpleInstanceOfFalse(type) => false; } diff --git a/runtime/lib/schedule_microtask_patch.dart b/runtime/lib/schedule_microtask_patch.dart index 58e30e7b00d..0f90f1e95e3 100644 --- a/runtime/lib/schedule_microtask_patch.dart +++ b/runtime/lib/schedule_microtask_patch.dart @@ -21,12 +21,12 @@ class _ScheduleImmediate { static _ScheduleImmediateClosure _closure; } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") void _setScheduleImmediateClosure(_ScheduleImmediateClosure closure) { _ScheduleImmediate._closure = closure; } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") void _ensureScheduleImmediate() { _AsyncRun._scheduleImmediate(_startMicrotaskLoop); } diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart index e90667aa77e..0fcb35c5bca 100644 --- a/runtime/lib/string_patch.dart +++ b/runtime/lib/string_patch.dart @@ -811,7 +811,7 @@ abstract class _StringBase implements String { } // Convert single object to string. - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") static String _interpolateSingle(Object o) { if (o is String) return o; final s = o.toString(); @@ -826,7 +826,7 @@ abstract class _StringBase implements String { * into a result string. * Modifies the input list if it contains non-`String` values. */ - @pragma("vm:entry-point") + @pragma("vm:entry-point", "call") static String _interpolate(final List values) { final numValues = values.length; int totalLength = 0; diff --git a/runtime/lib/timer_impl.dart b/runtime/lib/timer_impl.dart index 01db53f1824..f6e85bd2398 100644 --- a/runtime/lib/timer_impl.dart +++ b/runtime/lib/timer_impl.dart @@ -462,7 +462,7 @@ class _Timer implements Timer { } } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") _setupHooks() { VMLibraryHooks.timerFactory = _Timer._factory; } diff --git a/sdk/lib/io/stdio.dart b/sdk/lib/io/stdio.dart index 1c1ce978399..4086f081451 100644 --- a/sdk/lib/io/stdio.dart +++ b/sdk/lib/io/stdio.dart @@ -394,7 +394,7 @@ int _stdinFD = 0; int _stdoutFD = 1; int _stderrFD = 2; -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') void _setStdioFDs(int stdin, int stdout, int stderr) { _stdinFD = stdin; _stdoutFD = stdout; diff --git a/sdk/lib/vmservice/vmservice.dart b/sdk/lib/vmservice/vmservice.dart index 2cccb59c957..72db816e8e1 100644 --- a/sdk/lib/vmservice/vmservice.dart +++ b/sdk/lib/vmservice/vmservice.dart @@ -702,7 +702,7 @@ class VMService extends MessageRouter { } } -@pragma("vm:entry-point") +@pragma("vm:entry-point", "call") RawReceivePort boot() { // Return the port we expect isolate control messages on. return isolateControlPort;