[vm] Pass snapshot flag to kernel_service

Enable reporting of null safety compilation mode when running
`dart compile aot-snapshot`, `dart compile jit-snapshot`,
and `dart compile kernel`.

Closes #44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I0d4b35c6ccb4167c0c7539a4eb24a5139e29cf53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178990
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Johnni Winther
2021-01-18 09:27:59 +00:00
committed by commit-bot@chromium.org
parent e8d4569e37
commit f8b0d26cc3
17 changed files with 303 additions and 71 deletions
+141
View File
@@ -356,4 +356,145 @@ void main() {}
expect(File(outFile).existsSync(), true,
reason: 'File not found: $outFile');
});
test('Compile AOT snapshot with sound null safety', () {
final p = project(mainSrc: '''void main() {}''');
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
final outFile = path.canonicalize(path.join(p.dirPath, 'myaot'));
var result = p.runSync(
[
'compile',
'aot-snapshot',
'-o',
outFile,
inFile,
],
);
expect(result.stdout, contains(soundNullSafetyMessage));
expect(result.stderr, isEmpty);
expect(result.exitCode, 0);
expect(File(outFile).existsSync(), true,
reason: 'File not found: $outFile');
});
test('Compile AOT snapshot with unsound null safety', () {
final p = project(mainSrc: '''
// @dart=2.9
void main() {}
''');
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
final outFile = path.canonicalize(path.join(p.dirPath, 'myaot'));
var result = p.runSync(
[
'compile',
'aot-snapshot',
'-o',
outFile,
inFile,
],
);
expect(result.stdout, contains(unsoundNullSafetyMessage));
expect(result.stderr, isEmpty);
expect(result.exitCode, 0);
expect(File(outFile).existsSync(), true,
reason: 'File not found: $outFile');
});
test('Compile kernel with sound null safety', () {
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'));
var result = p.runSync(
[
'compile',
'kernel',
'-o',
outFile,
inFile,
],
);
expect(result.stdout, contains(soundNullSafetyMessage));
expect(result.stderr, isEmpty);
expect(result.exitCode, 0);
expect(File(outFile).existsSync(), true,
reason: 'File not found: $outFile');
});
test('Compile kernel with unsound null safety', () {
final p = project(mainSrc: '''
// @dart=2.9
void main() {}
''');
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
final outFile = path.canonicalize(path.join(p.dirPath, 'mydill'));
var result = p.runSync(
[
'compile',
'kernel',
'-o',
outFile,
inFile,
],
);
expect(result.stdout, contains(unsoundNullSafetyMessage));
expect(result.stderr, isEmpty);
expect(result.exitCode, 0);
expect(File(outFile).existsSync(), true,
reason: 'File not found: $outFile');
});
test('Compile JIT snapshot with sound null safety', () {
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'));
var result = p.runSync(
[
'compile',
'jit-snapshot',
'-o',
outFile,
inFile,
],
);
expect(result.stdout, contains(soundNullSafetyMessage));
expect(result.stderr, isEmpty);
expect(result.exitCode, 0);
expect(File(outFile).existsSync(), true,
reason: 'File not found: $outFile');
});
test('Compile JIT snapshot with unsound null safety', () {
final p = project(mainSrc: '''
// @dart=2.9
void main() {}
''');
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
final outFile = path.canonicalize(path.join(p.dirPath, 'myjit'));
var result = p.runSync(
[
'compile',
'jit-snapshot',
'-o',
outFile,
inFile,
],
);
expect(result.stdout, contains(unsoundNullSafetyMessage));
expect(result.stderr, isEmpty);
expect(result.exitCode, 0);
expect(File(outFile).existsSync(), true,
reason: 'File not found: $outFile');
});
}
+74 -41
View File
@@ -23,7 +23,9 @@ library runtime.tools.kernel_service;
import 'dart:async' show Future, ZoneSpecification, runZoned;
import 'dart:collection' show UnmodifiableMapBase;
import 'dart:convert' show utf8;
import 'dart:io' show Directory, File, Platform, stderr hide FileSystemEntity;
import 'dart:io'
show Directory, File, Platform, stderr, stdout
hide FileSystemEntity;
import 'dart:isolate';
import 'dart:typed_data' show Uint8List;
@@ -92,7 +94,8 @@ CompilerOptions setupCompilerOptions(
int nullSafety,
List<String> experimentalFlags,
Uri packagesUri,
List<String> errors) {
List<String> errors,
String invocationModes) {
final expFlags = <String>[];
if (experimentalFlags != null) {
for (String flag in experimentalFlags) {
@@ -116,27 +119,33 @@ CompilerOptions setupCompilerOptions(
? NnbdMode.Strong
: NnbdMode.Weak
..onDiagnostic = (DiagnosticMessage message) {
bool printMessage;
bool printToStdErr = false;
bool printToStdOut = false;
switch (message.severity) {
case Severity.error:
case Severity.internalProblem:
// TODO(sigmund): support emitting code with errors as long as they
// are handled in the generated code.
printMessage = false; // errors are printed by VM
printToStdErr = false; // errors are printed by VM
errors.addAll(message.plainTextFormatted);
break;
case Severity.warning:
printToStdErr = !suppressWarnings;
break;
case Severity.info:
printMessage = !suppressWarnings;
printToStdOut = !suppressWarnings;
break;
case Severity.context:
case Severity.ignored:
throw "Unexpected severity: ${message.severity}";
}
if (printMessage) {
if (printToStdErr) {
printDiagnosticMessage(message, stderr.writeln);
} else if (printToStdOut) {
printDiagnosticMessage(message, stdout.writeln);
}
};
}
..invocationModes = InvocationMode.parseArguments(invocationModes);
}
abstract class Compiler {
@@ -148,6 +157,7 @@ abstract class Compiler {
final int nullSafety;
final List<String> experimentalFlags;
final String packageConfig;
final String invocationModes;
// Code coverage and hot reload are only supported by incremental compiler,
// which is used if vm-service is enabled.
@@ -165,7 +175,8 @@ abstract class Compiler {
this.experimentalFlags: null,
this.supportCodeCoverage: false,
this.supportHotReload: false,
this.packageConfig: null}) {
this.packageConfig: null,
this.invocationModes: ''}) {
Uri packagesUri = null;
if (packageConfig != null) {
packagesUri = Uri.parse(packageConfig);
@@ -188,7 +199,8 @@ abstract class Compiler {
nullSafety,
experimentalFlags,
packagesUri,
errors);
errors,
invocationModes);
}
Future<CompilerResult> compile(Uri script) {
@@ -278,7 +290,8 @@ class IncrementalCompilerWrapper extends Compiler {
bool enableAsserts: false,
int nullSafety: kNullSafetyOptionUnspecified,
List<String> experimentalFlags: null,
String packageConfig: null})
String packageConfig: null,
String invocationModes: ''})
: super(isolateId, fileSystem, platformKernelPath,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
@@ -286,7 +299,8 @@ class IncrementalCompilerWrapper extends Compiler {
experimentalFlags: experimentalFlags,
supportHotReload: true,
supportCodeCoverage: true,
packageConfig: packageConfig);
packageConfig: packageConfig,
invocationModes: invocationModes);
factory IncrementalCompilerWrapper.forExpressionCompilationOnly(
Component component,
@@ -296,13 +310,15 @@ class IncrementalCompilerWrapper extends Compiler {
{bool suppressWarnings: false,
bool enableAsserts: false,
List<String> experimentalFlags: null,
String packageConfig: null}) {
String packageConfig: null,
String invocationModes: ''}) {
IncrementalCompilerWrapper result = IncrementalCompilerWrapper(
isolateId, fileSystem, platformKernelPath,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
experimentalFlags: experimentalFlags,
packageConfig: packageConfig);
packageConfig: packageConfig,
invocationModes: invocationModes);
result.generator = new IncrementalCompiler.forExpressionCompilationOnly(
component,
result.options,
@@ -331,7 +347,8 @@ class IncrementalCompilerWrapper extends Compiler {
enableAsserts: enableAsserts,
nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
packageConfig: packageConfig);
packageConfig: packageConfig,
invocationModes: invocationModes);
generator.resetDeltaState();
Component fullComponent = await generator.compile();
@@ -361,13 +378,15 @@ class SingleShotCompilerWrapper extends Compiler {
bool enableAsserts: false,
int nullSafety: kNullSafetyOptionUnspecified,
List<String> experimentalFlags: null,
String packageConfig: null})
String packageConfig: null,
String invocationModes: ''})
: super(isolateId, fileSystem, platformKernelPath,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
packageConfig: packageConfig);
packageConfig: packageConfig,
invocationModes: invocationModes);
@override
Future<CompilerResult> compileInternal(Uri script) async {
@@ -403,7 +422,8 @@ Future<Compiler> lookupOrBuildNewIncrementalCompiler(int isolateId,
List<String> experimentalFlags: null,
String packageConfig: null,
String multirootFilepaths,
String multirootScheme}) async {
String multirootScheme,
String invocationModes: ''}) async {
IncrementalCompilerWrapper compiler = lookupIncrementalCompiler(isolateId);
if (compiler != null) {
updateSources(compiler, sourceFiles);
@@ -432,7 +452,8 @@ Future<Compiler> lookupOrBuildNewIncrementalCompiler(int isolateId,
enableAsserts: enableAsserts,
nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
packageConfig: packageConfig);
packageConfig: packageConfig,
invocationModes: invocationModes);
}
isolateCompilers[isolateId] = compiler;
}
@@ -652,10 +673,7 @@ List<int> _serializeDependencies(List<Uri> uris) {
return utf8.encode(uris.map(_escapeDependency).join(" "));
}
Future _processListDependenciesRequest(request) async {
final SendPort port = request[1];
final int isolateId = request[6];
Future _processListDependenciesRequest(SendPort port, int isolateId) async {
final List<Uri> dependencies = isolateDependencies[isolateId] ?? <Uri>[];
CompilationResult result;
@@ -709,32 +727,34 @@ Future _processLoadRequest(request) async {
return;
}
if (tag == kListDependenciesTag) {
await _processListDependenciesRequest(request);
return;
}
if (tag == kNotifyIsolateShutdownTag) {
await _processIsolateShutdownNotification(request);
return;
}
final SendPort port = request[1];
final int isolateId = request[7];
if (tag == kListDependenciesTag) {
await _processListDependenciesRequest(port, isolateId);
return;
}
final String inputFileUri = request[2];
final Uri script =
inputFileUri != null ? Uri.base.resolve(inputFileUri) : null;
final bool incremental = request[4];
final int nullSafety = request[5];
final int isolateId = request[6];
final List sourceFiles = request[7];
final bool suppressWarnings = request[8];
final bool enableAsserts = request[9];
final bool snapshot = request[5];
final int nullSafety = request[6];
final List sourceFiles = request[8];
final bool suppressWarnings = request[9];
final bool enableAsserts = request[10];
final List<String> experimentalFlags =
request[10] != null ? request[10].cast<String>() : null;
final String packageConfig = request[11];
final String multirootFilepaths = request[12];
final String multirootScheme = request[13];
final String workingDirectory = request[14];
request[11] != null ? request[11].cast<String>() : null;
final String packageConfig = request[12];
final String multirootFilepaths = request[13];
final String multirootScheme = request[14];
final String workingDirectory = request[15];
Uri platformKernelPath = null;
List<int> platformKernel = null;
@@ -748,6 +768,8 @@ Future _processLoadRequest(request) async {
computePlatformBinariesLocation().resolve('vm_platform_strong.dill');
}
final String invocationModes = snapshot ? 'compile' : '';
Compiler compiler;
// Update the in-memory file system with the provided sources. Currently, only
@@ -792,8 +814,16 @@ Future _processLoadRequest(request) async {
packagesUri = Uri.directory(workingDirectory).resolveUri(packagesUri);
}
final List<String> errors = <String>[];
var options = setupCompilerOptions(fileSystem, platformKernelPath, false,
false, nullSafety, experimentalFlags, packagesUri, errors);
var options = setupCompilerOptions(
fileSystem,
platformKernelPath,
false,
false,
nullSafety,
experimentalFlags,
packagesUri,
errors,
invocationModes);
// script should only be null for kUpdateSourcesTag.
assert(script != null);
@@ -819,7 +849,8 @@ Future _processLoadRequest(request) async {
experimentalFlags: experimentalFlags,
packageConfig: packageConfig,
multirootFilepaths: multirootFilepaths,
multirootScheme: multirootScheme);
multirootScheme: multirootScheme,
invocationModes: invocationModes);
} else {
FileSystem fileSystem = _buildFileSystem(
sourceFiles, platformKernel, multirootFilepaths, multirootScheme);
@@ -830,7 +861,8 @@ Future _processLoadRequest(request) async {
enableAsserts: enableAsserts,
nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
packageConfig: packageConfig);
packageConfig: packageConfig,
invocationModes: invocationModes);
}
CompilationResult result;
@@ -974,6 +1006,7 @@ Future trainInternal(String scriptUri, String platformKernelPath) async {
scriptUri,
platformKernelPath,
false /* incremental */,
false /* snapshot */,
kNullSafetyOptionUnspecified /* null safety */,
1 /* isolateId chosen randomly */,
[] /* source files */,
+7 -5
View File
@@ -182,14 +182,15 @@ const char* PathSanitizer::sanitized_uri() const {
Dart_KernelCompilationResult DFE::CompileScript(const char* script_uri,
bool incremental,
const char* package_config) {
const char* package_config,
bool snapshot) {
// 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_CompileToKernel(sanitized_uri, platform_strong_dill,
platform_strong_dill_size, incremental,
platform_strong_dill_size, incremental, snapshot,
package_config);
}
@@ -198,9 +199,10 @@ void DFE::CompileAndReadScript(const char* script_uri,
intptr_t* kernel_buffer_size,
char** error,
int* exit_code,
const char* package_config) {
Dart_KernelCompilationResult result =
CompileScript(script_uri, use_incremental_compiler(), package_config);
const char* package_config,
bool snapshot) {
Dart_KernelCompilationResult result = CompileScript(
script_uri, use_incremental_compiler(), package_config, snapshot);
switch (result.status) {
case Dart_KernelCompilationStatus_Ok:
*kernel_buffer = result.kernel;
+10 -2
View File
@@ -59,20 +59,28 @@ class DFE {
// 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).
Dart_KernelCompilationResult CompileScript(const char* script_uri,
bool incremental,
const char* package_config);
const char* package_config,
bool snapshot);
// 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
// 'error' and 'exit_code' have the error values in case of errors.
//
// `snapshot` is used by the frontend to determine if compilation
// related information should be printed to console (e.g., null safety mode).
void CompileAndReadScript(const char* script_uri,
uint8_t** kernel_buffer,
intptr_t* kernel_buffer_size,
char** error,
int* exit_code,
const char* package_config);
const char* package_config,
bool snapshot);
// Reads the script kernel file if specified 'script_uri' is a kernel file.
// Returns an in memory kernel representation of the specified script is a
+1 -1
View File
@@ -198,7 +198,7 @@ Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag,
uint8_t* kernel_buffer = NULL;
intptr_t kernel_buffer_size = -1;
dfe.CompileAndReadScript(url_string, &kernel_buffer, &kernel_buffer_size,
&error, &exit_code, NULL);
&error, &exit_code, NULL, false);
if (exit_code == 0) {
return Dart_LoadLibraryFromKernel(kernel_buffer, kernel_buffer_size);
} else if (exit_code == kCompilationErrorExitCode) {
+6 -1
View File
@@ -298,9 +298,14 @@ static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate,
}
uint8_t* application_kernel_buffer = NULL;
intptr_t application_kernel_buffer_size = 0;
// Only pass snapshot = true when generating an AppJIT snapshot to avoid
// duplicate null-safety info messages from the frontend when generating
// a kernel snapshot (this flag is instead set in
// Snapshot::GenerateKernel()).
const bool snapshot = Options::gen_snapshot_kind() == kAppJIT;
dfe.CompileAndReadScript(script_uri, &application_kernel_buffer,
&application_kernel_buffer_size, error, exit_code,
resolved_packages_config);
resolved_packages_config, snapshot);
if (application_kernel_buffer == NULL) {
Dart_ExitScope();
Dart_ShutdownIsolate();
+1 -1
View File
@@ -471,7 +471,7 @@ void Snapshot::GenerateKernel(const char* snapshot_filename,
free(kernel_buffer);
} else {
Dart_KernelCompilationResult result =
dfe.CompileScript(script_name, false, package_config);
dfe.CompileScript(script_name, false, package_config, true);
if (result.status != Dart_KernelCompilationStatus_Ok) {
ErrorExit(kErrorExitCode, "%s\n", result.error);
}
+5
View File
@@ -3537,6 +3537,10 @@ DART_EXPORT Dart_Port Dart_KernelPort();
*
* \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).
*
* \return Returns the result of the compilation.
*
* On a successful compilation the returned [Dart_KernelCompilationResult] has
@@ -3554,6 +3558,7 @@ Dart_CompileToKernel(const char* script_uri,
const uint8_t* platform_kernel,
const intptr_t platform_kernel_size,
bool incremental_compile,
bool snapshot_compile,
const char* package_config);
typedef struct {
+1 -1
View File
@@ -35,7 +35,7 @@ Future<void> main(List<String> args) async {
]);
Expect.equals('', result.stderr);
Expect.equals(0, result.exitCode);
Expect.equals('', result.stdout);
Expect.equals('$unsoundNullSafetyMessage\n', result.stdout);
}
{
@@ -39,7 +39,10 @@ ${result.processResult.stderr}''');
void expectOutput(String what, Result result) {
if (result.output != what) {
reportError(result, 'Expected test to print \'${what}\' to stdout');
reportError(
result,
'Expected test to print \'${what}\' to stdout. '
'Actual: ${result.output}');
}
}
@@ -127,6 +130,12 @@ checkDeterministicSnapshot(String snapshotKind, String expectedStdout) async {
final snapshot1Path = p.join(temp, 'snapshot1');
final snapshot2Path = p.join(temp, 'snapshot2');
if (expectedStdout.isEmpty) {
expectedStdout = nullSafetyMessage;
} else {
expectedStdout = '$nullSafetyMessage\n$expectedStdout';
}
print("Version ${Platform.version}");
final generate1Result = await runDart('GENERATE SNAPSHOT 1', [
@@ -183,8 +192,15 @@ runAppJitTest(Uri testScriptUri,
testPath,
'--train'
]);
expectOutput("OK(Trained)", trainingResult);
expectOutput("$nullSafetyMessage\nOK(Trained)", trainingResult);
final runResult = await runSnapshot!(snapshotPath);
expectOutput("OK(Run)", runResult);
});
}
final String nullSafetyMessage =
hasSoundNullSafety ? soundNullSafetyMessage : unsoundNullSafetyMessage;
const String soundNullSafetyMessage = 'Info: Compiling with sound null safety';
const String unsoundNullSafetyMessage =
'Info: Compiling with unsound null safety';
+1 -1
View File
@@ -35,7 +35,7 @@ Future<void> main(List<String> args) async {
]);
Expect.equals('', result.stderr);
Expect.equals(0, result.exitCode);
Expect.equals('', result.stdout);
Expect.equals('$unsoundNullSafetyMessage\n', result.stdout);
}
{
@@ -39,7 +39,10 @@ ${result.processResult.stderr}''');
void expectOutput(String what, Result result) {
if (result.output != what) {
reportError(result, 'Expected test to print \'${what}\' to stdout');
reportError(
result,
'Expected test to print \'${what}\' to stdout. '
'Actual: ${result.output}');
}
}
@@ -127,6 +130,12 @@ checkDeterministicSnapshot(String snapshotKind, String expectedStdout) async {
final snapshot1Path = p.join(temp, 'snapshot1');
final snapshot2Path = p.join(temp, 'snapshot2');
if (expectedStdout.isEmpty) {
expectedStdout = unsoundNullSafetyMessage;
} else {
expectedStdout = '$unsoundNullSafetyMessage\n$expectedStdout';
}
print("Version ${Platform.version}");
final generate1Result = await runDart('GENERATE SNAPSHOT 1', [
@@ -183,8 +192,11 @@ runAppJitTest(Uri testScriptUri,
testPath,
'--train'
]);
expectOutput("OK(Trained)", trainingResult);
expectOutput("$unsoundNullSafetyMessage\nOK(Trained)", trainingResult);
final runResult = await runSnapshot(snapshotPath);
expectOutput("OK(Run)", runResult);
});
}
const String unsoundNullSafetyMessage =
'Info: Compiling with unsound null safety';
+4 -3
View File
@@ -6094,6 +6094,7 @@ Dart_CompileToKernel(const char* script_uri,
const uint8_t* platform_kernel,
intptr_t platform_kernel_size,
bool incremental_compile,
bool snapshot_compile,
const char* package_config) {
API_TIMELINE_DURATION(Thread::Current());
@@ -6102,9 +6103,9 @@ Dart_CompileToKernel(const char* script_uri,
result.status = Dart_KernelCompilationStatus_Unknown;
result.error = Utils::StrDup("Dart_CompileToKernel is unsupported.");
#else
result = KernelIsolate::CompileToKernel(script_uri, platform_kernel,
platform_kernel_size, 0, NULL,
incremental_compile, package_config);
result = KernelIsolate::CompileToKernel(
script_uri, platform_kernel, platform_kernel_size, 0, NULL,
incremental_compile, snapshot_compile, package_config);
if (result.status == Dart_KernelCompilationStatus_Ok) {
Dart_KernelCompilationResult accept_result =
KernelIsolate::AcceptCompilation();
+3 -3
View File
@@ -1048,9 +1048,9 @@ char* IsolateGroupReloadContext::CompileToKernel(bool force_reload,
{
const char* root_lib_url = root_lib_url_.ToCString();
TransitionVMToNative transition(Thread::Current());
retval = KernelIsolate::CompileToKernel(root_lib_url, nullptr, 0,
modified_scripts_count,
modified_scripts, true, nullptr);
retval = KernelIsolate::CompileToKernel(
root_lib_url, nullptr, 0, modified_scripts_count, modified_scripts,
true, false, nullptr);
}
if (retval.status != Dart_KernelCompilationStatus_Ok) {
if (retval.kernel != nullptr) {
+14 -7
View File
@@ -708,6 +708,7 @@ class KernelCompilationRequest : public ValueObject {
int source_files_count,
Dart_SourceFile source_files[],
bool incremental_compile,
bool snapshot_compile,
const char* package_config,
const char* multiroot_filepaths,
const char* multiroot_scheme,
@@ -755,6 +756,10 @@ class KernelCompilationRequest : public ValueObject {
dart_incremental.type = Dart_CObject_kBool;
dart_incremental.value.as_bool = incremental_compile;
Dart_CObject dart_snapshot;
dart_snapshot.type = Dart_CObject_kBool;
dart_snapshot.value.as_bool = snapshot_compile;
// TODO(aam): Assert that isolate exists once we move CompileAndReadScript
// compilation logic out of CreateIsolateAndSetupHelper and into
// IsolateSetupHelper in main.cc.
@@ -857,6 +862,7 @@ class KernelCompilationRequest : public ValueObject {
&uri,
&dart_platform_kernel,
&dart_incremental,
&dart_snapshot,
&null_safety,
&isolate_id,
&files,
@@ -1008,6 +1014,7 @@ Dart_KernelCompilationResult KernelIsolate::CompileToKernel(
int source_file_count,
Dart_SourceFile source_files[],
bool incremental_compile,
bool snapshot_compile,
const char* package_config,
const char* multiroot_filepaths,
const char* multiroot_scheme) {
@@ -1033,8 +1040,8 @@ Dart_KernelCompilationResult KernelIsolate::CompileToKernel(
return request.SendAndWaitForResponse(
kCompileTag, kernel_port, script_uri, platform_kernel,
platform_kernel_size, source_file_count, source_files,
incremental_compile, package_config, multiroot_filepaths,
multiroot_scheme, experimental_flags_, NULL);
incremental_compile, snapshot_compile, package_config,
multiroot_filepaths, multiroot_scheme, experimental_flags_, NULL);
}
bool KernelIsolate::DetectNullSafety(const char* script_uri,
@@ -1052,7 +1059,7 @@ bool KernelIsolate::DetectNullSafety(const char* script_uri,
KernelCompilationRequest request;
Dart_KernelCompilationResult result = request.SendAndWaitForResponse(
kDetectNullabilityTag, kernel_port, script_uri, nullptr, -1, 0, nullptr,
false, package_config, nullptr, nullptr, experimental_flags_,
false, false, package_config, nullptr, nullptr, experimental_flags_,
original_working_directory);
return result.null_safety;
}
@@ -1068,8 +1075,8 @@ Dart_KernelCompilationResult KernelIsolate::ListDependencies() {
KernelCompilationRequest request;
return request.SendAndWaitForResponse(kListDependenciesTag, kernel_port, NULL,
NULL, 0, 0, NULL, false, NULL, NULL,
NULL, experimental_flags_, NULL);
NULL, 0, 0, NULL, false, false, NULL,
NULL, NULL, experimental_flags_, NULL);
}
Dart_KernelCompilationResult KernelIsolate::AcceptCompilation() {
@@ -1085,7 +1092,7 @@ Dart_KernelCompilationResult KernelIsolate::AcceptCompilation() {
KernelCompilationRequest request;
return request.SendAndWaitForResponse(kAcceptTag, kernel_port, NULL, NULL, 0,
0, NULL, true, NULL, NULL, NULL,
0, NULL, true, false, NULL, NULL, NULL,
experimental_flags_, NULL);
}
@@ -1131,7 +1138,7 @@ Dart_KernelCompilationResult KernelIsolate::UpdateInMemorySources(
KernelCompilationRequest request;
return request.SendAndWaitForResponse(
kUpdateSourcesTag, kernel_port, NULL, NULL, 0, source_files_count,
source_files, true, NULL, NULL, NULL, experimental_flags_, NULL);
source_files, true, false, NULL, NULL, NULL, experimental_flags_, NULL);
}
void KernelIsolate::NotifyAboutIsolateShutdown(const Isolate* isolate) {
+1
View File
@@ -51,6 +51,7 @@ class KernelIsolate : public AllStatic {
int source_files_count = 0,
Dart_SourceFile source_files[] = NULL,
bool incremental_compile = true,
bool snapshot_compile = false,
const char* package_config = NULL,
const char* multiroot_filepaths = NULL,
const char* multiroot_scheme = NULL);
+2 -1
View File
@@ -322,7 +322,8 @@ char* TestCase::CompileTestScriptWithDFE(const char* url,
Zone* zone = Thread::Current()->zone();
Dart_KernelCompilationResult result = KernelIsolate::CompileToKernel(
url, platform_strong_dill, platform_strong_dill_size, sourcefiles_count,
sourcefiles, incrementally, NULL, multiroot_filepaths, multiroot_scheme);
sourcefiles, incrementally, false, NULL, multiroot_filepaths,
multiroot_scheme);
if (result.status == Dart_KernelCompilationStatus_Ok) {
if (KernelIsolate::AcceptCompilation().status !=
Dart_KernelCompilationStatus_Ok) {