[3.0 alpha][VM/Runtime] - Flip flag to make strong null safety the default.

- Flip flag to make strong null safety the default
- Remove code that auto detects null safety mode from source files,
  it is necessary to specify --no-strong-null-safety to opt out.
- Retains sniffing of AOT/JIT snapshots and kernel files to determine
  null safety mode, the opt out has to be done when generating these
  file.

TEST=ci

Change-Id: If2c9608eedb7c46d9c3cd85e261ee9640e0d28eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261140
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
asiva 2022-12-06 04:04:23 +00:00 committed by Commit Queue
parent 7e0d92d69d
commit 606a64a743
94 changed files with 458 additions and 1282 deletions

View file

@ -17,6 +17,7 @@ List<String> dart2JsCommand(List<String> args) {
String dart2jsPath =
path.normalize(path.join(basePath, 'pkg/compiler/lib/src/dart2js.dart'));
List command = <String>[];
command.add('--no-sound-null-safety');
if (Platform.packageConfig != null) {
command.add('--packages=${Platform.packageConfig}');
}

View file

@ -125,6 +125,7 @@ abstract class CFEStep extends IOModularStep {
// TODO(joshualitt): Ensure the kernel worker has some way to specify
// --no-sound-null-safety
List<String> args = [
'--no-sound-null-safety',
_kernelWorkerScript,
...stepArguments,
'--exclude-non-sources',
@ -268,6 +269,7 @@ class ModularAnalysisStep extends IOModularStep {
}
List<String> args = [
'--no-sound-null-safety',
'--packages=${sdkRoot.toFilePath()}/$packageConfigJsonPath',
_dart2jsScript,
'--no-sound-null-safety',
@ -343,6 +345,7 @@ class ConcatenateDillsStep extends IOModularStep {
.toList();
dataDependencies.add('${toUri(module, modularDataId)}');
List<String> args = [
'--no-sound-null-safety',
'--packages=${sdkRoot.toFilePath()}/$packageConfigJsonPath',
_dart2jsScript,
// TODO(sigmund): remove this dependency on libraries.json
@ -403,6 +406,7 @@ class ComputeClosedWorldStep extends IOModularStep {
if (_options.verbose)
print("\nstep: dart2js compute closed world on $module");
List<String> args = [
'--no-sound-null-safety',
'--packages=${sdkRoot.toFilePath()}/$packageConfigJsonPath',
_dart2jsScript,
// TODO(sigmund): remove this dependency on libraries.json
@ -452,6 +456,7 @@ class GlobalAnalysisStep extends IOModularStep {
List<String> flags) async {
if (_options.verbose) print("\nstep: dart2js global analysis on $module");
List<String> args = [
'--no-sound-null-safety',
'--packages=${sdkRoot.toFilePath()}/$packageConfigJsonPath',
_dart2jsScript,
// TODO(sigmund): remove this dependency on libraries.json
@ -506,6 +511,7 @@ class Dart2jsCodegenStep extends IOModularStep {
List<String> flags) async {
if (_options.verbose) print("\nstep: dart2js backend on $module");
List<String> args = [
'--no-sound-null-safety',
'--packages=${sdkRoot.toFilePath()}/$packageConfigJsonPath',
_dart2jsScript,
if (_options.useSdk) '--libraries-spec=$_librarySpecForSnapshot',
@ -559,6 +565,7 @@ class Dart2jsEmissionStep extends IOModularStep {
List<String> flags) async {
if (_options.verbose) print("step: dart2js backend on $module");
List<String> args = [
'--no-sound-null-safety',
'--packages=${sdkRoot.toFilePath()}/$packageConfigJsonPath',
_dart2jsScript,
if (_options.useSdk) '--libraries-spec=$_librarySpecForSnapshot',

View file

@ -28,7 +28,7 @@ Future<void> generateNative({
required List<String> defines,
String enableExperiment = '',
bool enableAsserts = false,
bool? soundNullSafety,
bool soundNullSafety = true,
bool verbose = false,
String verbosity = 'all',
List<String> extraOptions = const [],
@ -64,8 +64,7 @@ Future<void> generateNative({
extraGenKernelOptions: [
'--invocation-modes=compile',
'--verbosity=$verbosity',
if (soundNullSafety != null)
'--${soundNullSafety ? '' : 'no-'}sound-null-safety',
'--${soundNullSafety ? '' : 'no-'}sound-null-safety',
]);
await _forwardOutput(kernelResult);
if (kernelResult.exitCode != 0) {
@ -76,11 +75,15 @@ Future<void> generateNative({
print('Generating AOT snapshot.');
}
List<String> extraAotOptions = [
if (!soundNullSafety) "--no-sound-null-safety",
...extraOptions
];
final String snapshotFile = (outputKind == Kind.aot
? outputPath
: path.join(tempDir.path, 'snapshot.aot'));
final snapshotResult = await generateAotSnapshot(genSnapshot, kernelFile,
snapshotFile, debugPath, enableAsserts, extraOptions);
snapshotFile, debugPath, enableAsserts, extraAotOptions);
if (verbose || snapshotResult.exitCode != 0) {
await _forwardOutput(snapshotResult);

View file

@ -129,7 +129,7 @@ class CompileSnapshotCommand extends CompileSubcommandCommand {
)
..addFlag('sound-null-safety',
help: 'Respect the nullability of types at runtime.',
defaultsTo: null)
defaultsTo: true)
..addExperimentalFlags(verbose: verbose);
}
@ -186,9 +186,9 @@ class CompileSnapshotCommand extends CompileSubcommandCommand {
buildArgs.add('--snapshot-kind=$formatName');
buildArgs.add('--snapshot=${path.canonicalize(outputFile)}');
final bool? soundNullSafety = args['sound-null-safety'];
if (soundNullSafety != null) {
buildArgs.add('--${soundNullSafety ? '' : 'no-'}sound-null-safety');
final bool soundNullSafety = args['sound-null-safety'];
if (!soundNullSafety) {
buildArgs.add('--no-sound-null-safety');
}
final String? packages = args[packagesOption.flag];
@ -267,7 +267,7 @@ class CompileNativeCommand extends CompileSubcommandCommand {
)
..addFlag('sound-null-safety',
help: 'Respect the nullability of types at runtime.',
defaultsTo: null)
defaultsTo: true)
..addOption('save-debugging-info', abbr: 'S', valueHelp: 'path', help: '''
Remove debugging information from the output and save it separately to the specified file.
<path> can be relative or absolute.''')

View file

@ -522,7 +522,6 @@ void main() {
test('Compile exe with unsound null safety', () async {
final p = project(mainSrc: '''
// @dart=2.9
void main() {}
''');
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
@ -532,6 +531,7 @@ void main() {}
[
'compile',
'exe',
'--no-sound-null-safety',
'-o',
outFile,
inFile,
@ -786,7 +786,6 @@ void main() {
test('Compile AOT snapshot with unsound null safety', () async {
final p = project(mainSrc: '''
// @dart=2.9
void main() {}
''');
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
@ -796,6 +795,7 @@ void main() {}
[
'compile',
'aot-snapshot',
'--no-sound-null-safety',
'-o',
outFile,
inFile,
@ -917,7 +917,7 @@ void main() {
expect(File(outFile).existsSync(), false, reason: 'File found: $outFile');
});
test('Compile kernel with sound null safety', () async {
test('Compile kernel with default (sound null safety)', () async {
final p = project(mainSrc: '''void main() {}''');
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
final outFile = path.canonicalize(path.join(p.dirPath, 'mydill'));
@ -940,7 +940,6 @@ void main() {
test('Compile kernel with unsound null safety', () async {
final p = project(mainSrc: '''
// @dart=2.9
void main() {}
''');
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
@ -950,6 +949,7 @@ void main() {}
[
'compile',
'kernel',
'--no-sound-null-safety',
'-o',
outFile,
inFile,
@ -1086,7 +1086,7 @@ void main() {
expect(result.exitCode, 0);
});
test('Compile JIT snapshot with sound null safety', () async {
test('Compile JIT snapshot with default (sound null safety)', () async {
final p = project(mainSrc: '''void main() {}''');
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
final outFile = path.canonicalize(path.join(p.dirPath, 'myjit'));
@ -1109,7 +1109,6 @@ void main() {
test('Compile JIT snapshot with unsound null safety', () async {
final p = project(mainSrc: '''
// @dart=2.9
void main() {}
''');
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
@ -1119,6 +1118,7 @@ void main() {}
[
'compile',
'jit-snapshot',
'--no-sound-null-safety',
'-o',
outFile,
inFile,

View file

@ -135,8 +135,6 @@ void main() {
test('has package:test dependency', () async {
p = project(mainSrc: 'int get foo => 1;\n');
p.file('test/foo_test.dart', '''
$dartVersionFilePrefix2_9
import 'package:test/test.dart';
void main() {

View file

@ -340,8 +340,6 @@ final String mainFileContent = """
// 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.
// @dart = 2.9
import "${DocTestIncrementalCompiler.dartDocTestUri}" as tester;
import "dart:isolate";

View file

@ -173,7 +173,7 @@ ArgParser argParser = ArgParser(allowTrailingOptions: true)
..addFlag('enable-asserts',
help: 'Whether asserts will be enabled.', defaultsTo: false)
..addFlag('sound-null-safety',
help: 'Respect the nullability of types at runtime.', defaultsTo: null)
help: 'Respect the nullability of types at runtime.', defaultsTo: true)
..addMultiOption('enable-experiment',
help: 'Comma separated list of experimental features, eg set-literals.',
hide: true)
@ -456,7 +456,7 @@ class FrontendCompiler implements CompilerInterface {
final String platformKernelDill =
options['platform'] ?? 'platform_strong.dill';
final String? packagesOption = _options['packages'];
final bool? nullSafety = _options['sound-null-safety'];
final bool nullSafety = _options['sound-null-safety'];
final CompilerOptions compilerOptions = CompilerOptions()
..sdkRoot = sdkRoot
..fileSystem = _fileSystem
@ -468,7 +468,7 @@ class FrontendCompiler implements CompilerInterface {
..explicitExperimentalFlags = parseExperimentalFlags(
parseExperimentalArguments(options['enable-experiment']),
onError: (msg) => errors.add(msg))
..nnbdMode = (nullSafety == true) ? NnbdMode.Strong : NnbdMode.Weak
..nnbdMode = (nullSafety == false) ? NnbdMode.Weak : NnbdMode.Strong
..onDiagnostic = _onDiagnostic
..verbosity = Verbosity.parseArgument(options['verbosity'],
onError: (msg) => errors.add(msg));
@ -533,11 +533,6 @@ class FrontendCompiler implements CompilerInterface {
}
}
if (nullSafety == null &&
compilerOptions.globalFeatures.nonNullable.isEnabled) {
await autoDetectNullSafetyMode(_mainSource, compilerOptions);
}
// Initialize additional supported kernel targets.
_installDartdevcTarget();
compilerOptions.target = createFrontEndTarget(

View file

@ -2,8 +2,6 @@
// 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.
// @dart = 2.9
import 'dart:io';
import 'package:kernel/binary/ast_from_binary.dart';
@ -11,7 +9,7 @@ import 'package:kernel/kernel.dart';
import 'package:kernel/src/equivalence.dart';
void main(List<String> args) {
String resolvedExecutable = Platform.environment['resolvedExecutable'];
String? resolvedExecutable = Platform.environment['resolvedExecutable'];
File exe =
new File(resolvedExecutable ?? Platform.resolvedExecutable).absolute;
int steps = 0;

View file

@ -919,6 +919,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
],
if (_isAndroid && _isArm) '--no-sim-use-hardfp',
if (_configuration.isMinified) '--obfuscate',
..._nnbdModeArgument(_configuration),
// The SIMARM precompiler assumes support for integer division, but the
// Qemu arm cpus do not support integer division.
if (_configuration.useQemu) '--no-use-integer-division',

View file

@ -41,8 +41,7 @@ import 'package:kernel/core_types.dart' show CoreTypes;
import 'package:kernel/kernel.dart' show Component, Library, Procedure;
import 'package:kernel/target/targets.dart' show TargetFlags;
import 'package:vm/incremental_compiler.dart';
import 'package:vm/kernel_front_end.dart'
show autoDetectNullSafetyMode, createLoadedLibrariesSet;
import 'package:vm/kernel_front_end.dart' show createLoadedLibrariesSet;
import 'package:vm/http_filesystem.dart';
import 'package:vm/target/vm.dart' show VmTarget;
@ -70,26 +69,14 @@ const int kTrainTag = 3;
const int kCompileExpressionTag = 4;
const int kListDependenciesTag = 5;
const int kNotifyIsolateShutdownTag = 6;
const int kDetectNullabilityTag = 7;
bool allowDartInternalImport = false;
// Null Safety command line options
//
// Note: The values of these constants must match the
// values of flag sound_null_safety in ../../../../runtime/vm/flag_list.h.
// 0 - No --[no-]sound-null-safety option specified on the command line.
// 1 - '--no-sound-null-safety' specified on the command line.
// 2 - '--sound-null-safety' option specified on the command line.
const int kNullSafetyOptionUnspecified = 0;
const int kNullSafetyOptionWeak = 1;
const int kNullSafetyOptionStrong = 2;
CompilerOptions setupCompilerOptions(
FileSystem fileSystem,
Uri? platformKernelPath,
bool enableAsserts,
int nullSafety,
bool nullSafety,
List<String>? experimentalFlags,
Uri? packagesUri,
List<String> errorsPlain,
@ -108,8 +95,7 @@ CompilerOptions setupCompilerOptions(
return new CompilerOptions()
..fileSystem = fileSystem
..target = new VmTarget(new TargetFlags(
enableNullSafety: nullSafety == kNullSafetyOptionStrong,
supportMirrors: enableMirrors))
enableNullSafety: nullSafety, supportMirrors: enableMirrors))
..packagesFileUri = packagesUri
..sdkSummary = platformKernelPath
..verbose = verbose
@ -120,9 +106,7 @@ CompilerOptions setupCompilerOptions(
errorsColorized.add(msg);
})
..environmentDefines = new EnvironmentMap()
..nnbdMode = (nullSafety == kNullSafetyOptionStrong)
? NnbdMode.Strong
: NnbdMode.Weak
..nnbdMode = nullSafety ? NnbdMode.Strong : NnbdMode.Weak
..onDiagnostic = (DiagnosticMessage message) {
bool printToStdErr = false;
bool printToStdOut = false;
@ -164,7 +148,7 @@ abstract class Compiler {
final FileSystem fileSystem;
final Uri? platformKernelPath;
final bool enableAsserts;
final int nullSafety;
final bool nullSafety;
final List<String>? experimentalFlags;
final String? packageConfig;
final String invocationModes;
@ -183,7 +167,7 @@ abstract class Compiler {
Compiler(this.isolateGroupId, this.fileSystem, this.platformKernelPath,
{this.enableAsserts = false,
this.nullSafety = kNullSafetyOptionUnspecified,
this.nullSafety = true,
this.experimentalFlags = null,
this.supportCodeCoverage = false,
this.supportHotReload = false,
@ -298,7 +282,7 @@ class IncrementalCompilerWrapper extends Compiler {
IncrementalCompilerWrapper(
int isolateGroupId, FileSystem fileSystem, Uri? platformKernelPath,
{bool enableAsserts = false,
int nullSafety = kNullSafetyOptionUnspecified,
bool nullSafety = true,
List<String>? experimentalFlags,
String? packageConfig,
String invocationModes = '',
@ -392,7 +376,7 @@ class SingleShotCompilerWrapper extends Compiler {
int isolateGroupId, FileSystem fileSystem, Uri platformKernelPath,
{this.requireMain = false,
bool enableAsserts = false,
int nullSafety = kNullSafetyOptionUnspecified,
bool nullSafety = true,
List<String>? experimentalFlags,
String? packageConfig,
String invocationModes = '',
@ -436,7 +420,7 @@ IncrementalCompilerWrapper? lookupIncrementalCompiler(int isolateGroupId) {
Future<Compiler> lookupOrBuildNewIncrementalCompiler(int isolateGroupId,
List sourceFiles, Uri platformKernelPath, List<int>? platformKernel,
{bool enableAsserts = false,
int nullSafety = kNullSafetyOptionUnspecified,
bool nullSafety = true,
List<String>? experimentalFlags,
String? packageConfig,
String? multirootFilepaths,
@ -784,7 +768,7 @@ Future _processLoadRequest(request) async {
inputFileUri != null ? Uri.base.resolve(inputFileUri) : null;
final bool incremental = request[4];
final bool snapshot = request[5];
final int nullSafety = request[6];
final bool nullSafety = request[6];
final List sourceFiles = request[8];
final bool enableAsserts = request[9];
final List<String>? experimentalFlags =
@ -792,7 +776,6 @@ Future _processLoadRequest(request) async {
final String? packageConfig = request[11];
final String? multirootFilepaths = request[12];
final String? multirootScheme = request[13];
final String? workingDirectory = request[14];
final String verbosityLevel = request[15];
final bool enableMirrors = request[16];
Uri platformKernelPath;
@ -838,39 +821,6 @@ Future _processLoadRequest(request) async {
}
port.send(new CompilationResult.ok(null).toResponse());
return;
} else if (tag == kDetectNullabilityTag) {
FileSystem fileSystem = _buildFileSystem(
sourceFiles, platformKernel, multirootFilepaths, multirootScheme);
Uri? packagesUri = null;
final packageConfigWithDefault = packageConfig ?? Platform.packageConfig;
if (packageConfigWithDefault != null) {
packagesUri = Uri.parse(packageConfigWithDefault);
}
if (packagesUri != null && !packagesUri.hasScheme) {
// Script does not have a scheme, assume that it is a path,
// resolve it against the working directory.
packagesUri = Uri.directory(workingDirectory!).resolveUri(packagesUri);
}
final List<String> errorsPlain = <String>[];
final List<String> errorsColorized = <String>[];
var options = setupCompilerOptions(
fileSystem,
platformKernelPath,
false,
nullSafety,
experimentalFlags,
packagesUri,
errorsPlain,
errorsColorized,
invocationModes,
verbosityLevel,
false);
// script should only be null for kUpdateSourcesTag.
await autoDetectNullSafetyMode(script!, options);
bool value = options.nnbdMode == NnbdMode.Strong;
port.send(new CompilationResult.nullSafety(value).toResponse());
return;
}
// script should only be null for kUpdateSourcesTag.
@ -1056,7 +1006,7 @@ Future trainInternal(String scriptUri, String? platformKernelPath) async {
platformKernelPath,
false /* incremental */,
false /* snapshot */,
kNullSafetyOptionUnspecified /* null safety */,
true /* null safety */,
1 /* isolateGroupId chosen randomly */,
[] /* source files */,
false /* enable asserts */,

View file

@ -14,9 +14,6 @@ import 'package:build_integration/file_system/multi_root.dart'
import 'package:crypto/crypto.dart';
import 'package:front_end/src/api_prototype/language_version.dart'
show uriUsesLegacyLanguageVersion;
import 'package:front_end/src/api_unstable/vm.dart'
show
CompilerContext,
@ -123,7 +120,7 @@ void declareCompilerOptions(ArgParser args) {
args.addFlag('enable-asserts',
help: 'Whether asserts will be enabled.', defaultsTo: false);
args.addFlag('sound-null-safety',
help: 'Respect the nullability of types at runtime.', defaultsTo: null);
help: 'Respect the nullability of types at runtime.', defaultsTo: true);
args.addFlag('split-output-by-packages',
help:
'Split resulting kernel file into multiple files (one per package).',
@ -196,7 +193,7 @@ Future<int> runCompiler(ArgResults options, String usage) async {
final bool linkPlatform = options['link-platform'];
final bool embedSources = options['embed-sources'];
final bool enableAsserts = options['enable-asserts'];
final bool? nullSafety = options['sound-null-safety'];
final bool nullSafety = options['sound-null-safety'];
final bool useProtobufTreeShakerV2 = options['protobuf-tree-shaker-v2'];
final bool splitOutputByPackages = options['split-output-by-packages'];
final String? manifestFilename = options['manifest'];
@ -268,7 +265,7 @@ Future<int> runCompiler(ArgResults options, String usage) async {
..explicitExperimentalFlags = parseExperimentalFlags(
parseExperimentalArguments(experimentalFlags),
onError: print)
..nnbdMode = (nullSafety == true) ? NnbdMode.Strong : NnbdMode.Weak
..nnbdMode = nullSafety ? NnbdMode.Strong : NnbdMode.Weak
..onDiagnostic = (DiagnosticMessage m) {
errorDetector(m);
}
@ -277,11 +274,6 @@ Future<int> runCompiler(ArgResults options, String usage) async {
InvocationMode.parseArguments(options['invocation-modes'])
..verbosity = verbosity;
if (nullSafety == null &&
compilerOptions.globalFeatures.nonNullable.isEnabled) {
await autoDetectNullSafetyMode(mainUri, compilerOptions);
}
compilerOptions.target = createFrontEndTarget(targetName,
trackWidgetCreation: options['track-widget-creation'],
nullSafety: compilerOptions.nnbdMode == NnbdMode.Strong,
@ -603,17 +595,10 @@ bool parseCommandLineDefines(
return true;
}
/// Detect null safety mode from an entry point and set [options.nnbdMode].
Future<void> autoDetectNullSafetyMode(
Uri script, CompilerOptions options) async {
var isLegacy = await uriUsesLegacyLanguageVersion(script, options);
options.nnbdMode = isLegacy ? NnbdMode.Weak : NnbdMode.Strong;
}
/// Create front-end target with given name.
Target? createFrontEndTarget(String targetName,
{bool trackWidgetCreation = false,
bool nullSafety = false,
bool nullSafety = true,
bool supportMirrors = true}) {
// Make sure VM-specific targets are available.
installAdditionalTargets();

View file

@ -12,6 +12,7 @@ import 'package:front_end/src/api_unstable/vm.dart'
computePlatformBinariesLocation,
kernelForModule,
kernelForProgram,
NnbdMode,
parseExperimentalArguments,
parseExperimentalFlags;
import 'package:kernel/ast.dart';
@ -54,6 +55,7 @@ Future<Component> compileTestCaseToKernelProgram(Uri sourceUri,
..additionalDills = <Uri>[platformKernel]
..environmentDefines = environmentDefines
..packagesFileUri = packagesFileUri
..nnbdMode = NnbdMode.Strong
..explicitExperimentalFlags =
parseExperimentalFlags(parseExperimentalArguments(experimentalFlags),
onError: (String message) {

View file

@ -13,6 +13,7 @@ import 'package:front_end/src/api_unstable/vm.dart'
DiagnosticMessage,
ExperimentalFlag,
IncrementalCompilerResult,
NnbdMode,
computePlatformBinariesLocation;
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
import 'package:kernel/binary/ast_to_binary.dart';
@ -36,6 +37,7 @@ main() {
CompilerOptions getFreshOptions() {
return new CompilerOptions()
..sdkRoot = sdkRoot
..nnbdMode = NnbdMode.Strong
..target = new VmTarget(new TargetFlags())
..additionalDills = <Uri>[platformKernel]
..onDiagnostic = (DiagnosticMessage message) {
@ -1043,7 +1045,7 @@ main() {
"name": "foo",
"rootUri": "..",
"packageUri": "lib",
"languageVersion": "2.7",
"languageVersion": "2.12",
},
],
}));
@ -1059,7 +1061,7 @@ main() {
var barUri = Uri.file('${mytest.path}/lib/bar.dart');
new File(barUri.toFilePath())
.writeAsStringSync("class A { static int a; }\n");
.writeAsStringSync("class A { static int a = 0; }\n");
var bazUri = Uri.file('${mytest.path}/lib/baz.dart');
new File(bazUri.toFilePath()).writeAsStringSync("import 'dart:isolate';\n"
@ -1095,7 +1097,7 @@ main() {
}
new File(barUri.toFilePath())
.writeAsStringSync("class A { static int b; }\n");
.writeAsStringSync("class A { static int b = 0; }\n");
compiler.invalidate(barUri);
{
IncrementalCompilerResult compilerResult =
@ -1138,7 +1140,7 @@ main() {
final Uri barUri = Uri.file('${mytest.path}/bar.dart');
new File.fromUri(barUri).writeAsStringSync("""
class A {
static int a;
static int a = 0;
int b() { return 42; }
}
""");
@ -1185,7 +1187,7 @@ main() {
new File.fromUri(barUri).writeAsStringSync("""
class A {
static int a;
static int a = 0;
int b() { return 84; }
}
""");
@ -1619,7 +1621,7 @@ main() {
{
"name": "foo",
"rootUri": ".",
"languageVersion": "2.7",
"languageVersion": "2.12",
},
],
}));

View file

@ -117,7 +117,7 @@ Future<kernel_service.Status> singleShotCompile(
/* [3] = various = platformKernel = */ null,
/* [4] = bool = incremental = */ false,
/* [5] = bool = snapshot = */ false,
/* [6] = int = nullSafety = */ kernel_service.kNullSafetyOptionStrong,
/* [6] = bool = nullSafety = */ true,
/* [7] = int = isolateGroupId = */ 42,
/* [8] = List = sourceFiles = */ sourceFiles,
/* [9] = bool = enableAsserts = */ true,

View file

@ -173,7 +173,7 @@ constants {
#C52 = ffi::Uint16 {}
#C53 = ffi::Abi {_os:#C50, _architecture:#C14}
#C54 = ffi::Abi {_os:#C50, _architecture:#C18}
#C55 = <ffi::Abi*, ffi::NativeType*>{#C6:#C7, #C11:#C7, #C15:#C7, #C19:#C7, #C22:#C23, #C24:#C7, #C27:#C7, #C28:#C7, #C29:#C7, #C32:#C7, #C33:#C7, #C34:#C35, #C36:#C35, #C40:#C35, #C44:#C35, #C47:#C7, #C48:#C7, #C51:#C52, #C53:#C52, #C54:#C52)
#C55 = <ffi::Abi, ffi::NativeType>{#C6:#C7, #C11:#C7, #C15:#C7, #C19:#C7, #C22:#C23, #C24:#C7, #C27:#C7, #C28:#C7, #C29:#C7, #C32:#C7, #C33:#C7, #C34:#C35, #C36:#C35, #C40:#C35, #C44:#C35, #C47:#C7, #C48:#C7, #C51:#C52, #C53:#C52, #C54:#C52)
#C56 = ffi::AbiSpecificIntegerMapping {mapping:#C55}
#C57 = "vm:ffi:abi-specific-mapping"
#C58 = TypeLiteralConstant(ffi::Uint32)
@ -202,7 +202,7 @@ constants {
#C81 = <core::Type>[#C80]
#C82 = ffi::_FfiStructLayout {fieldTypes:#C81, packing:#C66}
#C83 = core::pragma {name:#C70, options:#C82}
#C84 = ffi::_ArraySize<ffi::NativeType*> {dimension1:#C79, dimension2:#C66, dimension3:#C66, dimension4:#C66, dimension5:#C66, dimensions:#C66}
#C84 = ffi::_ArraySize<ffi::NativeType> {dimension1:#C79, dimension2:#C66, dimension3:#C66, dimension4:#C66, dimension5:#C66, dimensions:#C66}
#C85 = 400
#C86 = 800
#C87 = 200

View file

@ -138,7 +138,7 @@ constants {
#C17 = "x64"
#C18 = ffi::_Architecture {index:#C1, _name:#C17}
#C19 = ffi::Abi {_os:#C3, _architecture:#C18}
#C20 = <ffi::Abi*, ffi::NativeType*>{#C7:#C8, #C12:#C8, #C16:#C8, #C19:#C8)
#C20 = <ffi::Abi, ffi::NativeType>{#C7:#C8, #C12:#C8, #C16:#C8, #C19:#C8)
#C21 = ffi::AbiSpecificIntegerMapping {mapping:#C20}
#C22 = "vm:ffi:abi-specific-mapping"
#C23 = null
@ -164,7 +164,7 @@ constants {
#C43 = <core::Type>[#C42]
#C44 = ffi::_FfiStructLayout {fieldTypes:#C43, packing:#C23}
#C45 = core::pragma {name:#C32, options:#C44}
#C46 = ffi::_ArraySize<ffi::NativeType*> {dimension1:#C41, dimension2:#C23, dimension3:#C23, dimension4:#C23, dimension5:#C23, dimensions:#C23}
#C46 = ffi::_ArraySize<ffi::NativeType> {dimension1:#C41, dimension2:#C23, dimension3:#C23, dimension4:#C23, dimension5:#C23, dimensions:#C23}
#C47 = 400
#C48 = <core::int*>[#C23, #C23, #C23, #C23, #C23, #C23, #C23, #C23, #C23, #C47, #C47, #C47, #C47, #C23, #C23, #C23, #C23, #C23, #C23, #C23]
#C49 = <core::int*>[]

View file

@ -9,20 +9,20 @@ import "dart:ffi";
import "dart:nativewrappers";
abstract class Classy extends core::Object {
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (core::int) → core::int _returnIntPtrStatic$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr*) →* ffi::IntPtr*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr*) →* ffi::IntPtr*>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (core::int) → core::int _returnIntPtrStatic$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr) → ffi::IntPtr>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr) → ffi::IntPtr>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static method returnIntPtrStatic() → core::int
return self::Classy::_returnIntPtrStatic$Method$FfiNative$Ptr(#C4){(core::int) → core::int};
}
class NativeClassy extends nat::NativeFieldWrapperClass1 {
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>, core::int) → void _goodHasReceiverPointer$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::int) → void, (ffi::Pointer<ffi::Void*>*, ffi::IntPtr*) →* ffi::Void*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*, ffi::IntPtr*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (self::NativeClassy, core::int) → void _goodHasReceiverHandle$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(self::NativeClassy, core::int) → void, (ffi::Handle*, ffi::IntPtr*) →* ffi::Void*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle*, ffi::IntPtr*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (self::NativeClassy, ffi::Pointer<ffi::Void>) → void _goodHasReceiverHandleAndPtr$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(self::NativeClassy, ffi::Pointer<ffi::Void>) → void, (ffi::Handle*, ffi::Pointer<ffi::Void*>*) →* ffi::Void*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle*, ffi::Pointer<ffi::Void*>*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (self::NativeClassy, self::NativeClassy) → void _goodHasReceiverHandleAndHandle$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(self::NativeClassy, self::NativeClassy) → void, (ffi::Handle*, ffi::Handle*) →* ffi::Void*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle*, ffi::Handle*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>, self::NativeClassy) → void _goodHasReceiverPtrAndHandle$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, self::NativeClassy) → void, (ffi::Pointer<ffi::Void*>*, ffi::Handle*) →* ffi::Void*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*, ffi::Handle*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>, core::bool) → core::Object? _meh$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::bool) → core::Object?, (ffi::Pointer<ffi::Void*>*, ffi::Bool*) →* ffi::Handle*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*, ffi::Bool*) →* ffi::Handle*>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>) → core::bool _blah$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>) → core::bool, (ffi::Pointer<ffi::Void*>*) →* ffi::Bool*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*) →* ffi::Bool*>*>(ffi::_ffi_resolver(#C1, #C5, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>) → core::bool _myField$Getter$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>) → core::bool, (ffi::Pointer<ffi::Void*>*) →* ffi::Bool*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*) →* ffi::Bool*>*>(ffi::_ffi_resolver(#C1, #C5, #C3){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>, core::bool) → void _myField$Setter$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::bool) → void, (ffi::Pointer<ffi::Void*>*, ffi::Bool*) →* ffi::Void*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*, ffi::Bool*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>, core::int) → void _goodHasReceiverPointer$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::int) → void, (ffi::Pointer<ffi::Void>, ffi::IntPtr) → ffi::Void>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>, ffi::IntPtr) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (self::NativeClassy, core::int) → void _goodHasReceiverHandle$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(self::NativeClassy, core::int) → void, (ffi::Handle, ffi::IntPtr) → ffi::Void>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle, ffi::IntPtr) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (self::NativeClassy, ffi::Pointer<ffi::Void>) → void _goodHasReceiverHandleAndPtr$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(self::NativeClassy, ffi::Pointer<ffi::Void>) → void, (ffi::Handle, ffi::Pointer<ffi::Void>) → ffi::Void>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle, ffi::Pointer<ffi::Void>) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (self::NativeClassy, self::NativeClassy) → void _goodHasReceiverHandleAndHandle$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(self::NativeClassy, self::NativeClassy) → void, (ffi::Handle, ffi::Handle) → ffi::Void>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle, ffi::Handle) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>, self::NativeClassy) → void _goodHasReceiverPtrAndHandle$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, self::NativeClassy) → void, (ffi::Pointer<ffi::Void>, ffi::Handle) → ffi::Void>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>, ffi::Handle) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>, core::bool) → core::Object? _meh$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::bool) → core::Object?, (ffi::Pointer<ffi::Void>, ffi::Bool) → ffi::Handle>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>, ffi::Bool) → ffi::Handle>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>) → core::bool _blah$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>) → core::bool, (ffi::Pointer<ffi::Void>) → ffi::Bool>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>) → ffi::Bool>*>(ffi::_ffi_resolver(#C1, #C5, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>) → core::bool _myField$Getter$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>) → core::bool, (ffi::Pointer<ffi::Void>) → ffi::Bool>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>) → ffi::Bool>*>(ffi::_ffi_resolver(#C1, #C5, #C3){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?] static final field (ffi::Pointer<ffi::Void>, core::bool) → void _myField$Setter$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::bool) → void, (ffi::Pointer<ffi::Void>, ffi::Bool) → ffi::Void>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>, ffi::Bool) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C5, #C6){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
synthetic constructor •() → self::NativeClassy
: super nat::NativeFieldWrapperClass1::•()
;
@ -114,8 +114,8 @@ class NativeClassy extends nat::NativeFieldWrapperClass1 {
_in::reachabilityFence(#t17);
} =>#t19;
}
[@vm.inferred-type.metadata=dart.core::_Closure?]static final field (core::int) → core::int _returnIntPtr$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr*) →* ffi::IntPtr*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr*) →* ffi::IntPtr*>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?]static final field (core::int) → core::int _returnIntPtrLeaf$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr*) →* ffi::IntPtr*>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr*) →* ffi::IntPtr*>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?]static final field (core::int) → core::int _returnIntPtr$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr) → ffi::IntPtr>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr) → ffi::IntPtr>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
[@vm.inferred-type.metadata=dart.core::_Closure?]static final field (core::int) → core::int _returnIntPtrLeaf$Method$FfiNative$Ptr = [@vm.inferred-type.metadata=dart.core::_Closure?] ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr) → ffi::IntPtr>([@vm.inferred-type.metadata=dart.ffi::Pointer?] ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr) → ffi::IntPtr>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
static method returnIntPtr() → core::int
return self::_returnIntPtr$Method$FfiNative$Ptr(#C11){(core::int) → core::int};
static method returnIntPtrLeaf() → core::int

View file

@ -9,7 +9,7 @@ import "dart:ffi";
import "dart:nativewrappers";
class Classy extends core::Object {
static final field (core::int) → core::int _returnIntPtrStatic$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr*) →* ffi::IntPtr*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr*) →* ffi::IntPtr*>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (core::int) → core::int _returnIntPtrStatic$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr) → ffi::IntPtr>(ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr) → ffi::IntPtr>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
synthetic constructor •() → self::Classy
: super core::Object::•()
;
@ -17,15 +17,15 @@ class Classy extends core::Object {
return self::Classy::_returnIntPtrStatic$Method$FfiNative$Ptr(x){(core::int) → core::int};
}
class NativeClassy extends nat::NativeFieldWrapperClass1 {
static final field (ffi::Pointer<ffi::Void>, core::int) → void _goodHasReceiverPointer$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::int) → void, (ffi::Pointer<ffi::Void*>*, ffi::IntPtr*) →* ffi::Void*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*, ffi::IntPtr*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (self::NativeClassy, core::int) → void _goodHasReceiverHandle$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(self::NativeClassy, core::int) → void, (ffi::Handle*, ffi::IntPtr*) →* ffi::Void*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle*, ffi::IntPtr*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (self::NativeClassy, ffi::Pointer<ffi::Void>) → void _goodHasReceiverHandleAndPtr$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(self::NativeClassy, ffi::Pointer<ffi::Void>) → void, (ffi::Handle*, ffi::Pointer<ffi::Void*>*) →* ffi::Void*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle*, ffi::Pointer<ffi::Void*>*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (self::NativeClassy, self::NativeClassy) → void _goodHasReceiverHandleAndHandle$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(self::NativeClassy, self::NativeClassy) → void, (ffi::Handle*, ffi::Handle*) →* ffi::Void*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle*, ffi::Handle*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>, self::NativeClassy) → void _goodHasReceiverPtrAndHandle$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, self::NativeClassy) → void, (ffi::Pointer<ffi::Void*>*, ffi::Handle*) →* ffi::Void*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*, ffi::Handle*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>, core::bool) → core::Object? _meh$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::bool) → core::Object?, (ffi::Pointer<ffi::Void*>*, ffi::Bool*) →* ffi::Handle*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*, ffi::Bool*) →* ffi::Handle*>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>) → core::bool _blah$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>) → core::bool, (ffi::Pointer<ffi::Void*>*) →* ffi::Bool*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*) →* ffi::Bool*>*>(ffi::_ffi_resolver(#C1, #C4, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>) → core::bool _myField$Getter$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>) → core::bool, (ffi::Pointer<ffi::Void*>*) →* ffi::Bool*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*) →* ffi::Bool*>*>(ffi::_ffi_resolver(#C1, #C4, #C3){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>, core::bool) → void _myField$Setter$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::bool) → void, (ffi::Pointer<ffi::Void*>*, ffi::Bool*) →* ffi::Void*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void*>*, ffi::Bool*) →* ffi::Void*>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>, core::int) → void _goodHasReceiverPointer$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::int) → void, (ffi::Pointer<ffi::Void>, ffi::IntPtr) → ffi::Void>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>, ffi::IntPtr) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (self::NativeClassy, core::int) → void _goodHasReceiverHandle$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(self::NativeClassy, core::int) → void, (ffi::Handle, ffi::IntPtr) → ffi::Void>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle, ffi::IntPtr) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (self::NativeClassy, ffi::Pointer<ffi::Void>) → void _goodHasReceiverHandleAndPtr$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(self::NativeClassy, ffi::Pointer<ffi::Void>) → void, (ffi::Handle, ffi::Pointer<ffi::Void>) → ffi::Void>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle, ffi::Pointer<ffi::Void>) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (self::NativeClassy, self::NativeClassy) → void _goodHasReceiverHandleAndHandle$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(self::NativeClassy, self::NativeClassy) → void, (ffi::Handle, ffi::Handle) → ffi::Void>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Handle, ffi::Handle) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>, self::NativeClassy) → void _goodHasReceiverPtrAndHandle$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, self::NativeClassy) → void, (ffi::Pointer<ffi::Void>, ffi::Handle) → ffi::Void>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>, ffi::Handle) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>, core::bool) → core::Object? _meh$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::bool) → core::Object?, (ffi::Pointer<ffi::Void>, ffi::Bool) → ffi::Handle>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>, ffi::Bool) → ffi::Handle>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>) → core::bool _blah$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>) → core::bool, (ffi::Pointer<ffi::Void>) → ffi::Bool>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>) → ffi::Bool>*>(ffi::_ffi_resolver(#C1, #C4, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>) → core::bool _myField$Getter$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>) → core::bool, (ffi::Pointer<ffi::Void>) → ffi::Bool>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>) → ffi::Bool>*>(ffi::_ffi_resolver(#C1, #C4, #C3){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
static final field (ffi::Pointer<ffi::Void>, core::bool) → void _myField$Setter$FfiNative$Ptr = ffi::_asFunctionInternal<(ffi::Pointer<ffi::Void>, core::bool) → void, (ffi::Pointer<ffi::Void>, ffi::Bool) → ffi::Void>(ffi::_fromAddress<ffi::NativeFunction<(ffi::Pointer<ffi::Void>, ffi::Bool) → ffi::Void>*>(ffi::_ffi_resolver(#C1, #C4, #C5){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
synthetic constructor •() → self::NativeClassy
: super nat::NativeFieldWrapperClass1::•()
;
@ -117,8 +117,8 @@ class NativeClassy extends nat::NativeFieldWrapperClass1 {
_in::reachabilityFence(#t17);
} =>#t19;
}
static final field (core::int) → core::int _returnIntPtr$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr*) →* ffi::IntPtr*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr*) →* ffi::IntPtr*>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (core::int) → core::int _returnIntPtrLeaf$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr*) →* ffi::IntPtr*>(ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr*) →* ffi::IntPtr*>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
static final field (core::int) → core::int _returnIntPtr$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr) → ffi::IntPtr>(ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr) → ffi::IntPtr>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), false)/*isLegacy*/;
static final field (core::int) → core::int _returnIntPtrLeaf$Method$FfiNative$Ptr = ffi::_asFunctionInternal<(core::int) → core::int, (ffi::IntPtr) → ffi::IntPtr>(ffi::_fromAddress<ffi::NativeFunction<(ffi::IntPtr) → ffi::IntPtr>*>(ffi::_ffi_resolver(#C1, #C2, #C3){(core::Object, core::Object, core::int) → core::int}), true)/*isLegacy*/;
static method returnIntPtr(core::int x) → core::int
return self::_returnIntPtr$Method$FfiNative$Ptr(x){(core::int) → core::int};
static method returnIntPtrLeaf(core::int x) → core::int

View file

@ -101,7 +101,7 @@ constants {
#C8 = 2
#C9 = "C"
#C10 = self::FooEnum {index:#C8, _name:#C9}
#C11 = <self::FooEnum*>[#C4, #C7, #C10]
#C11 = <self::FooEnum>[#C4, #C7, #C10]
#C12 = "flutter:keep-to-string"
#C13 = null
#C14 = core::pragma {name:#C12, options:#C13}

View file

@ -101,7 +101,7 @@ constants {
#C8 = 2
#C9 = "C"
#C10 = self::FooEnum {index:#C8, _name:#C9}
#C11 = <self::FooEnum*>[#C4, #C7, #C10]
#C11 = <self::FooEnum>[#C4, #C7, #C10]
#C12 = "flutter:keep-to-string"
#C13 = null
#C14 = core::pragma {name:#C12, options:#C13}

View file

@ -9,7 +9,7 @@ RESULT: _T (dart.core::int)+
RESULT: _T (dart.core::_OneByteString, "abc")
------------ indexingIntoConstantList1 ------------
%i = _Parameter #0 [_T (dart.core::int)+?]
t1 = _Join [dart.core::int*] (_T (dart.core::_Smi, 1), _T (dart.core::_Smi, 2), _T (dart.core::_Smi, 3))
t1 = _Join [dart.core::int] (_T (dart.core::_Smi, 1), _T (dart.core::_Smi, 2), _T (dart.core::_Smi, 3))
RESULT: t1
------------ indexingIntoConstantList2 ------------
%i = _Parameter #0 [_T (dart.core::int)+?]
@ -20,7 +20,7 @@ RESULT: t1
RESULT: _T {}?
------------ _constList1 ------------
RESULT: _T (dart.core::_ImmutableList, const <dart.core::int*>[1, 2, 3])
RESULT: _T (dart.core::_ImmutableList, const <dart.core::int>[1, 2, 3])
------------ _constList2 ------------
RESULT: _T (dart.core::_ImmutableList, const <dart.core::Object?>["hi", 33, null, -5])

View file

@ -26,7 +26,7 @@ t1 = _Call virtual get [dart.core::_Enum._name] (%this)
RESULT: _T (dart.core::String)+
------------ TestEnum.values ------------
RESULT: _T (dart.core::_ImmutableList, const <#lib::TestEnum*>[const #lib::TestEnum{dart.core::_Enum.index: 0, dart.core::_Enum._name: "v1"}, const #lib::TestEnum{dart.core::_Enum.index: 1, dart.core::_Enum._name: "v2"}])
RESULT: _T (dart.core::_ImmutableList, const <#lib::TestEnum>[const #lib::TestEnum{dart.core::_Enum.index: 0, dart.core::_Enum._name: "v1"}, const #lib::TestEnum{dart.core::_Enum.index: 1, dart.core::_Enum._name: "v2"}])
------------ TestEnum.v1 ------------
RESULT: _T (#lib::TestEnum, const #lib::TestEnum{dart.core::_Enum.index: 0, dart.core::_Enum._name: "v1"})

View file

@ -27,5 +27,5 @@ constants {
#C5 = 0
#C6 = "name"
#C7 = self::_AttributeName {index:#C5, _name:#C6}
#C8 = <core::int*, self::_AttributeName*>{#C1:#C3, #C4:#C7)
#C8 = <core::int, self::_AttributeName>{#C1:#C3, #C4:#C7)
}

View file

@ -54,7 +54,7 @@ static method main() → dynamic {
self::testDouble();
self::testStrings(new self::A::•());
self::testPassEnum();
let final dynamic #t1 = [@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int*>[1, 2, 3])] self::getList() in self::testList();
let final dynamic #t1 = [@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int>[1, 2, 3])] self::getList() in self::testList();
}
constants {
#C1 = 40
@ -67,8 +67,8 @@ constants {
#C8 = self::B {index:#C6, _name:#C7}
#C9 = 2
#C10 = 3
#C11 = <core::int*>[#C6, #C9, #C10]
#C11 = <core::int>[#C6, #C9, #C10]
#C12 = 4
#C13 = 5
#C14 = <core::int*>[#C12, #C13]
#C14 = <core::int>[#C12, #C13]
}

View file

@ -22,10 +22,10 @@ static method main() → void {
constants {
#C1 = 0
#C2 = 1
#C3 = <core::int*>{#C1, #C2}
#C3 = <core::int>{#C1, #C2}
#C4 = "name"
#C5 = self::_AttributeName {index:#C1, _name:#C4}
#C6 = "sibling"
#C7 = self::_AttributeName {index:#C2, _name:#C6}
#C8 = <self::_AttributeName*>[#C5, #C7]
#C8 = <self::_AttributeName>[#C5, #C7]
}

View file

@ -1,55 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
// This test needs pre-null-safety semantics.
// @dart=2.9
nonConstant() => int.parse('1') == 1;
class A {
final literal1 = <int>[];
final literal2 = [1, 2, 3];
final constLiteral1 = const <int>[];
final constLiteral2 = const [1, 2];
final defaultConstructor1 = List<int>();
final defaultConstructor2 = List<int>(3);
final filledFactory1 = List<int>.filled(2, 0);
final filledFactory2 = List<int>.filled(2, 0, growable: true);
final filledFactory3 = List<int>.filled(2, 0, growable: false);
final filledFactory4 = List<int>.filled(2, 0, growable: nonConstant());
final filledFactory5 = List<int>.filled(2, null);
final filledFactory6 = List<int>.filled(2, null, growable: true);
final filledFactory7 = List<int>.filled(2, null, growable: false);
final filledFactory8 = List<int>.filled(2, null, growable: nonConstant());
final generateFactory1 = List<int>.generate(2, (i) => i);
final generateFactory2 = List<int>.generate(2, (i) => i, growable: true);
final generateFactory3 = List<int>.generate(2, (i) => i, growable: false);
final generateFactory4 =
List<int>.generate(2, (i) => i, growable: nonConstant());
final generateFactory5 = List<List<int>>.generate(2, (_) => <int>[]);
}
main() {
A x = A();
// Make sure fields are not tree-shaken.
print(x.literal1);
print(x.literal2);
print(x.constLiteral1);
print(x.constLiteral2);
print(x.defaultConstructor1);
print(x.defaultConstructor2);
print(x.filledFactory1);
print(x.filledFactory2);
print(x.filledFactory3);
print(x.filledFactory4);
print(x.filledFactory5);
print(x.filledFactory6);
print(x.filledFactory7);
print(x.filledFactory8);
print(x.generateFactory1);
print(x.generateFactory2);
print(x.generateFactory3);
print(x.generateFactory4);
print(x.generateFactory5);
}

View file

@ -1,59 +0,0 @@
library #lib;
import self as self;
import "dart:core" as core;
import "dart:_internal" as _in;
class A extends core::Object {
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:1] final field core::List<core::int*>* literal1;
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:2] final field core::List<core::int*>* literal2;
[@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int*>[])] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:3] final field core::List<core::int*>* constLiteral1 = #C1;
[@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int*>[1, 2])] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:4] final field core::List<core::int*>* constLiteral2 = #C4;
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:5] final field core::List<core::int*>* defaultConstructor1;
[@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:6] final field core::List<core::int*>* defaultConstructor2;
[@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:7] final field core::List<core::int*>* filledFactory1;
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:8] final field core::List<core::int*>* filledFactory2;
[@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:9] final field core::List<core::int*>* filledFactory3;
[@vm.inferred-type.metadata=!] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:10] final field core::List<core::int*>* filledFactory4;
[@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:11] final field core::List<core::int*>* filledFactory5;
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:12] final field core::List<core::int*>* filledFactory6;
[@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:13] final field core::List<core::int*>* filledFactory7;
[@vm.inferred-type.metadata=!] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:14] final field core::List<core::int*>* filledFactory8;
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:15] final field core::List<core::int*>* generateFactory1;
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:16] final field core::List<core::int*>* generateFactory2;
[@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:17] final field core::List<core::int*>* generateFactory3;
[@vm.inferred-type.metadata=!] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:18] final field core::List<core::int*>* generateFactory4;
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::List<dart.core::int*>*>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:19] final field core::List<core::List<core::int*>*>* generateFactory5;
synthetic constructor •() → self::A*
: self::A::literal1 = [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] core::_GrowableList::•<core::int*>(0), self::A::literal2 = [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] core::_GrowableList::_literal3<core::int*>(1, 2, 3), self::A::defaultConstructor1 = [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] core::_GrowableList::•<core::int*>(0), self::A::defaultConstructor2 = [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] core::_List::•<core::int*>(3), self::A::filledFactory1 = [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] core::_List::filled<core::int*>(2, 0), self::A::filledFactory2 = [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] core::_GrowableList::filled<core::int*>(), self::A::filledFactory3 = [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] core::_List::filled<core::int*>(2, 0), self::A::filledFactory4 = let final core::bool #t1 = _in::unsafeCast<core::bool>([@vm.inferred-type.metadata=dart.core::bool] self::nonConstant()) in [@vm.inferred-type.metadata=!] core::List::filled<core::int*>(2, 0, #t1), self::A::filledFactory5 = [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] core::_List::•<core::int*>(2), self::A::filledFactory6 = [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] core::_GrowableList::•<core::int*>(2), self::A::filledFactory7 = [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] core::_List::•<core::int*>(2), self::A::filledFactory8 = let final core::bool #t2 = _in::unsafeCast<core::bool>([@vm.inferred-type.metadata=dart.core::bool] self::nonConstant()) in [@vm.inferred-type.metadata=!] core::List::filled<core::int*>(2, null, #t2), self::A::generateFactory1 = [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] core::_GrowableList::generate<core::int*>(2, (core::int* i) → core::int* => i), self::A::generateFactory2 = [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] core::_GrowableList::generate<core::int*>(2, (core::int* i) → core::int* => i), self::A::generateFactory3 = [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] core::_List::generate<core::int*>((core::int* i) → core::int* => i), self::A::generateFactory4 = let final (core::int*) →* core::int* #t3 = (core::int* i) → core::int* => i in let final core::bool #t4 = _in::unsafeCast<core::bool>([@vm.inferred-type.metadata=dart.core::bool] self::nonConstant()) in [@vm.inferred-type.metadata=!] core::List::generate<core::int*>(#t3, #t4), self::A::generateFactory5 = [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::List<dart.core::int*>*>] core::_GrowableList::generate<core::List<core::int*>*>(2, (core::int* _) → core::List<core::int*>* => core::_GrowableList::•<core::int*>(0)), super core::Object::•()
;
}
static method nonConstant() → dynamic
return [@vm.inferred-type.metadata=dart.core::bool] [@vm.inferred-type.metadata=int?] core::int::parse("1") =={core::num::==}{(core::Object*) →* core::bool*} 1;
static method main() → dynamic {
self::A* x = new self::A::•();
core::print([@vm.direct-call.metadata=#lib::A.literal1] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] x.{self::A::literal1}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.literal2] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] x.{self::A::literal2}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.constLiteral1] [@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int*>[])] x.{self::A::constLiteral1}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.constLiteral2] [@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int*>[1, 2])] x.{self::A::constLiteral2}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.defaultConstructor1] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] x.{self::A::defaultConstructor1}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.defaultConstructor2] [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] x.{self::A::defaultConstructor2}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory1] [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] x.{self::A::filledFactory1}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory2] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] x.{self::A::filledFactory2}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory3] [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] x.{self::A::filledFactory3}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory4] [@vm.inferred-type.metadata=!] x.{self::A::filledFactory4}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory5] [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] x.{self::A::filledFactory5}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory6] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] x.{self::A::filledFactory6}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory7] [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] x.{self::A::filledFactory7}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory8] [@vm.inferred-type.metadata=!] x.{self::A::filledFactory8}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.generateFactory1] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] x.{self::A::generateFactory1}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.generateFactory2] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int*>] x.{self::A::generateFactory2}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.generateFactory3] [@vm.inferred-type.metadata=dart.core::_List<dart.core::int*>] x.{self::A::generateFactory3}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.generateFactory4] [@vm.inferred-type.metadata=!] x.{self::A::generateFactory4}{core::List<core::int*>*});
core::print([@vm.direct-call.metadata=#lib::A.generateFactory5] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::List<dart.core::int*>*>] x.{self::A::generateFactory5}{core::List<core::List<core::int*>*>*});
}
constants {
#C1 = <core::int*>[]
#C2 = 1
#C3 = 2
#C4 = <core::int*>[#C2, #C3]
}

View file

@ -6,8 +6,8 @@ import "dart:_internal" as _in;
class A extends core::Object {
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:1] final field core::List<core::int> literal1;
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:2] final field core::List<core::int> literal2;
[@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int*>[])] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:3] final field core::List<core::int> constLiteral1 = #C1;
[@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int*>[1, 2])] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:4] final field core::List<core::int> constLiteral2 = #C4;
[@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int>[])] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:3] final field core::List<core::int> constLiteral1 = #C1;
[@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int>[1, 2])] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:4] final field core::List<core::int> constLiteral2 = #C4;
[@vm.inferred-type.metadata=dart.core::_List<dart.core::int>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:5] final field core::List<core::int> filledFactory1;
[@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:6] final field core::List<core::int> filledFactory2;
[@vm.inferred-type.metadata=dart.core::_List<dart.core::int>] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,getterSelectorId:7] final field core::List<core::int> filledFactory3;
@ -31,8 +31,8 @@ static method main() → dynamic {
self::A x = new self::A::•();
core::print([@vm.direct-call.metadata=#lib::A.literal1] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int>] x.{self::A::literal1}{core::List<core::int>});
core::print([@vm.direct-call.metadata=#lib::A.literal2] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int>] x.{self::A::literal2}{core::List<core::int>});
core::print([@vm.direct-call.metadata=#lib::A.constLiteral1] [@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int*>[])] x.{self::A::constLiteral1}{core::List<core::int>});
core::print([@vm.direct-call.metadata=#lib::A.constLiteral2] [@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int*>[1, 2])] x.{self::A::constLiteral2}{core::List<core::int>});
core::print([@vm.direct-call.metadata=#lib::A.constLiteral1] [@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int>[])] x.{self::A::constLiteral1}{core::List<core::int>});
core::print([@vm.direct-call.metadata=#lib::A.constLiteral2] [@vm.inferred-type.metadata=dart.core::_ImmutableList (value: const <dart.core::int>[1, 2])] x.{self::A::constLiteral2}{core::List<core::int>});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory1] [@vm.inferred-type.metadata=dart.core::_List<dart.core::int>] x.{self::A::filledFactory1}{core::List<core::int>});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory2] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int>] x.{self::A::filledFactory2}{core::List<core::int>});
core::print([@vm.direct-call.metadata=#lib::A.filledFactory3] [@vm.inferred-type.metadata=dart.core::_List<dart.core::int>] x.{self::A::filledFactory3}{core::List<core::int>});
@ -48,8 +48,8 @@ static method main() → dynamic {
core::print([@vm.direct-call.metadata=#lib::A.generateFactory5] [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::List<dart.core::int>>] x.{self::A::generateFactory5}{core::List<core::List<core::int>>});
}
constants {
#C1 = <core::int*>[]
#C1 = <core::int>[]
#C2 = 1
#C3 = 2
#C4 = <core::int*>[#C2, #C3]
#C4 = <core::int>[#C2, #C3]
}

View file

@ -37,7 +37,7 @@ constants {
#C8 = self::B {y:#C7}
#C9 = 4
#C10 = "hey"
#C11 = <core::int*, core::Object*>{#C6:#C8, #C9:#C10)
#C11 = <core::int, core::Object>{#C6:#C8, #C9:#C10)
#C12 = core::pragma {name:#C5, options:#C11}
#C13 = "test3"
#C14 = 12

View file

@ -199,21 +199,6 @@ Dart_KernelCompilationResult DFE::CompileScript(const char* script_uri,
package_config, verbosity());
}
Dart_KernelCompilationResult DFE::CompileScriptWithGivenNullsafety(
const char* script_uri,
const char* package_config,
bool snapshot,
bool null_safety) {
// TODO(aam): When Frontend is ready, VM should be passing vm_outline.dill
// instead of vm_platform.dill to Frontend for compilation.
PathSanitizer path_sanitizer(script_uri);
const char* sanitized_uri = path_sanitizer.sanitized_uri();
return Dart_CompileToKernelWithGivenNullsafety(
sanitized_uri, platform_strong_dill, platform_strong_dill_size, snapshot,
package_config, null_safety, verbosity());
}
void DFE::CompileAndReadScript(const char* script_uri,
uint8_t** kernel_buffer,
intptr_t* kernel_buffer_size,

View file

@ -74,19 +74,6 @@ class DFE {
const char* package_config,
bool snapshot);
// Compiles specified script.
// Returns result from compiling the script.
//
// `snapshot` is used by the frontend to determine if compilation
// related information should be printed to console (e.g., null safety mode).
// `null_safety` specifies compilation mode, which is normally
// retrieved either from vm flags or from vm isolate group.
Dart_KernelCompilationResult CompileScriptWithGivenNullsafety(
const char* script_uri,
const char* package_config,
bool snapshot,
bool null_safety);
// Compiles specified script and reads the resulting kernel file.
// If the compilation is successful, returns a valid in memory kernel
// representation of the script, NULL otherwise

View file

@ -729,20 +729,8 @@ void Snapshot::GenerateKernel(const char* snapshot_filename,
WriteSnapshotFile(snapshot_filename, kernel_buffer, kernel_buffer_size);
free(kernel_buffer);
} else {
PathSanitizer script_uri_sanitizer(script_name);
PathSanitizer packages_config_sanitizer(package_config);
bool null_safety =
Dart_DetectNullSafety(script_uri_sanitizer.sanitized_uri(),
packages_config_sanitizer.sanitized_uri(),
DartUtils::original_working_directory,
/*isolate_snapshot_data=*/nullptr,
/*isolate_snapshot_instructions=*/nullptr,
/*kernel_buffer=*/nullptr,
/*kernel_buffer_size=*/0);
Dart_KernelCompilationResult result = dfe.CompileScriptWithGivenNullsafety(
script_name, package_config, /*snapshot=*/true, null_safety);
Dart_KernelCompilationResult result = dfe.CompileScript(
script_name, /*incremental*/ false, package_config, /*snapshot=*/true);
if (result.status != Dart_KernelCompilationStatus_Ok) {
Syslog::PrintErr("%s\n", result.error);
Platform::Exit(kCompilationErrorExitCode);

View file

@ -3776,43 +3776,6 @@ Dart_CompileToKernel(const char* script_uri,
const char* package_config,
Dart_KernelCompilationVerbosityLevel verbosity);
/**
* Compiles the given `script_uri` to a kernel file.
*
* \param platform_kernel A buffer containing the kernel of the platform (e.g.
* `vm_platform_strong.dill`). The VM does not take ownership of this memory.
*
* \param platform_kernel_size The length of the platform_kernel buffer.
*
* \param snapshot_compile Set to `true` when the compilation is for a snapshot.
* This is used by the frontend to determine if compilation related information
* should be printed to console (e.g., null safety mode).
*
* \param null_safety Provides null-safety mode setting for the compiler.
*
* \param verbosity Specifies the logging behavior of the kernel compilation
* service.
*
* \return Returns the result of the compilation.
*
* On a successful compilation the returned [Dart_KernelCompilationResult] has
* a status of [Dart_KernelCompilationStatus_Ok] and the `kernel`/`kernel_size`
* fields are set. The caller takes ownership of the malloc()ed buffer.
*
* On a failed compilation the `error` might be set describing the reason for
* the failed compilation. The caller takes ownership of the malloc()ed
* error.
*/
DART_EXPORT Dart_KernelCompilationResult
Dart_CompileToKernelWithGivenNullsafety(
const char* script_uri,
const uint8_t* platform_kernel,
const intptr_t platform_kernel_size,
bool snapshot_compile,
const char* package_config,
const bool null_safety,
Dart_KernelCompilationVerbosityLevel verbosity);
typedef struct {
const char* uri;
const char* source;

View file

@ -13,6 +13,7 @@ void runTest(bool withDartDev) {
'Displays service URI on SIGQUIT ${withDartDev ? '' : 'with --disable-dart-dev'}',
() async {
final process = await Process.start(Platform.resolvedExecutable, [
'--no-sound-null-safety',
if (!withDartDev) '--disable-dart-dev',
Platform.script.resolve('sigquit_starts_service_script.dart').toString(),
]);
@ -31,6 +32,7 @@ void runTest(bool withDartDev) {
// Wait for the process to start.
await readyCompleter.future;
print("Child process has started");
process.kill(ProcessSignal.sigquit);
await completer.future;
process.kill();

View file

@ -3145,13 +3145,6 @@
"../../../tests/lib/developer/timeline_recorders_test.dart",
"../../../tests/lib/developer/timeline_test.dart",
"../../../tests/lib/developer/user_tags_test.dart",
"../../../tests/lib/isolate/detect_nullsafety_2_test.dart",
"../../../tests/lib/isolate/nnbd_spawn_autodetect_1_test.dart",
"../../../tests/lib/isolate/nnbd_spawn_autodetect_2_test.dart",
"../../../tests/lib/isolate/nnbd_spawnuri_autodetect_1_test.dart",
"../../../tests/lib/isolate/nnbd_spawnuri_autodetect_2_test.dart",
"../../../tests/lib/isolate/nnbd_spawnuri_autodetect_3_test.dart",
"../../../tests/lib/isolate/nnbd_spawnuri_autodetect_4_test.dart",
"../../../tests/lib/math/call_cmath_box_failure_path_test.dart",
"../../../tests/lib/math/coin_test.dart",
"../../../tests/lib/math/double_pow_test.dart",

View file

@ -48,9 +48,9 @@ main(List<String> args) async {
await withTempDir("incompatible-loading-unit-test", (String tempDir) async {
final source1 = path.join(
sdkDir, "runtime/tests/vm/dart_2/incompatible_loading_unit_1.dart");
sdkDir, "runtime/tests/vm/dart/incompatible_loading_unit_1.dart");
final source2 = path.join(
sdkDir, "runtime/tests/vm/dart_2/incompatible_loading_unit_2.dart");
sdkDir, "runtime/tests/vm/dart/incompatible_loading_unit_2.dart");
final dill1 = path.join(tempDir, "incompatible_loading_unit_1.dart.dill");
final dill2 = path.join(tempDir, "incompatible_loading_unit_2.dart.dill");
final snapshot1 = path.join(tempDir, "incompatible_loading_unit_1.so");

View file

@ -1,45 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
// Tests auto-detection of null safety mode in gen_kernel tool.
import 'dart:io' show File, Platform;
import 'package:path/path.dart' as path;
import 'snapshot_test_helper.dart';
compileAndRunTest(String comment, String expectedOutput) async {
await withTempDir((String temp) async {
final testScriptPath = path.join(temp, 'test.dart');
File(testScriptPath).writeAsStringSync('''
// $comment
void main() {
try {
null as int;
print('weak mode');
} on TypeError {
print('strong mode');
}
}
''');
final testDillPath = path.join(temp, 'test.dill');
await runGenKernelWithoutStandardOptions('BUILD DILL FILE', [
"--platform",
platformDill,
'--output=$testDillPath',
testScriptPath,
]);
final result = await runBinary(
'RUN TEST FROM DILL', Platform.executable, [testDillPath]);
expectOutput(expectedOutput, result);
});
}
main() async {
await compileAndRunTest('', 'strong mode');
await compileAndRunTest('@dart=2.7', 'weak mode');
}

View file

@ -22,7 +22,7 @@ Future<void> main(List<String> args) async {
}
final String sourcePath =
path.join('runtime', 'tests', 'vm', 'dart_2', 'sdk_hash_test.dart');
path.join('runtime', 'tests', 'vm', 'dart', 'sdk_hash_test.dart');
await withTempDir((String tmp) async {
final String dillPath = path.join(tmp, 'test.dill');

View file

@ -48,7 +48,7 @@ main(List<String> args) async {
await withTempDir("split-literals-test", (String tempDir) async {
final source =
path.join(sdkDir, "runtime/tests/vm/dart_2/split_literals.dart");
path.join(sdkDir, "runtime/tests/vm/dart/split_literals.dart");
final dill = path.join(tempDir, "split_literals.dart.dill");
final snapshot = path.join(tempDir, "split_literals.so");
final manifest = path.join(tempDir, "split_literals.txt");

View file

@ -1,29 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
// Test script for type_casts_with_null_safety_autodetection_test.dart which
// is supposed to run in strong mode because it is opted-in.
import 'package:expect/expect.dart';
dynamic nullObj;
@pragma('vm:never-inline')
typeCast<T>(x) => x as T;
doTests() {
typeCast<dynamic>(nullObj);
typeCast<void>(nullObj);
Expect.throwsTypeError(() => typeCast<Object>(nullObj));
Expect.throwsTypeError(() => typeCast<int>(nullObj));
typeCast<List<int>>(<int>[]);
Expect.throwsTypeError(() => typeCast<List<int>>(<Null>[]));
}
main() {
for (int i = 0; i < 20; ++i) {
doTests();
}
print('OK(strong)');
}

View file

@ -1,42 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
// OtherResources=type_casts_with_null_safety_autodetection_strong_script.dart
// OtherResources=type_casts_with_null_safety_autodetection_weak_script.dart
// This test verifies that casts with type testing stubs work as expected
// if null safety mode (weak/strong) is auto-detected.
import 'dart:io' show File, Platform;
import 'package:path/path.dart' as path;
import 'snapshot_test_helper.dart';
runTest(String script, String output, String temp) async {
// Need to copy test scripts out of Dart SDK to avoid hardcoded
// opted-in/opted-out status for Dart SDK tests.
final scriptInTemp = path.join(temp, script);
File.fromUri(Platform.script.resolve(script)).copySync(scriptInTemp);
// Do not add Platform.executableArguments into arguments to avoid passing
// --sound-null-safety / --no-sound-null-safety arguments.
final result = await runBinary("RUN $script", Platform.executable, [
'--deterministic',
'--optimization-counter-threshold=10',
'--packages=${Platform.packageConfig}',
scriptInTemp,
]);
expectOutput(output, result);
}
main() async {
await withTempDir((String temp) async {
await runTest(
'type_casts_with_null_safety_autodetection_strong_script.dart',
'OK(strong)',
temp);
await runTest('type_casts_with_null_safety_autodetection_weak_script.dart',
'OK(weak)', temp);
});
}

View file

@ -1,31 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
// Test script for type_casts_with_null_safety_autodetection_test.dart which
// is supposed to run in weak mode because it is opted-out.
// @dart=2.6
import 'package:expect/expect.dart';
dynamic nullObj;
@pragma('vm:never-inline')
typeCast<T>(x) => x as T;
void doTests() {
typeCast<dynamic>(nullObj);
typeCast<void>(nullObj);
typeCast<Object>(nullObj);
typeCast<int>(nullObj);
typeCast<List<int>>(<int>[]);
typeCast<List<int>>(<Null>[]);
}
main() {
for (int i = 0; i < 20; ++i) {
doTests();
}
print('OK(weak)');
}

View file

@ -48,6 +48,7 @@ Future<void> main(List<String> args) async {
// Compile script to Kernel IR.
await run(genKernel, <String>[
'--aot',
'--no-sound-null-safety',
'--platform=$platformDill',
'-o',
scriptDill,
@ -59,6 +60,7 @@ Future<void> main(List<String> args) async {
await run(genSnapshot, <String>[
'--disassemble',
'--disassemble_stubs',
'--no-sound-null-safety',
'--always_generate_trampolines_for_testing',
'--snapshot-kind=app-aot-elf',
'--elf=$elfFile',

View file

@ -44,6 +44,7 @@ main(List<String> args) async {
// Compile script to Kernel IR.
await run('pkg/vm/tool/gen_kernel', <String>[
'--aot',
'--no-sound-null-safety',
'--packages=$sdkDir/.dart_tool/package_config.json',
'--platform=$platformDill',
'-o',
@ -65,6 +66,7 @@ main(List<String> args) async {
// Compile script to Kernel IR.
await run('pkg/vm/tool/gen_kernel', <String>[
'--aot',
'--no-sound-null-safety',
'--packages=$sdkDir/.packages',
'--platform=$platformDill',
'-o',
@ -75,6 +77,7 @@ main(List<String> args) async {
final elfFile = path.join(tempDir.path, 'aot.snapshot');
await run(genSnapshot, <String>[
'--snapshot-kind=app-aot-elf',
'--no-sound-null-safety',
'--elf=$elfFile',
scriptDill,
]);

View file

@ -65,6 +65,7 @@ main(List<String> args) async {
// Compile source to kernel.
await run(genKernel, <String>[
"--aot",
'--no-sound-null-safety',
"--platform=$platformDill",
"-o",
dill1,
@ -72,6 +73,7 @@ main(List<String> args) async {
]);
await run(genKernel, <String>[
"--aot",
'--no-sound-null-safety',
"--platform=$platformDill",
"-o",
dill2,
@ -81,6 +83,7 @@ main(List<String> args) async {
// Compile kernel to ELF.
await run(genSnapshot, <String>[
"--snapshot-kind=app-aot-elf",
'--no-sound-null-safety',
"--elf=$snapshot1",
"--loading-unit-manifest=$manifest1",
dill1,
@ -96,6 +99,7 @@ main(List<String> args) async {
await run(genSnapshot, <String>[
"--snapshot-kind=app-aot-elf",
'--no-sound-null-safety',
"--elf=$snapshot2",
"--loading-unit-manifest=$manifest2",
dill2,

View file

@ -1,47 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
// @dart = 2.9
// Tests auto-detection of null safety mode in gen_kernel tool.
import 'dart:io' show File, Platform;
import 'package:path/path.dart' as path;
import 'snapshot_test_helper.dart';
compileAndRunTest(String comment, String expectedOutput) async {
await withTempDir((String temp) async {
final testScriptPath = path.join(temp, 'test.dart');
File(testScriptPath).writeAsStringSync('''
// $comment
void main() {
try {
null as int;
print('weak mode');
} on TypeError {
print('strong mode');
}
}
''');
final testDillPath = path.join(temp, 'test.dill');
await runGenKernelWithoutStandardOptions('BUILD DILL FILE', [
"--platform",
platformDill,
'--output=$testDillPath',
testScriptPath,
]);
final result = await runBinary(
'RUN TEST FROM DILL', Platform.executable, [testDillPath]);
expectOutput(expectedOutput, result);
});
}
main() async {
await compileAndRunTest('', 'strong mode');
await compileAndRunTest('@dart=2.7', 'weak mode');
}

View file

@ -87,6 +87,7 @@ main() async {
await run(genKernel, <String>[
'--aot',
'--no-sound-null-safety',
'--platform=$platformDill',
'--output=$appDillPath',
testScriptUri.toFilePath(),
@ -94,6 +95,7 @@ main() async {
await run(genSnapshot, <String>[
'--snapshot-kind=app-aot-elf',
'--no-sound-null-safety',
'--elf=$snapshotPath',
'--print-object-layout-to=$objectLayoutPath',
appDillPath,

View file

@ -30,15 +30,16 @@ Future<void> main(List<String> args) async {
{
final result = await generateAotKernel(checkedInDartVM, genKernel,
platformDill, sourcePath, dillPath, null, []);
platformDill, sourcePath, dillPath, null, [],
extraGenKernelOptions: ['--no-sound-null-safety']);
Expect.equals(result.stderr, '');
Expect.equals(result.exitCode, 0);
Expect.equals(result.stdout, '');
}
{
final result = await generateAotSnapshot(
genSnapshot, dillPath, aotPath, null, false, []);
final result = await generateAotSnapshot(genSnapshot, dillPath, aotPath,
null, false, ['--no-sound-null-safety']);
Expect.equals(result.stderr, '');
Expect.equals(result.exitCode, 0);
Expect.equals(result.stdout, '');

View file

@ -2,7 +2,7 @@
// 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.
// @dart = 2.9
// @dart=2.9
import 'dart:async';
import 'dart:convert';
@ -32,6 +32,7 @@ Future<void> main(List<String> args) async {
{
final result = await Process.run(dart, [
'--verbosity=warning',
'--no-sound-null-safety',
'--snapshot-kind=kernel',
'--snapshot=$dillPath',
sourcePath,
@ -42,7 +43,8 @@ Future<void> main(List<String> args) async {
}
{
final result = await Process.run(dart, [dillPath, '--child']);
final result = await Process.run(
dart, ['--no-sound-null-safety', dillPath, '--child']);
Expect.equals('', result.stderr);
Expect.equals(0, result.exitCode);
Expect.equals('Hello, SDK Hash!', result.stdout.trim());
@ -62,7 +64,8 @@ Future<void> main(List<String> args) async {
}
{
final result = await Process.run(dart, [dillPath, '--child']);
final result = await Process.run(
dart, ['--no-sound-null-safety', dillPath, '--child']);
Expect.equals(
'Can\'t load Kernel binary: Invalid SDK hash.', result.stderr.trim());
Expect.equals(253, result.exitCode);
@ -78,7 +81,8 @@ Future<void> main(List<String> args) async {
}
{
final result = await Process.run(dart, [dillPath, '--child']);
final result = await Process.run(
dart, ['--no-sound-null-safety', dillPath, '--child']);
Expect.equals('', result.stderr);
Expect.equals(0, result.exitCode);
Expect.equals('Hello, SDK Hash!', result.stdout.trim());

View file

@ -58,6 +58,7 @@ main(List<String> args) async {
// Compile source to kernel.
await run(genKernel, <String>[
"--no-sound-null-safety",
"--aot",
"--platform=$platformDill",
"-o",
@ -67,6 +68,7 @@ main(List<String> args) async {
// Compile kernel to ELF.
await run(genSnapshot, <String>[
"--no-sound-null-safety",
"--snapshot-kind=app-aot-elf",
"--elf=$snapshot",
"--loading-unit-manifest=$manifest",

View file

@ -46,6 +46,7 @@ main(List<String> args) async {
// Compile script to Kernel IR.
await run(genKernel, <String>[
'--no-sound-null-safety',
'--aot',
'--platform=$platformDill',
'-o',
@ -56,6 +57,7 @@ main(List<String> args) async {
final scriptSnapshot = path.join(tempDir, 'dwarf.so');
final scriptDebuggingInfo = path.join(tempDir, 'debug_info.so');
await run(genSnapshot, <String>[
'--no-sound-null-safety',
'--add-readonly-data-symbols',
'--dwarf-stack-traces-mode',
'--save-debugging-info=$scriptDebuggingInfo',

View file

@ -46,6 +46,7 @@ main(List<String> args) async {
// Compile script to Kernel IR.
await run(genKernel, <String>[
'--no-sound-null-safety',
'--aot',
'--platform=$platformDill',
'-o',
@ -55,6 +56,7 @@ main(List<String> args) async {
final scriptDwarfSnapshot = path.join(tempDir, 'dwarf.so');
await run(genSnapshot, <String>[
'--no-sound-null-safety',
'--resolve-dwarf-paths',
'--dwarf-stack-traces-mode',
'--snapshot-kind=app-aot-elf',

View file

@ -49,6 +49,7 @@ main(List<String> args) async {
// Compile script to Kernel IR.
await run(genKernel, <String>[
'--no-sound-null-safety',
'--aot',
'--platform=$platformDill',
'-o',
@ -61,6 +62,7 @@ main(List<String> args) async {
// information.
final scriptWholeSnapshot = path.join(tempDir, 'whole.so');
await run(genSnapshot, <String>[
'--no-sound-null-safety',
'--dwarf-stack-traces',
'--snapshot-kind=app-aot-elf',
'--elf=$scriptWholeSnapshot',
@ -70,6 +72,7 @@ main(List<String> args) async {
final scriptStrippedOnlySnapshot = path.join(tempDir, 'stripped_only.so');
await run(genSnapshot, <String>[
'--no-sound-null-safety',
'--dwarf-stack-traces',
'--snapshot-kind=app-aot-elf',
'--elf=$scriptStrippedOnlySnapshot',
@ -81,6 +84,7 @@ main(List<String> args) async {
final scriptStrippedSnapshot = path.join(tempDir, 'stripped.so');
final scriptDebuggingInfo = path.join(tempDir, 'debug.so');
await run(genSnapshot, <String>[
'--no-sound-null-safety',
'--dwarf-stack-traces',
'--snapshot-kind=app-aot-elf',
'--elf=$scriptStrippedSnapshot',

View file

@ -43,6 +43,7 @@ main(List<String> args) async {
// Compile script to Kernel IR.
await run(genKernel, <String>[
'--no-sound-null-safety',
'--aot',
'--platform=$platformDill',
'-o',
@ -53,6 +54,7 @@ main(List<String> args) async {
// Run the AOT compiler to generate stripped and unstripped ELF snapshots.
final unstrippedSnapshot = path.join(tempDir, 'whole.so');
await run(genSnapshot, <String>[
'--no-sound-null-safety',
'--snapshot-kind=app-aot-elf',
'--elf=$unstrippedSnapshot',
scriptDill,
@ -60,6 +62,7 @@ main(List<String> args) async {
final strippedSnapshot = path.join(tempDir, 'stripped.so');
await run(genSnapshot, <String>[
'--no-sound-null-safety',
'--snapshot-kind=app-aot-elf',
'--elf=$strippedSnapshot',
'--strip',
@ -75,6 +78,7 @@ main(List<String> args) async {
final unstrippedCode = path.join(tempDir, 'whole.S');
await run(genSnapshot, <String>[
'--no-sound-null-safety',
'--snapshot-kind=app-aot-assembly',
'--assembly=$unstrippedCode',
scriptDill,
@ -82,6 +86,7 @@ main(List<String> args) async {
final strippedCode = path.join(tempDir, 'stripped.S');
await run(genSnapshot, <String>[
'--no-sound-null-safety',
'--snapshot-kind=app-aot-assembly',
'--assembly=$strippedCode',
'--strip',

View file

@ -46,6 +46,7 @@ main(List<String> args) async {
// Compile script to Kernel IR.
await run(genKernel, <String>[
'--no-sound-null-safety',
'--aot',
'--platform=$platformDill',
'-o',
@ -81,6 +82,7 @@ Future<void> testTracePrecompiler(
final snapshot = path.join(tempDir, 'snapshot.so');
final result = await run(genSnapshot, <String>[
...flags,
'--no-sound-null-safety',
'--write-retained-reasons-to=$reasonsFile',
'--snapshot-kind=app-aot-elf',
'--elf=$snapshot',

View file

@ -10,7 +10,6 @@
// dart --verbose_gc foo.dart 2> foo.gclog
// dart verbose_gc_to_bmu.dart < foo.gclog > foo.bmu
// gnuplot -p -e "set yr [0:1]; set logscale x; plot 'foo.bmu' with linespoints"
// @dart=2.9
import 'dart:io';
import 'dart:math';
@ -18,19 +17,19 @@ import 'dart:math';
const WINDOW_STEP_FACTOR = 0.9;
const MINIMUM_WINDOW_SIZE_MS = 1;
class Interval<T extends int> {
T begin;
T end;
class Interval {
int begin;
int end;
Interval(this.begin, this.end);
T get length => max(0, end - begin);
Interval<T> overlap(Interval<T> other) =>
int get length => max(0, end - begin);
Interval overlap(Interval other) =>
new Interval(max(this.begin, other.begin), min(this.end, other.end));
}
class Timeline {
// Pauses must be added in non-decreasing order of 'begin'.
void addPause(Interval<int> pause) {
var last = _pauses.isEmpty ? new Interval<int>(0, 0) : _pauses.last;
void addPause(Interval pause) {
var last = _pauses.isEmpty ? new Interval(0, 0) : _pauses.last;
assert(last.begin <= pause.begin);
// Trim any initial overlap.
_pauses.add(new Interval(max(pause.begin, last.end), pause.end));
@ -59,24 +58,24 @@ class Timeline {
}
// Returns the fraction of non-pause time, or 1.0 for an invalid interval.
double _utilization(Interval<int> iv) {
double _utilization(Interval iv) {
if (_run.begin > iv.begin || iv.end > _run.end || iv.length == 0) {
return 1.0;
}
int paused = 0;
for (Interval<int> p in _pauses) {
for (Interval p in _pauses) {
paused += p.overlap(iv).length;
}
return 1.0 - (paused / iv.length);
}
final Interval<int> _run = new Interval<int>(0, 0);
final List<Interval<int>> _pauses = [];
final Interval _run = new Interval(0, 0);
final List<Interval> _pauses = [];
}
// Returns a GC pause as an interval in microseconds since program start, or
// the interval [0, 0) on parse error.
Interval<int> parseVerboseGCLine(String line) {
Interval parseVerboseGCLine(String line) {
var fields = line.split(',');
// Update this (and indices below, if needed) when logging format changes.
if (fields.length < 10) {
@ -84,17 +83,17 @@ Interval<int> parseVerboseGCLine(String line) {
// We assume these have very few commas in them, so that fields.length
// is < 10.
assert(line.contains("|"));
return new Interval<int>(0, 0);
return new Interval(0, 0);
}
var begin = (1e6 * double.parse(fields[2])).floor();
var duration = (1000 * double.parse(fields[3])).floor();
var end = begin + duration;
return new Interval<int>(begin, end);
return new Interval(begin, end);
}
void main() {
Timeline t = new Timeline();
for (String line = stdin.readLineSync();
for (String? line = stdin.readLineSync();
line != null;
line = stdin.readLineSync()) {
t.addPause(parseVerboseGCLine(line));

View file

@ -9111,17 +9111,15 @@ char* SnapshotHeaderReader::InitializeGlobalVMFlagsFromSnapshot(
#undef SET_FLAG
#if defined(DART_PRECOMPILED_RUNTIME)
if (FLAG_sound_null_safety == kNullSafetyOptionUnspecified) {
if (strncmp(cursor, "null-safety", end - cursor) == 0) {
FLAG_sound_null_safety = kNullSafetyOptionStrong;
cursor = end;
continue;
}
if (strncmp(cursor, "no-null-safety", end - cursor) == 0) {
FLAG_sound_null_safety = kNullSafetyOptionWeak;
cursor = end;
continue;
}
if (strncmp(cursor, "null-safety", end - cursor) == 0) {
FLAG_sound_null_safety = true;
cursor = end;
continue;
}
if (strncmp(cursor, "no-null-safety", end - cursor) == 0) {
FLAG_sound_null_safety = false;
cursor = end;
continue;
}
#endif // defined(DART_PRECOMPILED_RUNTIME)

View file

@ -260,7 +260,7 @@ static Dart_NativeFunction NativeResolver(Dart_Handle name,
//
BENCHMARK(KernelServiceCompileAll) {
// kernel_service.dill is built with sound null safety.
if (FLAG_sound_null_safety != kNullSafetyOptionStrong) {
if (!FLAG_sound_null_safety) {
return;
}
bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary);

View file

@ -270,7 +270,7 @@ ISOLATE_UNIT_TEST_CASE(FlowGraph_PhiUnboxingHeuristic_Double) {
RELEASE_ASSERT(cursor.TryMatch({
kMatchAndMoveFunctionEntry,
}));
if (FLAG_sound_null_safety != kNullSafetyOptionStrong) {
if (!FLAG_sound_null_safety) {
RELEASE_ASSERT(cursor.TryMatch({
kMatchAndMoveBranchFalse,
kMatchAndMoveTargetEntry,
@ -324,7 +324,7 @@ static void TestPhiUnboxingHeuristicSimd(const char* script) {
RELEASE_ASSERT(cursor.TryMatch({
kMatchAndMoveFunctionEntry,
}));
if (FLAG_sound_null_safety != kNullSafetyOptionStrong) {
if (!FLAG_sound_null_safety) {
RELEASE_ASSERT(cursor.TryMatch({
kMatchAndMoveBranchFalse,
kMatchAndMoveTargetEntry,

View file

@ -1010,7 +1010,7 @@ FlowGraph* SetupFfiFlowgraph(TestPipeline* pipeline,
// Additionally test that register allocation is done correctly by clobbering
// all volatile registers in the native function being called.
ISOLATE_UNIT_TEST_CASE(IRTest_FfiCallInstrLeafDoesntSpill) {
SetFlagScope<int> sfs(&FLAG_sound_null_safety, kNullSafetyOptionStrong);
SetFlagScope<bool> sfs(&FLAG_sound_null_safety, true);
const char* kScript = R"(
import 'dart:ffi';

View file

@ -1330,7 +1330,7 @@ main() {
kMatchAndMoveFunctionEntry,
kMatchAndMoveCheckStackOverflow,
}));
if (FLAG_sound_null_safety != kNullSafetyOptionStrong) {
if (!FLAG_sound_null_safety) {
RELEASE_ASSERT(cursor.TryMatch({
kMatchAndMoveCheckClass,
}));

View file

@ -909,57 +909,6 @@ ErrorPtr Dart::InitIsolateFromSnapshot(Thread* T,
return Error::null();
}
bool Dart::DetectNullSafety(const char* script_uri,
const uint8_t* snapshot_data,
const uint8_t* snapshot_instructions,
const uint8_t* kernel_buffer,
intptr_t kernel_buffer_size,
const char* package_config,
const char* original_working_directory) {
#if !defined(DART_PRECOMPILED_RUNTIME)
// Before creating the isolate we first determine the null safety mode
// in which the isolate needs to run based on one of these factors :
// - if loading from source, based on opt-in status of the source
// - if loading from a kernel file, based on the mode used when
// generating the kernel file
// - if loading from an appJIT, based on the mode used
// when generating the snapshot.
ASSERT(FLAG_sound_null_safety == kNullSafetyOptionUnspecified);
// If snapshot is not a core snapshot we will figure out the mode by
// sniffing the feature string in the snapshot.
if (snapshot_data != nullptr) {
// Read the snapshot and check for null safety option.
const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_data);
if (!Snapshot::IsAgnosticToNullSafety(snapshot->kind())) {
return SnapshotHeaderReader::NullSafetyFromSnapshot(snapshot);
}
}
// If kernel_buffer is specified, it could be a self contained
// kernel file or the kernel file of the application,
// figure out the null safety mode by sniffing the kernel file.
if (kernel_buffer != nullptr) {
const char* error = nullptr;
std::unique_ptr<kernel::Program> program = kernel::Program::ReadFromBuffer(
kernel_buffer, kernel_buffer_size, &error);
if (program != nullptr) {
return program->compilation_mode() == NNBDCompiledMode::kStrong;
}
return false;
}
// If we are loading from source, figure out the mode from the source.
if (KernelIsolate::GetExperimentalFlag(ExperimentalFeature::non_nullable)) {
return KernelIsolate::DetectNullSafety(script_uri, package_config,
original_working_directory);
}
return false;
#else
UNREACHABLE();
#endif // !defined(DART_PRECOMPILED_RUNTIME)
}
// The runtime assumes it can create certain kinds of objects at-will without
// a check whether their class need to be finalized first.
//
@ -1226,7 +1175,7 @@ char* Dart::FeaturesString(IsolateGroup* isolate_group,
buffer.AddString(" no-null-safety");
}
} else {
if (FLAG_sound_null_safety == kNullSafetyOptionStrong) {
if (FLAG_sound_null_safety) {
buffer.AddString(" null-safety");
} else {
buffer.AddString(" no-null-safety");

View file

@ -63,14 +63,6 @@ class Dart : public AllStatic {
const uint8_t* kernel_buffer,
intptr_t kernel_buffer_size);
static bool DetectNullSafety(const char* script_uri,
const uint8_t* snapshot_data,
const uint8_t* snapshot_instructions,
const uint8_t* kernel_buffer,
intptr_t kernel_buffer_size,
const char* package_config,
const char* original_working_directory);
static void RunShutdownCallback();
static void ShutdownIsolate(Isolate* isolate);
static void ShutdownIsolate();

View file

@ -6138,8 +6138,8 @@ Dart_CompileToKernel(const char* script_uri,
result = KernelIsolate::CompileToKernel(
script_uri, platform_kernel, platform_kernel_size, 0, NULL,
incremental_compile, snapshot_compile, package_config, NULL, NULL,
FLAG_sound_null_safety, verbosity);
if (result.status == Dart_KernelCompilationStatus_Ok) {
verbosity);
if (incremental_compile && result.status == Dart_KernelCompilationStatus_Ok) {
Dart_KernelCompilationResult accept_result =
KernelIsolate::AcceptCompilation();
if (accept_result.status != Dart_KernelCompilationStatus_Ok) {
@ -6153,34 +6153,6 @@ Dart_CompileToKernel(const char* script_uri,
return result;
}
DART_EXPORT Dart_KernelCompilationResult
Dart_CompileToKernelWithGivenNullsafety(
const char* script_uri,
const uint8_t* platform_kernel,
intptr_t platform_kernel_size,
bool snapshot_compile,
const char* package_config,
bool null_safety,
Dart_KernelCompilationVerbosityLevel verbosity) {
API_TIMELINE_DURATION(Thread::Current());
Dart_KernelCompilationResult result = {};
#if defined(DART_PRECOMPILED_RUNTIME)
result.status = Dart_KernelCompilationStatus_Unknown;
result.error = Utils::StrDup("Dart_CompileToKernel is unsupported.");
#else
intptr_t null_safety_option =
null_safety ? kNullSafetyOptionStrong : kNullSafetyOptionWeak;
result = KernelIsolate::CompileToKernel(
script_uri, platform_kernel, platform_kernel_size,
/*source_files_count=*/0, /*source_files=*/nullptr,
/*incremental_compile=*/false, snapshot_compile, package_config,
/*multiroot_filepaths=*/nullptr, /*multiroot_scheme=*/nullptr,
null_safety_option, verbosity);
#endif
return result;
}
DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies() {
Dart_KernelCompilationResult result = {};
#if defined(DART_PRECOMPILED_RUNTIME)
@ -6208,20 +6180,29 @@ DART_EXPORT bool Dart_DetectNullSafety(const char* script_uri,
const uint8_t* snapshot_instructions,
const uint8_t* kernel_buffer,
intptr_t kernel_buffer_size) {
#if defined(DART_PRECOMPILED_RUNTIME)
ASSERT(FLAG_sound_null_safety != kNullSafetyOptionUnspecified);
return (FLAG_sound_null_safety == kNullSafetyOptionStrong);
#else
bool null_safety;
if (FLAG_sound_null_safety == kNullSafetyOptionUnspecified) {
null_safety = Dart::DetectNullSafety(
script_uri, snapshot_data, snapshot_instructions, kernel_buffer,
kernel_buffer_size, package_config, original_working_directory);
} else {
null_safety = (FLAG_sound_null_safety == kNullSafetyOptionStrong);
#if !defined(DART_PRECOMPILED_RUNTIME)
// If snapshot is an app-jit snapshot we will figure out the mode by
// sniffing the feature string in the snapshot.
if (snapshot_data != nullptr) {
// Read the snapshot and check for null safety option.
const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_data);
if (!Snapshot::IsAgnosticToNullSafety(snapshot->kind())) {
return SnapshotHeaderReader::NullSafetyFromSnapshot(snapshot);
}
}
return null_safety;
#endif // defined(DART_PRECOMPILED_RUNTIME)
// If kernel_buffer is specified, it could be a self contained
// kernel file or the kernel file of the application,
// figure out the null safety mode by sniffing the kernel file.
if (kernel_buffer != nullptr) {
const char* error = nullptr;
std::unique_ptr<kernel::Program> program = kernel::Program::ReadFromBuffer(
kernel_buffer, kernel_buffer_size, &error);
if (program != nullptr) {
return program->compilation_mode() == NNBDCompiledMode::kStrong;
}
}
#endif
return FLAG_sound_null_safety;
}
// --- Service support ---

View file

@ -255,6 +255,8 @@ constexpr bool FLAG_support_il_printer = false;
P(verify_entry_points, bool, false, \
"Throw API error on invalid member access throuh native API. See " \
"entry_point_pragma.md") \
P(sound_null_safety, bool, true, \
"Respect the nullability of types at runtime.") \
C(branch_coverage, false, false, bool, false, "Enable branch coverage")
#endif // RUNTIME_VM_FLAG_LIST_H_

View file

@ -88,16 +88,6 @@ DEFINE_FLAG_HANDLER(DeterministicModeHandler,
deterministic,
"Enable deterministic mode.");
int FLAG_sound_null_safety = kNullSafetyOptionUnspecified;
static void SoundNullSafetyHandler(bool value) {
FLAG_sound_null_safety =
value ? kNullSafetyOptionStrong : kNullSafetyOptionWeak;
}
DEFINE_FLAG_HANDLER(SoundNullSafetyHandler,
sound_null_safety,
"Respect the nullability of types at runtime.");
DEFINE_FLAG(bool,
disable_thread_pool_limit,
false,

View file

@ -90,17 +90,6 @@ class ThreadRegistry;
class UserTag;
class WeakTable;
/*
* Possible values of null safety flag
0 - not specified
1 - weak mode
2 - strong mode)
*/
constexpr int kNullSafetyOptionUnspecified = 0;
constexpr int kNullSafetyOptionWeak = 1;
constexpr int kNullSafetyOptionStrong = 2;
extern int FLAG_sound_null_safety;
class IsolateVisitor {
public:
IsolateVisitor() {}

View file

@ -1136,7 +1136,7 @@ char* IsolateGroupReloadContext::CompileToKernel(bool force_reload,
/*snapshot_compile=*/false,
/*package_config=*/nullptr,
/*multiroot_filepaths=*/nullptr,
/*multiroot_scheme=*/nullptr, FLAG_sound_null_safety);
/*multiroot_scheme=*/nullptr);
}
if (retval.status != Dart_KernelCompilationStatus_Ok) {
if (retval.kernel != nullptr) {

View file

@ -52,7 +52,6 @@ DEFINE_FLAG(charp,
// 4 - Compile expressions in context (used by expression evaluation).
// 5 - Generate dependencies used to create a dependencies file.
// 6 - Triggers shutdown of the kernel isolate.
// 7 - Detects the nullability of a script based on it's opt-in status.
const int KernelIsolate::kCompileTag = 0;
const int KernelIsolate::kUpdateSourcesTag = 1;
const int KernelIsolate::kAcceptTag = 2;
@ -60,7 +59,6 @@ const int KernelIsolate::kTrainTag = 3;
const int KernelIsolate::kCompileExpressionTag = 4;
const int KernelIsolate::kListDependenciesTag = 5;
const int KernelIsolate::kNotifyIsolateShutdown = 6;
const int KernelIsolate::kDetectNullabilityTag = 7;
const char* KernelIsolate::kName = DART_KERNEL_ISOLATE_NAME;
Dart_IsolateGroupCreateCallback KernelIsolate::create_group_callback_ = NULL;
@ -792,7 +790,6 @@ class KernelCompilationRequest : public ValueObject {
const char* package_config,
const char* multiroot_filepaths,
const char* multiroot_scheme,
intptr_t default_null_safety,
const MallocGrowableArray<char*>* experimental_flags,
const char* original_working_directory,
Dart_KernelCompilationVerbosityLevel verbosity) {
@ -876,12 +873,10 @@ class KernelCompilationRequest : public ValueObject {
: FLAG_enable_asserts;
Dart_CObject null_safety;
null_safety.type = Dart_CObject_kInt32;
null_safety.value.as_int32 =
(isolate_group != nullptr)
? (isolate_group->null_safety() ? kNullSafetyOptionStrong
: kNullSafetyOptionWeak)
: default_null_safety;
null_safety.type = Dart_CObject_kBool;
null_safety.value.as_bool = (isolate_group != nullptr)
? isolate_group->null_safety()
: FLAG_sound_null_safety;
intptr_t num_experimental_flags = experimental_flags->length();
Dart_CObject** experimental_flags_array =
@ -1129,7 +1124,6 @@ Dart_KernelCompilationResult KernelIsolate::CompileToKernel(
const char* package_config,
const char* multiroot_filepaths,
const char* multiroot_scheme,
intptr_t default_null_safety,
Dart_KernelCompilationVerbosityLevel verbosity) {
// Start the kernel Isolate if it is not already running.
if (!Start()) {
@ -1154,29 +1148,8 @@ Dart_KernelCompilationResult KernelIsolate::CompileToKernel(
kCompileTag, kernel_port, script_uri, platform_kernel,
platform_kernel_size, source_file_count, source_files,
incremental_compile, snapshot_compile, package_config,
multiroot_filepaths, multiroot_scheme, default_null_safety,
experimental_flags_, NULL, verbosity);
}
bool KernelIsolate::DetectNullSafety(const char* script_uri,
const char* package_config,
const char* original_working_directory) {
// Start the kernel Isolate if it is not already running.
if (!Start()) {
return false;
}
// Wait for Kernel isolate to finish initialization.
Dart_Port kernel_port = WaitForKernelPort();
if (kernel_port == ILLEGAL_PORT) {
return false;
}
KernelCompilationRequest request;
Dart_KernelCompilationResult result = request.SendAndWaitForResponse(
kDetectNullabilityTag, kernel_port, script_uri, nullptr, -1, 0, nullptr,
false, false, package_config, nullptr, nullptr,
/*default_null_safety=*/kNullSafetyOptionUnspecified, experimental_flags_,
original_working_directory, Dart_KernelCompilationVerbosityLevel_Error);
return result.null_safety;
multiroot_filepaths, multiroot_scheme, experimental_flags_, NULL,
verbosity);
}
Dart_KernelCompilationResult KernelIsolate::ListDependencies() {
@ -1191,8 +1164,8 @@ Dart_KernelCompilationResult KernelIsolate::ListDependencies() {
KernelCompilationRequest request;
return request.SendAndWaitForResponse(
kListDependenciesTag, kernel_port, NULL, NULL, 0, 0, NULL, false, false,
NULL, NULL, NULL, /*default_null_safety=*/kNullSafetyOptionUnspecified,
experimental_flags_, NULL, Dart_KernelCompilationVerbosityLevel_Error);
NULL, NULL, NULL, experimental_flags_, NULL,
Dart_KernelCompilationVerbosityLevel_Error);
}
Dart_KernelCompilationResult KernelIsolate::AcceptCompilation() {
@ -1209,8 +1182,8 @@ Dart_KernelCompilationResult KernelIsolate::AcceptCompilation() {
KernelCompilationRequest request;
return request.SendAndWaitForResponse(
kAcceptTag, kernel_port, NULL, NULL, 0, 0, NULL, true, false, NULL, NULL,
NULL, /*default_null_safety=*/kNullSafetyOptionUnspecified,
experimental_flags_, NULL, Dart_KernelCompilationVerbosityLevel_Error);
NULL, experimental_flags_, NULL,
Dart_KernelCompilationVerbosityLevel_Error);
}
Dart_KernelCompilationResult KernelIsolate::CompileExpressionToKernel(
@ -1260,9 +1233,8 @@ Dart_KernelCompilationResult KernelIsolate::UpdateInMemorySources(
KernelCompilationRequest request;
return request.SendAndWaitForResponse(
kUpdateSourcesTag, kernel_port, NULL, NULL, 0, source_files_count,
source_files, true, false, NULL, NULL, NULL,
/*default_null_safety=*/kNullSafetyOptionUnspecified, experimental_flags_,
NULL, Dart_KernelCompilationVerbosityLevel_Error);
source_files, true, false, NULL, NULL, NULL, experimental_flags_, NULL,
Dart_KernelCompilationVerbosityLevel_Error);
}
void KernelIsolate::NotifyAboutIsolateGroupShutdown(

View file

@ -31,7 +31,6 @@ class KernelIsolate : public AllStatic {
static const int kCompileExpressionTag;
static const int kListDependenciesTag;
static const int kNotifyIsolateShutdown;
static const int kDetectNullabilityTag;
static void InitializeState();
static bool Start();
@ -55,7 +54,6 @@ class KernelIsolate : public AllStatic {
const char* package_config = NULL,
const char* multiroot_filepaths = NULL,
const char* multiroot_scheme = NULL,
intptr_t default_null_safety = kNullSafetyOptionUnspecified,
Dart_KernelCompilationVerbosityLevel verbosity =
Dart_KernelCompilationVerbosityLevel_All);

View file

@ -115,7 +115,7 @@ Dart_Isolate TestCase::CreateIsolate(const uint8_t* data_buffer,
char* err;
Dart_IsolateFlags api_flags;
Isolate::FlagsInitialize(&api_flags);
api_flags.null_safety = (FLAG_sound_null_safety == kNullSafetyOptionStrong);
api_flags.null_safety = FLAG_sound_null_safety;
Dart_Isolate isolate = NULL;
if (len == 0) {
isolate = Dart_CreateIsolateGroup(

View file

@ -37,6 +37,7 @@ fi
unset EXTRA_VM_OPTIONS
declare -a EXTRA_VM_OPTIONS
EXTRA_VM_OPTIONS+=('--no_sound_null_safety')
case $0 in
*_developer)
EXTRA_VM_OPTIONS+=('--enable-asserts')

View file

@ -20,7 +20,7 @@ IF %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%
set DART=%BIN_DIR%\dart
set EXTRA_OPTIONS=
set EXTRA_VM_OPTIONS=
set EXTRA_VM_OPTIONS="--no_sound_null_safety"
if _%DART2JS_DEVELOPER_MODE%_ == _1_ (
set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --enable-asserts

View file

@ -12,6 +12,16 @@ LibTest/mirrors/*: SkipByDesign # dart:mirrors is not supported
LibTest/collection/ListBase/ListBase_class_A01_t02: Slow, Pass # Does many calls
LibTest/collection/ListMixin/ListMixin_class_A01_t02: Slow, Pass # Does many calls
LibTest/core/List/List_class_A01_t02: Slow, Pass # Does many calls
LibTest/io/Stdout/add_A02_t03: SkipByDesign # Issue dart-lang/co19/issues/1509
LibTest/io/Stdout/add_A02_t04: SkipByDesign
LibTest/io/Stdout/add_A02_t05: SkipByDesign
LibTest/io/Stdout/add_A02_t06: SkipByDesign
LibTest/io/Stdout/add_A02_t07: SkipByDesign
LibTest/io/Stdout/add_A02_t08: SkipByDesign
LibTest/io/Stdout/add_A02_t09: SkipByDesign
LibTest/io/Stdout/writeCharCode_A01_t03: SkipByDesign
LibTest/io/Stdout/write_A01_t04: SkipByDesign
LibTest/io/Stdout/write_A01_t05: SkipByDesign
[ $compiler == dartk && $runtime == vm && $system == macos ]
LibTest/collection/ListBase/ListBase_class_A01_t02: Slow, Pass

View file

@ -28,7 +28,11 @@ Future<void> main(List<String> args) async {
return; // No disassembler in product mode.
}
final result = await runBinary(Platform.executable,
['--disassemble', Platform.script.toFilePath(), '--child']);
final result = await runBinary(Platform.executable, [
'--no-sound-null-safety',
'--disassemble',
Platform.script.toFilePath(),
'--child'
]);
Expect.equals(0, result.exitCode);
}

View file

@ -1,39 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "detect_nullsafety_helper.dart";
void main() {
// Create temporary directory.
var tmpDir = Directory.systemTemp.createTempSync();
var tmpDirPath = tmpDir.path;
String sourcePath = "$tmpDirPath/strong.dart";
String dillPath = "$tmpDirPath/strong.dill";
String jitPath = "$tmpDirPath/strong.appjit";
// Generate code for an isolate to run in strong mode.
generateIsolateSource(sourcePath, "");
generateKernel(sourcePath, dillPath);
generateAppJIT(sourcePath, jitPath);
try {
// Running from Source.
testNullSafetyMode(sourcePath, 'Strong Mode');
// Without the enable experiment option it will be in strong mode.
testNullSafetyMode1(sourcePath, 'Strong Mode');
// Running from Kernel File.
testNullSafetyMode(dillPath, 'Strong Mode');
// Without the enable experiment option it will be inferred to strong.
testNullSafetyMode1(dillPath, 'Strong Mode');
// Running from app JIT File.
testNullSafetyMode(jitPath, 'Strong Mode');
// Without the enable experiment option it will be inferred to strong.
testNullSafetyMode1(jitPath, 'Strong Mode');
} finally {
tmpDir.deleteSync(recursive: true);
}
}

View file

@ -1,38 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "detect_nullsafety_helper.dart";
void main() {
// Create temporary directory.
var tmpDir = Directory.systemTemp.createTempSync();
var tmpDirPath = tmpDir.path;
String sourcePath = "$tmpDirPath/weak.dart";
String dillPath = "$tmpDirPath/weak.dill";
String jitPath = "$tmpDirPath/weak.appjit";
// Generate code for an isolate to run in weak mode.
generateIsolateSource(sourcePath, "2.6");
generateKernel(sourcePath, dillPath);
generateAppJIT(sourcePath, jitPath);
try {
testNullSafetyMode(sourcePath, 'Weak Mode');
// Without the enable experiment option it will be in weak mode.
testNullSafetyMode1(sourcePath, 'Weak Mode');
// Running from Kernel File.
testNullSafetyMode(dillPath, 'Weak Mode');
// Without the enable experiment option it will be inferred to weak.
testNullSafetyMode1(dillPath, 'Weak Mode');
// Running from app JIT File.
testNullSafetyMode(jitPath, 'Weak Mode');
// Without the enable experiment option it will be inferred to weak.
testNullSafetyMode1(jitPath, 'Weak Mode');
} finally {
tmpDir.deleteSync(recursive: true);
}
}

View file

@ -1,58 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "package:async_helper/async_minitest.dart";
void generateIsolateSource(String filePath, String version) {
File mainIsolate = new File(filePath);
mainIsolate.writeAsStringSync('''
// @dart=$version
void main() {
try {
int x = null as int;
print("Weak Mode");
} catch (ex) {
print("Strong Mode");
}
}
''');
}
void generateOutput(String sourcePath, String outPath, String type) {
var exec = Platform.resolvedExecutable;
var args = <String>[];
args.add("--snapshot-kind=$type");
args.add("--snapshot=$outPath");
args.add(sourcePath);
var result = Process.runSync(exec, args);
print('snapshot $type stdout: ${result.stdout}');
print('snapshot $type stderr: ${result.stderr}');
}
void generateKernel(String sourcePath, String outPath) {
generateOutput(sourcePath, outPath, "kernel");
}
void generateAppJIT(String sourcePath, String outPath) {
generateOutput(sourcePath, outPath, "app-jit");
}
void testNullSafetyMode(String filePath, String expected) {
var exec = Platform.resolvedExecutable;
var args = <String>[];
args.add(filePath);
var result = Process.runSync(exec, args);
print('test stdout: ${result.stdout}');
print('test stderr: ${result.stderr}');
expect(result.stdout.contains('$expected'), true);
}
void testNullSafetyMode1(String filePath, String expected) {
var exec = Platform.resolvedExecutable;
var args = <String>[];
args.add(filePath);
var result = Process.runSync(exec, args);
expect(result.stdout.contains('$expected'), true);
}

View file

@ -1,29 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "nnbd_spawn_autodetect_helper.dart";
void main() {
// Create temporary directory.
var tmpDir = Directory.systemTemp.createTempSync();
var tmpDirPath = tmpDir.path;
String sourcePath = "$tmpDirPath/strong.dart";
String dillPath = "$tmpDirPath/strong.dill";
String jitPath = "$tmpDirPath/strong.appjit";
// Generate code for an isolate to run in strong mode.
generateIsolateSource(sourcePath, "");
generateKernel(sourcePath, dillPath);
generateAppJIT(sourcePath, jitPath);
try {
// Strong Isolate Spawning another Strong Isolate using spawn.
testNullSafetyMode(sourcePath, 're: strong');
testNullSafetyMode(dillPath, 're: strong');
testNullSafetyMode(jitPath, 're: strong');
} finally {
tmpDir.deleteSync(recursive: true);
}
}

View file

@ -1,29 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "nnbd_spawn_autodetect_helper.dart";
void main() {
// Create temporary directory.
var tmpDir = Directory.systemTemp.createTempSync();
var tmpDirPath = tmpDir.path;
String sourcePath = "$tmpDirPath/strong.dart";
String dillPath = "$tmpDirPath/strong.dill";
String jitPath = "$tmpDirPath/strong.appjit";
// Generate code for an isolate to run in strong mode.
generateIsolateSource(sourcePath, "2.6");
generateKernel(sourcePath, dillPath);
generateAppJIT(sourcePath, jitPath);
try {
// Strong Isolate Spawning another Strong Isolate using spawn.
testNullSafetyMode(sourcePath, 're: weak');
testNullSafetyMode(dillPath, 're: weak');
testNullSafetyMode(jitPath, 're: weak');
} finally {
tmpDir.deleteSync(recursive: true);
}
}

View file

@ -1,76 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "package:async_helper/async_minitest.dart";
void generateIsolateSource(String filePath, String version) {
File isolateSource = new File(filePath);
isolateSource.writeAsStringSync('''
// @dart=$version
import \'dart:isolate\';
spawnFunc(List args) {
var data = args[0];
var replyTo = args[1];
try {
int x = null as int;
replyTo.send(\'re: weak\');
} catch (ex) {
replyTo.send(\'re: strong\');
}
}
void main() async {
const String debugName = \'spawnedIsolate\';
final exitPort = ReceivePort();
final port = new ReceivePort();
port.listen((msg) {
print(msg);
port.close();
});
final isolate = await Isolate.spawn(
spawnFunc,
[\'re: hi\', port.sendPort],
paused: false,
debugName: debugName,
onExit: exitPort.sendPort);
// Explicitly await spawned isolate exit to enforce main isolate not
// completing (and the stand-alone runtime exiting) before the spawned
// isolate is done.
await exitPort.first;
}
''');
}
void generateOutput(String sourcePath, String outPath, String type) {
var exec = Platform.resolvedExecutable;
var args = <String>[];
args.add("--snapshot-kind=$type");
args.add("--snapshot=$outPath");
args.add(sourcePath);
var result = Process.runSync(exec, args);
print('snapshot $type stdout: ${result.stdout}');
print('snapshot $type stderr: ${result.stderr}');
}
void generateKernel(String sourcePath, String outPath) {
generateOutput(sourcePath, outPath, "kernel");
}
void generateAppJIT(String sourcePath, String outPath) {
generateOutput(sourcePath, outPath, "app-jit");
}
void testNullSafetyMode(String filePath, String expected) {
var exec = Platform.resolvedExecutable;
var args = <String>[];
args.add(filePath);
var result = Process.runSync(exec, args);
print('test stdout: ${result.stdout}');
print('test stderr: ${result.stderr}');
expect(result.stdout.contains('$expected'), true);
}

View file

@ -1,30 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "nnbd_spawnuri_autodetect_helper.dart";
void main() {
// Create temporary directory.
var tmpDir = Directory.systemTemp.createTempSync();
var tmpDirPath = tmpDir.path;
String sourcePath = "$tmpDirPath/strong_isolate.dart";
// Generate code for an isolate to run in strong mode.
generateIsolateSource(sourcePath, "");
try {
String sourceUri = Uri.file(sourcePath).toString();
// Strong Isolate Spawning another Strong Isolate using spawnUri.
testNullSafetyMode(
"$tmpDirPath/strong_strong.dart", "", sourceUri, 're: strong');
// Weak Isolate Spawning a Strong Isolate using spawnUri.
testNullSafetyMode(
"$tmpDirPath/weak_strong.dart", "2.6", sourceUri, 're: strong');
} finally {
tmpDir.deleteSync(recursive: true);
}
}

View file

@ -1,30 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "nnbd_spawnuri_autodetect_helper.dart";
void main() {
// Create temporary directory.
var tmpDir = Directory.systemTemp.createTempSync();
var tmpDirPath = tmpDir.path;
String sourcePath = "$tmpDirPath/weak_isolate.dart";
// Generate code for an isolate to run in strong mode.
generateIsolateSource(sourcePath, "2.6");
try {
String sourceUri = Uri.file(sourcePath).toString();
// Strong Isolate Spawning another weak Isolate using spawnUri.
testNullSafetyMode(
"$tmpDirPath/strong_weak.dart", "", sourceUri, 're: weak');
// Weak Isolate Spawning another Weak Isolate using spawnUri.
testNullSafetyMode(
"$tmpDirPath/weak_weak.dart", "2.6", sourceUri, 're: weak');
} finally {
tmpDir.deleteSync(recursive: true);
}
}

View file

@ -1,32 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "nnbd_spawnuri_autodetect_helper.dart";
void main() {
// Create temporary directory.
var tmpDir = Directory.systemTemp.createTempSync();
var tmpDirPath = tmpDir.path;
String sourcePath = "$tmpDirPath/strong_isolate.dart";
String outPath = "$tmpDirPath/strong_isolate.dill";
// Generate code for an isolate to run in strong mode.
generateIsolateSource(sourcePath, "");
generateKernel(sourcePath, outPath);
try {
String outUri = Uri.file(outPath).toString();
// Strong Isolate Spawning another Strong Isolate using spawnUri.
testNullSafetyMode(
"$tmpDirPath/strong_strong.dart", "", outUri, 're: strong');
// Weak Isolate Spawning a Strong Isolate using spawnUri.
testNullSafetyMode(
"$tmpDirPath/weak_strong.dart", "2.6", outUri, 're: strong');
} finally {
tmpDir.deleteSync(recursive: true);
}
}

View file

@ -1,31 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "nnbd_spawnuri_autodetect_helper.dart";
void main() {
// Create temporary directory.
var tmpDir = Directory.systemTemp.createTempSync();
var tmpDirPath = tmpDir.path;
String sourcePath = "$tmpDirPath/weak_isolate.dart";
String outPath = "$tmpDirPath/weak_isolate.dill";
// Generate code for an isolate to run in strong mode.
generateIsolateSource(sourcePath, "2.6");
generateKernel(sourcePath, outPath);
try {
String outUri = Uri.file(outPath).toString();
// Strong Isolate Spawning another weak Isolate using spawnUri.
testNullSafetyMode("$tmpDirPath/strong_weak.dart", "", outUri, 're: weak');
// Weak Isolate Spawning another Weak Isolate using spawnUri.
testNullSafetyMode(
"$tmpDirPath/weak_weak.dart", "2.6", outUri, 're: weak');
} finally {
tmpDir.deleteSync(recursive: true);
}
}

View file

@ -1,79 +0,0 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import "dart:io";
import "package:async_helper/async_minitest.dart";
void generateIsolateSource(String filePath, String version) {
File isolateSource = new File("$filePath");
isolateSource.writeAsStringSync('''
// @dart=$version
library SpawnUriIsolate;
main(List<String> args, replyTo) {
var data = args[0];
try {
int x = null as int;
replyTo.send(\'re: weak\');
} catch (ex) {
replyTo.send(\'re: strong\');
}
}
''');
}
void generateOutput(String sourcePath, String outPath, String type) {
var exec = Platform.resolvedExecutable;
var args = <String>[];
args.add("--snapshot-kind=$type");
args.add("--snapshot=$outPath");
args.add(sourcePath);
var result = Process.runSync(exec, args);
}
void generateKernel(String sourcePath, String outPath) {
generateOutput(sourcePath, outPath, "kernel");
}
void generateAppJIT(String sourcePath, String outPath) {
generateOutput(sourcePath, outPath, "app-jit");
}
void testNullSafetyMode(
String filePath, String version, String uri, String expected) {
File mainIsolate = new File(filePath);
mainIsolate.writeAsStringSync('''
// @dart=$version
library spawn_tests;
import \'dart:isolate\';
void main() async {
const String debugName = \'spawnedIsolate\';
final exitPort = ReceivePort();
final port = new ReceivePort();
port.listen((msg) {
print(msg);
port.close();
});
final isolate = await Isolate.spawnUri(
Uri.parse(\'$uri\'),
[\'re: hi\'],
port.sendPort,
paused: false,
debugName: debugName,
onExit: exitPort.sendPort);
// Explicitly await spawned isolate exit to enforce main isolate not
// completing (and the stand-alone runtime exiting) before the spawned
// isolate is done.
await exitPort.first;
}
''');
var exec = Platform.resolvedExecutable;
var args = <String>[];
args.add(mainIsolate.path);
var result = Process.runSync(exec, args);
expect(result.stdout.contains('$expected'), true);
}

View file

@ -26,7 +26,7 @@ main() {
final exePath = path.join(buildDir, 'dart$_execSuffix');
Expect.isTrue(File(exePath).existsSync(),
"Can't locate dart$_execSuffix on this platform");
final powTest = path.join(sdkDir, 'tests', 'standalone_2', 'pow_test.dart');
final powTest = path.join(sdkDir, 'tests', 'standalone', 'pow_test.dart');
Expect.isTrue(File(powTest).existsSync(),
"Can't locate dart$_execSuffix on this platform");
final d = Directory.systemTemp.createTempSync('aot_tmp');

View file

@ -36,6 +36,7 @@ main() {
final genKernelResult = runAndPrintOutput(
genKernel,
[
'--no-sound-null-safety',
'--aot',
'--platform=$platformDill',
'-o',

View file

@ -18,8 +18,8 @@ Future<void> main(List<String> args) async {
return;
} else {
// Create child process and keeps writing into stdout.
final p = await Process.start(
Platform.executable, [Platform.script.toFilePath(), 'child']);
final p = await Process.start(Platform.executable,
['--no-sound-null-safety', Platform.script.toFilePath(), 'child']);
p.stdout.drain();
p.stderr.drain();
final exitCode = await p.exitCode;

View file

@ -370,7 +370,10 @@
"mode": "release",
"runtime": "vm",
"timeout": 240,
"use-sdk": true
"use-sdk": true,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"web-unittest-asserts-legacy-(linux|mac|win)": {
@ -381,7 +384,10 @@
"mode": "release",
"runtime": "vm",
"timeout": 240,
"use-sdk": true
"use-sdk": true,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"unittest-asserts-(debug|product|release)-(linux|mac|win)": {
@ -425,61 +431,106 @@
"dartk-asan-(linux|mac)-(debug|product|release)-(ia32|x64|simarm|simarm64|simriscv32|simriscv64)": {
"options": {
"builder-tag": "asan",
"timeout": 240
"timeout": 240,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartk-lsan-(linux|mac)-(debug|product|release)-(ia32|x64|simarm|simarm64|simriscv32|simriscv64)": {
"options": {
"builder-tag": "lsan",
"timeout": 240
"timeout": 240,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartk-msan-linux-(debug|product|release)-(x64|simarm64|simriscv64)": {
"options": {
"builder-tag": "msan",
"timeout": 240
"timeout": 240,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartk-tsan-(linux|mac)-(debug|product|release)-(x64|simarm64|simriscv64)": {
"options": {
"builder-tag": "tsan",
"timeout": 240
"timeout": 240,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartk-ubsan-(linux|mac)-(debug|product|release)-(ia32|x64|simarm|simarm64|simriscv32|simriscv64)": {
"options": {
"builder-tag": "ubsan",
"timeout": 240
"timeout": 240,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-asan-(linux|mac)-(debug|product|release)-(x64|simarm|simarm64|simriscv32|simriscv64)": {
"options": {
"builder-tag": "asan",
"timeout": 240
"timeout": 240,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-lsan-(linux|mac)-(debug|product|release)-(x64|simarm|simarm64|simriscv32|simriscv64)": {
"options": {
"builder-tag": "lsan",
"timeout": 240
"timeout": 240,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-msan-linux-(debug|product|release)-(x64|simarm64|simriscv64)": {
"options": {
"builder-tag": "msan",
"timeout": 240
"timeout": 240,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-tsan-(linux|mac)-(debug|product|release)-(x64|simarm64|simriscv64)": {
"options": {
"builder-tag": "tsan",
"timeout": 240
"timeout": 240,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-ubsan-(linux|mac)-(debug|product|release)-(x64|simarm|simarm64|simriscv32|simriscv64)": {
"options": {
"builder-tag": "ubsan",
"timeout": 240
"timeout": 240,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dart2js-(linux|mac|win)-chrome": {
@ -722,25 +773,56 @@
"dartkp-android-(debug|product|release)-arm_x64": {
"options": {
"builder-tag": "crossword",
"use-elf": true
"use-elf": true,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-android-(debug|product|release)-(arm|arm64|arm64c)": {
"options": {
"use-elf": true
"use-elf": true,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartk-android-(debug|product|release)-(arm|arm64|arm64c)": {
"options": {
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartk-android-(debug|product|release)-(arm|arm64|arm64c)": {},
"dartkp-(linux|win|mac)-(debug|product|release)-(arm64|arm64c|simarm|simarm64|simarm64c|simriscv32|simriscv64)": {
"options": {
"use-elf": true
"use-elf": true,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-dwarf-(linux|win|mac)-product-(arm64|arm64c|simarm|simarm64|simarm64c|x64|x64c|simriscv32|simriscv64)": {
"options": {
"builder-tag": "dwarf",
"vm-options": [
"--dwarf_stack_traces"
"--dwarf_stack_traces",
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
],
"use-elf": true
}
@ -748,7 +830,13 @@
"dartkp-linux-(debug|product|release)-simarm-crossword": {
"options": {
"builder-tag": "crossword",
"use-elf": true
"use-elf": true,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-weak-asserts-linux-(debug|product|release)-simarm-crossword": {
@ -764,39 +852,89 @@
"dartkp-(win|mac)-(debug|product|release)-simarm-crossword": {
"options": {
"builder-tag": "crossword",
"use-elf": true
"use-elf": true,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-win-(product|release)-(x64|x64c)": {
"options": {
"use-elf": true
"use-elf": true,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-win-debug-(x64|x64c)": {
"options": {
"use-elf": true,
"vm-options": []
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-(linux|mac)-(product|release)-(x64|x64c)": {
"options": {
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-(linux|mac)-(product|release)-(x64|x64c)": {},
"dartkp-obfuscate-(linux|mac|win)-(debug|product|release)-(x64|x64c)": {
"options": {
"builder-tag": "obfuscated",
"vm-options": [
"--obfuscate"
"--obfuscate",
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-(linux|mac)-debug-(x64|x64c)": {
"options": {
"vm-options": []
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"dartk-(linux|mac|win)-(debug|product|release)-(ia32|x64|x64c)": {
"options": {
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartk-fuchsia-(debug|product|release)-(x64|x64c)": {
"options": {
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartk-(linux|mac|win)-(debug|product|release)-(ia32|x64|x64c)": {},
"dartk-fuchsia-(debug|product|release)-(x64|x64c)": {},
"dartk-linux-debug-(ia32|x64)-canary": {
"options": {
"builder-tag": "canary"
"builder-tag": "canary",
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-weak-asserts-(linux|mac)-(debug|product|release)-(arm64|x64|x64c)": {
@ -849,40 +987,71 @@
},
"dartk-checked-(linux|mac|win)-(debug|product|release)-(ia32|x64|x64c)": {
"options": {
"enable-asserts": true
"enable-asserts": true,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartk-(linux|mac|win)-(debug|product|release)-(arm64|arm64c|simarm|simarm64|simarm64c|simriscv32|simriscv64)": {
"options": {
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartk-(linux|mac|win)-(debug|product|release)-(arm64|arm64c|simarm|simarm64|simarm64c|simriscv32|simriscv64)": {},
"dartk-optcounter-(linux|mac|win)-(debug|product|release)-(ia32|x64|x64c|simarm|simarm64|simarm64c|simriscv32|simriscv64)": {
"options": {
"builder-tag": "optimization_counter_threshold",
"vm-options": [
"--optimization-counter-threshold=5",
"--random-seed=__RANDOM__"
"--random-seed=__RANDOM__",
"--no-sound-null-safety"
]
}
},
"dartk-reload-(linux|mac|win)-(debug|product|release)-(ia32|x64|x64c)": {
"options": {
"hot-reload": true
"hot-reload": true,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartk-reload-rollback-(linux|mac|win)-(debug|product|release)-(ia32|x64|x64c)": {
"options": {
"hot-reload-rollback": true
"hot-reload-rollback": true,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartk-linux-(debug|product|release)-(arm|arm64|arm64c|riscv32|riscv64)-qemu": {
"options": {
"use-qemu": true
"use-qemu": true,
"vm-options": [
"--no-sound-null-safety"
]
}
},
"dartkp-linux-(debug|product|release)-(arm|arm64|arm64c|riscv32|riscv64)-qemu": {
"options": {
"use-qemu": true
"use-qemu": true,
"vm-options": [
"--no-sound-null-safety"
],
"gen-kernel-options": [
"--no-sound-null-safety"
]
}
},
"app_jitk-(linux|mac|win)-(debug|product|release)-(ia32|x64|x64c)": {
"options": {
"vm-options": [
"--no-sound-null-safety"
]
}
},
"app_jitk-(linux|mac|win)-(debug|product|release)-(ia32|x64|x64c)": {},
"dartdevk-checked-(linux|mac|win)-(debug|product|release)-(chrome|firefox)": {
"options": {
"checked": true,
@ -2713,6 +2882,7 @@
"script": "out/ReleaseX64/dart-sdk/bin/dart",
"testRunner": true,
"arguments": [
"--no-sound-null-safety",
"pkg/compiler/tool/modular_test_suite_legacy.dart",
"-nweb-unittest-asserts-legacy-linux",
"--verbose",
@ -2724,6 +2894,7 @@
"script": "out/ReleaseX64/dart-sdk/bin/dart",
"testRunner": true,
"arguments": [
"--no-sound-null-safety",
"pkg/compiler/tool/modular_test_suite.dart",
"-nweb-unittest-asserts-linux",
"--verbose",

View file

@ -79,6 +79,11 @@ template("_application_snapshot") {
output = invoker.output
}
gen_kernel_args = []
if (defined(invoker.gen_kernel_args)) {
gen_kernel_args += invoker.gen_kernel_args
}
# Build the kernel file using the prebuilt VM to speed up the debug and
# simulator builds.
prebuilt_dart_action(target_name + "_dill") {
@ -131,6 +136,7 @@ template("_application_snapshot") {
"-Dsdk_hash=$sdk_hash",
"-Ddart.vm.product=$is_product_flag",
]
args += gen_kernel_args
args += [ rebase_path(main_dart) ]
}

View file

@ -60,7 +60,8 @@ application_snapshot("dart2js") {
"$root_out_dir/dart2js_outline.dill",
"$root_out_dir/dart2js_outline_unsound.dill",
]
vm_args = []
gen_kernel_args = [ "--no-sound-null-safety" ]
vm_args = [ "--no-sound-null-safety" ]
main_dart = "$target_gen_dir/dart2js.dart"
training_args = [
"--packages=" + rebase_path("../../.dart_tool/package_config.json"),

View file

@ -24,7 +24,7 @@ kernel_application_snapshot("kernel-service_snapshot") {
# Force triple-slashes both on Windows and otherwise.
# Becomes e.g. file:///full/path/to/file and "file:///C:/full/path/to/file.
# Without the ', "/"' part, on Linux it would get four slashes.
"file:///" + rebase_path("../../pkg/compiler/lib/src/dart2js.dart", "/"),
"file:///" + rebase_path("../../pkg/vm/bin/kernel_service.dart", "/"),
]
output = "$root_gen_dir/kernel-service.dart.snapshot"
}