mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:12:08 +00:00
Take 3 for "[vm/kernel/precomp] Remove procedures from entry points files."
I've updated the transformer test. The Windows build error appears to have been spurious. Take 2 is in patchset 1. Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try Change-Id: I6ef8f70aaf4664e0411e776463e88c2a1068dbcc Reviewed-on: https://dart-review.googlesource.com/65902 Commit-Queue: Samir Jindel <sjindel@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
9c69e7e1d2
commit
567109df7f
|
@ -102,7 +102,6 @@ Future<int> compile(List<String> arguments) async {
|
|||
entryPoints.addAll([
|
||||
'pkg/vm/lib/transformations/type_flow/entry_points.json',
|
||||
'pkg/vm/lib/transformations/type_flow/entry_points_extra.json',
|
||||
'pkg/vm/lib/transformations/type_flow/entry_points_extra_standalone.json',
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -1180,7 +1180,7 @@ class TypeFlowAnalysis implements EntryPointsListener, CallHandler {
|
|||
|
||||
TypeFlowAnalysis(Component component, CoreTypes coreTypes,
|
||||
ClosedWorldClassHierarchy hierarchy, this.environment, this.libraryIndex,
|
||||
{List<String> entryPointsJSONFiles})
|
||||
{List<String> entryPointsJSONFiles, EntryPointsAnnotationMatcher matcher})
|
||||
: nativeCodeOracle = new NativeCodeOracle(libraryIndex) {
|
||||
hierarchyCache = new _ClassHierarchyCache(this, hierarchy);
|
||||
summaryCollector =
|
||||
|
@ -1192,7 +1192,10 @@ class TypeFlowAnalysis implements EntryPointsListener, CallHandler {
|
|||
nativeCodeOracle.processEntryPointsJSONFiles(entryPointsJSONFiles, this);
|
||||
}
|
||||
|
||||
component.accept(new PragmaEntryPointsVisitor(coreTypes, this));
|
||||
matcher ??= new ConstantEntryPointsAnnotationMatcher(coreTypes);
|
||||
|
||||
component
|
||||
.accept(new PragmaEntryPointsVisitor(this, nativeCodeOracle, matcher));
|
||||
}
|
||||
|
||||
_Invocation get currentInvocation => workList.callStack.last;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,35 +1,5 @@
|
|||
{
|
||||
"roots": [
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "Object",
|
||||
"name": "noSuchMethod",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "Object",
|
||||
"name": "_haveSameRuntimeType",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "Object",
|
||||
"name": "_instanceOf",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "List",
|
||||
"name": "_fromLiteral",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "Map",
|
||||
"name": "_fromLiteral",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "_ImmutableList",
|
||||
|
@ -40,46 +10,6 @@
|
|||
"class": "_ImmutableMap",
|
||||
"action": "create-instance"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "_ImmutableMap",
|
||||
"name": "_create",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "_StringBase",
|
||||
"name": "_interpolate",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "_StringBase",
|
||||
"name": "_interpolateSingle",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"name": "_classRangeAssert",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"name": "_classIdEqualsAssert",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "_AssertionError",
|
||||
"name": "_evaluateAssertion",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "_AssertionError",
|
||||
"name": "_throwNew",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "_Closure",
|
||||
|
@ -121,54 +51,6 @@
|
|||
"class": "_CompileTimeError",
|
||||
"action": "create-instance"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "Object",
|
||||
"name": "_simpleInstanceOf",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "Object",
|
||||
"name": "_simpleInstanceOfTrue",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:core",
|
||||
"class": "Object",
|
||||
"name": "_simpleInstanceOfFalse",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:_internal",
|
||||
"name": "_classRangeCheck",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:_internal",
|
||||
"name": "_prependTypeArguments",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:async",
|
||||
"name": "_setAsyncThreadStackTrace",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:async",
|
||||
"name": "_clearAsyncThreadStackTrace",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:async",
|
||||
"name": "_asyncStarMoveNextHelper",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:async",
|
||||
"name": "_completeOnAsyncReturn",
|
||||
"action": "call"
|
||||
},
|
||||
{
|
||||
"library": "dart:async",
|
||||
"class": "_AsyncStarStreamController",
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"roots": [
|
||||
{
|
||||
"library": "dart:_builtin",
|
||||
"name": "_resolveScriptUri",
|
||||
"action": "call"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -29,25 +29,23 @@ abstract class EntryPointsListener {
|
|||
ConcreteType addAllocatedClass(Class c);
|
||||
}
|
||||
|
||||
/// Some entry points are not listed in any JSON file but are marked with the
|
||||
/// `@pragma('vm.entry_point', ...)` annotation instead.
|
||||
///
|
||||
/// Currently Procedure`s (action "call") can be annotated in this way.
|
||||
//
|
||||
// TODO(sjindel): Support all types of entry points.
|
||||
class PragmaEntryPointsVisitor extends RecursiveVisitor {
|
||||
final EntryPointsListener entryPoints;
|
||||
abstract class EntryPointsAnnotationMatcher {
|
||||
bool annotationsDefineRoot(List<Expression> annotations);
|
||||
}
|
||||
|
||||
class ConstantEntryPointsAnnotationMatcher
|
||||
implements EntryPointsAnnotationMatcher {
|
||||
final CoreTypes coreTypes;
|
||||
|
||||
PragmaEntryPointsVisitor(this.coreTypes, this.entryPoints);
|
||||
ConstantEntryPointsAnnotationMatcher(this.coreTypes);
|
||||
|
||||
bool _definesRoot(InstanceConstant constant) {
|
||||
bool definesRoot(InstanceConstant constant) {
|
||||
if (constant.classReference.node != coreTypes.pragmaClass) return false;
|
||||
|
||||
Constant name = constant.fieldValues[coreTypes.pragmaName.reference];
|
||||
assertx(name != null);
|
||||
if (name is! StringConstant ||
|
||||
(name as StringConstant).value != "vm.entry_point") {
|
||||
(name as StringConstant).value != "vm.entry-point") {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -57,34 +55,66 @@ class PragmaEntryPointsVisitor extends RecursiveVisitor {
|
|||
return options is BoolConstant && options.value;
|
||||
}
|
||||
|
||||
bool _annotationsDefineRoot(List<Expression> annotations) {
|
||||
@override
|
||||
bool annotationsDefineRoot(List<Expression> annotations) {
|
||||
for (var annotation in annotations) {
|
||||
if (annotation is ConstantExpression) {
|
||||
Constant constant = annotation.constant;
|
||||
if (constant is InstanceConstant) {
|
||||
if (_definesRoot(constant)) {
|
||||
if (definesRoot(constant)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw "All annotations must be constants!";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Some entry points are not listed in any JSON file but are marked with the
|
||||
/// `@pragma('vm.entry-point', ...)` annotation instead.
|
||||
///
|
||||
/// Currently Procedure`s (action "call") can be annotated in this way.
|
||||
//
|
||||
// TODO(sjindel): Support all types of entry points.
|
||||
class PragmaEntryPointsVisitor extends RecursiveVisitor {
|
||||
final EntryPointsListener entryPoints;
|
||||
final NativeCodeOracle nativeCodeOracle;
|
||||
final EntryPointsAnnotationMatcher matcher;
|
||||
Class currentClass = null;
|
||||
|
||||
PragmaEntryPointsVisitor(
|
||||
this.entryPoints, this.nativeCodeOracle, this.matcher);
|
||||
|
||||
@override
|
||||
visitClass(Class klass) {
|
||||
if (_annotationsDefineRoot(klass.annotations)) {
|
||||
if (matcher.annotationsDefineRoot(klass.annotations)) {
|
||||
entryPoints.addAllocatedClass(klass);
|
||||
}
|
||||
currentClass = klass;
|
||||
klass.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
visitProcedure(Procedure proc) {
|
||||
if (_annotationsDefineRoot(proc.annotations)) {
|
||||
if (matcher.annotationsDefineRoot(proc.annotations)) {
|
||||
assertx(!proc.isGetter && !proc.isSetter);
|
||||
entryPoints.addRawCall(proc.isInstanceMember
|
||||
? new InterfaceSelector(proc, callKind: CallKind.Method)
|
||||
: new DirectSelector(proc, callKind: CallKind.Method));
|
||||
nativeCodeOracle.setMemberReferencedFromNativeCode(proc);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
visitConstructor(Constructor ctor) {
|
||||
if (matcher.annotationsDefineRoot(ctor.annotations)) {
|
||||
entryPoints
|
||||
.addRawCall(new DirectSelector(ctor, callKind: CallKind.Method));
|
||||
entryPoints.addAllocatedClass(currentClass);
|
||||
nativeCodeOracle.setMemberReferencedFromNativeCode(ctor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +131,9 @@ class NativeCodeOracle {
|
|||
bool isMemberReferencedFromNativeCode(Member member) =>
|
||||
_membersReferencedFromNativeCode.contains(member);
|
||||
|
||||
void setMemberReferencedFromNativeCode(Member member) =>
|
||||
_membersReferencedFromNativeCode.add(member);
|
||||
|
||||
/// Simulate the execution of a native method by adding its entry points
|
||||
/// using [entryPointsListener]. Returns result type of the native method.
|
||||
Type handleNativeProcedure(
|
||||
|
|
|
@ -14,6 +14,7 @@ import 'package:kernel/library_index.dart' show LibraryIndex;
|
|||
import 'package:kernel/type_environment.dart';
|
||||
|
||||
import 'analysis.dart';
|
||||
import 'native_code.dart';
|
||||
import 'calls.dart';
|
||||
import 'summary_collector.dart';
|
||||
import 'types.dart';
|
||||
|
@ -31,7 +32,8 @@ const bool kDumpClassHierarchy =
|
|||
/// Whole-program type flow analysis and transformation.
|
||||
/// Assumes strong mode and closed world.
|
||||
Component transformComponent(
|
||||
CoreTypes coreTypes, Component component, List<String> entryPoints) {
|
||||
CoreTypes coreTypes, Component component, List<String> entryPoints,
|
||||
[EntryPointsAnnotationMatcher matcher]) {
|
||||
if ((entryPoints == null) || entryPoints.isEmpty) {
|
||||
throw 'Error: unable to perform global type flow analysis without entry points.';
|
||||
}
|
||||
|
@ -53,7 +55,7 @@ Component transformComponent(
|
|||
|
||||
final typeFlowAnalysis = new TypeFlowAnalysis(
|
||||
component, coreTypes, hierarchy, types, libraryIndex,
|
||||
entryPointsJSONFiles: entryPoints);
|
||||
entryPointsJSONFiles: entryPoints, matcher: matcher);
|
||||
|
||||
Procedure main = component.mainMethod;
|
||||
final Selector mainSelector = new DirectSelector(main);
|
||||
|
|
|
@ -8,13 +8,50 @@ import 'package:kernel/ast.dart';
|
|||
import 'package:kernel/core_types.dart';
|
||||
import 'package:kernel/kernel.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:vm/transformations/type_flow/native_code.dart';
|
||||
import 'package:vm/transformations/type_flow/transformer.dart'
|
||||
show transformComponent;
|
||||
import 'package:vm/transformations/type_flow/utils.dart';
|
||||
|
||||
import '../../common_test_utils.dart';
|
||||
|
||||
final String pkgVmDir = Platform.script.resolve('../../..').toFilePath();
|
||||
|
||||
// Since we don't run the constants transformation in this test, we can't
|
||||
// recognize all pragma annotations precisely. Instead, we pattern match on
|
||||
// annotations which look like a pragma and assume that their options field
|
||||
// evaluates to true.
|
||||
class ExpressionEntryPointsAnnotationMatcher
|
||||
extends EntryPointsAnnotationMatcher {
|
||||
final CoreTypes coreTypes;
|
||||
|
||||
ExpressionEntryPointsAnnotationMatcher(this.coreTypes);
|
||||
|
||||
bool _looksLikePragma(ConstructorInvocation annotation) {
|
||||
if (annotation.target.parent != coreTypes.pragmaClass) return false;
|
||||
|
||||
if (annotation.arguments.types.length != 0 ||
|
||||
annotation.arguments.positional.length < 1 ||
|
||||
annotation.arguments.named.length != 0) {
|
||||
throw "Cannot evaluate pragma annotation $annotation";
|
||||
}
|
||||
|
||||
var argument = annotation.arguments.positional[0];
|
||||
return argument is StringLiteral && argument.value == "vm.entry-point";
|
||||
}
|
||||
|
||||
@override
|
||||
bool annotationsDefineRoot(List<Expression> annotations) {
|
||||
for (var annotation in annotations) {
|
||||
assertx(annotation is! ConstantExpression);
|
||||
if (annotation is ConstructorInvocation && _looksLikePragma(annotation)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
runTestCase(Uri source) async {
|
||||
Component component = await compileTestCaseToKernelProgram(source);
|
||||
|
||||
|
@ -25,7 +62,8 @@ runTestCase(Uri source) async {
|
|||
pkgVmDir + '/lib/transformations/type_flow/entry_points_extra.json',
|
||||
];
|
||||
|
||||
component = transformComponent(coreTypes, component, entryPoints);
|
||||
component = transformComponent(coreTypes, component, entryPoints,
|
||||
new ExpressionEntryPointsAnnotationMatcher(coreTypes));
|
||||
|
||||
final actual = kernelLibraryToString(component.mainMethod.enclosingLibrary);
|
||||
|
||||
|
|
|
@ -90,8 +90,7 @@ export DART_CONFIGURATION=${DART_CONFIGURATION:-ReleaseX64}
|
|||
BIN_DIR="$OUT_DIR/$DART_CONFIGURATION"
|
||||
|
||||
ENTRY_POINTS="--entry-points ${BIN_DIR}/gen/runtime/bin/precompiler_entry_points.json \
|
||||
--entry-points ${SDK_DIR}/pkg/vm/lib/transformations/type_flow/entry_points_extra.json \
|
||||
--entry-points ${SDK_DIR}/pkg/vm/lib/transformations/type_flow/entry_points_extra_standalone.json"
|
||||
--entry-points ${SDK_DIR}/pkg/vm/lib/transformations/type_flow/entry_points_extra.json"
|
||||
|
||||
# Step 1: Generate Kernel binary from the input Dart source.
|
||||
"$BIN_DIR"/dart \
|
||||
|
@ -116,4 +115,4 @@ ENTRY_POINTS="--entry-points ${BIN_DIR}/gen/runtime/bin/precompiler_entry_points
|
|||
# Step 3: Assemble the assembly file into an ELF object.
|
||||
if [ $BUILD_ELF -eq 1 ]; then
|
||||
gcc -shared -o "$SNAPSHOT_FILE" "$DART_BOOTSTRAP_OUT"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -28,6 +28,7 @@ void _print(arg) {
|
|||
_printString(arg.toString());
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
_getPrintClosure() => _print;
|
||||
|
||||
// Asynchronous loading of resources.
|
||||
|
@ -137,6 +138,7 @@ _enforceTrailingSlash(uri) {
|
|||
|
||||
// Embedder Entrypoint:
|
||||
// The embedder calls this method with the current working directory.
|
||||
@pragma("vm.entry-point")
|
||||
void _setWorkingDirectory(String cwd) {
|
||||
if (!_setupCompleted) {
|
||||
_setupHooks();
|
||||
|
@ -152,6 +154,7 @@ void _setWorkingDirectory(String cwd) {
|
|||
|
||||
// Embedder Entrypoint:
|
||||
// The embedder calls this method with a custom package root.
|
||||
@pragma("vm.entry-point")
|
||||
String _setPackageRoot(String packageRoot) {
|
||||
if (!_setupCompleted) {
|
||||
_setupHooks();
|
||||
|
@ -182,6 +185,7 @@ String _setPackageRoot(String packageRoot) {
|
|||
}
|
||||
|
||||
// Embedder Entrypoint:
|
||||
@pragma("vm.entry-point")
|
||||
String _setPackagesMap(String packagesParam) {
|
||||
if (!_setupCompleted) {
|
||||
_setupHooks();
|
||||
|
@ -213,6 +217,7 @@ String _setPackagesMap(String packagesParam) {
|
|||
|
||||
// Resolves the script uri in the current working directory iff the given uri
|
||||
// did not specify a scheme (e.g. a path to a script file on the command line).
|
||||
@pragma("vm.entry-point")
|
||||
String _resolveScriptUri(String scriptName) {
|
||||
if (_traceLoading) {
|
||||
_log("Resolving script: $scriptName");
|
||||
|
@ -241,6 +246,7 @@ String _resolveScriptUri(String scriptName) {
|
|||
|
||||
// Embedder Entrypoint (gen_snapshot):
|
||||
// Resolve relative paths relative to working directory.
|
||||
@pragma("vm.entry-point")
|
||||
String _resolveInWorkingDirectory(String fileName) {
|
||||
if (!_setupCompleted) {
|
||||
_setupHooks();
|
||||
|
@ -297,6 +303,7 @@ String _filePathFromUri(String userUri) {
|
|||
}
|
||||
|
||||
// Embedder Entrypoint.
|
||||
@pragma("vm.entry-point")
|
||||
_libraryFilePath(String libraryUri) {
|
||||
if (!_setupCompleted) {
|
||||
_setupHooks();
|
||||
|
@ -312,6 +319,7 @@ _libraryFilePath(String libraryUri) {
|
|||
}
|
||||
|
||||
// Register callbacks and hooks with the rest of the core libraries.
|
||||
@pragma("vm.entry-point")
|
||||
_setupHooks() {
|
||||
_setupCompleted = true;
|
||||
VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes;
|
||||
|
|
|
@ -55,6 +55,7 @@ class _IOCrypto {
|
|||
static Uint8List getRandomBytes(int count) native "Crypto_GetRandomBytes";
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
_setupHooks() {
|
||||
VMLibraryHooks.eventHandlerSendData = _EventHandler._sendData;
|
||||
VMLibraryHooks.timerMillisecondClock = _EventHandler._timerMillisecondClock;
|
||||
|
|
|
@ -67,4 +67,5 @@ Uri _uriBaseClosure() {
|
|||
return new Uri.directory(result);
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
_getUriBaseClosure() => _uriBaseClosure;
|
||||
|
|
|
@ -414,6 +414,7 @@ class _FSEventStreamFileSystemWatcher extends _FileSystemWatcher {
|
|||
}
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) {
|
||||
return new Uint8List.view(source.buffer, offsetInBytes, length);
|
||||
}
|
||||
|
|
|
@ -889,46 +889,20 @@ static void ReadFile(const char* filename, uint8_t** buffer, intptr_t* size) {
|
|||
|
||||
static Dart_QualifiedFunctionName standalone_entry_points[] = {
|
||||
// Functions.
|
||||
{"dart:_builtin", "::", "_getPrintClosure"},
|
||||
{"dart:_builtin", "::", "_libraryFilePath"},
|
||||
{"dart:_builtin", "::", "_resolveInWorkingDirectory"},
|
||||
{"dart:_builtin", "::", "_setPackageRoot"},
|
||||
{"dart:_builtin", "::", "_setPackagesMap"},
|
||||
{"dart:_builtin", "::", "_setWorkingDirectory"},
|
||||
{"dart:async", "::", "_setScheduleImmediateClosure"},
|
||||
{"dart:cli", "::", "_getWaitForEvent"},
|
||||
{"dart:cli", "::", "_waitForEventClosure"},
|
||||
{"dart:io", "::", "_getUriBaseClosure"},
|
||||
{"dart:io", "::", "_getWatchSignalInternal"},
|
||||
{"dart:io", "::", "_makeDatagram"},
|
||||
{"dart:io", "::", "_makeUint8ListView"},
|
||||
{"dart:io", "::", "_setupHooks"},
|
||||
{"dart:io", "_EmbedderConfig", "_mayExit"},
|
||||
{"dart:io", "_ExternalBuffer", "get:end"},
|
||||
{"dart:io", "_ExternalBuffer", "get:start"},
|
||||
{"dart:io", "_ExternalBuffer", "set:data"},
|
||||
{"dart:io", "_ExternalBuffer", "set:end"},
|
||||
{"dart:io", "_ExternalBuffer", "set:start"},
|
||||
{"dart:io", "_Namespace", "_setupNamespace"},
|
||||
{"dart:io", "_Platform", "set:_nativeScript"},
|
||||
{"dart:io", "_ProcessStartStatus", "set:_errorCode"},
|
||||
{"dart:io", "_ProcessStartStatus", "set:_errorMessage"},
|
||||
{"dart:io", "_SecureFilterImpl", "get:buffers"},
|
||||
{"dart:io", "_SecureFilterImpl", "get:ENCRYPTED_SIZE"},
|
||||
{"dart:io", "_SecureFilterImpl", "get:SIZE"},
|
||||
{"dart:io", "CertificateException", "CertificateException."},
|
||||
{"dart:io", "Directory", "Directory."},
|
||||
{"dart:io", "File", "File."},
|
||||
{"dart:io", "FileSystemException", "FileSystemException."},
|
||||
{"dart:io", "HandshakeException", "HandshakeException."},
|
||||
{"dart:io", "Link", "Link."},
|
||||
{"dart:io", "OSError", "OSError."},
|
||||
{"dart:io", "TlsException", "TlsException."},
|
||||
{"dart:io", "X509Certificate", "X509Certificate._"},
|
||||
{"dart:isolate", "::", "_getIsolateScheduleImmediateClosure"},
|
||||
{"dart:isolate", "::", "_setupHooks"},
|
||||
{"dart:isolate", "::", "_startMainIsolate"},
|
||||
// Fields
|
||||
{"dart:io", "_EmbedderConfig", "_mayExit"},
|
||||
{"dart:cli", "::", "_waitForEventClosure"},
|
||||
{"dart:_builtin", "::", "_isolateId"},
|
||||
{"dart:_builtin", "::", "_loadPort"},
|
||||
{"dart:_internal", "::", "_printClosure"},
|
||||
|
|
|
@ -33,6 +33,7 @@ class _NamespaceImpl extends NativeFieldWrapperClass1 implements _Namespace {
|
|||
@patch
|
||||
class _Namespace {
|
||||
@patch
|
||||
@pragma("vm.entry-point")
|
||||
static void _setupNamespace(var namespace) {
|
||||
_NamespaceImpl._setupNamespace(namespace);
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ class _SignalController {
|
|||
native "Process_ClearSignalHandler";
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
Function _getWatchSignalInternal() => _ProcessUtils._watchSignalInternal;
|
||||
|
||||
@patch
|
||||
|
|
|
@ -20,6 +20,7 @@ class _SecureFilter {
|
|||
@patch
|
||||
class X509Certificate {
|
||||
@patch
|
||||
@pragma("vm.entry-point")
|
||||
factory X509Certificate._() => new _X509CertificateImpl();
|
||||
}
|
||||
|
||||
|
|
|
@ -1905,6 +1905,7 @@ class _RawDatagramSocket extends Stream<RawSocketEvent>
|
|||
}
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
Datagram _makeDatagram(
|
||||
List<int> data, String address, List<int> in_addr, int port) {
|
||||
return new Datagram(data, new _InternetAddress(address, null, in_addr), port);
|
||||
|
|
|
@ -220,7 +220,7 @@ _registerSignalHandler() {
|
|||
_signalSubscription = _signalWatch(ProcessSignal.SIGQUIT).listen(_onSignal);
|
||||
}
|
||||
|
||||
@pragma("vm.entry_point", !const bool.fromEnvironment("dart.vm.product"))
|
||||
@pragma("vm.entry-point", !const bool.fromEnvironment("dart.vm.product"))
|
||||
main() {
|
||||
// Set embedder hooks.
|
||||
VMServiceEmbedderHooks.cleanup = cleanupCallback;
|
||||
|
|
|
@ -52,6 +52,7 @@ class List<E> {
|
|||
|
||||
// Factory constructing a mutable List from a parser generated List literal.
|
||||
// [elements] contains elements that are already type checked.
|
||||
@pragma("vm.entry-point")
|
||||
factory List._fromLiteral(List elements) {
|
||||
if (elements.isEmpty) {
|
||||
return new _GrowableList<E>(0);
|
||||
|
|
|
@ -120,6 +120,7 @@ void _asyncStarListenHelper(var object, var awaiter) {
|
|||
object._awaiter = awaiter;
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
void _asyncStarMoveNextHelper(var stream) {
|
||||
if (stream is! _StreamImpl) {
|
||||
return;
|
||||
|
@ -288,6 +289,7 @@ class _StreamImpl<T> {
|
|||
Function _generator;
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
void _completeOnAsyncReturn(Completer completer, Object value) {
|
||||
completer.complete(value);
|
||||
}
|
||||
|
@ -297,9 +299,11 @@ void _completeOnAsyncReturn(Completer completer, Object value) {
|
|||
Object _asyncStackTraceHelper(Function async_op)
|
||||
native "StackTrace_asyncStackTraceHelper";
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
void _clearAsyncThreadStackTrace()
|
||||
native "StackTrace_clearAsyncThreadStackTrace";
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
void _setAsyncThreadStackTrace(StackTrace stackTrace)
|
||||
native "StackTrace_setAsyncThreadStackTrace";
|
||||
|
||||
|
|
|
@ -8,6 +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")
|
||||
void _rehashObjects(List objects) {
|
||||
final int length = objects.length;
|
||||
for (int i = 0; i < length; ++i) {
|
||||
|
|
|
@ -68,6 +68,7 @@ _registerExtension(String method, ServiceExtensionHandler handler)
|
|||
native "Developer_registerExtension";
|
||||
|
||||
// This code is only invoked when there is no other Dart code on the stack.
|
||||
@pragma("vm.entry-point", !const bool.fromEnvironment("dart.vm.product"))
|
||||
_runExtension(
|
||||
ServiceExtensionHandler handler,
|
||||
String method,
|
||||
|
|
|
@ -23,12 +23,14 @@ class Error {
|
|||
}
|
||||
|
||||
class _AssertionError extends Error implements AssertionError {
|
||||
@pragma("vm.entry-point")
|
||||
_AssertionError._create(
|
||||
this._failedAssertion, this._url, this._line, this._column, this.message);
|
||||
|
||||
// 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")
|
||||
static _throwNew(int assertionStart, int assertionEnd, Object message) {
|
||||
_doThrowNew(assertionStart, assertionEnd, message);
|
||||
}
|
||||
|
@ -36,6 +38,7 @@ class _AssertionError extends Error implements AssertionError {
|
|||
static _doThrowNew(int assertionStart, int assertionEnd, Object message)
|
||||
native "AssertionError_throwNew";
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
static _evaluateAssertion(condition) {
|
||||
if (identical(condition, true) || identical(condition, false)) {
|
||||
return condition;
|
||||
|
@ -77,6 +80,7 @@ class _AssertionError extends Error implements AssertionError {
|
|||
}
|
||||
|
||||
class _TypeError extends _AssertionError implements TypeError {
|
||||
@pragma("vm.entry-point")
|
||||
_TypeError._create(String url, int line, int column, String errorMsg)
|
||||
: super._create("is assignable", url, line, column, errorMsg);
|
||||
|
||||
|
@ -99,6 +103,7 @@ class _TypeError extends _AssertionError implements TypeError {
|
|||
}
|
||||
|
||||
class _CastError extends Error implements CastError {
|
||||
@pragma("vm.entry-point")
|
||||
_CastError._create(this._url, this._line, this._column, this._errorMsg);
|
||||
|
||||
// A CastError is allocated by TypeError._throwNew() when dst_name equals
|
||||
|
@ -116,6 +121,7 @@ class _CastError extends Error implements CastError {
|
|||
@patch
|
||||
class FallThroughError {
|
||||
@patch
|
||||
@pragma("vm.entry-point")
|
||||
FallThroughError._create(String url, int line)
|
||||
: _url = url,
|
||||
_line = line;
|
||||
|
@ -134,6 +140,7 @@ class FallThroughError {
|
|||
}
|
||||
|
||||
class _InternalError {
|
||||
@pragma("vm.entry-point")
|
||||
const _InternalError(this._msg);
|
||||
String toString() => "InternalError: '${_msg}'";
|
||||
final String _msg;
|
||||
|
@ -155,6 +162,7 @@ class CyclicInitializationError {
|
|||
|
||||
@patch
|
||||
class AbstractClassInstantiationError {
|
||||
@pragma("vm.entry-point")
|
||||
AbstractClassInstantiationError._create(
|
||||
this._className, this._url, this._line);
|
||||
|
||||
|
@ -252,6 +260,7 @@ class NoSuchMethodError {
|
|||
// _throwNew above, taking a TypeArguments object rather than an unpacked list
|
||||
// of types, as well as a list of all arguments and a list of names, rather
|
||||
// than a separate list of positional arguments and a map of named arguments.
|
||||
@pragma("vm.entry-point")
|
||||
NoSuchMethodError._withType(
|
||||
this._receiver,
|
||||
String memberName,
|
||||
|
@ -576,6 +585,7 @@ class _CompileTimeError extends Error {
|
|||
String toString() => _errorMsg;
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
dynamic _classRangeAssert(int position, dynamic instance, _Type type, int cid,
|
||||
int lowerLimit, int upperLimit) {
|
||||
if ((cid < lowerLimit || cid > upperLimit) && instance != null) {
|
||||
|
@ -585,6 +595,7 @@ dynamic _classRangeAssert(int position, dynamic instance, _Type type, int cid,
|
|||
return instance;
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
dynamic _classIdEqualsAssert(
|
||||
int position, dynamic instance, _Type type, int cid, int otherCid) {
|
||||
if (cid != otherCid && instance != null) {
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
bool identical(Object a, Object b) native "Identical_comparison";
|
||||
|
||||
@patch
|
||||
@pragma("vm.entry-point")
|
||||
int identityHashCode(Object object) => object._identityHashCode;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
class _ImmutableMap<K, V> implements Map<K, V> {
|
||||
final _ImmutableList _kvPairs;
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
const _ImmutableMap._create(_ImmutableList keyValuePairs)
|
||||
: _kvPairs = keyValuePairs;
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ final bool is64Bit = _inquireIs64Bit();
|
|||
|
||||
bool _inquireIs64Bit() native "Internal_inquireIs64Bit";
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
bool _classRangeCheck(int cid, int lowerLimit, int upperLimit) {
|
||||
return cid >= lowerLimit && cid <= upperLimit;
|
||||
}
|
||||
|
@ -97,6 +98,7 @@ 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")
|
||||
_prependTypeArguments(functionTypeArguments, parentTypeArguments, parentLen,
|
||||
totalLen) native "Internal_prependTypeArguments";
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ class _InvocationMirror implements Invocation {
|
|||
this._positionalArguments, this._namedArguments, this._isSuperInvocation,
|
||||
[this._delayedTypeArgumentsLen = 0]);
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
static _allocateInvocationMirror(String functionName,
|
||||
List argumentsDescriptor, List arguments, bool isSuperInvocation,
|
||||
[int type = null]) {
|
||||
|
@ -188,6 +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")
|
||||
static _allocateInvocationMirrorForClosure(
|
||||
String functionName,
|
||||
List argumentsDescriptor,
|
||||
|
|
|
@ -106,6 +106,7 @@ void _isolateScheduleImmediate(void callback()) {
|
|||
_pendingImmediateCallback = callback;
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
void _runPendingImmediateCallback() {
|
||||
if (_pendingImmediateCallback != null) {
|
||||
var callback = _pendingImmediateCallback;
|
||||
|
@ -122,6 +123,7 @@ _ImmediateCallback _removePendingImmediateCallback() {
|
|||
|
||||
/// The embedder can execute this function to get hold of
|
||||
/// [_isolateScheduleImmediate] above.
|
||||
@pragma("vm.entry-point")
|
||||
Function _getIsolateScheduleImmediateClosure() {
|
||||
return _isolateScheduleImmediate;
|
||||
}
|
||||
|
@ -152,12 +154,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")
|
||||
static _lookupHandler(int id) {
|
||||
var result = _handlerMap[id];
|
||||
return result;
|
||||
}
|
||||
|
||||
// Called from the VM to dispatch to the handler.
|
||||
@pragma("vm.entry-point")
|
||||
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
|
||||
|
@ -190,6 +194,7 @@ class _RawReceivePortImpl implements RawReceivePort {
|
|||
|
||||
class _SendPortImpl implements SendPort {
|
||||
/*--- public interface ---*/
|
||||
@pragma("vm.entry-point")
|
||||
void send(var message) {
|
||||
_sendInternal(message);
|
||||
}
|
||||
|
@ -219,6 +224,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")
|
||||
void _startMainIsolate(Function entryPoint, List<String> args) {
|
||||
_startIsolate(
|
||||
null, // no parent port
|
||||
|
@ -234,6 +240,7 @@ void _startMainIsolate(Function entryPoint, List<String> args) {
|
|||
* Takes the real entry point as argument and invokes it with the initial
|
||||
* message.
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
void _startIsolate(
|
||||
SendPort parentPort,
|
||||
Function entryPoint,
|
||||
|
|
|
@ -46,6 +46,7 @@ class _LibraryPrefix {
|
|||
var _outstandingLoadRequests = new List<List>();
|
||||
|
||||
// Called from the VM when an outstanding load request has finished.
|
||||
@pragma("vm.entry-point")
|
||||
_completeDeferredLoads() {
|
||||
// Determine which outstanding load requests have completed and complete
|
||||
// their completer (with an error or true). For outstanding load requests
|
||||
|
|
|
@ -11,6 +11,7 @@ class Map<K, V> {
|
|||
// 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")
|
||||
factory Map._fromLiteral(List elements) {
|
||||
var map = new LinkedHashMap<K, V>();
|
||||
var len = elements.length;
|
||||
|
|
|
@ -41,6 +41,7 @@ class Object {
|
|||
static String _toString(obj) native "Object_toString";
|
||||
|
||||
@patch
|
||||
@pragma("vm.entry-point")
|
||||
dynamic noSuchMethod(Invocation invocation) {
|
||||
// TODO(regis): Remove temp constructor identifier 'withInvocation'.
|
||||
throw new NoSuchMethodError.withInvocation(this, invocation);
|
||||
|
@ -49,16 +50,21 @@ class Object {
|
|||
@patch
|
||||
Type get runtimeType native "Object_runtimeType";
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
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")
|
||||
bool _instanceOf(instantiatorTypeArguments, functionTypeArguments, type)
|
||||
native "Object_instanceOf";
|
||||
|
||||
// Group of functions for implementing fast simple instance of.
|
||||
@pragma("vm.entry-point")
|
||||
bool _simpleInstanceOf(type) native "Object_simpleInstanceOf";
|
||||
@pragma("vm.entry-point")
|
||||
bool _simpleInstanceOfTrue(type) => true;
|
||||
@pragma("vm.entry-point")
|
||||
bool _simpleInstanceOfFalse(type) => false;
|
||||
|
||||
// Call this function instead of inlining 'as', thus collecting type
|
||||
|
|
|
@ -21,10 +21,12 @@ class _ScheduleImmediate {
|
|||
static _ScheduleImmediateClosure _closure;
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
void _setScheduleImmediateClosure(_ScheduleImmediateClosure closure) {
|
||||
_ScheduleImmediate._closure = closure;
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
void _ensureScheduleImmediate() {
|
||||
_AsyncRun._scheduleImmediate(_startMicrotaskLoop);
|
||||
}
|
||||
|
|
|
@ -794,6 +794,7 @@ abstract class _StringBase implements String {
|
|||
}
|
||||
|
||||
// Convert single object to string.
|
||||
@pragma("vm.entry-point")
|
||||
static String _interpolateSingle(Object o) {
|
||||
if (o is String) return o;
|
||||
final s = o.toString();
|
||||
|
@ -808,6 +809,7 @@ abstract class _StringBase implements String {
|
|||
* into a result string.
|
||||
* Modifies the input list if it contains non-`String` values.
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
static String _interpolate(final List values) {
|
||||
final numValues = values.length;
|
||||
int totalLength = 0;
|
||||
|
|
|
@ -462,6 +462,7 @@ class _Timer implements Timer {
|
|||
}
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
_setupHooks() {
|
||||
VMLibraryHooks.timerFactory = _Timer._factory;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
||||
@pragma("vm.entry-point")
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
|
@ -36,12 +37,14 @@ import 'dart:math' show Random;
|
|||
@patch
|
||||
class ByteData implements TypedData {
|
||||
@patch
|
||||
@pragma("vm.entry-point")
|
||||
factory ByteData(int length) {
|
||||
final list = new Uint8List(length) as _TypedList;
|
||||
return new _ByteDataView(list, 0, length);
|
||||
}
|
||||
|
||||
// Called directly from C code.
|
||||
@pragma("vm.entry-point")
|
||||
factory ByteData._view(_TypedList typedData, int offsetInBytes, int length) {
|
||||
return new _ByteDataView(typedData, offsetInBytes, length);
|
||||
}
|
||||
|
@ -1900,6 +1903,7 @@ class _ByteBuffer implements ByteBuffer {
|
|||
|
||||
_ByteBuffer(this._data);
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
factory _ByteBuffer._New(data) => new _ByteBuffer(data);
|
||||
|
||||
// Forward calls to _data.
|
||||
|
|
|
@ -491,46 +491,6 @@ void Precompiler::PrecompileConstructors() {
|
|||
}
|
||||
|
||||
static Dart_QualifiedFunctionName vm_entry_points[] = {
|
||||
// Functions
|
||||
{"dart:async", "::", "_ensureScheduleImmediate"},
|
||||
{"dart:core", "::", "_completeDeferredLoads"},
|
||||
{"dart:core", "::", "identityHashCode"},
|
||||
{"dart:core", "AbstractClassInstantiationError",
|
||||
"AbstractClassInstantiationError._create"},
|
||||
{"dart:core", "ArgumentError", "ArgumentError."},
|
||||
{"dart:core", "ArgumentError", "ArgumentError.value"},
|
||||
{"dart:core", "CyclicInitializationError", "CyclicInitializationError."},
|
||||
{"dart:core", "FallThroughError", "FallThroughError._create"},
|
||||
{"dart:core", "FormatException", "FormatException."},
|
||||
{"dart:core", "NoSuchMethodError", "NoSuchMethodError._withType"},
|
||||
{"dart:core", "NullThrownError", "NullThrownError."},
|
||||
{"dart:core", "OutOfMemoryError", "OutOfMemoryError."},
|
||||
{"dart:core", "RangeError", "RangeError."},
|
||||
{"dart:core", "RangeError", "RangeError.range"},
|
||||
{"dart:core", "StackOverflowError", "StackOverflowError."},
|
||||
{"dart:core", "UnsupportedError", "UnsupportedError."},
|
||||
{"dart:core", "_AssertionError", "_AssertionError._create"},
|
||||
{"dart:core", "_CastError", "_CastError._create"},
|
||||
{"dart:core", "_InternalError", "_InternalError."},
|
||||
{"dart:core", "_InvocationMirror", "_allocateInvocationMirror"},
|
||||
{"dart:core", "_InvocationMirror", "_allocateInvocationMirrorForClosure"},
|
||||
{"dart:core", "_TypeError", "_TypeError._create"},
|
||||
{"dart:collection", "::", "_rehashObjects"},
|
||||
{"dart:isolate", "IsolateSpawnException", "IsolateSpawnException."},
|
||||
{"dart:isolate", "::", "_runPendingImmediateCallback"},
|
||||
{"dart:isolate", "::", "_startIsolate"},
|
||||
{"dart:isolate", "_RawReceivePortImpl", "_handleMessage"},
|
||||
{"dart:isolate", "_RawReceivePortImpl", "_lookupHandler"},
|
||||
{"dart:isolate", "_SendPortImpl", "send"},
|
||||
{"dart:typed_data", "ByteData", "ByteData."},
|
||||
{"dart:typed_data", "ByteData", "ByteData._view"},
|
||||
{"dart:typed_data", "_ByteBuffer", "_ByteBuffer._New"},
|
||||
{"dart:_vmservice", "::", "boot"},
|
||||
#if !defined(PRODUCT)
|
||||
{"dart:_vmservice", "::", "_registerIsolate"},
|
||||
{"dart:developer", "Metrics", "_printMetrics"},
|
||||
{"dart:developer", "::", "_runExtension"},
|
||||
#endif // !PRODUCT
|
||||
// Fields
|
||||
{"dart:core", "Error", "_stackTrace"},
|
||||
{"dart:core", "::", "_uriBaseClosure"},
|
||||
|
@ -1508,7 +1468,7 @@ void Precompiler::AddInstantiatedClass(const Class& cls) {
|
|||
}
|
||||
}
|
||||
|
||||
// Adds all values annotated with @pragma('vm.entry_point') as roots.
|
||||
// Adds all values annotated with @pragma('vm.entry-point') as roots.
|
||||
void Precompiler::AddAnnotatedRoots() {
|
||||
auto& lib = Library::Handle(Z);
|
||||
auto& cls = Class::Handle(isolate()->object_store()->pragma_class());
|
||||
|
|
|
@ -1633,7 +1633,7 @@ TEST_CASE(IsolateReload_TearOff_Parameter_Count_Mismatch) {
|
|||
"Tried calling: C.foo()\n"
|
||||
"Found: C.foo(dynamic) => dynamic\n"
|
||||
"#0 Object.noSuchMethod "
|
||||
"(dart:core/runtime/libobject_patch.dart:46:5)\n"
|
||||
"(dart:core/runtime/libobject_patch.dart:47:5)\n"
|
||||
"#1 main (file:///test-lib:8:12)";
|
||||
} else {
|
||||
error =
|
||||
|
@ -1643,7 +1643,7 @@ TEST_CASE(IsolateReload_TearOff_Parameter_Count_Mismatch) {
|
|||
"Tried calling: C.foo()\n"
|
||||
"Found: C.foo(dynamic) => dynamic\n"
|
||||
"#0 Object.noSuchMethod "
|
||||
"(dart:core-patch/dart:core/object_patch.dart:46)\n"
|
||||
"(dart:core-patch/dart:core/object_patch.dart:47)\n"
|
||||
"#1 main (test-lib:8:12)";
|
||||
}
|
||||
EXPECT_ERROR(error_handle, error);
|
||||
|
|
|
@ -1218,6 +1218,17 @@ void KernelLoader::FinishClassLoading(const Class& klass,
|
|||
intptr_t constructor_offset = helper_.ReaderOffset() - correction_offset_;
|
||||
ActiveMemberScope active_member_scope(&active_class_, NULL);
|
||||
ConstructorHelper constructor_helper(&helper_);
|
||||
constructor_helper.ReadUntilExcluding(ConstructorHelper::kAnnotations);
|
||||
intptr_t annotation_count = helper_.ReadListLength();
|
||||
bool has_pragma_annotation;
|
||||
{
|
||||
String& native_name_unused = String::Handle();
|
||||
bool is_potential_native_unused;
|
||||
ReadProcedureAnnotations(annotation_count, &native_name_unused,
|
||||
&is_potential_native_unused,
|
||||
&has_pragma_annotation);
|
||||
}
|
||||
constructor_helper.SetJustRead(ConstructorHelper::kAnnotations);
|
||||
constructor_helper.ReadUntilExcluding(ConstructorHelper::kFunction);
|
||||
|
||||
const String& name =
|
||||
|
@ -1244,6 +1255,7 @@ void KernelLoader::FinishClassLoading(const Class& klass,
|
|||
functions_.Add(&function);
|
||||
function.set_kernel_offset(constructor_offset);
|
||||
function.set_result_type(T.ReceiverType(klass));
|
||||
function.set_has_pragma(has_pragma_annotation);
|
||||
|
||||
FunctionNodeHelper function_node_helper(&helper_);
|
||||
function_node_helper.ReadUntilExcluding(
|
||||
|
@ -1260,7 +1272,8 @@ void KernelLoader::FinishClassLoading(const Class& klass,
|
|||
constructor_helper.SetJustRead(ConstructorHelper::kFunction);
|
||||
constructor_helper.ReadUntilExcluding(ConstructorHelper::kEnd);
|
||||
|
||||
if (FLAG_enable_mirrors && constructor_helper.annotation_count_ > 0) {
|
||||
if ((FLAG_enable_mirrors || has_pragma_annotation) &&
|
||||
annotation_count > 0) {
|
||||
library.AddFunctionMetadata(function, TokenPosition::kNoSource,
|
||||
constructor_offset);
|
||||
}
|
||||
|
|
|
@ -4006,6 +4006,7 @@ void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) {
|
|||
method->has_external,
|
||||
method->has_native, // May change.
|
||||
current_class(), method->decl_begin_pos));
|
||||
func.set_has_pragma(IsPragmaAnnotation(method->metadata_pos));
|
||||
|
||||
ASSERT(innermost_function().IsNull());
|
||||
innermost_function_ = func.raw();
|
||||
|
@ -5574,8 +5575,12 @@ bool Parser::IsPatchAnnotation(TokenPosition pos) {
|
|||
}
|
||||
TokenPosScope saved_pos(this);
|
||||
SetPosition(pos);
|
||||
ExpectToken(Token::kAT);
|
||||
return IsSymbol(Symbols::Patch());
|
||||
while (CurrentToken() == Token::kAT) {
|
||||
ConsumeToken();
|
||||
if (IsSymbol(Symbols::Patch())) return true;
|
||||
SkipOneMetadata();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::IsPragmaAnnotation(TokenPosition pos) {
|
||||
|
@ -5584,8 +5589,27 @@ bool Parser::IsPragmaAnnotation(TokenPosition pos) {
|
|||
}
|
||||
TokenPosScope saved_pos(this);
|
||||
SetPosition(pos);
|
||||
ExpectToken(Token::kAT);
|
||||
return IsSymbol(Symbols::Pragma());
|
||||
while (CurrentToken() == Token::kAT) {
|
||||
ConsumeToken();
|
||||
if (IsSymbol(Symbols::Pragma())) return true;
|
||||
SkipOneMetadata();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Parser::SkipOneMetadata() {
|
||||
ExpectIdentifier("identifier expected");
|
||||
if (CurrentToken() == Token::kPERIOD) {
|
||||
ConsumeToken();
|
||||
ExpectIdentifier("identifier expected");
|
||||
if (CurrentToken() == Token::kPERIOD) {
|
||||
ConsumeToken();
|
||||
ExpectIdentifier("identifier expected");
|
||||
}
|
||||
}
|
||||
if (CurrentToken() == Token::kLPAREN) {
|
||||
SkipToMatchingParenthesis();
|
||||
}
|
||||
}
|
||||
|
||||
TokenPosition Parser::SkipMetadata() {
|
||||
|
@ -5595,18 +5619,7 @@ TokenPosition Parser::SkipMetadata() {
|
|||
TokenPosition metadata_pos = TokenPos();
|
||||
while (CurrentToken() == Token::kAT) {
|
||||
ConsumeToken();
|
||||
ExpectIdentifier("identifier expected");
|
||||
if (CurrentToken() == Token::kPERIOD) {
|
||||
ConsumeToken();
|
||||
ExpectIdentifier("identifier expected");
|
||||
if (CurrentToken() == Token::kPERIOD) {
|
||||
ConsumeToken();
|
||||
ExpectIdentifier("identifier expected");
|
||||
}
|
||||
}
|
||||
if (CurrentToken() == Token::kLPAREN) {
|
||||
SkipToMatchingParenthesis();
|
||||
}
|
||||
SkipOneMetadata();
|
||||
}
|
||||
return metadata_pos;
|
||||
}
|
||||
|
|
|
@ -412,6 +412,7 @@ class Parser : public ValueObject {
|
|||
void SkipToMatching();
|
||||
void SkipToMatchingParenthesis();
|
||||
void SkipBlock();
|
||||
void SkipOneMetadata();
|
||||
TokenPosition SkipMetadata();
|
||||
bool IsPatchAnnotation(TokenPosition pos);
|
||||
bool IsPragmaAnnotation(TokenPosition pos);
|
||||
|
|
|
@ -458,7 +458,7 @@ class ObjectPointerVisitor;
|
|||
V(GrowRegExpStack, "_growRegExpStack") \
|
||||
V(DebugProcedureName, ":Eval") \
|
||||
V(DebugClassName, "#DebugClass") \
|
||||
V(vm_entry_point, "vm.entry_point")
|
||||
V(vm_entry_point, "vm.entry-point")
|
||||
|
||||
// Contains a list of frequently used strings in a canonicalized form. This
|
||||
// list is kept in the vm_isolate in order to share the copy across isolates
|
||||
|
|
|
@ -46,6 +46,7 @@ part of dart.cli;
|
|||
*/
|
||||
external void _waitForEvent(int timeoutMillis);
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
void Function(int) _getWaitForEvent() => _waitForEvent;
|
||||
|
||||
// This should be set from C++ code by the embedder to wire up waitFor() to the
|
||||
|
|
|
@ -248,7 +248,7 @@ const Object proxy = const _Proxy();
|
|||
* function foo is annotated with a pragma 'other-pragma' specific to OtherTool.
|
||||
*
|
||||
*/
|
||||
@pragma('vm.entry_point')
|
||||
@pragma('vm.entry-point')
|
||||
class pragma {
|
||||
/**
|
||||
* The name of the hint.
|
||||
|
|
|
@ -116,6 +116,8 @@ class CastError extends Error {}
|
|||
* Error thrown when attempting to throw [:null:].
|
||||
*/
|
||||
class NullThrownError extends Error {
|
||||
@pragma("vm.entry-point")
|
||||
NullThrownError();
|
||||
String toString() => "Throw of null.";
|
||||
}
|
||||
|
||||
|
@ -139,6 +141,7 @@ class ArgumentError extends Error {
|
|||
* If the `message` is not a [String], it is assumed to be a value instead
|
||||
* of a message.
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
ArgumentError([this.message])
|
||||
: invalidValue = null,
|
||||
_hasValue = false,
|
||||
|
@ -157,6 +160,7 @@ class ArgumentError extends Error {
|
|||
* names differ from the interface, it might be more useful to use the
|
||||
* interface method's argument name (or just rename arguments to match).
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
ArgumentError.value(value, [this.name, this.message])
|
||||
: invalidValue = value,
|
||||
_hasValue = true;
|
||||
|
@ -202,6 +206,7 @@ class RangeError extends ArgumentError {
|
|||
/**
|
||||
* Create a new [RangeError] with the given [message].
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
RangeError(var message)
|
||||
: start = null,
|
||||
end = null,
|
||||
|
@ -234,6 +239,7 @@ class RangeError extends ArgumentError {
|
|||
* invalid value, and the [message] can override the default error
|
||||
* description.
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
RangeError.range(num invalidValue, int minValue, int maxValue,
|
||||
[String name, String message])
|
||||
: start = minValue,
|
||||
|
@ -411,6 +417,7 @@ class IndexError extends ArgumentError implements RangeError {
|
|||
*/
|
||||
class FallThroughError extends Error {
|
||||
FallThroughError();
|
||||
@pragma("vm.entry-point")
|
||||
external FallThroughError._create(String url, int line);
|
||||
|
||||
external String toString();
|
||||
|
@ -481,6 +488,7 @@ class NoSuchMethodError extends Error {
|
|||
*/
|
||||
class UnsupportedError extends Error {
|
||||
final String message;
|
||||
@pragma("vm.entry-point")
|
||||
UnsupportedError(this.message);
|
||||
String toString() => "Unsupported operation: $message";
|
||||
}
|
||||
|
@ -538,6 +546,7 @@ class ConcurrentModificationError extends Error {
|
|||
}
|
||||
|
||||
class OutOfMemoryError implements Error {
|
||||
@pragma("vm.entry-point")
|
||||
const OutOfMemoryError();
|
||||
String toString() => "Out of Memory";
|
||||
|
||||
|
@ -545,6 +554,7 @@ class OutOfMemoryError implements Error {
|
|||
}
|
||||
|
||||
class StackOverflowError implements Error {
|
||||
@pragma("vm.entry-point")
|
||||
const StackOverflowError();
|
||||
String toString() => "Stack Overflow";
|
||||
|
||||
|
@ -560,6 +570,7 @@ class StackOverflowError implements Error {
|
|||
*/
|
||||
class CyclicInitializationError extends Error {
|
||||
final String variableName;
|
||||
@pragma("vm.entry-point")
|
||||
CyclicInitializationError([this.variableName]);
|
||||
String toString() => variableName == null
|
||||
? "Reading static variable during its initialization"
|
||||
|
|
|
@ -74,6 +74,7 @@ class FormatException implements Exception {
|
|||
* Optionally also supply the actual [source] with the incorrect format,
|
||||
* and the [offset] in the format where a problem was detected.
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
const FormatException([this.message = "", this.source, this.offset]);
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,4 +18,5 @@ external bool identical(Object a, Object b);
|
|||
*
|
||||
* This hash code is compatible with [identical].
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
external int identityHashCode(Object object);
|
||||
|
|
|
@ -104,6 +104,7 @@ class Object {
|
|||
*
|
||||
* The default behavior is to throw a [NoSuchMethodError].
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
external dynamic noSuchMethod(Invocation invocation);
|
||||
|
||||
/**
|
||||
|
|
|
@ -144,6 +144,7 @@ class Metrics {
|
|||
}
|
||||
|
||||
// ignore: unused_element, called from native code
|
||||
@pragma("vm.entry-point", !const bool.fromEnvironment("dart.vm.product"))
|
||||
static String _printMetrics() {
|
||||
var metrics = [];
|
||||
for (var metric in _metrics.values) {
|
||||
|
|
|
@ -64,6 +64,7 @@ class OSError {
|
|||
final int errorCode;
|
||||
|
||||
/** Creates an OSError object from a message and an errorCode. */
|
||||
@pragma("vm.entry-point")
|
||||
const OSError([this.message = "", this.errorCode = noErrorCode]);
|
||||
|
||||
/** Converts an OSError object to a string representation. */
|
||||
|
|
|
@ -126,6 +126,7 @@ abstract class Directory implements FileSystemEntity {
|
|||
* If [path] is an absolute path, it will be immune to changes to the
|
||||
* current working directory.
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
factory Directory(String path) {
|
||||
final IOOverrides overrides = IOOverrides.current;
|
||||
if (overrides == null) {
|
||||
|
|
|
@ -247,6 +247,7 @@ abstract class File implements FileSystemEntity {
|
|||
* If [path] is an absolute path, it will be immune to changes to the
|
||||
* current working directory.
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
factory File(String path) {
|
||||
final IOOverrides overrides = IOOverrides.current;
|
||||
if (overrides == null) {
|
||||
|
@ -979,6 +980,7 @@ class FileSystemException implements IOException {
|
|||
* [message], optional file system path [path] and optional OS error
|
||||
* [osError].
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
const FileSystemException([this.message = "", this.path = "", this.osError]);
|
||||
|
||||
String toString() {
|
||||
|
|
|
@ -12,6 +12,7 @@ abstract class Link implements FileSystemEntity {
|
|||
/**
|
||||
* Creates a Link object.
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
factory Link(String path) {
|
||||
final IOOverrides overrides = IOOverrides.current;
|
||||
if (overrides == null) {
|
||||
|
|
|
@ -19,5 +19,6 @@ abstract class _Namespace {
|
|||
// If it is not set up by the embedder, relative paths will be resolved
|
||||
// relative to the process's current working directory and absolute paths will
|
||||
// be left relative to the file system root.
|
||||
@pragma("vm.entry-point")
|
||||
external static void _setupNamespace(var namespace);
|
||||
}
|
||||
|
|
|
@ -378,6 +378,7 @@ abstract class RawSecureSocket implements RawSocket {
|
|||
* get the fields of the certificate.
|
||||
*/
|
||||
abstract class X509Certificate {
|
||||
@pragma("vm.entry-point")
|
||||
external factory X509Certificate._();
|
||||
|
||||
/// The DER encoded bytes of the certificate.
|
||||
|
@ -1256,6 +1257,7 @@ class TlsException implements IOException {
|
|||
final String message;
|
||||
final OSError osError;
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
const TlsException([String message = "", OSError osError = null])
|
||||
: this._("TlsException", message, osError);
|
||||
|
||||
|
@ -1281,6 +1283,7 @@ class TlsException implements IOException {
|
|||
* a secure network connection.
|
||||
*/
|
||||
class HandshakeException extends TlsException {
|
||||
@pragma("vm.entry-point")
|
||||
const HandshakeException([String message = "", OSError osError = null])
|
||||
: super._("HandshakeException", message, osError);
|
||||
}
|
||||
|
@ -1291,6 +1294,7 @@ class HandshakeException extends TlsException {
|
|||
* certificate.
|
||||
*/
|
||||
class CertificateException extends TlsException {
|
||||
@pragma("vm.entry-point")
|
||||
const CertificateException([String message = "", OSError osError = null])
|
||||
: super._("CertificateException", message, osError);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ part "capability.dart";
|
|||
class IsolateSpawnException implements Exception {
|
||||
/** Error message reported by the spawn operation. */
|
||||
final String message;
|
||||
@pragma("vm.entry-point")
|
||||
IsolateSpawnException(this.message);
|
||||
String toString() => "IsolateSpawnException: $message";
|
||||
}
|
||||
|
|
|
@ -455,6 +455,7 @@ abstract class ByteData implements TypedData {
|
|||
* Creates a [ByteData] of the specified length (in elements), all of
|
||||
* whose bytes are initially zero.
|
||||
*/
|
||||
@pragma("vm.entry-point")
|
||||
external factory ByteData(int length);
|
||||
|
||||
/**
|
||||
|
|
|
@ -696,11 +696,13 @@ class VMService extends MessageRouter {
|
|||
}
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point")
|
||||
RawReceivePort boot() {
|
||||
// Return the port we expect isolate control messages on.
|
||||
return isolateControlPort;
|
||||
}
|
||||
|
||||
@pragma("vm.entry-point", !const bool.fromEnvironment("dart.vm.product"))
|
||||
void _registerIsolate(int port_id, SendPort sp, String name) {
|
||||
var service = new VMService();
|
||||
service.runningIsolates.isolateStartup(port_id, sp, name);
|
||||
|
|
|
@ -41,8 +41,6 @@ void main(List<String> args) {
|
|||
'$buildDir/gen/runtime/bin/precompiler_entry_points.json',
|
||||
'--entry-points',
|
||||
'pkg/vm/lib/transformations/type_flow/entry_points_extra.json',
|
||||
'--entry-points',
|
||||
'pkg/vm/lib/transformations/type_flow/entry_points_extra_standalone.json',
|
||||
scriptPath,
|
||||
];
|
||||
runSync("pkg/vm/tool/gen_kernel${Platform.isWindows ? '.bat' : ''}", args);
|
||||
|
|
|
@ -1036,8 +1036,6 @@ abstract class VMKernelCompilerMixin {
|
|||
'${_configuration.buildDirectory}/gen/runtime/bin/precompiler_entry_points.json',
|
||||
'--entry-points',
|
||||
'${pkgVmDir}/lib/transformations/type_flow/entry_points_extra.json',
|
||||
'--entry-points',
|
||||
'${pkgVmDir}/lib/transformations/type_flow/entry_points_extra_standalone.json',
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue