Skip to content

Commit 6af7d0f

Browse files
author
Dart CI
committed
Version 2.13.0-49.0.dev
Merge commit '9f68048cae8ec3344e845917f3f42dbc8340e8a3' into 'dev'
2 parents b32f0b8 + 9f68048 commit 6af7d0f

12 files changed

Lines changed: 359 additions & 118 deletions

File tree

pkg/vm/bin/kernel_service.dart

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ CompilerOptions setupCompilerOptions(
153153
}
154154

155155
abstract class Compiler {
156-
final int isolateId;
156+
final int isolateGroupId;
157157
final FileSystem fileSystem;
158158
final Uri platformKernelPath;
159159
final bool enableAsserts;
@@ -172,7 +172,7 @@ abstract class Compiler {
172172

173173
CompilerOptions options;
174174

175-
Compiler(this.isolateId, this.fileSystem, this.platformKernelPath,
175+
Compiler(this.isolateGroupId, this.fileSystem, this.platformKernelPath,
176176
{this.enableAsserts: false,
177177
this.nullSafety: kNullSafetyOptionUnspecified,
178178
this.experimentalFlags: null,
@@ -214,7 +214,7 @@ abstract class Compiler {
214214

215215
if (errors.isEmpty) {
216216
// Record dependencies only if compilation was error free.
217-
_recordDependencies(isolateId, component, options.packagesFileUri);
217+
_recordDependencies(isolateGroupId, component, options.packagesFileUri);
218218
}
219219

220220
return compilerResult;
@@ -289,14 +289,14 @@ class IncrementalCompilerWrapper extends Compiler {
289289
IncrementalCompiler generator;
290290

291291
IncrementalCompilerWrapper(
292-
int isolateId, FileSystem fileSystem, Uri platformKernelPath,
292+
int isolateGroupId, FileSystem fileSystem, Uri platformKernelPath,
293293
{bool enableAsserts: false,
294294
int nullSafety: kNullSafetyOptionUnspecified,
295295
List<String> experimentalFlags: null,
296296
String packageConfig: null,
297297
String invocationModes: '',
298298
String verbosityLevel: Verbosity.defaultValue})
299-
: super(isolateId, fileSystem, platformKernelPath,
299+
: super(isolateGroupId, fileSystem, platformKernelPath,
300300
enableAsserts: enableAsserts,
301301
nullSafety: nullSafety,
302302
experimentalFlags: experimentalFlags,
@@ -308,15 +308,15 @@ class IncrementalCompilerWrapper extends Compiler {
308308

309309
factory IncrementalCompilerWrapper.forExpressionCompilationOnly(
310310
Component component,
311-
int isolateId,
311+
int isolateGroupId,
312312
FileSystem fileSystem,
313313
Uri platformKernelPath,
314314
{bool enableAsserts: false,
315315
List<String> experimentalFlags: null,
316316
String packageConfig: null,
317317
String invocationModes: ''}) {
318318
IncrementalCompilerWrapper result = IncrementalCompilerWrapper(
319-
isolateId, fileSystem, platformKernelPath,
319+
isolateGroupId, fileSystem, platformKernelPath,
320320
enableAsserts: enableAsserts,
321321
experimentalFlags: experimentalFlags,
322322
packageConfig: packageConfig,
@@ -342,9 +342,9 @@ class IncrementalCompilerWrapper extends Compiler {
342342
void accept() => generator.accept();
343343
void invalidate(Uri uri) => generator.invalidate(uri);
344344

345-
Future<IncrementalCompilerWrapper> clone(int isolateId) async {
345+
Future<IncrementalCompilerWrapper> clone(int isolateGroupId) async {
346346
IncrementalCompilerWrapper clone = IncrementalCompilerWrapper(
347-
isolateId, fileSystem, platformKernelPath,
347+
isolateGroupId, fileSystem, platformKernelPath,
348348
enableAsserts: enableAsserts,
349349
nullSafety: nullSafety,
350350
experimentalFlags: experimentalFlags,
@@ -359,7 +359,7 @@ class IncrementalCompilerWrapper extends Compiler {
359359
// clone should be used for.
360360
MemoryFileSystem memoryFileSystem = (fileSystem as HybridFileSystem).memory;
361361

362-
String filename = 'full-component-$isolateId.dill';
362+
String filename = 'full-component-$isolateGroupId.dill';
363363
Sink sink = FileSink(memoryFileSystem.entityForUri(Uri.file(filename)));
364364
new BinaryPrinter(sink).writeComponentFile(fullComponent);
365365
await sink.close();
@@ -374,15 +374,15 @@ class SingleShotCompilerWrapper extends Compiler {
374374
final bool requireMain;
375375

376376
SingleShotCompilerWrapper(
377-
int isolateId, FileSystem fileSystem, Uri platformKernelPath,
377+
int isolateGroupId, FileSystem fileSystem, Uri platformKernelPath,
378378
{this.requireMain: false,
379379
bool enableAsserts: false,
380380
int nullSafety: kNullSafetyOptionUnspecified,
381381
List<String> experimentalFlags: null,
382382
String packageConfig: null,
383383
String invocationModes: '',
384384
String verbosityLevel: Verbosity.defaultValue})
385-
: super(isolateId, fileSystem, platformKernelPath,
385+
: super(isolateGroupId, fileSystem, platformKernelPath,
386386
enableAsserts: enableAsserts,
387387
nullSafety: nullSafety,
388388
experimentalFlags: experimentalFlags,
@@ -405,18 +405,15 @@ class SingleShotCompilerWrapper extends Compiler {
405405
}
406406
}
407407

408-
// TODO(33428): This state is leaked on isolate shutdown.
409-
final Map<int, IncrementalCompilerWrapper> isolateCompilers =
410-
new Map<int, IncrementalCompilerWrapper>();
411-
final Map<int, List<Uri>> isolateDependencies = new Map<int, List<Uri>>();
412-
final Map<int, _ExpressionCompilationFromDillSettings> isolateLoadNotifies =
413-
new Map<int, _ExpressionCompilationFromDillSettings>();
408+
final Map<int, IncrementalCompilerWrapper> isolateCompilers = {};
409+
final Map<int, List<Uri>> isolateDependencies = {};
410+
final Map<int, _ExpressionCompilationFromDillSettings> isolateLoadNotifies = {};
414411

415-
IncrementalCompilerWrapper lookupIncrementalCompiler(int isolateId) {
416-
return isolateCompilers[isolateId];
412+
IncrementalCompilerWrapper lookupIncrementalCompiler(int isolateGroupId) {
413+
return isolateCompilers[isolateGroupId];
417414
}
418415

419-
Future<Compiler> lookupOrBuildNewIncrementalCompiler(int isolateId,
416+
Future<Compiler> lookupOrBuildNewIncrementalCompiler(int isolateGroupId,
420417
List sourceFiles, Uri platformKernelPath, List<int> platformKernel,
421418
{bool enableAsserts: false,
422419
int nullSafety: kNullSafetyOptionUnspecified,
@@ -426,7 +423,8 @@ Future<Compiler> lookupOrBuildNewIncrementalCompiler(int isolateId,
426423
String multirootScheme,
427424
String invocationModes: '',
428425
String verbosityLevel: Verbosity.defaultValue}) async {
429-
IncrementalCompilerWrapper compiler = lookupIncrementalCompiler(isolateId);
426+
IncrementalCompilerWrapper compiler =
427+
lookupIncrementalCompiler(isolateGroupId);
430428
if (compiler != null) {
431429
updateSources(compiler, sourceFiles);
432430
invalidateSources(compiler, sourceFiles);
@@ -439,7 +437,7 @@ Future<Compiler> lookupOrBuildNewIncrementalCompiler(int isolateId,
439437
sourceFiles[1] == null) {
440438
// Just use first compiler that should represent main isolate as a source for cloning.
441439
var source = isolateCompilers.entries.first;
442-
compiler = await source.value.clone(isolateId);
440+
compiler = await source.value.clone(isolateGroupId);
443441
} else {
444442
FileSystem fileSystem = _buildFileSystem(
445443
sourceFiles, platformKernel, multirootFilepaths, multirootScheme);
@@ -449,15 +447,15 @@ Future<Compiler> lookupOrBuildNewIncrementalCompiler(int isolateId,
449447
// isolate needs to receive a message indicating that particular
450448
// isolate was shut down. Message should be handled here in this script.
451449
compiler = new IncrementalCompilerWrapper(
452-
isolateId, fileSystem, platformKernelPath,
450+
isolateGroupId, fileSystem, platformKernelPath,
453451
enableAsserts: enableAsserts,
454452
nullSafety: nullSafety,
455453
experimentalFlags: experimentalFlags,
456454
packageConfig: packageConfig,
457455
invocationModes: invocationModes,
458456
verbosityLevel: verbosityLevel);
459457
}
460-
isolateCompilers[isolateId] = compiler;
458+
isolateCompilers[isolateGroupId] = compiler;
461459
}
462460
return compiler;
463461
}
@@ -494,7 +492,7 @@ void invalidateSources(IncrementalCompilerWrapper compiler, List sourceFiles) {
494492
// kernel_isolate.cc and Loader::SendKernelRequest in loader.cc.
495493
Future _processExpressionCompilationRequest(request) async {
496494
final SendPort port = request[1];
497-
final int isolateId = request[2];
495+
final int isolateGroupId = request[2];
498496
final dynamic dart_platform_kernel = request[3];
499497
final String expression = request[4];
500498
final List<String> definitions = request[5].cast<String>();
@@ -508,15 +506,15 @@ Future _processExpressionCompilationRequest(request) async {
508506
final List<String> experimentalFlags =
509507
request[13] != null ? request[13].cast<String>() : null;
510508

511-
IncrementalCompilerWrapper compiler = isolateCompilers[isolateId];
509+
IncrementalCompilerWrapper compiler = isolateCompilers[isolateGroupId];
512510

513511
_ExpressionCompilationFromDillSettings isolateLoadDillData =
514-
isolateLoadNotifies[isolateId];
512+
isolateLoadNotifies[isolateGroupId];
515513
if (isolateLoadDillData != null) {
516514
// Check if we can reuse the compiler.
517515
if (isolateLoadDillData.blobLoadCount != blobLoadCount ||
518516
isolateLoadDillData.prevDillCount != dillData.length) {
519-
compiler = isolateCompilers[isolateId] = null;
517+
compiler = isolateCompilers[isolateGroupId] = null;
520518
}
521519
}
522520

@@ -525,7 +523,7 @@ Future _processExpressionCompilationRequest(request) async {
525523
if (verbose) {
526524
print("DFE: Initializing compiler from ${dillData.length} dill files");
527525
}
528-
isolateLoadNotifies[isolateId] =
526+
isolateLoadNotifies[isolateGroupId] =
529527
new _ExpressionCompilationFromDillSettings(
530528
blobLoadCount, dillData.length);
531529

@@ -585,11 +583,11 @@ Future _processExpressionCompilationRequest(request) async {
585583
// isolate was shut down. Message should be handled here in this script.
586584
try {
587585
compiler = new IncrementalCompilerWrapper.forExpressionCompilationOnly(
588-
component, isolateId, fileSystem, null,
586+
component, isolateGroupId, fileSystem, null,
589587
enableAsserts: enableAsserts,
590588
experimentalFlags: experimentalFlags,
591589
packageConfig: dotPackagesFile);
592-
isolateCompilers[isolateId] = compiler;
590+
isolateCompilers[isolateGroupId] = compiler;
593591
await compiler.compile(
594592
component.mainMethod?.enclosingLibrary?.importUri ??
595593
component.libraries.last.importUri);
@@ -640,8 +638,8 @@ Future _processExpressionCompilationRequest(request) async {
640638
}
641639

642640
void _recordDependencies(
643-
int isolateId, Component component, Uri packageConfig) {
644-
final dependencies = isolateDependencies[isolateId] ??= <Uri>[];
641+
int isolateGroupId, Component component, Uri packageConfig) {
642+
final dependencies = isolateDependencies[isolateGroupId] ??= <Uri>[];
645643

646644
if (component != null) {
647645
for (var lib in component.libraries) {
@@ -673,8 +671,9 @@ List<int> _serializeDependencies(List<Uri> uris) {
673671
return utf8.encode(uris.map(_escapeDependency).join(" "));
674672
}
675673

676-
Future _processListDependenciesRequest(SendPort port, int isolateId) async {
677-
final List<Uri> dependencies = isolateDependencies[isolateId] ?? <Uri>[];
674+
Future _processListDependenciesRequest(
675+
SendPort port, int isolateGroupId) async {
676+
final List<Uri> dependencies = isolateDependencies[isolateGroupId] ?? <Uri>[];
678677

679678
CompilationResult result;
680679
try {
@@ -687,10 +686,10 @@ Future _processListDependenciesRequest(SendPort port, int isolateId) async {
687686
}
688687

689688
Future _processIsolateShutdownNotification(request) async {
690-
final int isolateId = request[1];
691-
isolateCompilers.remove(isolateId);
692-
isolateDependencies.remove(isolateId);
693-
isolateLoadNotifies.remove(isolateId);
689+
final int isolateGroupId = request[1];
690+
isolateCompilers.remove(isolateGroupId);
691+
isolateDependencies.remove(isolateGroupId);
692+
isolateLoadNotifies.remove(isolateGroupId);
694693
}
695694

696695
Future _processLoadRequest(request) async {
@@ -733,10 +732,10 @@ Future _processLoadRequest(request) async {
733732
}
734733

735734
final SendPort port = request[1];
736-
final int isolateId = request[7];
735+
final int isolateGroupId = request[7];
737736

738737
if (tag == kListDependenciesTag) {
739-
await _processListDependenciesRequest(port, isolateId);
738+
await _processListDependenciesRequest(port, isolateGroupId);
740739
return;
741740
}
742741

@@ -777,7 +776,7 @@ Future _processLoadRequest(request) async {
777776
if (tag == kUpdateSourcesTag) {
778777
assert(incremental,
779778
"Incremental compiler required for use of 'kUpdateSourcesTag'");
780-
compiler = lookupIncrementalCompiler(isolateId);
779+
compiler = lookupIncrementalCompiler(isolateGroupId);
781780
if (compiler == null) {
782781
port.send(new CompilationResult.errors(
783782
["No incremental compiler available for this isolate."], null)
@@ -790,7 +789,7 @@ Future _processLoadRequest(request) async {
790789
} else if (tag == kAcceptTag) {
791790
assert(
792791
incremental, "Incremental compiler required for use of 'kAcceptTag'");
793-
compiler = lookupIncrementalCompiler(isolateId);
792+
compiler = lookupIncrementalCompiler(isolateGroupId);
794793
// There are unit tests that invoke the IncrementalCompiler directly and
795794
// request a reload, meaning that we won't have a compiler for this isolate.
796795
if (compiler != null) {
@@ -841,7 +840,7 @@ Future _processLoadRequest(request) async {
841840
// watch the performance though.
842841
if (incremental) {
843842
compiler = await lookupOrBuildNewIncrementalCompiler(
844-
isolateId, sourceFiles, platformKernelPath, platformKernel,
843+
isolateGroupId, sourceFiles, platformKernelPath, platformKernel,
845844
enableAsserts: enableAsserts,
846845
nullSafety: nullSafety,
847846
experimentalFlags: experimentalFlags,
@@ -854,7 +853,7 @@ Future _processLoadRequest(request) async {
854853
FileSystem fileSystem = _buildFileSystem(
855854
sourceFiles, platformKernel, multirootFilepaths, multirootScheme);
856855
compiler = new SingleShotCompilerWrapper(
857-
isolateId, fileSystem, platformKernelPath,
856+
isolateGroupId, fileSystem, platformKernelPath,
858857
requireMain: false,
859858
enableAsserts: enableAsserts,
860859
nullSafety: nullSafety,
@@ -1007,7 +1006,7 @@ Future trainInternal(String scriptUri, String platformKernelPath) async {
10071006
false /* incremental */,
10081007
false /* snapshot */,
10091008
kNullSafetyOptionUnspecified /* null safety */,
1010-
1 /* isolateId chosen randomly */,
1009+
1 /* isolateGroupId chosen randomly */,
10111010
[] /* source files */,
10121011
false /* enable asserts */,
10131012
null /* experimental_flags */,

runtime/lib/isolate.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -886,10 +886,10 @@ static const char* CanonicalizeUri(Thread* thread,
886886
char** error) {
887887
const char* result = NULL;
888888
Zone* zone = thread->zone();
889-
Isolate* isolate = thread->isolate();
890-
if (isolate->HasTagHandler()) {
889+
auto isolate_group = thread->isolate_group();
890+
if (isolate_group->HasTagHandler()) {
891891
const Object& obj = Object::Handle(
892-
isolate->CallTagHandler(Dart_kCanonicalizeUrl, library, uri));
892+
isolate_group->CallTagHandler(Dart_kCanonicalizeUrl, library, uri));
893893
if (obj.IsString()) {
894894
result = String2UTF8(String::Cast(obj));
895895
} else if (obj.IsError()) {

runtime/lib/mirrors.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static void ThrowLanguageError(const char* message) {
662662
DEFINE_NATIVE_ENTRY(IsolateMirror_loadUri, 0, 1) {
663663
GET_NON_NULL_NATIVE_ARGUMENT(String, uri, arguments->NativeArgAt(0));
664664

665-
if (!isolate->HasTagHandler()) {
665+
if (!isolate->group()->HasTagHandler()) {
666666
ThrowLanguageError("no library handler registered");
667667
}
668668

@@ -675,7 +675,7 @@ DEFINE_NATIVE_ENTRY(IsolateMirror_loadUri, 0, 1) {
675675
} else {
676676
isolate->BlockClassFinalization();
677677
const Object& result = Object::Handle(
678-
zone, isolate->CallTagHandler(
678+
zone, isolate->group()->CallTagHandler(
679679
Dart_kCanonicalizeUrl,
680680
Library::Handle(
681681
zone, isolate->group()->object_store()->root_library()),
@@ -703,7 +703,7 @@ DEFINE_NATIVE_ENTRY(IsolateMirror_loadUri, 0, 1) {
703703
// Request the embedder to load the library.
704704
isolate->BlockClassFinalization();
705705
Object& result = Object::Handle(
706-
zone, isolate->CallTagHandler(
706+
zone, isolate->group()->CallTagHandler(
707707
Dart_kImportTag,
708708
Library::Handle(
709709
zone, isolate->group()->object_store()->root_library()),

runtime/vm/BUILD.gn

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ library_for_all_configs("libdart_vm") {
7474
if (is_fuchsia) {
7575
if (using_fuchsia_gn_sdk) {
7676
extra_deps = [
77-
"$fuchsia_sdk_root/fidl/fuchsia.deprecatedtimezone",
77+
"$fuchsia_sdk_root/fidl/fuchsia.intl",
7878
"$fuchsia_sdk_root/pkg/async",
7979
"$fuchsia_sdk_root/pkg/async-default",
8080
"$fuchsia_sdk_root/pkg/async-loop",
@@ -87,7 +87,7 @@ library_for_all_configs("libdart_vm") {
8787
]
8888
} else if (using_fuchsia_sdk) {
8989
extra_deps = [
90-
"$fuchsia_sdk_root/fidl:fuchsia.deprecatedtimezone",
90+
"$fuchsia_sdk_root/fidl:fuchsia.intl",
9191
"$fuchsia_sdk_root/pkg:async-loop",
9292
"$fuchsia_sdk_root/pkg:async-loop-default",
9393
"$fuchsia_sdk_root/pkg:inspect",
@@ -98,9 +98,7 @@ library_for_all_configs("libdart_vm") {
9898
]
9999
} else {
100100
extra_deps = [
101-
# TODO(US-399): Remove time_service specific code when it is no longer
102-
# necessary.
103-
"//sdk/fidl/fuchsia.deprecatedtimezone",
101+
"//sdk/fidl/fuchsia.intl",
104102
"//sdk/lib/sys/cpp",
105103
"//sdk/lib/sys/inspect/cpp",
106104
"//zircon/public/lib/fbl",

0 commit comments

Comments
 (0)