Files
sdk/pkg/vm/bin/dump_kernel.dart
T
Alexander Markov e3de763163 [vm/kernel] Use types inferred by type flow analysis for results of calls
* Type flow analysis writes inferred types (which include
  non-nullability and concrete classes) for the results of calls.

* VM uses new metadata to compute CompileTypes.

Issue: https://github.com/dart-lang/sdk/issues/30480

Change-Id: Ib0b7446af071f9cca5d8f1edd2d1d5f83b5714ba
Reviewed-on: https://dart-review.googlesource.com/33140
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-01-18 21:19:14 +00:00

40 lines
1.2 KiB
Dart

// Copyright (c) 2017, 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:kernel/kernel.dart' show Program, writeProgramToText;
import 'package:kernel/binary/ast_from_binary.dart'
show BinaryBuilderWithMetadata;
import 'package:vm/metadata/direct_call.dart' show DirectCallMetadataRepository;
import 'package:vm/metadata/inferred_type.dart'
show InferredTypeMetadataRepository;
final String _usage = '''
Usage: dump_kernel input.dill output.txt
Dumps kernel binary file with VM-specific metadata.
''';
main(List<String> arguments) async {
if (arguments.length != 2) {
print(_usage);
exit(1);
}
final input = arguments[0];
final output = arguments[1];
final program = new Program();
// Register VM-specific metadata.
program.addMetadataRepository(new DirectCallMetadataRepository());
program.addMetadataRepository(new InferredTypeMetadataRepository());
final List<int> bytes = new File(input).readAsBytesSync();
new BinaryBuilderWithMetadata(bytes).readProgram(program);
writeProgramToText(program, path: output, showMetadata: true);
}