Make tools/build.py -cprecompiler -rdart_precompiled green:

- Create a separate compilation output directory for each VMOptions varient so they can run in parallel.
- Run both the snapshotter and assembler from the test harness instead of a wrapper script so crashes in the snapshotter are correctly identified by the test harness.
- Delete the assembly source for the precompiled shared library as we go to limit space required to run the test suite (now 61GB for X64 release).
- Remove the VMOption --optimization-counter-threshold in when running precompilation tests.
- Don't look at a library prefix's import list during load(), it was removed by tree-shaking.
- Trace types of TypeParameters.
- Trace types of a Function's owner and parent.
- Update status file for remaining 4 failures under http://dartbug.com/25892.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1732323005 .
This commit is contained in:
Ryan Macnak 2016-03-01 15:19:11 -08:00
parent 3deae0d887
commit 3fd5ffdbd4
11 changed files with 150 additions and 109 deletions

View file

@ -10393,6 +10393,11 @@ bool LibraryPrefix::LoadLibrary() const {
}
ASSERT(is_deferred_load());
ASSERT(num_imports() == 1);
if (Dart::IsRunningPrecompiledCode()) {
// The library list was tree-shaken away.
this->set_is_loaded();
return true;
}
// This is a prefix for a deferred library. If the library is not loaded
// yet and isn't being loaded, call the library tag handler to schedule
// loading. Once all outstanding load requests have completed, the embedder

View file

@ -590,6 +590,15 @@ void Precompiler::AddTypesOf(const Function& function) {
}
}
}
// A function can always be inlined and have only a nested local function
// remain.
const Function& parent = Function::Handle(Z, function.parent_function());
if (!parent.IsNull()) {
AddTypesOf(parent);
}
// A class may have all functions inlined except a local function.
const Class& owner = Class::Handle(Z, function.Owner());
AddTypesOf(owner);
}
@ -623,6 +632,13 @@ void Precompiler::AddType(const AbstractType& abstype) {
AbstractType& type = AbstractType::Handle(Z);
type = TypeRef::Cast(abstype).type();
AddType(type);
} else if (abstype.IsTypeParameter()) {
const AbstractType& type =
AbstractType::Handle(Z, TypeParameter::Cast(abstype).bound());
AddType(type);
const Class& cls =
Class::Handle(Z, TypeParameter::Cast(abstype).parameterized_class());
AddTypesOf(cls);
}
}

View file

