7d14785115
Original PR was reverted because it broke hot-reload bots. This CL adds steps to initialize kernel_service compiler for child isolate. Compiler is needed to support hot-reload request. Child isolate's compiler is created from full kernel file produced by main isolate's compiler. Changes since original PR are pkg/vm/bin/kernel_service.dart in pkg/vm/lib/incremental_compiler.dart.
Further this CL changes kernel fingerprint calculation for interface types so it calculates the hash of the canonical names themselves, rather than indices(that might change from one compilation to another).
This reverts commit 63fd8f63e6.
Change-Id: I6fe5b2ef99f209b32cd4087dfd1c8cac229c2d8b
Reviewed-on: https://dart-review.googlesource.com/c/87265
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
75 lines
1.8 KiB
Dart
75 lines
1.8 KiB
Dart
// Copyright (c) 2018, 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.
|
|
|
|
// Testing that Isolate.spawn copies the source code of the parent isolate,
|
|
// rather than rereading the parent's source URI.
|
|
// https://github.com/dart-lang/sdk/issues/6610
|
|
|
|
// Isolate structure:
|
|
// Root 1 -> Branch 1 -> Leaf 1
|
|
// /
|
|
// main
|
|
// \
|
|
// Root 2 -> Branch 2 -> Leaf 2
|
|
|
|
library spawn_tests;
|
|
|
|
import "dart:io";
|
|
import 'dart:isolate';
|
|
import 'package:expect/expect.dart';
|
|
|
|
void main() {
|
|
HttpServer.bind("127.0.0.1", 0).then((server) {
|
|
var count = 0;
|
|
server.listen((HttpRequest request) {
|
|
++count;
|
|
request.response.write("""
|
|
import 'dart:isolate';
|
|
|
|
void main(_, SendPort port) {
|
|
root(port);
|
|
}
|
|
|
|
void root(SendPort port) {
|
|
port.send("Root ${count}");
|
|
Isolate.spawn(branch, port);
|
|
}
|
|
|
|
void branch(SendPort port) {
|
|
port.send("Branch ${count}");
|
|
Isolate.spawn(leaf, port);
|
|
}
|
|
|
|
void leaf(SendPort port) {
|
|
port.send("Leaf ${count}");
|
|
}
|
|
""");
|
|
request.response.close();
|
|
});
|
|
|
|
ReceivePort port = new ReceivePort();
|
|
var messageSet = Set();
|
|
port.listen((message) {
|
|
messageSet.add(message);
|
|
if (messageSet.length >= 6) {
|
|
server.close();
|
|
port.close();
|
|
Expect.setEquals([
|
|
"Root 1",
|
|
"Root 2",
|
|
"Branch 1",
|
|
"Branch 2",
|
|
"Leaf 1",
|
|
"Leaf 2",
|
|
], messageSet);
|
|
}
|
|
});
|
|
|
|
Isolate.spawnUri(
|
|
Uri.parse("http://127.0.0.1:${server.port}"), [], port.sendPort);
|
|
Isolate.spawnUri(
|
|
Uri.parse("http://127.0.0.1:${server.port}"), [], port.sendPort);
|
|
});
|
|
}
|