@ -143,7 +143,8 @@ Language/Errors_and_Warnings/static_warning_t04: RuntimeError # Please triage th
Language/Errors_and_Warnings/static_warning_t05: RuntimeError # Please triage this failure
Language/Errors_and_Warnings/static_warning_t06: RuntimeError # Please triage this failure
[ ($noopt || $compiler == precompiler) ]
[ $noopt || $compiler == precompiler ]
Language/Metadata/*: SkipByDesign # Uses dart:mirrors
LibTest/collection/ListBase/ListBase_class_A01_t02: Pass, Timeout
LibTest/collection/ListMixin/ListMixin_class_A01_t02: Pass, Timeout
LibTest/core/Map/Map_class_A01_t04: Pass, Timeout
@ -152,10 +153,11 @@ Language/Mixins/Mixin_Application/error_t01: Pass
Language/Mixins/Mixin_Application/error_t02: Pass
Language/Mixins/declaring_constructor_t01: Pass
Language/Expressions/Property_Extraction/Named_Constructor_Extraction/deferred_type_t01: Pass
Language/Metadata/*: Skip # Uses dart:mirrors
[ $runtime == dart_precompiled ]
LibTest/isolate/Isolate/spawnUri*: RuntimeError # Isolate.spawnUri
Language/Expressions/Constants/identifier_denotes_a_constant_t05: Crash # Issue 25892
Language/Expressions/Constants/static_method_t01: Crash # Issue 25892
[ $runtime == dart_product ]
LibTest/isolate/Isolate/spawnUri*: Skip # Isolate.spawnUri

View file

@ -154,19 +154,19 @@ duration2_test: StaticWarning, OK # Test generates error on purpose.
[ $system == windows && $arch == x64 ]
stopwatch_test: Skip # Flaky test due to expected performance behaviour.
[ $runtime != d8 && $runtime != vm ]
[ $runtime != d8 && $runtime != vm && $runtime != dart_precompiled ]
# The regexp tests are not verified to work on non d8/vm platforms yet.
regexp/*: Skip
[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
regexp/global_test: Skip # Timeout. Issue 21709 and 21708
[ $runtime != vm && $compiler != dart2analyzer]
[ $runtime != vm && $runtime != dart_precompiled && $compiler != dart2analyzer]
data_resource_test: RuntimeError # Issue 23825 (not implemented yet).
file_resource_test: Skip, OK # VM specific test, uses dart:io.
http_resource_test: Skip, OK # VM specific test, uses dart:io.
[ $runtime != vm && $compiler != dart2analyzer && $cps_ir == false ]
[ $runtime != vm && $runtime != dart_precompiled && $compiler != dart2analyzer && $cps_ir == false ]
package_resource_test: RuntimeError # Issue 23825 (not implemented yet).
[ $mode == debug ]
@ -189,7 +189,7 @@ regexp/pcre_test: Crash # Stack Overflow
stacktrace_current_test: Pass, RuntimeError
error_stack_trace1_test: Pass, RuntimeError
[ ($noopt || $compiler == precompiler) ]
[ $noopt || $compiler == precompiler ]
apply3_test: CompileTimeError # Imports dart:mirrors
regexp/stack-overflow_test: RuntimeError, OK # Smaller limit with irregex interpreter
big_integer_huge_mul_vm_test: Pass, Timeout # --no_intrinsify

View file

@ -139,29 +139,7 @@ package_resolve_test: SkipByDesign # Uses Isolate.resolvePackageUri
spawn_uri_fail_test: SkipByDesign # Uses dart:io.
scenarios/*: SkipByDesign # Use automatic package resolution, spawnFunction and .dart URIs.
[ ($noopt || $compiler == precompiler) ]
# Imports dart:mirrors
count_test: CompileTimeError
cross_isolate_message_test: CompileTimeError
illegal_msg_function_test: CompileTimeError
illegal_msg_mirror_test: CompileTimeError
isolate_complex_messages_test: CompileTimeError
mandel_isolate_test: CompileTimeError
message2_test: CompileTimeError
message_test: CompileTimeError
mint_maker_test: CompileTimeError
nested_spawn2_test: CompileTimeError
nested_spawn_test: CompileTimeError
raw_port_test: CompileTimeError
request_reply_test: CompileTimeError
spawn_function_custom_class_test: CompileTimeError
spawn_function_test: CompileTimeError
stacktrace_message_test: CompileTimeError
stacktrace_message_test: CompileTimeError
static_function_test: CompileTimeError
unresolved_ports_test: CompileTimeError
[ $runtime == dart_product ]
[ $noopt || $compiler == precompiler || $runtime == dart_product ]
# Imports dart:mirrors
count_test: SkipByDesign
cross_isolate_message_test: SkipByDesign
@ -183,6 +161,10 @@ stacktrace_message_test: SkipByDesign
static_function_test: SkipByDesign
unresolved_ports_test: SkipByDesign
[ $compiler == precompiler ]
function_send_test: RuntimeError # Issue 25892
message3_test/fun: RuntimeError # Issue 25892
[ $runtime == dart_precompiled || $runtime == dart_product ]
deferred_in_isolate_test: Skip # Isolate.spawnUri
deferred_in_isolate2_test: Skip # Isolate.spawnUri

View file

@ -233,7 +233,7 @@ async/timer_not_available_test: Fail, OK
mirrors/native_class_test: Fail, OK # This test is meant to run in a browser.
mirrors/deferred_type_test: CompileTimeError, OK # Don't have a multitest marker for dynamic compile time errors.
[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) ]
[ $compiler == none || $compiler == precompiler || $compiler == dart2app ]
async/timer_not_available_test: SkipByDesign # only meant to test when there is no way to implement timer (currently only in d8)
mirrors/symbol_validation_test: RuntimeError # Issue 13596
@ -348,7 +348,7 @@ async/dart2js_uncaught_error_test: Skip # JS-integration only test
[ $noopt && $arch == simarm64 ]
async/slow_consumer2_test: Pass, RuntimeError # Issue 25726
[ ($noopt || $compiler == precompiler) ]
[ $noopt || $compiler == precompiler ]
mirrors/*: SkipByDesign
convert/chunked_conversion_utf88_test: Pass, Timeout
convert/utf85_test: Pass, Timeout

View file

@ -22,5 +22,5 @@ dart2js_test: SkipByDesign # Uses dart:io.
[ $compiler == dart2js && $mode == debug ]
dummy_compiler_test: Slow, Pass
[ ($noopt || $compiler == precompiler || $compiler == dart2app) ]
[ $noopt || $compiler == precompiler || $compiler == dart2app ]
source_mirrors_test: SkipByDesign # Imports dart:mirrors

View file

@ -1,64 +0,0 @@
// Copyright (c) 2015, 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.
library precompiler;
import 'dart:io';
void run(String executable, String arguments, [String workingDirectory]) {
print("+ $executable ${arguments.join(' ')}");
var result = Process.runSync(executable, arguments,
workingDirectory: workingDirectory);
stdout.write(result.stdout);
stderr.write(result.stderr);
if (result.exitCode != 0) {
exit(result.exitCode);
}
}
void main(List<String> args) {
var configuration = Platform.environment["DART_CONFIGURATION"];
var cc, cc_flags, shared, libname;
if (Platform.isLinux) {
cc = 'gcc';
shared = '-shared';
libname = 'libprecompiled.so';
} else if (Platform.isMacOS) {
cc = 'clang';
shared = '-dynamiclib';
libname = 'libprecompiled.dylib';
} else {
print("Test only supports Linux and Mac");
return;
}
if (configuration.endsWith("X64")) {
cc_flags = "-m64";
} else if (configuration.endsWith("SIMARM64")) {
cc_flags = "-m64";
} else if (configuration.endsWith("SIMARM")) {
cc_flags = "-m32";
} else if (configuration.endsWith("SIMMIPS")) {
cc_flags = "-m32";
} else if (configuration.endsWith("ARM")) {
cc_flags = "";
} else if (configuration.endsWith("MIPS")) {
cc_flags = "-EL";
} else {
print("Architecture not supported: $configuration");
return;
}
var tmpDir;
for (var arg in args) {
if (arg.startsWith("--gen-precompiled-snapshot")) {
tmpDir = arg.substring("--gen-precompiled-snapshot".length + 1);
}
}
print("Using directory $tmpDir");
run(args[0], args.sublist(1));
run(cc, [shared, cc_flags, "-o", libname, "precompiled.S"], tmpDir);
}

View file

@ -78,7 +78,8 @@ abstract class CompilerConfiguration {
isDebug: isDebug, isChecked: isChecked);
case 'precompiler':
return new PrecompilerCompilerConfiguration(
isDebug: isDebug, isChecked: isChecked);
isDebug: isDebug, isChecked: isChecked,
arch: configuration['arch']);
case 'none':
return new NoneCompilerConfiguration(
isDebug: isDebug, isChecked: isChecked,
@ -302,10 +303,13 @@ class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration {
class PrecompilerCompilerConfiguration extends CompilerConfiguration {
final String arch;
PrecompilerCompilerConfiguration({
bool isDebug,
bool isChecked})
: super._subclass(isDebug: isDebug, isChecked: isChecked);
bool isChecked,
String arch})
: super._subclass(isDebug: isDebug, isChecked: isChecked), arch = arch;
int computeTimeoutMultiplier() {
int multiplier = 2;
@ -323,6 +327,18 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
return new CommandArtifact(
<Command>[
this.computeCompilationCommand(
tempDir,
buildDir,
CommandBuilder.instance,
arguments,
environmentOverrides),
this.computeAssembleCommand(
tempDir,
buildDir,
CommandBuilder.instance,
arguments,
environmentOverrides),
this.computeRemoveAssemblyCommand(
tempDir,
buildDir,
CommandBuilder.instance,
@ -338,19 +354,91 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
CommandBuilder commandBuilder,
List arguments,
Map<String, String> environmentOverrides) {
var exec = "$buildDir/dart";
var exec = "$buildDir/dart_no_snapshot";
var args = new List();
args.add("tools/precompilation/precompiler.dart");
args.add("$buildDir/dart_no_snapshot");
args.add("--gen-precompiled-snapshot=$tempDir");
args.addAll(arguments);
return commandBuilder.getCompilationCommand(
'precompiler.dart', tempDir, !useSdk,
'precompiler', tempDir, !useSdk,
bootstrapDependencies(buildDir),
exec, args, environmentOverrides);
}
CompilationCommand computeAssembleCommand(
String tempDir,
String buildDir,
CommandBuilder commandBuilder,
List arguments,
Map<String, String> environmentOverrides) {
var cc, cc_flags, shared, libname;
if (Platform.isLinux) {
cc = 'gcc';
shared = '-shared';
libname = 'libprecompiled.so';
} else if (Platform.isMacOS) {
cc = 'clang';
shared = '-dynamiclib';
libname = 'libprecompiled.dylib';
} else {
throw "Platform not supported: ${Platform.name}";
}
if (arch == 'x64') {
cc_flags = "-m64";
} else if (arch == 'simarm64') {
cc_flags = "-m64";
} else if (arch == 'simarm') {
cc_flags = "-m32";
} else if (arch == 'simmips') {
cc_flags = "-m32";
} else if (arch == 'arm') {
cc_flags = "";
} else if (arch == 'mips') {
cc_flags = "-EL";
} else {
throw "Architecture not supported: $arch";
}
var exec = cc;
var args = [shared,
cc_flags,
'-o',
'$tempDir/$libname',
'$tempDir/precompiled.S'];
return commandBuilder.getCompilationCommand(
'assemble', tempDir, !useSdk,
bootstrapDependencies(buildDir),
exec, args, environmentOverrides);
}
// This step reduces the amount of space needed to run the precompilation
// tests by 60%.
CompilationCommand computeRemoveAssemblyCommand(
String tempDir,
String buildDir,
CommandBuilder commandBuilder,
List arguments,
Map<String, String> environmentOverrides) {
var exec = 'rm';
var args = ['$tempDir/precompiled.S'];
return commandBuilder.getCompilationCommand(
'remove_assembly', tempDir, !useSdk,
bootstrapDependencies(buildDir),
exec, args, environmentOverrides);
}
List<String> filterVmOptions(List<String> vmOptions) {
var filtered = new List.from(vmOptions);
filtered.removeWhere(
(option) => option.startsWith("--optimization-counter-threshold"));
filtered.removeWhere(
(option) => option.startsWith("--optimization_counter_threshold"));
return filtered;
}
List<String> computeCompilerArguments(vmOptions,
sharedOptions,
originalArguments) {
@ -360,7 +448,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
args.add('--enable_type_checks');
}
return args
..addAll(vmOptions)
..addAll(filterVmOptions(vmOptions))
..addAll(sharedOptions)
..addAll(originalArguments);
}

View file

@ -1679,7 +1679,7 @@ CommandOutput createCommandOutput(Command command,
return new VmCommandOutputImpl(
command, exitCode, timedOut, stdout, stderr, time, pid);
} else if (command is CompilationCommand) {
if (command.displayName == 'precompiler.dart' ||
if (command.displayName == 'precompiler' ||
command.displayName == 'dart2snapshot') {
return new VmCommandOutputImpl(
command, exitCode, timedOut, stdout, stderr, time, pid);

View file

@ -1018,14 +1018,18 @@ class StandardTestSuite extends TestSuite {
List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile);
assert(!vmOptionsList.isEmpty);
for (var vmOptions in vmOptionsList) {
for (var vmOptionsVarient = 0;
vmOptionsVarient < vmOptionsList.length;
vmOptionsVarient++) {
var vmOptions = vmOptionsList[vmOptionsVarient];
var allVmOptions = vmOptions;
if (!extraVmOptions.isEmpty) {
allVmOptions = new List.from(vmOptions)..addAll(extraVmOptions);
}
var commands = []..addAll(baseCommands);
commands.addAll(makeCommands(info, allVmOptions, commonArguments));
commands.addAll(makeCommands(info, vmOptionsVarient,
allVmOptions, commonArguments));
enqueueNewTestCase(
new TestCase('$suiteName/$testName',
commands,
@ -1050,7 +1054,10 @@ class StandardTestSuite extends TestSuite {
return negative;
}
List<Command> makeCommands(TestInformation info, var vmOptions, var args) {
List<Command> makeCommands(TestInformation info,
int vmOptionsVarient,
var vmOptions,
var args) {
List<Command> commands = <Command>[];
CompilerConfiguration compilerConfiguration =
new CompilerConfiguration(configuration);
@ -1064,7 +1071,12 @@ class StandardTestSuite extends TestSuite {
sharedOptions,
args);
// Avoid doing this for analyzer.
tempDir = createCompilationOutputDirectory(info.filePath);
var path = info.filePath;
if (vmOptionsVarient != 0) {
// Ensure a unique directory for each test case.
path = path.join(new Path(vmOptionsVarient.toString()));
}
tempDir = createCompilationOutputDirectory(path);
}
CommandArtifact compilationArtifact =