Version 2.11.0-252.0.dev
Merge commit '520fd2059aaa23145ba16a029fb318e7dce4a3ae' into 'dev'
diff --git a/benchmarks/EventLoopLatencyJson/dart/latency.dart b/benchmarks/EventLoopLatencyJson/dart/latency.dart
index c368802..5da9f4e 100644
--- a/benchmarks/EventLoopLatencyJson/dart/latency.dart
+++ b/benchmarks/EventLoopLatencyJson/dart/latency.dart
@@ -83,13 +83,13 @@
this.maxRss);
void report(String name) {
- print('$name.Min(RunTime): $minLatency ms.');
- print('$name.Avg(RunTime): $avgLatency ms.');
- print('$name.Percentile50(RunTime): $percentile50th ms.');
- print('$name.Percentile90(RunTime): $percentile90th ms.');
- print('$name.Percentile95(RunTime): $percentile95th ms.');
- print('$name.Percentile99(RunTime): $percentile99th ms.');
- print('$name.Max(RunTime): $maxLatency ms.');
+ print('$name.Min(RunTimeRaw): $minLatency ms.');
+ print('$name.Avg(RunTimeRaw): $avgLatency ms.');
+ print('$name.Percentile50(RunTimeRaw): $percentile50th ms.');
+ print('$name.Percentile90(RunTimeRaw): $percentile90th ms.');
+ print('$name.Percentile95(RunTimeRaw): $percentile95th ms.');
+ print('$name.Percentile99(RunTimeRaw): $percentile99th ms.');
+ print('$name.Max(RunTimeRaw): $maxLatency ms.');
print('$name.MaxRss(MemoryUse): $maxRss');
}
}
diff --git a/benchmarks/EventLoopLatencyJson/dart2/latency.dart b/benchmarks/EventLoopLatencyJson/dart2/latency.dart
index cfec940..44ecae6 100644
--- a/benchmarks/EventLoopLatencyJson/dart2/latency.dart
+++ b/benchmarks/EventLoopLatencyJson/dart2/latency.dart
@@ -85,13 +85,13 @@
this.maxRss);
void report(String name) {
- print('$name.Min(RunTime): $minLatency ms.');
- print('$name.Avg(RunTime): $avgLatency ms.');
- print('$name.Percentile50(RunTime): $percentile50th ms.');
- print('$name.Percentile90(RunTime): $percentile90th ms.');
- print('$name.Percentile95(RunTime): $percentile95th ms.');
- print('$name.Percentile99(RunTime): $percentile99th ms.');
- print('$name.Max(RunTime): $maxLatency ms.');
+ print('$name.Min(RunTimeRaw): $minLatency ms.');
+ print('$name.Avg(RunTimeRaw): $avgLatency ms.');
+ print('$name.Percentile50(RunTimeRaw): $percentile50th ms.');
+ print('$name.Percentile90(RunTimeRaw): $percentile90th ms.');
+ print('$name.Percentile95(RunTimeRaw): $percentile95th ms.');
+ print('$name.Percentile99(RunTimeRaw): $percentile99th ms.');
+ print('$name.Max(RunTimeRaw): $maxLatency ms.');
print('$name.MaxRss(MemoryUse): $maxRss');
}
}
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index c288f21..d701947 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -491,15 +491,6 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Null> codeBytecodeLimitExceededTooManyArguments =
- messageBytecodeLimitExceededTooManyArguments;
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const MessageCode messageBytecodeLimitExceededTooManyArguments =
- const MessageCode("BytecodeLimitExceededTooManyArguments",
- message: r"""Dart bytecode limit exceeded: too many arguments.""");
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeCandidateFound = messageCandidateFound;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -3744,9 +3735,6 @@
--omit-platform
Exclude the platform from the serialized dill file.
- --bytecode
- Generate bytecode. Supported only for SDK platform compilation.
-
--exclude-source
Do not include source code in the dill file.
@@ -8626,7 +8614,7 @@
_names)> templateStrongModeNNBDPackageOptOut = const Template<
Message Function(List<String> _names)>(
messageTemplate:
- r"""Cannot run with sound null safety as one or more dependencies do not
+ r"""This project cannot run with sound null safety, because one or more project dependencies do not
support null safety:
#names
@@ -8649,7 +8637,7 @@
String names = itemizeNames(_names);
return new Message(codeStrongModeNNBDPackageOptOut,
message:
- """Cannot run with sound null safety as one or more dependencies do not
+ """This project cannot run with sound null safety, because one or more project dependencies do not
support null safety:
${names}
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index 0271281..2efebfa 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -76,7 +76,6 @@
JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS,
JS_INTEROP_FIELD_NOT_SUPPORTED,
JS_INTEROP_NON_EXTERNAL_MEMBER,
- JS_INTEROP_METHOD_WITH_NAMED_ARGUMENTS,
JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS,
JS_PLACEHOLDER_CAPTURE,
LIBRARY_NOT_FOUND,
diff --git a/pkg/dev_compiler/test/expression_compiler/expression_compiler_test.dart b/pkg/dev_compiler/test/expression_compiler/expression_compiler_test.dart
index f1b9e63..49a1d1c 100644
--- a/pkg/dev_compiler/test/expression_compiler/expression_compiler_test.dart
+++ b/pkg/dev_compiler/test/expression_compiler/expression_compiler_test.dart
@@ -338,6 +338,7 @@
group('Expression compiler tests in static function:', () {
const source = '''
+ // @dart = 2.9
int foo(int x, {int y}) {
int z = 0;
/* evaluation placeholder */
@@ -1362,6 +1363,7 @@
group('Expression compiler tests in constructor:', () {
const source = '''
+ // @dart = 2.9
extension NumberParsing on String {
int parseInt() {
return int.parse(this);
@@ -1618,6 +1620,7 @@
group('Expression compiler tests in loops:', () {
const source = r'''
+ // @dart = 2.9
int globalFunction() {
int x = 15;
var c = C(1, 2);
@@ -1674,6 +1677,7 @@
group('Expression compiler tests in conditional (then):', () {
const source = r'''
+ // @dart = 2.9
int globalFunction() {
int x = 1;
var c = C(1, 2);
@@ -1726,6 +1730,7 @@
group('Expression compiler tests in conditional (else):', () {
const source = r'''
+ // @dart = 2.9
int globalFunction() {
int x = 1;
var c = C(1, 2);
@@ -1778,6 +1783,7 @@
group('Expression compiler tests after conditionals:', () {
const source = r'''
+ // @dart = 2.9
int globalFunction() {
int x = 1;
var c = C(1, 2);
diff --git a/pkg/front_end/lib/src/api_prototype/compiler_options.dart b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
index 866ea26..4b517ca 100644
--- a/pkg/front_end/lib/src/api_prototype/compiler_options.dart
+++ b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
@@ -234,9 +234,6 @@
/// diagnostic, but do not stop the compilation.
int skipForDebugging = 0;
- /// Whether to generate bytecode.
- bool bytecode = false;
-
/// Whether to write a file (e.g. a dill file) when reporting a crash.
bool writeFileOnCrashReport = true;
@@ -343,7 +340,6 @@
return false;
}
if (skipForDebugging != other.skipForDebugging) return false;
- if (bytecode != other.bytecode) return false;
if (writeFileOnCrashReport != other.writeFileOnCrashReport) return false;
if (nnbdMode != other.nnbdMode) return false;
if (currentSdkVersion != other.currentSdkVersion) return false;
diff --git a/pkg/front_end/lib/src/api_unstable/vm.dart b/pkg/front_end/lib/src/api_unstable/vm.dart
index 49d660d..e0970d7 100644
--- a/pkg/front_end/lib/src/api_unstable/vm.dart
+++ b/pkg/front_end/lib/src/api_unstable/vm.dart
@@ -43,7 +43,6 @@
export '../fasta/fasta_codes.dart'
show
LocatedMessage,
- messageBytecodeLimitExceededTooManyArguments,
messageFfiExceptionalReturnNull,
messageFfiExpectedConstant,
noLength,
@@ -57,8 +56,7 @@
templateFfiNotStatic,
templateFfiStructGeneric,
templateFfiTypeInvalid,
- templateFfiTypeMismatch,
- templateIllegalRecursiveType;
+ templateFfiTypeMismatch;
export '../fasta/hybrid_file_system.dart' show HybridFileSystem;
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 78bf4f4..b45bbcf 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -322,9 +322,6 @@
/// effect.
void clearFileSystemCache() => _fileSystem = null;
- /// Whether to generate bytecode.
- bool get bytecode => _raw.bytecode;
-
/// Whether to write a file (e.g. a dill file) when reporting a crash.
bool get writeFileOnCrashReport => _raw.writeFileOnCrashReport;
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
index 3e928df..902fdd1 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
@@ -1034,32 +1034,6 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(DartType _type, bool isNonNullableByDefault)>
- templateIllegalRecursiveType = const Template<
- Message Function(DartType _type, bool isNonNullableByDefault)>(
- messageTemplate: r"""Illegal recursive type '#type'.""",
- withArguments: _withArgumentsIllegalRecursiveType);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(DartType _type, bool isNonNullableByDefault)>
- codeIllegalRecursiveType =
- const Code<Message Function(DartType _type, bool isNonNullableByDefault)>(
- "IllegalRecursiveType",
- templateIllegalRecursiveType,
-);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-Message _withArgumentsIllegalRecursiveType(
- DartType _type, bool isNonNullableByDefault) {
- TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
- List<Object> typeParts = labeler.labelType(_type);
- String type = typeParts.join();
- return new Message(codeIllegalRecursiveType,
- message: """Illegal recursive type '${type}'.""" + labeler.originMessages,
- arguments: {'type': _type});
-}
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Template<Message Function(DartType _type, bool isNonNullableByDefault)>
templateImplicitCallOfNonMethod = const Template<
Message Function(DartType _type, bool isNonNullableByDefault)>(
messageTemplate:
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 9428be9..a90e697 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -1325,7 +1325,7 @@
StrongModeNNBDPackageOptOut:
template: |
- Cannot run with sound null safety as one or more dependencies do not
+ This project cannot run with sound null safety, because one or more project dependencies do not
support null safety:
#names
@@ -1747,9 +1747,6 @@
--omit-platform
Exclude the platform from the serialized dill file.
- --bytecode
- Generate bytecode. Supported only for SDK platform compilation.
-
--exclude-source
Do not include source code in the dill file.
@@ -4212,15 +4209,6 @@
}
}
-IllegalRecursiveType:
- template: "Illegal recursive type '#type'."
- script: >
- class Base<T> {}
- class Derived<T> extends Base<Derived<Derived<T>>> {}
-
-BytecodeLimitExceededTooManyArguments:
- template: "Dart bytecode limit exceeded: too many arguments."
-
CombinedMemberSignatureFailed:
template: "Class '#name' inherits multiple members named '#name2' with incompatible signatures."
tip: "Try adding a declaration of '#name2' to '#name'."
diff --git a/pkg/front_end/test/fasta/type_inference/type_schema_environment_nnbd_test.dart b/pkg/front_end/test/fasta/type_inference/type_schema_environment_nnbd_test.dart
index 5217ca9..f7b5496 100644
--- a/pkg/front_end/test/fasta/type_inference/type_schema_environment_nnbd_test.dart
+++ b/pkg/front_end/test/fasta/type_inference/type_schema_environment_nnbd_test.dart
@@ -386,6 +386,27 @@
}
}
+ void test_lower_bound_object() {
+ _initialize("");
+
+ testLower("Object", "FutureOr<Null>", "FutureOr<Never>");
+ testLower("FutureOr<Null>", "Object", "FutureOr<Never>");
+
+ // FutureOr<dynamic> is top.
+ testLower("Object", "FutureOr<dynamic>", "Object");
+ testLower("FutureOr<dynamic>", "Object", "Object");
+
+ // FutureOr<X> is not top and cannot be made non-nullable.
+ testLower("Object", "FutureOr<X>", "Never",
+ typeParameters: 'X extends dynamic');
+ testLower("FutureOr<X>", "Object", "Never",
+ typeParameters: 'X extends dynamic');
+
+ // FutureOr<void> is top.
+ testLower("Object", "FutureOr<void>", "Object");
+ testLower("FutureOr<void>", "Object", "Object");
+ }
+
void test_lower_bound_function() {
const String testSdk = """
class A;
@@ -777,6 +798,13 @@
testUpper("List<int?>", "List<double>", "List<num?>");
}
+ void test_upper_bound_object() {
+ _initialize("");
+
+ testUpper("Object", "FutureOr<Function?>", "Object?");
+ testUpper("FutureOr<Function?>", "Object", "Object?");
+ }
+
void test_upper_bound_function() {
const String testSdk = """
class A;
diff --git a/pkg/front_end/test/flutter_gallery_leak_tester.dart b/pkg/front_end/test/flutter_gallery_leak_tester.dart
index b0aacdb..033b59a 100644
--- a/pkg/front_end/test/flutter_gallery_leak_tester.dart
+++ b/pkg/front_end/test/flutter_gallery_leak_tester.dart
@@ -186,9 +186,6 @@
"$rootPath/gallery/.packages",
"-Ddart.vm.profile=false",
"-Ddart.vm.product=false",
- "--bytecode-options=source-positions,local-var-info,debugger-stops,"
- "instance-field-initializers,keep-unreachable-code,"
- "avoid-closure-call-instructions",
"--enable-asserts",
"--track-widget-creation",
"--initialize-from-dill",
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.outline.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.outline.expect
index 0c8bca3..71ff088 100644
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.outline.expect
+++ b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.outline.expect
@@ -1,7 +1,7 @@
//
// Problems in component:
//
-// Error: Cannot run with sound null safety as one or more dependencies do not
+// Error: This project cannot run with sound null safety, because one or more project dependencies do not
// support null safety:
//
// - package:opt_in_package/opt_out_lib.dart
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.expect
index ce5b6e5..c889df0 100644
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.expect
@@ -1,7 +1,7 @@
//
// Problems in component:
//
-// Error: Cannot run with sound null safety as one or more dependencies do not
+// Error: This project cannot run with sound null safety, because one or more project dependencies do not
// support null safety:
//
// - package:opt_in_package/opt_out_lib.dart
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.transformed.expect
index ce5b6e5..c889df0 100644
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
//
// Problems in component:
//
-// Error: Cannot run with sound null safety as one or more dependencies do not
+// Error: This project cannot run with sound null safety, because one or more project dependencies do not
// support null safety:
//
// - package:opt_in_package/opt_out_lib.dart
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.outline.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.outline.expect
index 6d4bfe9..59a5039 100644
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.outline.expect
+++ b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.outline.expect
@@ -8,7 +8,7 @@
//
// Problems in component:
//
-// Error: Cannot run with sound null safety as one or more dependencies do not
+// Error: This project cannot run with sound null safety, because one or more project dependencies do not
// support null safety:
//
// - package:opt_out_package
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.strong.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.strong.expect
index 45dd453..d834f3b 100644
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.strong.expect
@@ -8,7 +8,7 @@
//
// Problems in component:
//
-// Error: Cannot run with sound null safety as one or more dependencies do not
+// Error: This project cannot run with sound null safety, because one or more project dependencies do not
// support null safety:
//
// - package:opt_out_package
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.strong.transformed.expect
index 0134870..95f7dc1 100644
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/strong.dart.strong.transformed.expect
@@ -1,7 +1,7 @@
//
// Problems in component:
//
-// Error: Cannot run with sound null safety as one or more dependencies do not
+// Error: This project cannot run with sound null safety, because one or more project dependencies do not
// support null safety:
//
// - package:opt_out_package
diff --git a/pkg/front_end/tool/_fasta/command_line.dart b/pkg/front_end/tool/_fasta/command_line.dart
index e9bf2ec..12a1073 100644
--- a/pkg/front_end/tool/_fasta/command_line.dart
+++ b/pkg/front_end/tool/_fasta/command_line.dart
@@ -171,7 +171,6 @@
// * Get an explicit approval from the front-end team.
const Map<String, ValueSpecification> optionSpecification =
const <String, ValueSpecification>{
- Flags.bytecode: const BoolValue(false),
Flags.compileSdk: const UriValue(),
Flags.dumpIr: const BoolValue(false),
Flags.enableExperiment: const StringListValue(),
@@ -285,8 +284,6 @@
final int fatalSkip = int.tryParse(options[Flags.fatalSkip] ?? "0") ?? -1;
- final bool bytecode = options[Flags.bytecode];
-
final bool compileSdk = options.containsKey(Flags.compileSdk);
final String singleRootScheme = options[Flags.singleRootScheme];
@@ -376,8 +373,7 @@
options: compilerOptions
..sdkSummary = options[Flags.platform]
..librariesSpecificationUri = resolveInputUri(arguments[1])
- ..setExitCodeOnProblem = true
- ..bytecode = bytecode,
+ ..setExitCodeOnProblem = true,
inputs: <Uri>[Uri.parse(arguments[0])],
output: resolveInputUri(arguments[3]));
} else if (arguments.isEmpty) {
diff --git a/pkg/front_end/tool/_fasta/entry_points.dart b/pkg/front_end/tool/_fasta/entry_points.dart
index d1af713..f6f412b 100644
--- a/pkg/front_end/tool/_fasta/entry_points.dart
+++ b/pkg/front_end/tool/_fasta/entry_points.dart
@@ -23,11 +23,6 @@
import 'package:kernel/src/types.dart' show Types;
-import 'package:vm/bytecode/gen_bytecode.dart'
- show createFreshComponentWithBytecode, generateBytecode;
-
-import 'package:vm/bytecode/options.dart' show BytecodeOptions;
-
import 'package:front_end/src/api_prototype/compiler_options.dart'
show CompilerOptions;
@@ -433,18 +428,7 @@
new File.fromUri(outlineOutput).writeAsBytesSync(result.summary);
c.options.ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}");
- Component component = result.component;
- if (c.options.bytecode) {
- generateBytecode(component,
- options: new BytecodeOptions(
- enableAsserts: true,
- emitSourceFiles: true,
- emitSourcePositions: true,
- environmentDefines: c.options.environmentDefines));
- component = createFreshComponentWithBytecode(component);
- }
-
- await writeComponentToFile(component, fullOutput);
+ await writeComponentToFile(result.component, fullOutput);
c.options.ticker.logMs("Wrote component to ${fullOutput.toFilePath()}");
diff --git a/pkg/frontend_server/lib/frontend_server.dart b/pkg/frontend_server/lib/frontend_server.dart
index 9f93eea..4d9b5ae 100644
--- a/pkg/frontend_server/lib/frontend_server.dart
+++ b/pkg/frontend_server/lib/frontend_server.dart
@@ -30,12 +30,6 @@
import 'package:path/path.dart' as path;
import 'package:usage/uuid/uuid.dart';
-import 'package:vm/metadata/binary_cache.dart'
- show BinaryCacheMetadataRepository;
-
-import 'package:vm/bytecode/gen_bytecode.dart'
- show generateBytecode, createFreshComponentWithBytecode;
-import 'package:vm/bytecode/options.dart' show BytecodeOptions;
import 'package:vm/incremental_compiler.dart' show IncrementalCompiler;
import 'package:vm/kernel_front_end.dart';
@@ -145,14 +139,6 @@
..addFlag('track-widget-creation',
help: 'Run a kernel transformer to track creation locations for widgets.',
defaultsTo: false)
- ..addFlag('gen-bytecode', help: 'Generate bytecode', defaultsTo: false)
- ..addMultiOption('bytecode-options',
- help: 'Specify options for bytecode generation:',
- valueHelp: 'opt1,opt2,...',
- allowed: BytecodeOptions.commandLineFlags.keys,
- allowedHelp: BytecodeOptions.commandLineFlags)
- ..addFlag('drop-ast',
- help: 'Include only bytecode into the output file', defaultsTo: true)
..addFlag('enable-asserts',
help: 'Whether asserts will be enabled.', defaultsTo: false)
..addFlag('sound-null-safety',
@@ -345,7 +331,6 @@
bool _printIncrementalDependencies;
CompilerOptions _compilerOptions;
- BytecodeOptions _bytecodeOptions;
ProcessedOptions _processedOptions;
FileSystem _fileSystem;
Uri _mainSource;
@@ -484,14 +469,6 @@
await autoDetectNullSafetyMode(_mainSource, compilerOptions);
}
- compilerOptions.bytecode = options['gen-bytecode'];
- final BytecodeOptions bytecodeOptions = BytecodeOptions(
- enableAsserts: options['enable-asserts'],
- emitSourceFiles: options['embed-source-text'],
- environmentDefines: environmentDefines,
- aot: options['aot'],
- )..parseCommandLineFlags(options['bytecode-options']);
-
// Initialize additional supported kernel targets.
_installDartdevcTarget();
compilerOptions.target = createFrontEndTarget(
@@ -511,17 +488,7 @@
];
}
- if (compilerOptions.bytecode && _initializeFromDill != null) {
- // If we are generating bytecode, put bytecode only (not AST) in
- // [_kernelBinaryFilename], which the user of this tool will eventually
- // feed to Flutter engine or flutter_tester. Use a separate file to cache
- // the AST result to initialize the incremental compiler for the next
- // invocation of this tool.
- _initializeFromDill += ".ast";
- }
-
_compilerOptions = compilerOptions;
- _bytecodeOptions = bytecodeOptions;
_processedOptions = ProcessedOptions(options: compilerOptions);
KernelCompilationResults results;
@@ -554,7 +521,6 @@
sdkRoot.resolve(platformKernelDill)
];
}
- // No bytecode at this step. Bytecode is generated later in _writePackage.
results = await _runWithPrintRedirection(() => compileToKernel(
_mainSource, compilerOptions,
includePlatform: options['link-platform'],
@@ -597,22 +563,6 @@
return errors.isEmpty;
}
- Future<Component> _generateBytecodeIfNeeded(Component component) async {
- if (_compilerOptions.bytecode && errors.isEmpty) {
- await runWithFrontEndCompilerContext(
- _mainSource, _compilerOptions, component, () {
- generateBytecode(component,
- coreTypes: _generator.getCoreTypes(),
- hierarchy: _generator.getClassHierarchy(),
- options: _bytecodeOptions);
- if (_options['drop-ast']) {
- component = createFreshComponentWithBytecode(component);
- }
- });
- }
- return component;
- }
-
void _outputDependenciesDelta(Iterable<Uri> compiledSources) async {
if (!_printIncrementalDependencies) {
return;
@@ -695,88 +645,29 @@
{bool filterExternal: false,
IncrementalSerializer incrementalSerializer}) async {
final Component component = results.component;
- // Remove the cache that came either from this function or from
- // initializing from a kernel file.
- component.metadata.remove(BinaryCacheMetadataRepository.repositoryTag);
+ final IOSink sink = File(filename).openWrite();
+ final Set<Library> loadedLibraries = results.loadedLibraries;
+ final BinaryPrinter printer = filterExternal
+ ? BinaryPrinter(sink,
+ libraryFilter: (lib) => !loadedLibraries.contains(lib),
+ includeSources: false)
+ : printerFactory.newBinaryPrinter(sink);
- if (_compilerOptions.bytecode) {
- {
- // Generate bytecode as the output proper.
- final IOSink sink = File(filename).openWrite();
- await runWithFrontEndCompilerContext(
- _mainSource, _compilerOptions, component, () async {
- if (_options['incremental']) {
- // When loading a single kernel buffer with multiple sub-components,
- // the VM expects 'main' to be the first sub-component.
- await forEachPackage(results,
- (String package, List<Library> libraries) async {
- _writePackage(results, package, libraries, sink);
- }, mainFirst: true);
- } else {
- _writePackage(results, 'main', component.libraries, sink);
- }
- });
- await sink.close();
- }
+ sortComponent(component);
- {
- // Generate AST as a cache. This goes to [_initializeFromDill] instead
- // of [filename] so that a later invocation of frontend_server will the
- // same arguments will use this to initialize its incremental kernel
- // compiler.
- final repository = BinaryCacheMetadataRepository();
- component.addMetadataRepository(repository);
- for (var lib in component.libraries) {
- var bytes = BinaryCacheMetadataRepository.lookup(lib);
- if (bytes != null) {
- repository.mapping[lib] = bytes;
- }
- }
-
- final file = new File(_initializeFromDill);
- await file.create(recursive: true);
- final IOSink sink = file.openWrite();
- final Set<Library> loadedLibraries = results.loadedLibraries;
- final BinaryPrinter printer = filterExternal
- ? BinaryPrinter(sink,
- libraryFilter: (lib) => !loadedLibraries.contains(lib),
- includeSources: false)
- : printerFactory.newBinaryPrinter(sink);
-
- sortComponent(component);
-
- printer.writeComponentFile(component);
- await sink.close();
- }
- } else {
- // Generate AST as the output proper.
- final IOSink sink = File(filename).openWrite();
- final Set<Library> loadedLibraries = results.loadedLibraries;
- final BinaryPrinter printer = filterExternal
- ? BinaryPrinter(sink,
- libraryFilter: (lib) => !loadedLibraries.contains(lib),
- includeSources: false)
- : printerFactory.newBinaryPrinter(sink);
-
- sortComponent(component);
-
- if (incrementalSerializer != null) {
- incrementalSerializer.writePackagesToSinkAndTrimComponent(
- component, sink);
- } else if (unsafePackageSerialization == true) {
- writePackagesToSinkAndTrimComponent(component, sink);
- }
-
- printer.writeComponentFile(component);
- await sink.close();
+ if (incrementalSerializer != null) {
+ incrementalSerializer.writePackagesToSinkAndTrimComponent(
+ component, sink);
+ } else if (unsafePackageSerialization == true) {
+ writePackagesToSinkAndTrimComponent(component, sink);
}
+ printer.writeComponentFile(component);
+ await sink.close();
+
if (_options['split-output-by-packages']) {
await writeOutputSplitByPackages(
- _mainSource, _compilerOptions, results, filename,
- genBytecode: _compilerOptions.bytecode,
- bytecodeOptions: _bytecodeOptions,
- dropAST: _options['drop-ast']);
+ _mainSource, _compilerOptions, results, filename);
}
final String manifestFilename = _options['far-manifest'];
@@ -846,54 +737,6 @@
}
}
- void _writePackage(KernelCompilationResults result, String package,
- List<Library> libraries, IOSink sink) {
- final canCache = libraries.isNotEmpty &&
- _compilerOptions.bytecode &&
- errors.isEmpty &&
- package != "main";
-
- if (canCache) {
- var cachedBytes = BinaryCacheMetadataRepository.lookup(libraries.first);
- if (cachedBytes != null) {
- sink.add(cachedBytes);
- return;
- }
- }
-
- Component partComponent = result.component;
- if (_compilerOptions.bytecode && errors.isEmpty) {
- final List<Library> librariesFiltered = new List<Library>();
- final Set<Library> loadedLibraries = result.loadedLibraries;
- for (Library library in libraries) {
- if (loadedLibraries.contains(library)) continue;
- librariesFiltered.add(library);
- }
-
- generateBytecode(partComponent,
- options: _bytecodeOptions,
- libraries: librariesFiltered,
- coreTypes: _generator?.getCoreTypes(),
- hierarchy: _generator?.getClassHierarchy());
-
- if (_options['drop-ast']) {
- partComponent = createFreshComponentWithBytecode(partComponent);
- }
- }
-
- final byteSink = ByteSink();
- final BinaryPrinter printer = BinaryPrinter(byteSink,
- libraryFilter: (lib) =>
- packageFor(lib, result.loadedLibraries) == package);
- printer.writeComponentFile(partComponent);
-
- final bytes = byteSink.builder.takeBytes();
- sink.add(bytes);
- if (canCache) {
- BinaryCacheMetadataRepository.insert(libraries.first, bytes);
- }
- }
-
@override
Future<Null> recompileDelta({String entryPoint}) async {
final String boundaryKey = Uuid().generateV4();
@@ -946,7 +789,6 @@
expression, definitions, typeDefinitions, libraryUri, klass, isStatic);
if (procedure != null) {
Component component = createExpressionEvaluationComponent(procedure);
- component = await _generateBytecodeIfNeeded(component);
final IOSink sink = File(_kernelBinaryFilename).openWrite();
sink.add(serializeComponent(component));
await sink.close();
diff --git a/pkg/frontend_server/test/frontend_server_test.dart b/pkg/frontend_server/test/frontend_server_test.dart
index 0524ae1..470e340 100644
--- a/pkg/frontend_server/test/frontend_server_test.dart
+++ b/pkg/frontend_server/test/frontend_server_test.dart
@@ -2122,52 +2122,6 @@
expect(count, 3);
});
- test('compile with bytecode', () async {
- var file = File('${tempDir.path}/foo.dart')..createSync();
- file.writeAsStringSync("main() {}\n");
- var dillFile = File('${tempDir.path}/app.dill');
- expect(dillFile.existsSync(), equals(false));
- final List<String> args = <String>[
- '--sdk-root=${sdkRoot.toFilePath()}',
- '--incremental',
- '--platform=${platformKernel.path}',
- '--output-dill=${dillFile.path}',
- '--gen-bytecode',
- '--drop-ast',
- file.path,
- ];
- expect(await starter(args), 0);
- });
-
- test('compile with bytecode and produce deps file', () async {
- var sourceFoo = File('${tempDir.path}/foo.dart')..createSync();
- sourceFoo.writeAsStringSync("import 'bar.dart'; main() { barfunc(); }\n");
- var sourceBar = File('${tempDir.path}/bar.dart')..createSync();
- sourceBar.writeAsStringSync("barfunc() {}\n");
- var dillFile = File('${tempDir.path}/app.dill');
- expect(dillFile.existsSync(), equals(false));
- var depFile = File('${tempDir.path}/app.dill.d');
- expect(depFile.existsSync(), equals(false));
- final List<String> args = <String>[
- '--sdk-root=${sdkRoot.toFilePath()}',
- '--incremental',
- '--platform=${platformKernel.path}',
- '--output-dill=${dillFile.path}',
- '--depfile=${depFile.path}',
- '--gen-bytecode',
- '--drop-ast',
- sourceFoo.path,
- ];
- expect(await starter(args), 0);
- expect(depFile.existsSync(), true);
- var depContents = depFile.readAsStringSync();
- print(depContents);
- var depContentsParsed = depContents.split(': ');
- expect(path.basename(depContentsParsed[0]), path.basename(dillFile.path));
- expect(depContentsParsed[1], contains(path.basename(sourceFoo.path)));
- expect(depContentsParsed[1], contains(path.basename(sourceBar.path)));
- });
-
test('compile "package:"-file', () async {
Directory lib = Directory('${tempDir.path}/lib')..createSync();
File('${lib.path}/foo.dart')
diff --git a/pkg/js/CHANGELOG.md b/pkg/js/CHANGELOG.md
index 3728fa9..3b4897d 100644
--- a/pkg/js/CHANGELOG.md
+++ b/pkg/js/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.6.3-nullsafety.2
+
+* Allow prerelease versions of the `2.12` sdk.
+
## 0.6.3-nullsafety.1
* Allow 2.10 stable and 2.11.0 dev SDK versions.
diff --git a/pkg/js/pubspec.yaml b/pkg/js/pubspec.yaml
index b9d05c4..6ae05bb 100644
--- a/pkg/js/pubspec.yaml
+++ b/pkg/js/pubspec.yaml
@@ -1,10 +1,10 @@
name: js
-version: 0.6.3-nullsafety.1
+version: 0.6.3-nullsafety.2
description: Annotations to create static Dart interfaces for JavaScript APIs.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/js
environment:
- sdk: '>=2.10.0-0 <2.11.0'
+ sdk: '>=2.10.0-0 <2.12.0'
dev_dependencies:
pedantic: ^1.9.0
diff --git a/pkg/kernel/lib/src/non_null.dart b/pkg/kernel/lib/src/non_null.dart
new file mode 100644
index 0000000..2e28022
--- /dev/null
+++ b/pkg/kernel/lib/src/non_null.dart
@@ -0,0 +1,139 @@
+// Copyright (c) 2019, 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.md file.
+
+import '../ast.dart';
+import '../core_types.dart';
+
+/// Returns the type defines as `NonNull(type)` in the nnbd specification.
+DartType computeNonNull(CoreTypes coreTypes, DartType type) {
+ return type.accept1(const _NonNullVisitor(), coreTypes) ?? type;
+}
+
+/// Visitor that computes the `NonNull` function defined in the nnbd
+/// specification.
+///
+/// The visitor returns `null` if `NonNull(T) = T`.
+class _NonNullVisitor implements DartTypeVisitor1<DartType, CoreTypes> {
+ const _NonNullVisitor();
+
+ @override
+ DartType defaultDartType(DartType node, CoreTypes coreTypes) {
+ throw new UnsupportedError(
+ "Unexpected DartType ${node} (${node.runtimeType})");
+ }
+
+ @override
+ DartType visitBottomType(BottomType node, CoreTypes coreTypes) => null;
+
+ @override
+ DartType visitDynamicType(DynamicType node, CoreTypes coreTypes) => null;
+
+ @override
+ DartType visitFunctionType(FunctionType node, CoreTypes coreTypes) {
+ if (node.declaredNullability == Nullability.nonNullable) {
+ return null;
+ }
+ return node.withDeclaredNullability(Nullability.nonNullable);
+ }
+
+ @override
+ DartType visitFutureOrType(FutureOrType node, CoreTypes coreTypes) {
+ DartType typeArgument = node.typeArgument.accept1(this, coreTypes);
+ if (node.declaredNullability == Nullability.nonNullable &&
+ typeArgument == null) {
+ return null;
+ }
+ return new FutureOrType(
+ typeArgument ?? node.typeArgument, Nullability.nonNullable);
+ }
+
+ @override
+ DartType visitInterfaceType(InterfaceType node, CoreTypes coreTypes) {
+ if (node == coreTypes.nullType) {
+ return const NeverType(Nullability.nonNullable);
+ }
+ if (node.declaredNullability == Nullability.nonNullable) {
+ return null;
+ }
+ return node.withDeclaredNullability(Nullability.nonNullable);
+ }
+
+ @override
+ DartType visitInvalidType(InvalidType node, CoreTypes coreTypes) => null;
+
+ @override
+ DartType visitNeverType(NeverType node, CoreTypes coreTypes) {
+ if (node.declaredNullability == Nullability.nonNullable) {
+ return null;
+ }
+ return const NeverType(Nullability.nonNullable);
+ }
+
+ @override
+ DartType visitTypeParameterType(TypeParameterType node, CoreTypes coreTypes) {
+ if (node.nullability == Nullability.nonNullable) {
+ return null;
+ }
+ if (node.promotedBound != null) {
+ if (node.promotedBound.nullability == Nullability.nonNullable) {
+ // The promoted bound is already non-nullable so we set the declared
+ // nullability to non-nullable.
+ return node.withDeclaredNullability(Nullability.nonNullable);
+ }
+ DartType promotedBound = node.promotedBound.accept1(this, coreTypes);
+ if (promotedBound == null) {
+ // The promoted bound could not be made non-nullable so we set the
+ // declared nullability to undetermined.
+ if (node.declaredNullability == Nullability.undetermined) {
+ return null;
+ }
+ return new TypeParameterType.intersection(
+ node.parameter, Nullability.undetermined, node.promotedBound);
+ } else if (promotedBound.nullability == Nullability.nonNullable) {
+ // The bound could be made non-nullable so we use it as the promoted
+ // bound.
+ return new TypeParameterType.intersection(
+ node.parameter, Nullability.nonNullable, promotedBound);
+ } else {
+ // The bound could not be made non-nullable so we use it as the promoted
+ // bound with undetermined nullability.
+ return new TypeParameterType.intersection(
+ node.parameter, Nullability.undetermined, promotedBound);
+ }
+ } else {
+ if (node.bound.nullability == Nullability.nonNullable) {
+ // The bound is already non-nullable so we set the declared nullability
+ // to non-nullable.
+ return node.withDeclaredNullability(Nullability.nonNullable);
+ }
+ DartType bound = node.bound.accept1(this, coreTypes);
+ if (bound == null) {
+ // The bound could not be made non-nullable so we set the declared
+ // nullability to undetermined.
+ if (node.declaredNullability == Nullability.undetermined) {
+ return null;
+ }
+ return node.withDeclaredNullability(Nullability.undetermined);
+ } else {
+ // The nullability is fully determined by the bound so we pass the
+ // default nullability for the declared nullability.
+ return new TypeParameterType.intersection(
+ node.parameter,
+ TypeParameterType.computeNullabilityFromBound(node.parameter),
+ bound);
+ }
+ }
+ }
+
+ @override
+ DartType visitTypedefType(TypedefType node, CoreTypes coreTypes) {
+ if (node.declaredNullability == Nullability.nonNullable) {
+ return null;
+ }
+ return node.withDeclaredNullability(Nullability.nonNullable);
+ }
+
+ @override
+ DartType visitVoidType(VoidType node, CoreTypes coreTypes) => null;
+}
diff --git a/pkg/kernel/lib/src/standard_bounds.dart b/pkg/kernel/lib/src/standard_bounds.dart
index 2fb3a96..f94edc0 100644
--- a/pkg/kernel/lib/src/standard_bounds.dart
+++ b/pkg/kernel/lib/src/standard_bounds.dart
@@ -27,6 +27,7 @@
import '../type_algebra.dart';
import '../type_environment.dart';
import 'legacy_erasure.dart';
+import 'non_null.dart';
mixin StandardBounds {
ClassHierarchyBase get hierarchy;
@@ -354,20 +355,20 @@
if (coreTypes.isObject(type2)) {
return moretop(type2, type1) ? type1 : type2;
}
- if (type2.declaredNullability == Nullability.nonNullable) {
+ if (type2.nullability == Nullability.nonNullable) {
return type2;
}
- type2 = type2.withDeclaredNullability(Nullability.nonNullable);
- if (type2.declaredNullability == Nullability.nonNullable) {
+ type2 = computeNonNull(coreTypes, type2);
+ if (type2.nullability == Nullability.nonNullable) {
return type2;
}
return const NeverType(Nullability.nonNullable);
} else if (coreTypes.isObject(type2)) {
- if (type1.declaredNullability == Nullability.nonNullable) {
+ if (type1.nullability == Nullability.nonNullable) {
return type1;
}
- type1 = type1.withDeclaredNullability(Nullability.nonNullable);
- if (type1.declaredNullability == Nullability.nonNullable) {
+ type1 = computeNonNull(coreTypes, type1);
+ if (type1.nullability == Nullability.nonNullable) {
return type1;
}
return const NeverType(Nullability.nonNullable);
@@ -667,12 +668,12 @@
if (coreTypes.isObject(type2)) {
return moretop(type1, type2) ? type1 : type2;
}
- if (type2.declaredNullability == Nullability.nonNullable) {
+ if (type2.nullability == Nullability.nonNullable) {
return type1;
}
return type1.withDeclaredNullability(Nullability.nullable);
} else if (coreTypes.isObject(type2)) {
- if (type1.declaredNullability == Nullability.nonNullable) {
+ if (type1.nullability == Nullability.nonNullable) {
return type2;
}
return type2.withDeclaredNullability(Nullability.nullable);
diff --git a/pkg/kernel/lib/testing/type_parser.dart b/pkg/kernel/lib/testing/type_parser.dart
index 4744340..ef288ed 100644
--- a/pkg/kernel/lib/testing/type_parser.dart
+++ b/pkg/kernel/lib/testing/type_parser.dart
@@ -345,7 +345,7 @@
ParsedType parseType() {
if (optional("class")) return parseClass();
if (optional("typedef")) return parseTypedef();
- ParsedType result;
+ List<ParsedType> results = <ParsedType>[];
do {
ParsedType type;
if (optional("(") || optional("<")) {
@@ -369,12 +369,17 @@
ParsedNullability parsedNullability = parseNullability();
type = new ParsedInterfaceType(name, arguments, parsedNullability);
}
+ results.add(type);
+ } while (optionalAdvance("&"));
+ // Parse `A & B & C` as `A & (B & C)` and not `(A & B) & C`.
+ ParsedType result;
+ for (ParsedType type in results.reversed) {
if (result == null) {
result = type;
} else {
- result = new ParsedIntersectionType(result, type);
+ result = new ParsedIntersectionType(type, result);
}
- } while (optionalAdvance("&"));
+ }
return result;
}
diff --git a/pkg/kernel/test/non_null_test.dart b/pkg/kernel/test/non_null_test.dart
new file mode 100644
index 0000000..1158a4e
--- /dev/null
+++ b/pkg/kernel/test/non_null_test.dart
@@ -0,0 +1,94 @@
+// Copyright (c) 2019, 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 "package:expect/expect.dart" show Expect;
+
+import 'package:kernel/ast.dart' hide MapEntry;
+import 'package:kernel/src/non_null.dart';
+import 'package:kernel/testing/type_parser_environment.dart';
+
+const Map<String, String> data = {
+ 'dynamic': 'dynamic',
+ 'void': 'void',
+ 'Null': 'Never',
+ 'Never': 'Never',
+ 'Never?': 'Never',
+ 'Never*': 'Never',
+ 'Object': 'Object',
+ 'Object?': 'Object',
+ 'Object*': 'Object',
+ 'List<Object>': 'List<Object>',
+ 'List<Object>?': 'List<Object>',
+ 'List<Object>*': 'List<Object>',
+ 'List<Object?>': 'List<Object?>',
+ 'List<Object?>?': 'List<Object?>',
+ 'List<Object?>*': 'List<Object?>',
+ 'List<Object*>': 'List<Object*>',
+ 'List<Object*>?': 'List<Object*>',
+ 'List<Object*>*': 'List<Object*>',
+ 'FutureOr<Null>': 'FutureOr<Never>',
+ 'FutureOr<dynamic>': 'FutureOr<dynamic>',
+ 'FutureOr<Object>': 'FutureOr<Object>',
+ 'FutureOr<Object>?': 'FutureOr<Object>',
+ 'FutureOr<Object>*': 'FutureOr<Object>',
+ 'FutureOr<Object?>': 'FutureOr<Object>',
+ 'FutureOr<Object?>?': 'FutureOr<Object>',
+ 'FutureOr<Object?>*': 'FutureOr<Object>',
+ 'FutureOr<Object*>': 'FutureOr<Object>',
+ 'FutureOr<Object*>?': 'FutureOr<Object>',
+ 'FutureOr<Object*>*': 'FutureOr<Object>',
+ 'FutureOr<FutureOr<Object?>>': 'FutureOr<FutureOr<Object>>',
+ '(List<Object>, {required List<Object> a, List<Object> b}) -> List<Object>':
+ '(List<Object>, {required List<Object> a, List<Object> b}) -> List<Object>',
+ '(List<Object>, {required List<Object> a, List<Object> b}) ->? List<Object>':
+ '(List<Object>, {required List<Object> a, List<Object> b}) -> List<Object>',
+ '(List<Object>, {required List<Object> a, List<Object> b}) ->* List<Object>':
+ '(List<Object>, {required List<Object> a, List<Object> b}) -> List<Object>',
+ '(List<Object>?, {required List<Object?> a, List<Object?>? b}) ->? List<Object?>':
+ '(List<Object>?, {required List<Object?> a, List<Object?>? b}) -> List<Object?>',
+ 'X': 'X & Object',
+ 'X?': 'X & Object',
+ 'X*': 'X & Object',
+ 'X_extends_Object': 'X_extends_Object',
+ 'X_extends_Object?': 'X_extends_Object',
+ 'X_extends_Object*': 'X_extends_Object',
+ 'X_extends_dynamic': 'X_extends_dynamic',
+ 'X_extends_dynamic?': 'X_extends_dynamic',
+ 'X_extends_dynamic*': 'X_extends_dynamic',
+ 'X & Object?': 'X & Object',
+ 'X & dynamic': 'X & dynamic',
+ 'X & Object': 'X & Object',
+ 'X? & Object?': 'X & Object',
+ 'X? & dynamic': 'X & dynamic',
+ 'X? & Object': 'X & Object',
+ 'Y': 'Y & X & Object',
+ 'Y?': 'Y & X & Object',
+ 'Y_extends_dynamic': 'Y_extends_dynamic',
+ 'Y_extends_dynamic?': 'Y_extends_dynamic',
+ 'Y_extends_dynamic*': 'Y_extends_dynamic',
+ 'Y_extends_dynamic & X': 'Y_extends_dynamic & X & Object',
+ 'Y_extends_dynamic & X_extends_dynamic?':
+ 'Y_extends_dynamic & X_extends_dynamic',
+};
+
+main() {
+ Env env = new Env('')
+ ..extendWithTypeParameters('X,'
+ 'X_extends_Object extends Object,'
+ 'X_extends_dynamic extends dynamic,'
+ 'Y extends X,'
+ 'Y_extends_dynamic extends X_extends_dynamic');
+ data.forEach((String input, String output) {
+ DartType inputType = env.parseType(input);
+ DartType expectedOutputType = env.parseType(output);
+ DartType actualOutputType = computeNonNull(env.coreTypes, inputType);
+ print('legacyErasure($inputType) = $actualOutputType: $expectedOutputType');
+ Expect.equals(
+ expectedOutputType,
+ actualOutputType,
+ "Unexpected NonNull of $inputType ('$input'):\n"
+ "Expected: ${expectedOutputType} ('$output')\n"
+ "Actual: ${actualOutputType}");
+ });
+}
diff --git a/pkg/kernel/test/type_parser_test.dart b/pkg/kernel/test/type_parser_test.dart
index 76bb490..5a2e651 100644
--- a/pkg/kernel/test/type_parser_test.dart
+++ b/pkg/kernel/test/type_parser_test.dart
@@ -42,6 +42,7 @@
class B<T extends List<List<Object>>>;
<E>(E) -> int
S & T
+S & T & U
class C;
<E>(E) -> int & <E>(E) -> void
C*
diff --git a/pkg/meta/CHANGELOG.md b/pkg/meta/CHANGELOG.md
index d80e12b..743ed08 100644
--- a/pkg/meta/CHANGELOG.md
+++ b/pkg/meta/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.3.0-nullsafety.5
+
+* Allow prerelease versions of the `2.12` sdk.
+
## 1.3.0-nullsafety.4
* Introduce `@internal` to annotate elements that should not be used outside of
diff --git a/pkg/meta/pubspec.yaml b/pkg/meta/pubspec.yaml
index 28a9847..a68bacd 100644
--- a/pkg/meta/pubspec.yaml
+++ b/pkg/meta/pubspec.yaml
@@ -1,5 +1,5 @@
name: meta
-version: 1.3.0-nullsafety.4
+version: 1.3.0-nullsafety.5
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/meta
description: >
This library contains the declarations of annotations that developers can use
@@ -8,4 +8,4 @@
to provide a better user experience.
environment:
# This must remain a tight constraint until nnbd is stable
- sdk: '>=2.10.0-0 <2.11.0'
+ sdk: '>=2.10.0-0 <2.12.0'
diff --git a/pkg/nnbd_migration/test/abstract_context.dart b/pkg/nnbd_migration/test/abstract_context.dart
index d04f358..4ea440d 100644
--- a/pkg/nnbd_migration/test/abstract_context.dart
+++ b/pkg/nnbd_migration/test/abstract_context.dart
@@ -131,6 +131,88 @@
newFile('$testsPath/.packages', content: '''
tests:file://$testsPath/lib
''');
+ var pubspecPath = '$testsPath/pubspec.yaml';
+ // Subclasses may write out a different file first.
+ if (!getFile(pubspecPath).exists) {
+ newFile(pubspecPath, content: '''
+name: tests
+version: 1.0.0
+environment:
+ sdk: '>=2.9.0 <3.0.0'
+''');
+ }
+ var packageConfigPath = '$testsPath/.dart_tool/package_config.json';
+ // Subclasses may write out a different file first.
+ if (!getFile(packageConfigPath).exists) {
+ // TODO(srawlins): This is a rough hack to allow for the "null safe by
+ // default" flag flip. We need to _opt out_ all packages at the onset.
+ // A better solution likely involves the package config-editing code in
+ // analyzer's [context_collection_resolution.dart].
+ newFile(packageConfigPath, content: '''
+{
+ "configVersion": 2,
+ "packages": [
+ {
+ "name": "args",
+ "rootUri": "${toUriStr('/.pub-cache/args')}",
+ "packageUri": "lib/",
+ "languageVersion": "2.9"
+ },
+ {
+ "name": "collection",
+ "rootUri": "${toUriStr('/.pub-cache/collection')}",
+ "packageUri": "lib/",
+ "languageVersion": "2.9"
+ },
+ {
+ "name": "fixnum",
+ "rootUri": "${toUriStr('/.pub-cache/fixnum')}",
+ "packageUri": "lib/",
+ "languageVersion": "2.9"
+ },
+ {
+ "name": "foo",
+ "rootUri": "${toUriStr('/.pub-cache/foo')}",
+ "packageUri": "lib/",
+ "languageVersion": "2.9"
+ },
+ {
+ "name": "meta",
+ "rootUri": "${toUriStr('/.pub-cache/meta')}",
+ "packageUri": "lib/",
+ "languageVersion": "2.9"
+ },
+ {
+ "name": "quiver",
+ "rootUri": "${toUriStr('/.pub-cache/quiver')}",
+ "packageUri": "lib/",
+ "languageVersion": "2.9"
+ },
+ {
+ "name": "test",
+ "rootUri": "${toUriStr('/.pub-cache/test')}",
+ "packageUri": "lib/",
+ "languageVersion": "2.9"
+ },
+ {
+ "name": "test_core",
+ "rootUri": "${toUriStr('/.pub-cache/test_core')}",
+ "packageUri": "lib/",
+ "languageVersion": "2.9"
+ },
+ {
+ "name": "tests",
+ "rootUri": "../",
+ "packageUri": "lib/",
+ "languageVersion": "2.9"
+ }
+ ],
+ "generated": "2020-10-21T21:13:05.186004Z",
+ "generator": "pub",
+ "generatorVersion": "2.10.0"
+}
+''');
+ }
createAnalysisContexts();
}
diff --git a/pkg/nnbd_migration/test/abstract_single_unit.dart b/pkg/nnbd_migration/test/abstract_single_unit.dart
index 16f0f45..cd7b060 100644
--- a/pkg/nnbd_migration/test/abstract_single_unit.dart
+++ b/pkg/nnbd_migration/test/abstract_single_unit.dart
@@ -74,6 +74,36 @@
- non-nullable
''');
}
+ if (analyzeWithNnbd) {
+ newFile('$testRoot/pubspec.yaml', content: '''
+name: tests
+version: 1.0.0
+environment:
+ sdk: '>=2.12.0 <3.0.0'
+''');
+ newFile('$testRoot/.dart_tool/package_config.json', content: '''
+{
+ "configVersion": 2,
+ "packages": [
+ {
+ "name": "meta",
+ "rootUri": "file:///.pub-cache/meta",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ },
+ {
+ "name": "tests",
+ "rootUri": "../",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ }
+ ],
+ "generated": "2020-10-21T21:13:05.186004Z",
+ "generator": "pub",
+ "generatorVersion": "2.12.0"
+}
+''');
+ }
super.setUp();
testFile = convertPath('$testRoot/lib/test.dart');
testUri = Uri.parse('package:tests/test.dart');
diff --git a/pkg/nnbd_migration/test/api_test.dart b/pkg/nnbd_migration/test/api_test.dart
index 629a6ac..b1f06d2 100644
--- a/pkg/nnbd_migration/test/api_test.dart
+++ b/pkg/nnbd_migration/test/api_test.dart
@@ -30,6 +30,13 @@
abstract class _ProvisionalApiTestBase extends AbstractContextTest {
bool get _usePermissiveMode;
+ String projectPath;
+
+ void setUp() {
+ projectPath = convertPath(AbstractContextTest.testsPath);
+ super.setUp();
+ }
+
/// Hook invoked between stages of processing inputs.
void _betweenStages() {}
@@ -102,7 +109,8 @@
{Map<String, String> migratedInput = const {},
bool removeViaComments = false,
bool warnOnWeakCode = false}) async {
- var sourcePath = convertPath('/home/test/lib/test.dart');
+ var sourcePath =
+ convertPath('${AbstractContextTest.testsPath}/lib/test.dart');
await _checkMultipleFileChanges(
{sourcePath: content}, {sourcePath: expected},
migratedInput: migratedInput,
@@ -398,7 +406,7 @@
}
''';
await _checkSingleFileChanges(content, expected, migratedInput: {
- '/home/test/lib/already_migrated.dart': alreadyMigrated
+ '$projectPath/lib/already_migrated.dart': alreadyMigrated
});
}
@@ -4312,7 +4320,7 @@
}
Future<void> test_libraryWithParts() async {
- var root = '/home/test/lib';
+ var root = '$projectPath/lib';
var path1 = convertPath('$root/lib.dart');
var file1 = '''
part 'src/foo/part.dart';
@@ -4338,7 +4346,7 @@
}
Future<void> test_libraryWithParts_add_questions() async {
- var root = '/home/test/lib';
+ var root = '$projectPath/lib';
var path1 = convertPath('$root/lib.dart');
var file1 = '''
part 'src/foo/part.dart';
@@ -5581,7 +5589,7 @@
}
Future<void> test_prefixes() async {
- var root = '/home/test/lib';
+ var root = '$projectPath/lib';
var path1 = convertPath('$root/file1.dart');
var file1 = '''
import 'file2.dart';
@@ -6408,7 +6416,7 @@
}
Future<void> test_two_files() async {
- var root = '/home/test/lib';
+ var root = '$projectPath/lib';
var path1 = convertPath('$root/file1.dart');
var file1 = '''
import 'file2.dart';
@@ -6509,7 +6517,7 @@
}
''';
await _checkSingleFileChanges(content, expected, migratedInput: {
- '/home/test/lib/migrated_typedef.dart': 'typedef F<R> = Function(R);'
+ '$projectPath/lib/migrated_typedef.dart': 'typedef F<R> = Function(R);'
});
}
@@ -6545,7 +6553,7 @@
}
''';
await _checkSingleFileChanges(content, expected, migratedInput: {
- '/home/test/lib/migrated_typedef.dart':
+ '$projectPath/lib/migrated_typedef.dart':
'typedef F<T> = Function<R>(T, R);'
});
}
@@ -6564,7 +6572,7 @@
}
''';
await _checkSingleFileChanges(content, expected, migratedInput: {
- '/home/test/lib/migrated_typedef.dart': 'typedef F = Function<R>(R);'
+ '$projectPath/lib/migrated_typedef.dart': 'typedef F = Function<R>(R);'
});
}
diff --git a/pkg/nnbd_migration/test/edge_builder_test.dart b/pkg/nnbd_migration/test/edge_builder_test.dart
index 04aebe5..fc33d2e 100644
--- a/pkg/nnbd_migration/test/edge_builder_test.dart
+++ b/pkg/nnbd_migration/test/edge_builder_test.dart
@@ -5018,13 +5018,13 @@
}
Future<void> test_methodInvocation_parameter_named_differentPackage() async {
- addPackageFile('pkgC', 'c.dart', '''
+ addPackageFile('foo', 'c.dart', '''
class C {
void f({int i}) {}
}
''');
await analyze('''
-import "package:pkgC/c.dart";
+import "package:foo/c.dart";
void g(C c, int j) {
c.f(i: j/*check*/);
}
@@ -7663,11 +7663,11 @@
}
Future<void> test_topLevelVar_reference_differentPackage() async {
- addPackageFile('pkgPi', 'piConst.dart', '''
+ addPackageFile('foo', 'piConst.dart', '''
double pi = 3.1415;
''');
await analyze('''
-import "package:pkgPi/piConst.dart";
+import "package:foo/piConst.dart";
double get myPi => pi;
''');
var myPiType = decoratedTypeAnnotation('double get');
diff --git a/pkg/nnbd_migration/test/edit_plan_test.dart b/pkg/nnbd_migration/test/edit_plan_test.dart
index 224da57..64ff882 100644
--- a/pkg/nnbd_migration/test/edit_plan_test.dart
+++ b/pkg/nnbd_migration/test/edit_plan_test.dart
@@ -332,11 +332,11 @@
}
Future<void> test_addUnaryPostfix_outer_precedence() async {
- await analyze('f(x) => x!;');
+ await analyze('f(x) => x/*!*/;');
checkPlan(
- planner.addUnaryPostfix(
- planner.passThrough(findNode.simple('x!')), TokenType.PLUS_PLUS),
- 'f(x) => x++!;');
+ planner.addUnaryPostfix(planner.passThrough(findNode.simple('x/*!*/')),
+ TokenType.PLUS_PLUS),
+ 'f(x) => x++/*!*/;');
}
Future<void> test_addUnaryPrefix_inner_precedence_add_parens() async {
diff --git a/pkg/nnbd_migration/test/front_end/analysis_abstract.dart b/pkg/nnbd_migration/test/front_end/analysis_abstract.dart
index 7daaddd..2eb23ec 100644
--- a/pkg/nnbd_migration/test/front_end/analysis_abstract.dart
+++ b/pkg/nnbd_migration/test/front_end/analysis_abstract.dart
@@ -2,14 +2,12 @@
// 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 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:test/test.dart';
import '../abstract_context.dart';
/// An abstract base for all 'analysis' domain tests.
-class AbstractAnalysisTest extends AbstractContextTest
- with ResourceProviderMixin {
+class AbstractAnalysisTest extends AbstractContextTest {
String projectPath;
String testFolder;
String testFile;
diff --git a/pkg/nnbd_migration/test/front_end/info_builder_test.dart b/pkg/nnbd_migration/test/front_end/info_builder_test.dart
index 9fc7d93..67a796f 100644
--- a/pkg/nnbd_migration/test/front_end/info_builder_test.dart
+++ b/pkg/nnbd_migration/test/front_end/info_builder_test.dart
@@ -319,28 +319,6 @@
replacement: ''));
}
- Future<void> test_addLateFinal_dueToHint() async {
- var content = '/*late final*/ int x = 0;';
- var migratedContent = '/*late final*/ int x = 0;';
- var unit = await buildInfoForSingleTestFile(content,
- migratedContent: migratedContent);
- var regions = unit.fixRegions;
- expect(regions, hasLength(2));
- var textToRemove = '/*late final*/ ';
- assertRegionPair(regions, 0,
- offset1: migratedContent.indexOf('/*'),
- length1: 2,
- offset2: migratedContent.indexOf('*/'),
- length2: 2,
- explanation: 'Added late and final keywords, due to a hint',
- kind: NullabilityFixKind.addLateFinalDueToHint,
- edits: (List<EditDetail> edits) => assertEdit(
- edit: edits.single,
- offset: content.indexOf(textToRemove),
- length: textToRemove.length,
- replacement: ''));
- }
-
Future<void> test_addLate_dueToTestSetup() async {
addTestCorePackage();
var content = '''
@@ -382,6 +360,28 @@
kind: NullabilityFixKind.addLateDueToTestSetup);
}
+ Future<void> test_addLateFinal_dueToHint() async {
+ var content = '/*late final*/ int x = 0;';
+ var migratedContent = '/*late final*/ int x = 0;';
+ var unit = await buildInfoForSingleTestFile(content,
+ migratedContent: migratedContent);
+ var regions = unit.fixRegions;
+ expect(regions, hasLength(2));
+ var textToRemove = '/*late final*/ ';
+ assertRegionPair(regions, 0,
+ offset1: migratedContent.indexOf('/*'),
+ length1: 2,
+ offset2: migratedContent.indexOf('*/'),
+ length2: 2,
+ explanation: 'Added late and final keywords, due to a hint',
+ kind: NullabilityFixKind.addLateFinalDueToHint,
+ edits: (List<EditDetail> edits) => assertEdit(
+ edit: edits.single,
+ offset: content.indexOf(textToRemove),
+ length: textToRemove.length,
+ replacement: ''));
+ }
+
Future<void> test_compound_assignment_nullable_result() async {
var unit = await buildInfoForSingleTestFile('''
abstract class C {
diff --git a/pkg/nnbd_migration/test/front_end/instrumentation_renderer_test.dart b/pkg/nnbd_migration/test/front_end/instrumentation_renderer_test.dart
index 5c456f8..452d4d0 100644
--- a/pkg/nnbd_migration/test/front_end/instrumentation_renderer_test.dart
+++ b/pkg/nnbd_migration/test/front_end/instrumentation_renderer_test.dart
@@ -19,44 +19,36 @@
@reflectiveTest
class InstrumentationRendererTest extends NnbdMigrationTestBase {
/// Render the instrumentation view for [files].
- Future<String> renderViewForTestFiles(Map<String, String> files,
+ Future<String> renderViewForTestFiles(
{bool applied = false, bool needsRerun = false}) async {
- var packageRoot = convertPath('/project');
- await buildInfoForTestFiles(files, includedRoot: packageRoot);
+ var files = {convertPath('$projectPath/lib/a.dart'): 'int a = null;'};
+ await buildInfoForTestFiles(files, includedRoot: projectPath);
var migrationInfo =
- MigrationInfo(infos, {}, resourceProvider.pathContext, packageRoot);
+ MigrationInfo(infos, {}, resourceProvider.pathContext, projectPath);
var instrumentationRenderer = InstrumentationRenderer(
migrationInfo, PathMapper(resourceProvider), applied, needsRerun);
return instrumentationRenderer.render();
}
Future<void> test_appliedStyle() async {
- var renderedView = await renderViewForTestFiles(
- {convertPath('/project/lib/a.dart'): 'int a = null;'},
- applied: true);
+ var renderedView = await renderViewForTestFiles(applied: true);
// harmless space in class list due to other potential classes here.
expect(renderedView, contains('<body class="applied ">'));
}
Future<void> test_navigation_containsRoot() async {
- var renderedView = await renderViewForTestFiles(
- {convertPath('/project/lib/a.dart'): 'int a = null;'});
- var expectedPath = convertPath('/project');
+ var renderedView = await renderViewForTestFiles();
// harmless space in class list due to other potential classes here.
- expect(renderedView, contains('<p class="root">$expectedPath</p>'));
+ expect(renderedView, contains('<p class="root">$projectPath</p>'));
}
Future<void> test_needsRerunStyle() async {
- var renderedView = await renderViewForTestFiles(
- {convertPath('/project/lib/a.dart'): 'int a = null;'},
- needsRerun: true);
+ var renderedView = await renderViewForTestFiles(needsRerun: true);
expect(renderedView, contains('<body class="proposed needs-rerun">'));
}
Future<void> test_notAppliedStyle() async {
- var renderedView = await renderViewForTestFiles(
- {convertPath('/project/lib/a.dart'): 'int a = null;'},
- applied: false);
+ var renderedView = await renderViewForTestFiles(applied: false);
// harmless space in class list due to other potential classes here.
expect(renderedView, contains('<body class="proposed ">'));
}
diff --git a/pkg/nnbd_migration/test/front_end/navigation_tree_renderer_test.dart b/pkg/nnbd_migration/test/front_end/navigation_tree_renderer_test.dart
index 77ca56e..2781783 100644
--- a/pkg/nnbd_migration/test/front_end/navigation_tree_renderer_test.dart
+++ b/pkg/nnbd_migration/test/front_end/navigation_tree_renderer_test.dart
@@ -26,19 +26,18 @@
/// Render the navigation tree view for [files].
Future<List<NavigationTreeNode>> renderNavigationTree(
Map<String, String> files) async {
- var packageRoot = convertPath('/project');
- await buildInfoForTestFiles(files, includedRoot: packageRoot);
+ await buildInfoForTestFiles(files, includedRoot: projectPath);
var migrationInfo =
- MigrationInfo(infos, {}, resourceProvider.pathContext, packageRoot);
+ MigrationInfo(infos, {}, resourceProvider.pathContext, projectPath);
pathMapper = PathMapper(resourceProvider);
return NavigationTreeRenderer(migrationInfo, pathMapper).render();
}
Future<void> test_containsEditCounts() async {
var response = await renderNavigationTree({
- convertPath('/project/lib/a.dart'): 'int a = 1;',
- convertPath('/project/lib/b.dart'): 'int b = null;',
- convertPath('/project/lib/c.dart'): 'int c = null;\nint d = null;',
+ convertPath('$projectPath/lib/a.dart'): 'int a = 1;',
+ convertPath('$projectPath/lib/b.dart'): 'int b = null;',
+ convertPath('$projectPath/lib/c.dart'): 'int c = null;\nint d = null;',
});
var libNode = response[0];
@@ -53,9 +52,9 @@
Future<void> test_containsHrefs() async {
var response = await renderNavigationTree({
- convertPath('/project/lib/a.dart'): 'int a = null;',
- convertPath('/project/lib/src/b.dart'): 'int b = null;',
- convertPath('/project/tool.dart'): 'int c = null;',
+ convertPath('$projectPath/lib/a.dart'): 'int a = null;',
+ convertPath('$projectPath/lib/src/b.dart'): 'int b = null;',
+ convertPath('$projectPath/tool.dart'): 'int c = null;',
});
var libNode = response[0];
@@ -64,20 +63,21 @@
isNavigationTreeNode.named('lib').havingSubtree([
isNavigationTreeNode.named('src').havingSubtree([
isNavigationTreeNode.havingHref(
- '/project/lib/src/b.dart', pathMapper)
+ '$projectPath/lib/src/b.dart', pathMapper)
]),
- isNavigationTreeNode.havingHref('/project/lib/a.dart', pathMapper)
+ isNavigationTreeNode.havingHref('$projectPath/lib/a.dart', pathMapper)
]));
var toolNode = response[1];
- expect(toolNode.href, pathMapper.map(convertPath('/project/tool.dart')));
+ expect(
+ toolNode.href, pathMapper.map(convertPath('$projectPath/tool.dart')));
}
Future<void> test_containsMultipleLinks_multipleDepths() async {
var response = await renderNavigationTree({
- convertPath('/project/lib/a.dart'): 'int a = null;',
- convertPath('/project/lib/src/b.dart'): 'int b = null;',
- convertPath('/project/tool.dart'): 'int c = null;',
+ convertPath('$projectPath/lib/a.dart'): 'int a = null;',
+ convertPath('$projectPath/lib/src/b.dart'): 'int b = null;',
+ convertPath('$projectPath/tool.dart'): 'int c = null;',
});
expect(response, hasLength(2));
@@ -97,8 +97,8 @@
Future<void> test_containsMultipleLinks_multipleRoots() async {
var response = await renderNavigationTree({
- convertPath('/project/bin/bin.dart'): 'int c = null;',
- convertPath('/project/lib/a.dart'): 'int a = null;',
+ convertPath('$projectPath/bin/bin.dart'): 'int c = null;',
+ convertPath('$projectPath/lib/a.dart'): 'int a = null;',
});
expect(response, hasLength(2));
@@ -115,8 +115,8 @@
Future<void> test_containsMultipleLinks_sameDepth() async {
var response = await renderNavigationTree({
- convertPath('/project/lib/a.dart'): 'int a = null;',
- convertPath('/project/lib/b.dart'): 'int b = null;',
+ convertPath('$projectPath/lib/a.dart'): 'int a = null;',
+ convertPath('$projectPath/lib/b.dart'): 'int b = null;',
});
expect(response, hasLength(1));
@@ -127,19 +127,19 @@
isNavigationTreeNode
.named('a.dart')
.havingPath(convertPath('lib/a.dart'))
- .havingHref('/project/lib/a.dart', pathMapper),
+ .havingHref('$projectPath/lib/a.dart', pathMapper),
isNavigationTreeNode
.named('b.dart')
.havingPath(convertPath('lib/b.dart'))
- .havingHref('/project/lib/b.dart', pathMapper)
+ .havingHref('$projectPath/lib/b.dart', pathMapper)
]));
}
Future<void> test_containsPaths() async {
var response = await renderNavigationTree({
- convertPath('/project/lib/a.dart'): 'int a = null;',
- convertPath('/project/lib/src/b.dart'): 'int b = null;',
- convertPath('/project/tool.dart'): 'int c = null;',
+ convertPath('$projectPath/lib/a.dart'): 'int a = null;',
+ convertPath('$projectPath/lib/src/b.dart'): 'int b = null;',
+ convertPath('$projectPath/tool.dart'): 'int c = null;',
});
var libNode = response[0];
@@ -157,7 +157,7 @@
Future<void> test_containsSingleLink_deep() async {
var response = await renderNavigationTree({
- convertPath('/project/lib/src/a.dart'): 'int a = null;',
+ convertPath('$projectPath/lib/src/a.dart'): 'int a = null;',
});
expect(response, hasLength(1));
@@ -169,21 +169,21 @@
isNavigationTreeNode
.named('a.dart')
.havingPath(convertPath('lib/src/a.dart'))
- .havingHref('/project/lib/src/a.dart', pathMapper)
+ .havingHref('$projectPath/lib/src/a.dart', pathMapper)
])
]));
}
Future<void> test_containsSingleLink_shallow() async {
var response = await renderNavigationTree({
- convertPath('/project/a.dart'): 'int a = null;',
+ convertPath('$projectPath/a.dart'): 'int a = null;',
});
expect(response, hasLength(1));
var aNode = response[0];
expect(aNode.name, 'a.dart');
expect(aNode.path, 'a.dart');
- expect(aNode.href, pathMapper.map(convertPath('/project/a.dart')));
+ expect(aNode.href, pathMapper.map(convertPath('$projectPath/a.dart')));
}
}
diff --git a/pkg/nnbd_migration/test/front_end/nnbd_migration_test_base.dart b/pkg/nnbd_migration/test/front_end/nnbd_migration_test_base.dart
index 972c478..3b31e90 100644
--- a/pkg/nnbd_migration/test/front_end/nnbd_migration_test_base.dart
+++ b/pkg/nnbd_migration/test/front_end/nnbd_migration_test_base.dart
@@ -167,10 +167,9 @@
return unit;
}
- /// Uses the InfoBuilder to build information for test files.
+ /// Uses the [InfoBuilder] to build information for test files.
///
- /// Returns
- /// the singular UnitInfo which was built.
+ /// Returns the singular [UnitInfo] which was built.
Future<List<UnitInfo>> buildInfoForTestFiles(Map<String, String> files,
{String includedRoot}) async {
var testPaths = <String>[];
diff --git a/pkg/nnbd_migration/test/front_end/unit_renderer_test.dart b/pkg/nnbd_migration/test/front_end/unit_renderer_test.dart
index e7f297a..3148db3 100644
--- a/pkg/nnbd_migration/test/front_end/unit_renderer_test.dart
+++ b/pkg/nnbd_migration/test/front_end/unit_renderer_test.dart
@@ -350,19 +350,18 @@
// addition of a `?`, but at different offsets. We make sure the `?`s get
// added at the correct locations in each file.
var files = {
- convertPath('/project/lib/a.dart'): '''
+ convertPath('$projectPath/lib/a.dart'): '''
part 'b.dart';
int f() => null;
''',
- convertPath('/project/lib/b.dart'): '''
+ convertPath('$projectPath/lib/b.dart'): '''
part of 'a.dart';
int g() => null;
''',
};
- var packageRoot = convertPath('/project');
- await buildInfoForTestFiles(files, includedRoot: packageRoot);
+ await buildInfoForTestFiles(files, includedRoot: projectPath);
var output = renderUnits();
expect(output[0].sourceCode, contains('int?'));
expect(output[1].sourceCode, contains('int?'));
diff --git a/pkg/nnbd_migration/test/instrumentation_test.dart b/pkg/nnbd_migration/test/instrumentation_test.dart
index 19cfacf..3a3856c 100644
--- a/pkg/nnbd_migration/test/instrumentation_test.dart
+++ b/pkg/nnbd_migration/test/instrumentation_test.dart
@@ -140,7 +140,8 @@
Future<void> analyze(String content,
{bool removeViaComments = false, bool warnOnWeakCode = true}) async {
- var sourcePath = convertPath('/home/test/lib/test.dart');
+ var sourcePath =
+ convertPath('${AbstractContextTest.testsPath}/lib/test.dart');
newFile(sourcePath, content: content);
var listener = TestMigrationListener();
var migration = NullabilityMigration(listener, getLineInfo,
diff --git a/pkg/nnbd_migration/test/migration_cli_test.dart b/pkg/nnbd_migration/test/migration_cli_test.dart
index febc90b..27af5aa 100644
--- a/pkg/nnbd_migration/test/migration_cli_test.dart
+++ b/pkg/nnbd_migration/test/migration_cli_test.dart
@@ -6,6 +6,7 @@
import 'dart:convert';
import 'dart:io';
+import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/file_system/file_system.dart' show ResourceProvider;
import 'package:analyzer/file_system/memory_file_system.dart';
@@ -209,6 +210,9 @@
final urlStartRegexp = RegExp('https?:');
+ final dartVersionIsNullSafeByDefault =
+ Feature.non_nullable.releaseVersion != null;
+
String assertDecodeArgsFailure(List<String> args) {
var cli = _createCli();
try {
@@ -430,20 +434,8 @@
environment:
sdk: '${migrated ? '>=2.10.0 <2.12.0' : '>=2.6.0 <3.0.0'}'
''',
- '.dart_tool/package_config.json': packageConfigText ??
- '''
-{
- "configVersion": 2,
- "packages": [
- {
- "name": "test",
- "rootUri": "../",
- "packageUri": "lib/",
- "languageVersion": "${migrated ? '2.10' : '2.6'}"
- }
- ]
-}
-''',
+ '.dart_tool/package_config.json':
+ packageConfigText ?? _getPackageConfigText(migrated: migrated),
'lib/test.dart': sourceText ??
'''
int${migrated ? '?' : ''} f() => null;
@@ -1735,20 +1727,29 @@
var projectContents = simpleProject()
..remove('.dart_tool/package_config.json');
var projectDir = createProjectDir(projectContents);
- var cliRunner = _createCli().decodeCommandLineArgs(
- _parseArgs(['--no-web-preview', '--apply-changes', projectDir]));
- await cliRunner.run();
- // The Dart source code should still be migrated.
- assertProjectContents(
- projectDir,
- simpleProject(migrated: true)
- ..remove('.dart_tool/package_config.json'));
+
+ if (dartVersionIsNullSafeByDefault) {
+ // The lack of a package config file means the test file is already opted
+ // in.
+ await assertRunFailure(
+ ['--no-web-preview', '--apply-changes', projectDir]);
+ _expectErrorIndicatingCodeIsAlreadyOptedIn();
+ } else {
+ var cliRunner = _createCli().decodeCommandLineArgs(
+ _parseArgs(['--no-web-preview', '--apply-changes', projectDir]));
+ await cliRunner.run();
+ // The Dart source code should still be migrated.
+ assertProjectContents(
+ projectDir,
+ simpleProject(migrated: true)
+ ..remove('.dart_tool/package_config.json'));
+ }
}
test_package_config_is_missing_languageVersion() async {
var packageConfigText = '''
{
- "configVersion": 3,
+ "configVersion": 2,
"packages": [
{
"name": "test",
@@ -1760,30 +1761,48 @@
''';
var projectContents = simpleProject(packageConfigText: packageConfigText);
var projectDir = createProjectDir(projectContents);
- var cliRunner = _createCli().decodeCommandLineArgs(
- _parseArgs(['--no-web-preview', '--apply-changes', projectDir]));
- await cliRunner.run();
- // The Dart source code should still be migrated.
- assertProjectContents(projectDir,
- simpleProject(migrated: true, packageConfigText: packageConfigText));
+
+ if (dartVersionIsNullSafeByDefault) {
+ // An omitted languageVersion field means the code is opted in to null
+ // safety.
+ await assertRunFailure(
+ ['--no-web-preview', '--apply-changes', projectDir]);
+ _expectErrorIndicatingCodeIsAlreadyOptedIn();
+ } else {
+ var cliRunner = _createCli().decodeCommandLineArgs(
+ _parseArgs(['--no-web-preview', '--apply-changes', projectDir]));
+ await cliRunner.run();
+ // The Dart source code should still be migrated.
+ assertProjectContents(projectDir,
+ simpleProject(migrated: true, packageConfigText: packageConfigText));
+ }
}
test_package_config_is_missing_this_package() async {
var packageConfigText = '''
{
- "configVersion": 3,
+ "configVersion": 2,
"packages": [
]
}
''';
var projectContents = simpleProject(packageConfigText: packageConfigText);
var projectDir = createProjectDir(projectContents);
- var cliRunner = _createCli().decodeCommandLineArgs(
- _parseArgs(['--no-web-preview', '--apply-changes', projectDir]));
- await cliRunner.run();
- // The Dart source code should still be migrated.
- assertProjectContents(projectDir,
- simpleProject(migrated: true, packageConfigText: packageConfigText));
+
+ if (dartVersionIsNullSafeByDefault) {
+ // An omitted entry in the package config means the code is opted in to null
+ // safety.
+ await assertRunFailure(
+ ['--no-web-preview', '--apply-changes', projectDir]);
+ _expectErrorIndicatingCodeIsAlreadyOptedIn();
+ } else {
+ var cliRunner = _createCli().decodeCommandLineArgs(
+ _parseArgs(['--no-web-preview', '--apply-changes', projectDir]));
+ await cliRunner.run();
+ // The Dart source code should still be migrated.
+ assertProjectContents(projectDir,
+ simpleProject(migrated: true, packageConfigText: packageConfigText));
+ }
}
test_package_config_is_wrong_version() async {
@@ -1802,12 +1821,20 @@
''';
var projectContents = simpleProject(packageConfigText: packageConfigText);
var projectDir = createProjectDir(projectContents);
- var cliRunner = _createCli().decodeCommandLineArgs(
- _parseArgs(['--no-web-preview', '--apply-changes', projectDir]));
- await cliRunner.run();
- // The Dart source code should still be migrated.
- assertProjectContents(projectDir,
- simpleProject(migrated: true, packageConfigText: packageConfigText));
+
+ if (dartVersionIsNullSafeByDefault) {
+ // An unreadable package config means the code is opted in to null safety.
+ await assertRunFailure(
+ ['--no-web-preview', '--apply-changes', projectDir]);
+ _expectErrorIndicatingCodeIsAlreadyOptedIn();
+ } else {
+ var cliRunner = _createCli().decodeCommandLineArgs(
+ _parseArgs(['--no-web-preview', '--apply-changes', projectDir]));
+ await cliRunner.run();
+ // The Dart source code should still be migrated.
+ assertProjectContents(projectDir,
+ simpleProject(migrated: true, packageConfigText: packageConfigText));
+ }
}
test_pub_outdated_has_malformed_json() {
@@ -1939,9 +1966,7 @@
}
test_pubspec_does_not_exist() async {
- var projectContents = simpleProject()
- ..remove('pubspec.yaml')
- ..remove('.dart_tool/package_config.json');
+ var projectContents = simpleProject()..remove('pubspec.yaml');
var projectDir = createProjectDir(projectContents);
var cliRunner = _createCli().decodeCommandLineArgs(
_parseArgs(['--no-web-preview', '--apply-changes', projectDir]));
@@ -1949,9 +1974,11 @@
// The Dart source code should still be migrated.
assertProjectContents(
projectDir,
- simpleProject(migrated: true)
- ..remove('pubspec.yaml')
- ..remove('.dart_tool/package_config.json'));
+ simpleProject(
+ migrated: true,
+ // The package config file should not have been touched.
+ packageConfigText: _getPackageConfigText(migrated: false))
+ ..remove('pubspec.yaml'));
}
test_pubspec_environment_is_missing_sdk() async {
@@ -1995,8 +2022,7 @@
environment:
sdk: 1
''';
- var projectContents = simpleProject(pubspecText: pubspecText)
- ..remove('.dart_tool/package_config.json');
+ var projectContents = simpleProject(pubspecText: pubspecText);
var projectDir = createProjectDir(projectContents);
var cliRunner = _createCli().decodeCommandLineArgs(
_parseArgs(['--no-web-preview', '--apply-changes', projectDir]));
@@ -2004,8 +2030,11 @@
// The Dart source code should still be migrated.
assertProjectContents(
projectDir,
- simpleProject(migrated: true, pubspecText: pubspecText)
- ..remove('.dart_tool/package_config.json'));
+ simpleProject(
+ migrated: true,
+ pubspecText: pubspecText,
+ // The package config file should not have been touched.
+ packageConfigText: _getPackageConfigText(migrated: false)));
}
test_pubspec_is_missing_environment() async {
@@ -2055,6 +2084,15 @@
return _MigrationCli(this);
}
+ void _expectErrorIndicatingCodeIsAlreadyOptedIn() {
+ var errorOutput = logger.stdoutBuffer.toString();
+ expect(errorOutput, contains('1 analysis issue found:'));
+ expect(
+ errorOutput,
+ contains("A value of type 'Null' can't be returned from function 'f' "
+ "because it has a return type of 'int'"));
+ }
+
String _getHelpText({@required bool verbose}) {
var cliRunner = _createCli().decodeCommandLineArgs(_parseArgs(
['--${CommandLineOptions.helpFlag}', if (verbose) '--verbose']));
@@ -2066,6 +2104,20 @@
ArgResults _parseArgs(List<String> args) {
return MigrationCli.createParser().parse(args);
}
+
+ static String _getPackageConfigText({@required bool migrated}) => '''
+{
+ "configVersion": 2,
+ "packages": [
+ {
+ "name": "test",
+ "rootUri": "../",
+ "packageUri": "lib/",
+ "languageVersion": "${migrated ? '2.10' : '2.6'}"
+ }
+ ]
+}
+''';
}
@reflectiveTest
diff --git a/pkg/vm/bin/dump_bytecode_ngrams.dart b/pkg/vm/bin/dump_bytecode_ngrams.dart
deleted file mode 100644
index 50ec2a4..0000000
--- a/pkg/vm/bin/dump_bytecode_ngrams.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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.
-
-import 'dart:io' as io;
-
-import 'package:args/args.dart' show ArgParser, ArgResults;
-import 'package:vm/bytecode/ngrams.dart';
-
-final ArgParser _argParser = new ArgParser(allowTrailingOptions: true)
- ..addFlag('basic-blocks',
- help: 'Only allow control flow as the last instruction in a window',
- defaultsTo: true)
- ..addOption('output',
- abbr: 'o', help: 'Path to output file', defaultsTo: null)
- ..addFlag('merge-pushes',
- help: 'Do not distinguish among different kinds of Push opcodes',
- defaultsTo: false)
- ..addFlag('sort',
- abbr: 's', help: 'Sort the output by ngram frequency', defaultsTo: true)
- ..addOption('threshold',
- abbr: 't', help: 'Minimum ngram count threshold', defaultsTo: "1")
- ..addOption('window', abbr: 'w', help: 'Window size', defaultsTo: "3");
-
-final String _usage = '''
-Usage: dump_bytecode_ngrams [options] input.trace
-
-Dumps stats about a dynamic bytecode instruction trace produced with the
-Dart VM option --interpreter-trace-file, e.g.:
-
-\$ dart --enable-interpreter --interpreter-trace-file=trace program.dart
-
-Options:
-${_argParser.usage}
-''';
-
-const int _badUsageExitCode = 1;
-
-void main(List<String> arguments) {
- final ArgResults options = _argParser.parse(arguments);
- if ((options.rest.length != 1) || (options['output'] == null)) {
- print(_usage);
- io.exit(_badUsageExitCode);
- }
-
- final basicBlocks = options['basic-blocks'];
- final input = options.rest.single;
- final output = options['output'];
- final mergePushes = options['merge-pushes'];
- final windowSize = int.parse(options['window']);
- final sort = options['sort'];
- final threshold = int.parse(options['threshold']);
-
- if (!(new io.File(input).existsSync())) {
- print("The file '$input' does not exist");
- print(_usage);
- io.exit(_badUsageExitCode);
- }
-
- NGramReader nGramReader = new NGramReader(input);
- nGramReader.readAllNGrams(windowSize,
- basicBlocks: basicBlocks, mergePushes: mergePushes);
- nGramReader.writeNGramStats(output, sort: sort, minCount: threshold);
-}
diff --git a/pkg/vm/bin/dump_kernel.dart b/pkg/vm/bin/dump_kernel.dart
index 852c073..d41077f 100644
--- a/pkg/vm/bin/dump_kernel.dart
+++ b/pkg/vm/bin/dump_kernel.dart
@@ -8,7 +8,6 @@
import 'package:kernel/binary/ast_from_binary.dart'
show BinaryBuilderWithMetadata;
-import 'package:vm/metadata/bytecode.dart' show BytecodeMetadataRepository;
import 'package:vm/metadata/direct_call.dart' show DirectCallMetadataRepository;
import 'package:vm/metadata/inferred_type.dart'
show InferredTypeMetadataRepository;
@@ -48,7 +47,6 @@
component.addMetadataRepository(new TableSelectorMetadataRepository());
component.addMetadataRepository(new UnboxingInfoMetadataRepository());
component.addMetadataRepository(new UnreachableNodeMetadataRepository());
- component.addMetadataRepository(new BytecodeMetadataRepository());
component.addMetadataRepository(new CallSiteAttributesMetadataRepository());
component.addMetadataRepository(new LoadingUnitsMetadataRepository());
diff --git a/pkg/vm/bin/kernel_service.dart b/pkg/vm/bin/kernel_service.dart
index b980799..778ccc0 100644
--- a/pkg/vm/bin/kernel_service.dart
+++ b/pkg/vm/bin/kernel_service.dart
@@ -39,15 +39,9 @@
import 'package:kernel/core_types.dart' show CoreTypes;
import 'package:kernel/kernel.dart' show Component, Library, Procedure;
import 'package:kernel/target/targets.dart' show TargetFlags;
-import 'package:vm/bytecode/gen_bytecode.dart'
- show createFreshComponentWithBytecode, generateBytecode;
-import 'package:vm/bytecode/options.dart' show BytecodeOptions;
import 'package:vm/incremental_compiler.dart';
import 'package:vm/kernel_front_end.dart'
- show
- autoDetectNullSafetyMode,
- createLoadedLibrariesSet,
- runWithFrontEndCompilerContext;
+ show autoDetectNullSafetyMode, createLoadedLibrariesSet;
import 'package:vm/http_filesystem.dart';
import 'package:vm/target/vm.dart' show VmTarget;
import 'package:front_end/src/api_prototype/compiler_options.dart'
@@ -99,7 +93,6 @@
bool enableAsserts,
int nullSafety,
List<String> experimentalFlags,
- bool bytecode,
Uri packagesUri,
List<String> errors) {
final expFlags = <String>[];
@@ -117,7 +110,6 @@
..sdkSummary = platformKernelPath
..verbose = verbose
..omitPlatform = true
- ..bytecode = bytecode
..explicitExperimentalFlags = parseExperimentalFlags(
parseExperimentalArguments(expFlags),
onError: (msg) => errors.add(msg))
@@ -156,7 +148,6 @@
final bool enableAsserts;
final int nullSafety;
final List<String> experimentalFlags;
- final bool bytecode;
final String packageConfig;
// Code coverage and hot reload are only supported by incremental compiler,
@@ -173,7 +164,6 @@
this.enableAsserts: false,
this.nullSafety: kNullSafetyOptionUnspecified,
this.experimentalFlags: null,
- this.bytecode: false,
this.supportCodeCoverage: false,
this.supportHotReload: false,
this.packageConfig: null}) {
@@ -198,67 +188,20 @@
enableAsserts,
nullSafety,
experimentalFlags,
- bytecode,
packagesUri,
errors);
}
Future<CompilerResult> compile(Uri script) {
return runWithPrintToStderr(() async {
- CompilerResult compilerResult = await compileInternal(script);
- Component component = compilerResult.component;
+ final CompilerResult compilerResult = await compileInternal(script);
+ final Component component = compilerResult.component;
if (errors.isEmpty) {
- // Record dependencies only if compilation was error free, and before
- // createFreshComponentWithBytecode drops the uriToSource table.
+ // Record dependencies only if compilation was error free.
_recordDependencies(isolateId, component, options.packagesFileUri);
}
- if (options.bytecode && errors.isEmpty) {
- final List<Library> libraries = new List<Library>();
- final Set<Library> loadedLibraries = compilerResult.loadedLibraries;
- for (Library library in component.libraries) {
- if (loadedLibraries.contains(library)) continue;
- libraries.add(library);
- }
-
- await runWithFrontEndCompilerContext(script, options, component, () {
- // TODO(alexmarkov): disable local variables info,
- // debugger stops and source files in VM PRODUCT mode.
- // TODO(rmacnak): disable annotations if mirrors are not enabled.
- generateBytecode(component,
- libraries: libraries,
- coreTypes: compilerResult.coreTypes,
- hierarchy: compilerResult.classHierarchy,
- options: new BytecodeOptions(
- enableAsserts: enableAsserts,
- environmentDefines: options.environmentDefines,
- // Needed both for stack traces and the debugger.
- emitSourcePositions: true,
- // Only needed when the debugger is available.
- emitLocalVarInfo: true,
- // Only needed when the debugger is available.
- emitDebuggerStops: true,
- // Only needed when the VM service is available.
- emitSourceFiles: true,
- // Only needed when reload is available.
- emitInstanceFieldInitializers: supportHotReload,
- // Only needed when mirrors are available.
- emitAnnotations: true,
- // Only needed when observatory (source report) is available.
- keepUnreachableCode: supportCodeCoverage,
- avoidClosureCallInstructions: supportCodeCoverage,
- ));
- Component freshComponent =
- createFreshComponentWithBytecode(component);
- compilerResult = new CompilerResult(
- freshComponent,
- compilerResult.loadedLibraries,
- compilerResult.classHierarchy,
- compilerResult.coreTypes);
- });
- }
-
return compilerResult;
});
}
@@ -336,14 +279,12 @@
bool enableAsserts: false,
int nullSafety: kNullSafetyOptionUnspecified,
List<String> experimentalFlags: null,
- bool bytecode: false,
String packageConfig: null})
: super(isolateId, fileSystem, platformKernelPath,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
- bytecode: bytecode,
supportHotReload: true,
supportCodeCoverage: true,
packageConfig: packageConfig);
@@ -356,14 +297,12 @@
{bool suppressWarnings: false,
bool enableAsserts: false,
List<String> experimentalFlags: null,
- bool bytecode: false,
String packageConfig: null}) {
IncrementalCompilerWrapper result = IncrementalCompilerWrapper(
isolateId, fileSystem, platformKernelPath,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
experimentalFlags: experimentalFlags,
- bytecode: bytecode,
packageConfig: packageConfig);
result.generator = new IncrementalCompiler.forExpressionCompilationOnly(
component,
@@ -393,7 +332,6 @@
enableAsserts: enableAsserts,
nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
- bytecode: bytecode,
packageConfig: packageConfig);
generator.resetDeltaState();
@@ -424,14 +362,12 @@
bool enableAsserts: false,
int nullSafety: kNullSafetyOptionUnspecified,
List<String> experimentalFlags: null,
- bool bytecode: false,
String packageConfig: null})
: super(isolateId, fileSystem, platformKernelPath,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
- bytecode: bytecode,
packageConfig: packageConfig);
@override
@@ -466,7 +402,6 @@
bool enableAsserts: false,
int nullSafety: kNullSafetyOptionUnspecified,
List<String> experimentalFlags: null,
- bool bytecode: false,
String packageConfig: null,
String multirootFilepaths,
String multirootScheme}) async {
@@ -498,7 +433,6 @@
enableAsserts: enableAsserts,
nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
- bytecode: bytecode,
packageConfig: packageConfig);
}
isolateCompilers[isolateId] = compiler;
@@ -552,7 +486,6 @@
final bool enableAsserts = request[13];
final List<String> experimentalFlags =
request[14] != null ? request[14].cast<String>() : null;
- final bool bytecode = request[15];
IncrementalCompilerWrapper compiler = isolateCompilers[isolateId];
@@ -635,7 +568,6 @@
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
experimentalFlags: experimentalFlags,
- bytecode: bytecode,
packageConfig: dotPackagesFile);
isolateCompilers[isolateId] = compiler;
await compiler.compile(
@@ -678,19 +610,6 @@
result = new CompilationResult.errors(compiler.errors, null);
} else {
Component component = createExpressionEvaluationComponent(procedure);
- if (compiler.bytecode) {
- await runWithFrontEndCompilerContext(
- compiler.generator.entryPoint, compiler.options, component, () {
- generateBytecode(component,
- coreTypes: compiler.generator.getCoreTypes(),
- hierarchy: compiler.generator.getClassHierarchy(),
- options: new BytecodeOptions(
- enableAsserts: compiler.enableAsserts,
- environmentDefines: compiler.options.environmentDefines,
- ));
- component = createFreshComponentWithBytecode(component);
- });
- }
result = new CompilationResult.ok(serializeComponent(component));
}
} catch (error, stack) {
@@ -813,7 +732,6 @@
final bool enableAsserts = request[9];
final List<String> experimentalFlags =
request[10] != null ? request[10].cast<String>() : null;
- final bool bytecode = request[11];
final String packageConfig = request[12];
final String multirootFilepaths = request[13];
final String multirootScheme = request[14];
@@ -876,7 +794,7 @@
}
final List<String> errors = <String>[];
var options = setupCompilerOptions(fileSystem, platformKernelPath, false,
- false, nullSafety, experimentalFlags, false, packagesUri, errors);
+ false, nullSafety, experimentalFlags, packagesUri, errors);
// script should only be null for kUpdateSourcesTag.
assert(script != null);
@@ -900,7 +818,6 @@
enableAsserts: enableAsserts,
nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
- bytecode: bytecode,
packageConfig: packageConfig,
multirootFilepaths: multirootFilepaths,
multirootScheme: multirootScheme);
@@ -914,7 +831,6 @@
enableAsserts: enableAsserts,
nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
- bytecode: bytecode,
packageConfig: packageConfig);
}
@@ -1016,9 +932,9 @@
return fileSystem;
}
-train(String scriptUri, String platformKernelPath, bool bytecode) async {
+train(String scriptUri, String platformKernelPath) async {
// Train on program asked to train on.
- await trainInternal(scriptUri, platformKernelPath, bytecode);
+ await trainInternal(scriptUri, platformKernelPath);
// Also train a few times on a hello-world program to make sure we exercise
// the startup sequence.
@@ -1032,16 +948,14 @@
""");
try {
for (int i = 0; i < 10; i++) {
- await trainInternal(
- helloDart.uri.toString(), platformKernelPath, bytecode);
+ await trainInternal(helloDart.uri.toString(), platformKernelPath);
}
} finally {
tmpDir.deleteSync(recursive: true);
}
}
-Future trainInternal(
- String scriptUri, String platformKernelPath, bool bytecode) async {
+Future trainInternal(String scriptUri, String platformKernelPath) async {
var tag = kTrainTag;
var responsePort = new RawReceivePort();
responsePort.handler = (response) {
@@ -1067,7 +981,7 @@
false /* suppress warnings */,
false /* enable asserts */,
null /* experimental_flags */,
- bytecode,
+ null /* unused */,
null /* package_config */,
null /* multirootFilepaths */,
null /* multirootScheme */,
@@ -1081,17 +995,11 @@
// This entry point is used when creating an app snapshot.
// It takes the following extra arguments:
// 1) Script to compile.
- // 2) Optional '--bytecode' argument to train bytecode generation.
- // 3) Optional platform kernel path.
+ // 2) Optional platform kernel path.
int argIndex = 1;
final String script = args[argIndex++];
- bool bytecode = false;
- if ((argIndex < args.length) && (args[argIndex] == '--bytecode')) {
- bytecode = true;
- ++argIndex;
- }
final String platform = (argIndex < args.length) ? args[argIndex] : null;
- train(script, platform, bytecode);
+ train(script, platform);
} else {
// Entry point for the Kernel isolate.
return new RawReceivePort()..handler = _processLoadRequest;
diff --git a/pkg/vm/bin/protobuf_aware_treeshaker.dart b/pkg/vm/bin/protobuf_aware_treeshaker.dart
index 143a4c6..d1fa2d1 100644
--- a/pkg/vm/bin/protobuf_aware_treeshaker.dart
+++ b/pkg/vm/bin/protobuf_aware_treeshaker.dart
@@ -52,9 +52,6 @@
help: 'If set, produces kernel file for AOT compilation (enables '
'global transformations). Otherwise, writes regular dill.',
defaultsTo: false)
- ..addFlag('gen-bytecode',
- help:
- 'If true, the kernel file will be output in bytecode format. Defaults to true if --aot, false otherwise')
..addFlag('write-txt',
help: 'Also write the result in kernel-text format as <out.dill>.txt',
defaultsTo: false)
diff --git a/pkg/vm/lib/bytecode/assembler.dart b/pkg/vm/lib/bytecode/assembler.dart
deleted file mode 100644
index be95068..0000000
--- a/pkg/vm/lib/bytecode/assembler.dart
+++ /dev/null
@@ -1,759 +0,0 @@
-// 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.
-
-library vm.bytecode.assembler;
-
-import 'package:kernel/ast.dart' show TreeNode;
-import 'package:vm/bytecode/options.dart';
-
-import 'dbc.dart';
-import 'exceptions.dart' show ExceptionsTable;
-import 'local_variable_table.dart' show LocalVariableTable;
-import 'source_positions.dart' show SourcePositions;
-
-import 'dart:typed_data' show Uint8List;
-
-class Label {
- final bool allowsBackwardJumps;
- List<int> _jumps = <int>[];
- int offset = -1;
-
- Label({this.allowsBackwardJumps: false});
-
- bool get isBound => offset >= 0;
-
- int jumpOperand(int jumpOffset) {
- if (isBound) {
- if (offset <= jumpOffset && !allowsBackwardJumps) {
- throw 'Backward jump to this label is not allowed';
- }
- // Jump instruction takes a relative offset.
- return offset - jumpOffset;
- }
- _jumps.add(jumpOffset);
- return 0;
- }
-
- List<int> bind(int offset) {
- assert(!isBound);
- this.offset = offset;
- final jumps = _jumps;
- _jumps = null;
- return jumps;
- }
-}
-
-class BytecodeAssembler {
- static const int kByteMask = 0xFF;
- static const int kUint32Mask = 0xFFFFFFFF;
- static const int kMinInt8 = -0x80;
- static const int kMaxInt8 = 0x7F;
- static const int kMinInt24 = -0x800000;
- static const int kMaxInt24 = 0x7FFFFF;
- static const int kMinInt32 = -0x80000000;
- static const int kMaxInt32 = 0x7FFFFFFF;
-
- static const int kInitialCapacity = 32;
-
- int _length = 0;
- Uint8List _buffer = new Uint8List(kInitialCapacity);
-
- final ExceptionsTable exceptionsTable = new ExceptionsTable();
- final LocalVariableTable localVariableTable = new LocalVariableTable();
- final SourcePositions sourcePositions = new SourcePositions();
- final bool _emitSourcePositions;
- bool isUnreachable = false;
- int currentSourcePosition = TreeNode.noOffset;
-
- BytecodeAssembler(BytecodeOptions options)
- : _emitSourcePositions = options.emitSourcePositions;
-
- int get offset => _length;
-
- Uint8List get bytecode => new Uint8List.view(_buffer.buffer, 0, _length);
-
- void bind(Label label) {
- final List<int> jumps = label.bind(offset);
- for (int jumpOffset in jumps) {
- _patchJump(jumpOffset, label.jumpOperand(jumpOffset));
- }
- if (jumps.isNotEmpty || label.allowsBackwardJumps) {
- isUnreachable = false;
- }
- }
-
- @pragma('vm:prefer-inline')
- void emitSourcePosition() {
- if (_emitSourcePositions &&
- !isUnreachable &&
- currentSourcePosition != TreeNode.noOffset) {
- sourcePositions.add(offset, currentSourcePosition);
- }
- }
-
- // TreeNode.noOffset (-1) source position on calls is used to mark synthetic
- // calls without corresponding source position. Debugger uses the absence of
- // source position to distinguish these calls and avoid stopping at them
- // while single stepping.
- @pragma('vm:prefer-inline')
- void emitSourcePositionForCall() {
- if (_emitSourcePositions && !isUnreachable) {
- sourcePositions.add(
- offset,
- currentSourcePosition == TreeNode.noOffset
- ? SourcePositions.syntheticCodeMarker
- : currentSourcePosition);
- }
- }
-
- void emitYieldPointSourcePosition(int yieldSourcePosition) {
- if (!isUnreachable) {
- sourcePositions.addYieldPoint(offset, yieldSourcePosition);
- }
- }
-
- void _grow() {
- final newSize = _buffer.length << 1;
- final newBuffer = new Uint8List(newSize);
- newBuffer.setRange(0, _buffer.length, _buffer);
- _buffer = newBuffer;
- }
-
- void _growAndEmitBytes(int b0, [int b1, int b2, int b3, int b4, int b5]) {
- _grow();
- assert(_length + 6 < _buffer.length);
- _buffer[_length] = b0;
- ++_length;
- if (b1 != null) {
- _buffer[_length] = b1;
- ++_length;
- if (b2 != null) {
- _buffer[_length] = b2;
- ++_length;
- if (b3 != null) {
- _buffer[_length] = b3;
- ++_length;
- if (b4 != null) {
- _buffer[_length] = b4;
- ++_length;
- if (b5 != null) {
- _buffer[_length] = b5;
- ++_length;
- }
- }
- }
- }
- }
- }
-
- @pragma('vm:prefer-inline')
- void _emitByte(int abyte) {
- assert(_isUint8(abyte));
- if (_length < _buffer.length) {
- _buffer[_length] = abyte;
- ++_length;
- } else {
- _growAndEmitBytes(abyte);
- }
- }
-
- @pragma('vm:prefer-inline')
- void _emitBytes2(int b0, int b1) {
- assert(_isUint8(b0) && _isUint8(b1));
- if (_length + 1 < _buffer.length) {
- _buffer[_length] = b0;
- _buffer[_length + 1] = b1;
- _length += 2;
- } else {
- _growAndEmitBytes(b0, b1);
- }
- }
-
- @pragma('vm:prefer-inline')
- void _emitBytes3(int b0, int b1, int b2) {
- assert(_isUint8(b0) && _isUint8(b1) && _isUint8(b2));
- if (_length + 2 < _buffer.length) {
- _buffer[_length] = b0;
- _buffer[_length + 1] = b1;
- _buffer[_length + 2] = b2;
- _length += 3;
- } else {
- _growAndEmitBytes(b0, b1, b2);
- }
- }
-
- @pragma('vm:prefer-inline')
- void _emitBytes4(int b0, int b1, int b2, int b3) {
- assert(_isUint8(b0) && _isUint8(b1) && _isUint8(b2) && _isUint8(b3));
- if (_length + 3 < _buffer.length) {
- _buffer[_length] = b0;
- _buffer[_length + 1] = b1;
- _buffer[_length + 2] = b2;
- _buffer[_length + 3] = b3;
- _length += 4;
- } else {
- _growAndEmitBytes(b0, b1, b2, b3);
- }
- }
-
- void _emitBytes5(int b0, int b1, int b2, int b3, int b4) {
- assert(_isUint8(b0) &&
- _isUint8(b1) &&
- _isUint8(b2) &&
- _isUint8(b3) &&
- _isUint8(b4));
- if (_length + 4 < _buffer.length) {
- _buffer[_length] = b0;
- _buffer[_length + 1] = b1;
- _buffer[_length + 2] = b2;
- _buffer[_length + 3] = b3;
- _buffer[_length + 4] = b4;
- _length += 5;
- } else {
- _growAndEmitBytes(b0, b1, b2, b3, b4);
- }
- }
-
- void _emitBytes6(int b0, int b1, int b2, int b3, int b4, int b5) {
- assert(_isUint8(b0) &&
- _isUint8(b1) &&
- _isUint8(b2) &&
- _isUint8(b3) &&
- _isUint8(b4) &&
- _isUint8(b5));
- if (_length + 5 < _buffer.length) {
- _buffer[_length] = b0;
- _buffer[_length + 1] = b1;
- _buffer[_length + 2] = b2;
- _buffer[_length + 3] = b3;
- _buffer[_length + 4] = b4;
- _buffer[_length + 5] = b5;
- _length += 6;
- } else {
- _growAndEmitBytes(b0, b1, b2, b3, b4, b5);
- }
- }
-
- int _byteAt(int pos) {
- return _buffer[pos];
- }
-
- void _setByteAt(int pos, int value) {
- assert(_isUint8(value));
- _buffer[pos] = value;
- }
-
- @pragma('vm:prefer-inline')
- int _byte0(int v) => v & kByteMask;
-
- @pragma('vm:prefer-inline')
- int _byte1(int v) => (v >> 8) & kByteMask;
-
- @pragma('vm:prefer-inline')
- int _byte2(int v) => (v >> 16) & kByteMask;
-
- @pragma('vm:prefer-inline')
- int _byte3(int v) => (v >> 24) & kByteMask;
-
- @pragma('vm:prefer-inline')
- bool _isInt8(int v) => (kMinInt8 <= v) && (v <= kMaxInt8);
-
- @pragma('vm:prefer-inline')
- bool _isInt24(int v) => (kMinInt24 <= v) && (v <= kMaxInt24);
-
- @pragma('vm:prefer-inline')
- bool _isInt32(int v) => (kMinInt32 <= v) && (v <= kMaxInt32);
-
- @pragma('vm:prefer-inline')
- bool _isUint8(int v) => (v & kByteMask) == v;
-
- @pragma('vm:prefer-inline')
- bool _isUint32(int v) => (v & kUint32Mask) == v;
-
- @pragma('vm:prefer-inline')
- void _emitInstruction0(Opcode opcode) {
- if (isUnreachable) {
- return;
- }
- _emitByte(opcode.index);
- }
-
- @pragma('vm:prefer-inline')
- void _emitInstructionA(Opcode opcode, int ra) {
- if (isUnreachable) {
- return;
- }
- _emitBytes2(opcode.index, ra);
- }
-
- @pragma('vm:prefer-inline')
- void _emitInstructionD(Opcode opcode, int rd) {
- if (isUnreachable) {
- return;
- }
- if (_isUint8(rd)) {
- _emitBytes2(opcode.index, rd);
- } else {
- assert(_isUint32(rd));
- _emitBytes5(opcode.index + kWideModifier, _byte0(rd), _byte1(rd),
- _byte2(rd), _byte3(rd));
- }
- }
-
- @pragma('vm:prefer-inline')
- void _emitInstructionX(Opcode opcode, int rx) {
- if (isUnreachable) {
- return;
- }
- if (_isInt8(rx)) {
- _emitBytes2(opcode.index, rx & kByteMask);
- } else {
- assert(_isInt32(rx));
- _emitBytes5(opcode.index + kWideModifier, _byte0(rx), _byte1(rx),
- _byte2(rx), _byte3(rx));
- }
- }
-
- @pragma('vm:prefer-inline')
- void _emitInstructionAE(Opcode opcode, int ra, int re) {
- if (isUnreachable) {
- return;
- }
- if (_isUint8(re)) {
- _emitBytes3(opcode.index, ra, re);
- } else {
- assert(_isUint32(re));
- _emitBytes6(opcode.index + kWideModifier, ra, _byte0(re), _byte1(re),
- _byte2(re), _byte3(re));
- }
- }
-
- @pragma('vm:prefer-inline')
- void _emitInstructionAY(Opcode opcode, int ra, int ry) {
- if (isUnreachable) {
- return;
- }
- if (_isInt8(ry)) {
- _emitBytes3(opcode.index, ra, ry & kByteMask);
- } else {
- assert(_isInt32(ry));
- _emitBytes6(opcode.index + kWideModifier, ra, _byte0(ry), _byte1(ry),
- _byte2(ry), _byte3(ry));
- }
- }
-
- @pragma('vm:prefer-inline')
- void _emitInstructionDF(Opcode opcode, int rd, int rf) {
- if (isUnreachable) {
- return;
- }
- if (_isUint8(rd)) {
- _emitBytes3(opcode.index, rd, rf);
- } else {
- assert(_isUint32(rd));
- _emitBytes6(opcode.index + kWideModifier, _byte0(rd), _byte1(rd),
- _byte2(rd), _byte3(rd), rf);
- }
- }
-
- @pragma('vm:prefer-inline')
- void _emitInstructionABC(Opcode opcode, int ra, int rb, int rc) {
- if (isUnreachable) {
- return;
- }
- _emitBytes4(opcode.index, ra, rb, rc);
- }
-
- @pragma('vm:prefer-inline')
- void emitSpecializedBytecode(Opcode opcode) {
- assert(BytecodeFormats[opcode].encoding == Encoding.k0);
- emitSourcePosition();
- _emitInstruction0(opcode);
- }
-
- @pragma('vm:prefer-inline')
- void _emitJumpInstruction(Opcode opcode, Label label) {
- assert(isJump(opcode));
- if (isUnreachable) {
- return;
- }
- final int target = label.jumpOperand(offset);
- // Use compact representation only for backwards jumps.
- // TODO(alexmarkov): generate compact forward jumps as well.
- if (label.isBound && _isInt8(target)) {
- _emitBytes2(opcode.index, target & kByteMask);
- } else {
- assert(_isInt24(target));
- _emitBytes4(opcode.index + kWideModifier, _byte0(target), _byte1(target),
- _byte2(target));
- }
- }
-
- void _patchJump(int pos, int rt) {
- final Opcode opcode = Opcode.values[_byteAt(pos) - kWideModifier];
- assert(hasWideVariant(opcode));
- assert(isJump(opcode));
- assert(_isInt24(rt));
- _setByteAt(pos + 1, _byte0(rt));
- _setByteAt(pos + 2, _byte1(rt));
- _setByteAt(pos + 3, _byte2(rt));
- }
-
- void emitTrap() {
- _emitInstruction0(Opcode.kTrap);
- isUnreachable = true;
- }
-
- @pragma('vm:prefer-inline')
- void emitDrop1() {
- _emitInstruction0(Opcode.kDrop1);
- }
-
- @pragma('vm:prefer-inline')
- void emitJump(Label label) {
- _emitJumpInstruction(Opcode.kJump, label);
- isUnreachable = true;
- }
-
- @pragma('vm:prefer-inline')
- void emitJumpIfNoAsserts(Label label) {
- _emitJumpInstruction(Opcode.kJumpIfNoAsserts, label);
- }
-
- @pragma('vm:prefer-inline')
- void emitJumpIfNotZeroTypeArgs(Label label) {
- _emitJumpInstruction(Opcode.kJumpIfNotZeroTypeArgs, label);
- }
-
- @pragma('vm:prefer-inline')
- void emitJumpIfEqStrict(Label label) {
- _emitJumpInstruction(Opcode.kJumpIfEqStrict, label);
- }
-
- @pragma('vm:prefer-inline')
- void emitJumpIfNeStrict(Label label) {
- _emitJumpInstruction(Opcode.kJumpIfNeStrict, label);
- }
-
- @pragma('vm:prefer-inline')
- void emitJumpIfTrue(Label label) {
- _emitJumpInstruction(Opcode.kJumpIfTrue, label);
- }
-
- @pragma('vm:prefer-inline')
- void emitJumpIfFalse(Label label) {
- _emitJumpInstruction(Opcode.kJumpIfFalse, label);
- }
-
- @pragma('vm:prefer-inline')
- void emitJumpIfNull(Label label) {
- _emitJumpInstruction(Opcode.kJumpIfNull, label);
- }
-
- @pragma('vm:prefer-inline')
- void emitJumpIfNotNull(Label label) {
- _emitJumpInstruction(Opcode.kJumpIfNotNull, label);
- }
-
- @pragma('vm:prefer-inline')
- void emitJumpIfUnchecked(Label label) {
- _emitJumpInstruction(Opcode.kJumpIfUnchecked, label);
- }
-
- @pragma('vm:prefer-inline')
- void emitReturnTOS() {
- emitSourcePosition();
- _emitInstruction0(Opcode.kReturnTOS);
- isUnreachable = true;
- }
-
- @pragma('vm:prefer-inline')
- void emitPush(int rx) {
- _emitInstructionX(Opcode.kPush, rx);
- }
-
- @pragma('vm:prefer-inline')
- void emitLoadConstant(int ra, int re) {
- _emitInstructionAE(Opcode.kLoadConstant, ra, re);
- }
-
- @pragma('vm:prefer-inline')
- void emitPushConstant(int rd) {
- _emitInstructionD(Opcode.kPushConstant, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitPushNull() {
- _emitInstruction0(Opcode.kPushNull);
- }
-
- @pragma('vm:prefer-inline')
- void emitPushTrue() {
- _emitInstruction0(Opcode.kPushTrue);
- }
-
- @pragma('vm:prefer-inline')
- void emitPushFalse() {
- _emitInstruction0(Opcode.kPushFalse);
- }
-
- @pragma('vm:prefer-inline')
- void emitPushInt(int rx) {
- _emitInstructionX(Opcode.kPushInt, rx);
- }
-
- @pragma('vm:prefer-inline')
- void emitStoreLocal(int rx) {
- _emitInstructionX(Opcode.kStoreLocal, rx);
- }
-
- @pragma('vm:prefer-inline')
- void emitPopLocal(int rx) {
- _emitInstructionX(Opcode.kPopLocal, rx);
- }
-
- @pragma('vm:prefer-inline')
- void emitDirectCall(int rd, int rf) {
- emitSourcePositionForCall();
- _emitInstructionDF(Opcode.kDirectCall, rd, rf);
- }
-
- @pragma('vm:prefer-inline')
- void emitUncheckedDirectCall(int rd, int rf) {
- emitSourcePositionForCall();
- _emitInstructionDF(Opcode.kUncheckedDirectCall, rd, rf);
- }
-
- @pragma('vm:prefer-inline')
- void emitInterfaceCall(int rd, int rf) {
- emitSourcePositionForCall();
- _emitInstructionDF(Opcode.kInterfaceCall, rd, rf);
- }
-
- @pragma('vm:prefer-inline')
- void emitInstantiatedInterfaceCall(int rd, int rf) {
- emitSourcePositionForCall();
- _emitInstructionDF(Opcode.kInstantiatedInterfaceCall, rd, rf);
- }
-
- @pragma('vm:prefer-inline')
- void emitUncheckedClosureCall(int rd, int rf) {
- emitSourcePositionForCall();
- _emitInstructionDF(Opcode.kUncheckedClosureCall, rd, rf);
- }
-
- @pragma('vm:prefer-inline')
- void emitUncheckedInterfaceCall(int rd, int rf) {
- emitSourcePositionForCall();
- _emitInstructionDF(Opcode.kUncheckedInterfaceCall, rd, rf);
- }
-
- @pragma('vm:prefer-inline')
- void emitDynamicCall(int rd, int rf) {
- emitSourcePositionForCall();
- _emitInstructionDF(Opcode.kDynamicCall, rd, rf);
- }
-
- @pragma('vm:prefer-inline')
- void emitNativeCall(int rd) {
- _emitInstructionD(Opcode.kNativeCall, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitLoadStatic(int rd) {
- _emitInstructionD(Opcode.kLoadStatic, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitStoreStaticTOS(int rd) {
- emitSourcePosition();
- _emitInstructionD(Opcode.kStoreStaticTOS, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitCreateArrayTOS() {
- _emitInstruction0(Opcode.kCreateArrayTOS);
- }
-
- @pragma('vm:prefer-inline')
- void emitAllocate(int rd) {
- emitSourcePosition();
- _emitInstructionD(Opcode.kAllocate, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitAllocateT() {
- emitSourcePosition();
- _emitInstruction0(Opcode.kAllocateT);
- }
-
- @pragma('vm:prefer-inline')
- void emitStoreIndexedTOS() {
- _emitInstruction0(Opcode.kStoreIndexedTOS);
- }
-
- @pragma('vm:prefer-inline')
- void emitStoreFieldTOS(int rd) {
- emitSourcePosition();
- _emitInstructionD(Opcode.kStoreFieldTOS, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitStoreContextParent() {
- _emitInstruction0(Opcode.kStoreContextParent);
- }
-
- @pragma('vm:prefer-inline')
- void emitStoreContextVar(int ra, int re) {
- _emitInstructionAE(Opcode.kStoreContextVar, ra, re);
- }
-
- @pragma('vm:prefer-inline')
- void emitLoadFieldTOS(int rd) {
- _emitInstructionD(Opcode.kLoadFieldTOS, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitLoadTypeArgumentsField(int rd) {
- _emitInstructionD(Opcode.kLoadTypeArgumentsField, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitLoadContextParent() {
- _emitInstruction0(Opcode.kLoadContextParent);
- }
-
- @pragma('vm:prefer-inline')
- void emitLoadContextVar(int ra, int re) {
- _emitInstructionAE(Opcode.kLoadContextVar, ra, re);
- }
-
- @pragma('vm:prefer-inline')
- void emitBooleanNegateTOS() {
- _emitInstruction0(Opcode.kBooleanNegateTOS);
- }
-
- @pragma('vm:prefer-inline')
- void emitThrow(int ra) {
- emitSourcePosition();
- _emitInstructionA(Opcode.kThrow, ra);
- isUnreachable = true;
- }
-
- @pragma('vm:prefer-inline')
- void emitEntry(int rd) {
- _emitInstructionD(Opcode.kEntry, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitFrame(int rd) {
- _emitInstructionD(Opcode.kFrame, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitSetFrame(int ra) {
- _emitInstructionA(Opcode.kSetFrame, ra);
- }
-
- @pragma('vm:prefer-inline')
- void emitAllocateContext(int ra, int re) {
- _emitInstructionAE(Opcode.kAllocateContext, ra, re);
- }
-
- @pragma('vm:prefer-inline')
- void emitCloneContext(int ra, int re) {
- _emitInstructionAE(Opcode.kCloneContext, ra, re);
- }
-
- @pragma('vm:prefer-inline')
- void emitMoveSpecial(SpecialIndex ra, int ry) {
- _emitInstructionAY(Opcode.kMoveSpecial, ra.index, ry);
- }
-
- @pragma('vm:prefer-inline')
- void emitInstantiateType(int rd) {
- emitSourcePosition();
- _emitInstructionD(Opcode.kInstantiateType, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitInstantiateTypeArgumentsTOS(int ra, int re) {
- emitSourcePosition();
- _emitInstructionAE(Opcode.kInstantiateTypeArgumentsTOS, ra, re);
- }
-
- @pragma('vm:prefer-inline')
- void emitAssertAssignable(int ra, int re) {
- emitSourcePosition();
- _emitInstructionAE(Opcode.kAssertAssignable, ra, re);
- }
-
- @pragma('vm:prefer-inline')
- void emitAssertSubtype() {
- emitSourcePosition();
- _emitInstruction0(Opcode.kAssertSubtype);
- }
-
- @pragma('vm:prefer-inline')
- void emitAssertBoolean(int ra) {
- emitSourcePosition();
- _emitInstructionA(Opcode.kAssertBoolean, ra);
- }
-
- @pragma('vm:prefer-inline')
- void emitCheckStack(int ra) {
- emitSourcePosition();
- _emitInstructionA(Opcode.kCheckStack, ra);
- }
-
- @pragma('vm:prefer-inline')
- void emitDebugCheck() {
- emitSourcePosition();
- _emitInstruction0(Opcode.kDebugCheck);
- }
-
- @pragma('vm:prefer-inline')
- void emitCheckFunctionTypeArgs(int ra, int re) {
- emitSourcePosition();
- _emitInstructionAE(Opcode.kCheckFunctionTypeArgs, ra, re);
- }
-
- @pragma('vm:prefer-inline')
- void emitEntryFixed(int ra, int re) {
- _emitInstructionAE(Opcode.kEntryFixed, ra, re);
- }
-
- @pragma('vm:prefer-inline')
- void emitEntryOptional(int ra, int rb, int rc) {
- _emitInstructionABC(Opcode.kEntryOptional, ra, rb, rc);
- }
-
- @pragma('vm:prefer-inline')
- void emitAllocateClosure(int rd) {
- emitSourcePosition();
- _emitInstructionD(Opcode.kAllocateClosure, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitNullCheck(int rd) {
- emitSourcePosition();
- _emitInstructionD(Opcode.kNullCheck, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitInitLateField(int rd) {
- emitSourcePosition();
- _emitInstructionD(Opcode.kInitLateField, rd);
- }
-
- @pragma('vm:prefer-inline')
- void emitPushUninitializedSentinel() {
- _emitInstruction0(Opcode.kPushUninitializedSentinel);
- }
-
- @pragma('vm:prefer-inline')
- void emitJumpIfInitialized(Label label) {
- _emitJumpInstruction(Opcode.kJumpIfInitialized, label);
- }
-}
diff --git a/pkg/vm/lib/bytecode/bytecode_serialization.dart b/pkg/vm/lib/bytecode/bytecode_serialization.dart
deleted file mode 100644
index 671cf16..0000000
--- a/pkg/vm/lib/bytecode/bytecode_serialization.dart
+++ /dev/null
@@ -1,690 +0,0 @@
-// 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.
-
-library vm.bytecode.bytecode_serialization;
-
-import 'package:kernel/ast.dart' show BinarySink;
-import 'dart:typed_data' show ByteData, Endian, Uint8List, Uint16List;
-
-abstract class StringWriter {
- int put(String string);
-}
-
-abstract class StringReader {
- String get(int ref);
-}
-
-abstract class BytecodeObject {}
-
-abstract class ObjectWriter {
- void writeObject(BytecodeObject object, BufferedWriter writer);
-}
-
-abstract class ObjectReader {
- BytecodeObject readObject(BufferedReader reader);
-}
-
-class BufferedWriter {
- /// Initial size of the buffer in BufferedWriter.
- static const int initialSize = 1024;
-
- /// Lists less than this size are copied into the buffer.
- /// Larger lists are appended without copying.
- static const int avoidCopyingSize = 1024;
-
- /// Keep buffers with this remaining bytes or more, instead of
- /// creating a new buffer.
- static const int minRemainderToKeep = 256;
-
- final int formatVersion;
- final StringWriter stringWriter;
- final ObjectWriter objectWriter;
- final LinkWriter linkWriter;
-
- // Prefix of the data stored in this writer.
- // List of pairs Uint8List buffer, int length.
- List<dynamic> _buffers;
- // Total length of data in [_buffers].
- int _buffersLength = 0;
-
- Uint8List _currentBuffer = new Uint8List(initialSize);
- int _currentLength = 0;
- int _nextBufferSize = initialSize << 1;
-
- BufferedWriter(this.formatVersion, this.stringWriter, this.objectWriter,
- this.linkWriter);
-
- factory BufferedWriter.fromWriter(BufferedWriter writer) =>
- new BufferedWriter(writer.formatVersion, writer.stringWriter,
- writer.objectWriter, writer.linkWriter);
-
- Uint8List getContents() {
- if (_buffers == null) {
- return new Uint8List.view(
- _currentBuffer.buffer, _currentBuffer.offsetInBytes, _currentLength);
- }
- final Uint8List result = new Uint8List(_buffersLength + _currentLength);
- int position = 0;
- for (int i = 0; i < _buffers.length; i += 2) {
- final Uint8List buf = _buffers[i];
- final int len = _buffers[i + 1];
- result.setRange(position, position + len, buf);
- position += len;
- }
- assert(position == _buffersLength);
- result.setRange(position, position + _currentLength, _currentBuffer);
- return result;
- }
-
- void writeContentsToBinarySink(BinarySink sink) {
- if (_buffers != null) {
- for (int i = 0; i < _buffers.length; i += 2) {
- Uint8List buf = _buffers[i];
- final int len = _buffers[i + 1];
- if (len != buf.length) {
- buf = new Uint8List.view(buf.buffer, buf.offsetInBytes, len);
- }
- sink.writeBytes(buf);
- }
- }
- Uint8List buf = _currentBuffer;
- if (_currentLength != buf.length) {
- buf = new Uint8List.view(buf.buffer, buf.offsetInBytes, _currentLength);
- }
- sink.writeBytes(buf);
- }
-
- int get offset => _buffersLength + _currentLength;
-
- @pragma('vm:prefer-inline')
- void _addByte(int value) {
- assert((value >> 8) == 0);
- _currentBuffer[_currentLength] = value;
- ++_currentLength;
- }
-
- void _flushBuffer(Uint8List buf, int len) {
- _buffers ??= <dynamic>[];
- _buffers.add(buf);
- _buffers.add(len);
- _buffersLength += len;
- }
-
- void _flushCurrentBuffer() {
- _flushBuffer(_currentBuffer, _currentLength);
- _currentBuffer = null;
- _currentLength = 0;
- }
-
- @pragma('vm:never-inline')
- void _grow() {
- _flushCurrentBuffer();
- // Callers of _grow() expect up to avoidCopyingSize bytes to be available.
- assert(_nextBufferSize >= avoidCopyingSize);
- _currentBuffer = new Uint8List(_nextBufferSize);
- _nextBufferSize = _nextBufferSize << 1;
- }
-
- @pragma('vm:prefer-inline')
- void writeByte(int value) {
- if (_currentLength == _currentBuffer.length) {
- _grow();
- }
- _addByte(value);
- }
-
- void appendUint8List(Uint8List src) {
- if (src.length < avoidCopyingSize) {
- if (_currentLength > _currentBuffer.length - src.length) {
- _grow();
- }
- _currentBuffer.setRange(_currentLength, _currentLength + src.length, src);
- _currentLength += src.length;
- } else {
- final int remainingBytes = _currentBuffer.length - _currentLength;
- if (remainingBytes >= minRemainderToKeep) {
- final Uint8List remainder = new Uint8List.view(_currentBuffer.buffer,
- _currentBuffer.offsetInBytes + _currentLength, remainingBytes);
- _flushCurrentBuffer();
- _flushBuffer(src, src.length);
- _currentBuffer = remainder;
- _currentLength = 0;
- } else {
- _flushCurrentBuffer();
- _currentBuffer = src;
- _currentLength = src.length;
- }
- }
- }
-
- void appendWriter(BufferedWriter other) {
- final int remainingBytes = _currentBuffer.length - _currentLength;
- Uint8List remainder;
- if (remainingBytes >= minRemainderToKeep &&
- remainingBytes > (other._currentBuffer.length - other._currentLength)) {
- remainder = new Uint8List.view(_currentBuffer.buffer,
- _currentBuffer.offsetInBytes + _currentLength, remainingBytes);
- }
- _flushCurrentBuffer();
- if (other._buffers != null) {
- _buffers.addAll(other._buffers);
- _buffersLength += other._buffersLength;
- }
- if (remainder != null) {
- _flushBuffer(other._currentBuffer, other._currentLength);
- _currentBuffer = remainder;
- _currentLength = 0;
- } else {
- _currentBuffer = other._currentBuffer;
- _currentLength = other._currentLength;
- }
- // Reset [other] to make sure it is no longer used.
- other._buffers = null;
- other._buffersLength = 0;
- other._currentBuffer = null;
- other._currentLength = 0;
- }
-
- @pragma('vm:prefer-inline')
- void writeUInt32(int value) {
- if ((value >> 32) != 0) {
- throw 'Unable to write $value as 32-bit unsigned integer';
- }
- if (_currentLength > _currentBuffer.length - 4) {
- _grow();
- }
- // TODO(alexmarkov): consider using native byte order
- _addByte((value >> 24) & 0xFF);
- _addByte((value >> 16) & 0xFF);
- _addByte((value >> 8) & 0xFF);
- _addByte(value & 0xFF);
- }
-
- @pragma('vm:prefer-inline')
- void writePackedUInt30(int value) {
- if ((value >> 30) != 0) {
- throw 'Unable to write $value as 30-bit unsigned integer';
- }
- if (value < 0x80) {
- writeByte(value);
- } else if (value < 0x4000) {
- if (_currentLength > _currentBuffer.length - 2) {
- _grow();
- }
- _addByte((value >> 8) | 0x80);
- _addByte(value & 0xFF);
- } else {
- if (_currentLength > _currentBuffer.length - 4) {
- _grow();
- }
- _addByte((value >> 24) | 0xC0);
- _addByte((value >> 16) & 0xFF);
- _addByte((value >> 8) & 0xFF);
- _addByte(value & 0xFF);
- }
- }
-
- @pragma('vm:prefer-inline')
- void writeSLEB128(int value) {
- bool last = false;
- do {
- int part = value & 0x7f;
- value >>= 7;
- if ((value == 0 && (part & 0x40) == 0) ||
- (value == -1 && (part & 0x40) != 0)) {
- last = true;
- } else {
- part |= 0x80;
- }
- writeByte(part);
- } while (!last);
- }
-
- @pragma('vm:prefer-inline')
- void writePackedStringReference(String value) {
- writePackedUInt30(stringWriter.put(value));
- }
-
- @pragma('vm:prefer-inline')
- void writePackedObject(BytecodeObject object) {
- objectWriter.writeObject(object, this);
- }
-
- @pragma('vm:prefer-inline')
- void writePackedList(List<BytecodeObject> objects) {
- writePackedUInt30(objects.length);
- for (var obj in objects) {
- writePackedObject(obj);
- }
- }
-
- @pragma('vm:prefer-inline')
- void writeLinkOffset(Object target) {
- final offset = linkWriter.getOffset(target);
- writePackedUInt30(offset);
- }
-}
-
-class BufferedReader {
- int formatVersion;
- StringReader stringReader;
- ObjectReader objectReader;
- LinkReader linkReader;
- final List<int> bytes;
- final int baseOffset;
-
- /// Position within [bytes], already includes [baseOffset].
- int _pos;
-
- BufferedReader(this.formatVersion, this.stringReader, this.objectReader,
- this.linkReader, this.bytes,
- {this.baseOffset: 0})
- : _pos = baseOffset {
- assert((0 <= _pos) && (_pos <= bytes.length));
- }
-
- int get offset => _pos - baseOffset;
-
- set offset(int offs) {
- _pos = baseOffset + offs;
- assert((0 <= _pos) && (_pos <= bytes.length));
- }
-
- int readByte() => bytes[_pos++];
-
- int readUInt32() {
- return (readByte() << 24) |
- (readByte() << 16) |
- (readByte() << 8) |
- readByte();
- }
-
- int readPackedUInt30() {
- var byte = readByte();
- if (byte & 0x80 == 0) {
- // 0xxxxxxx
- return byte;
- } else if (byte & 0x40 == 0) {
- // 10xxxxxx
- return ((byte & 0x3F) << 8) | readByte();
- } else {
- // 11xxxxxx
- return ((byte & 0x3F) << 24) |
- (readByte() << 16) |
- (readByte() << 8) |
- readByte();
- }
- }
-
- int readSLEB128() {
- int value = 0;
- int shift = 0;
- int part = 0;
- do {
- part = readByte();
- value |= (part & 0x7f) << shift;
- shift += 7;
- } while ((part & 0x80) != 0);
- const int kBitsPerInt = 64;
- if ((shift < kBitsPerInt) && ((part & 0x40) != 0)) {
- value |= (-1) << shift;
- }
- return value;
- }
-
- String readPackedStringReference() {
- return stringReader.get(readPackedUInt30());
- }
-
- BytecodeObject readPackedObject() {
- return objectReader.readObject(this);
- }
-
- List<T> readPackedList<T extends BytecodeObject>() {
- final int len = readPackedUInt30();
- final list = new List<T>(len);
- for (int i = 0; i < len; ++i) {
- list[i] = readPackedObject();
- }
- return list;
- }
-
- Uint8List readBytesAsUint8List(int count) {
- final Uint8List result = new Uint8List(count);
- result.setRange(0, result.length, bytes, _pos);
- _pos += count;
- return result;
- }
-
- Uint16List readBytesAsUint16List(int count) {
- final Uint16List result = new Uint16List(count);
- int pos = _pos;
- for (int i = 0; i < count; ++i) {
- result[i] = bytes[pos] | (bytes[pos + 1] << 8);
- pos += 2;
- }
- _pos += count << 1;
- return result;
- }
-
- T readLinkOffset<T extends BytecodeDeclaration>() {
- final offset = readPackedUInt30();
- return linkReader.get<T>(offset);
- }
-
- ForwardReference<T>
- readLinkOffsetAsForwardReference<T extends BytecodeDeclaration>() {
- final offset = readPackedUInt30();
- return new ForwardReference<T>(offset, linkReader);
- }
-
- void align(int alignment) {
- assert(alignment & (alignment - 1) == 0);
- _pos = ((_pos + alignment - 1) & -alignment);
- }
-}
-
-class StringTable implements StringWriter, StringReader {
- // Bit 0 in string reference is set for two-byte strings.
- static const int flagTwoByteString = 1;
-
- Map<String, int> _map = <String, int>{};
- List<String> _oneByteStrings = <String>[];
- List<String> _twoByteStrings = <String>[];
- bool _written = false;
-
- StringTable();
-
- @override
- int put(String string) {
- int ref = _map[string];
- if (ref == null) {
- if (_written) {
- throw 'Unable to add a string to string table after it was written';
- }
- if (isOneByteString(string)) {
- ref = (_oneByteStrings.length << 1);
- _oneByteStrings.add(string);
- } else {
- ref = (_twoByteStrings.length << 1) | flagTwoByteString;
- _twoByteStrings.add(string);
- }
- _map[string] = ref;
- }
- return ref;
- }
-
- @override
- String get(int ref) {
- if ((ref & flagTwoByteString) == 0) {
- return _oneByteStrings[ref >> 1];
- } else {
- return _twoByteStrings[ref >> 1];
- }
- }
-
- bool isOneByteString(String value) {
- const int maxLatin1 = 0xff;
- for (int i = 0; i < value.length; ++i) {
- if (value.codeUnitAt(i) > maxLatin1) {
- return false;
- }
- }
- return true;
- }
-
- void write(BufferedWriter writer) {
- final start = writer.offset;
- writer.writeUInt32(_oneByteStrings.length);
- writer.writeUInt32(_twoByteStrings.length);
- int endOffset = 0;
- for (var str in _oneByteStrings) {
- endOffset += str.length;
- writer.writeUInt32(endOffset);
- }
- for (var str in _twoByteStrings) {
- endOffset += str.length << 1;
- writer.writeUInt32(endOffset);
- }
- for (var str in _oneByteStrings) {
- for (int i = 0; i < str.length; ++i) {
- writer.writeByte(str.codeUnitAt(i));
- }
- }
- for (var str in _twoByteStrings) {
- for (int i = 0; i < str.length; ++i) {
- int utf16codeUnit = str.codeUnitAt(i);
- writer.writeByte(utf16codeUnit & 0xFF);
- writer.writeByte(utf16codeUnit >> 8);
- }
- }
- _written = true;
- BytecodeSizeStatistics.stringTableSize += (writer.offset - start);
- }
-
- StringTable.read(BufferedReader reader) {
- final int numOneByteStrings = reader.readUInt32();
- final int numTwoByteStrings = reader.readUInt32();
- final List<int> oneByteEndOffsets = new List<int>(numOneByteStrings);
- for (int i = 0; i < oneByteEndOffsets.length; ++i) {
- oneByteEndOffsets[i] = reader.readUInt32();
- }
- List<int> twoByteEndOffsets = new List<int>(numTwoByteStrings);
- for (int i = 0; i < twoByteEndOffsets.length; ++i) {
- twoByteEndOffsets[i] = reader.readUInt32();
- }
- int start = 0;
- if (numOneByteStrings > 0) {
- _oneByteStrings = new List<String>(numOneByteStrings);
- final charCodes = reader.readBytesAsUint8List(oneByteEndOffsets.last);
- for (int i = 0; i < _oneByteStrings.length; ++i) {
- final end = oneByteEndOffsets[i];
- final str = new String.fromCharCodes(charCodes, start, end);
- _oneByteStrings[i] = str;
- _map[str] = i << 1;
- start = end;
- }
- }
- final int twoByteBaseOffset = start;
- if (numTwoByteStrings > 0) {
- int start = 0;
- _twoByteStrings = new List<String>(numTwoByteStrings);
- final charCodes = reader.readBytesAsUint16List(
- (twoByteEndOffsets.last - twoByteBaseOffset) >> 1);
- for (int i = 0; i < _twoByteStrings.length; ++i) {
- final end = (twoByteEndOffsets[i] - twoByteBaseOffset) >> 1;
- final str = new String.fromCharCodes(charCodes, start, end);
- _twoByteStrings[i] = str;
- _map[str] = (i << 1) | flagTwoByteString;
- start = end;
- }
- }
- }
-
- @override
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.writeln('StringTable {');
- sb.writeln(' // One Byte Strings');
- for (String str in _oneByteStrings) {
- sb.writeln(' "$str"');
- }
- sb.writeln(' // Two Byte Strings');
- for (String str in _twoByteStrings) {
- sb.writeln(' "$str"');
- }
- sb.writeln('}');
- return sb.toString();
- }
-}
-
-int doubleToIntBits(double value) {
- final buf = new ByteData(8);
- buf.setFloat64(0, value, Endian.little);
- return buf.getInt64(0, Endian.little);
-}
-
-double intBitsToDouble(int bits) {
- final buf = new ByteData(8);
- buf.setInt64(0, bits, Endian.little);
- return buf.getFloat64(0, Endian.little);
-}
-
-class PackedUInt30DeltaEncoder {
- int _last = 0;
-
- void write(BufferedWriter write, int value) {
- write.writePackedUInt30(value - _last);
- _last = value;
- }
-}
-
-class PackedUInt30DeltaDecoder {
- int _last = 0;
-
- int read(BufferedReader reader) {
- int value = reader.readPackedUInt30() + _last;
- _last = value;
- return value;
- }
-}
-
-class SLEB128DeltaEncoder {
- int _last = 0;
-
- void write(BufferedWriter writer, int value) {
- writer.writeSLEB128(value - _last);
- _last = value;
- }
-}
-
-class SLEB128DeltaDecoder {
- int _last = 0;
-
- int read(BufferedReader reader) {
- int value = reader.readSLEB128() + _last;
- _last = value;
- return value;
- }
-}
-
-class BytecodeDeclaration {
- int _offset;
-}
-
-class LinkWriter {
- void put(BytecodeDeclaration target, int offset) {
- target._offset = offset;
- }
-
- int getOffset(BytecodeDeclaration target) {
- return target._offset ??
- (throw 'Offset of ${target.runtimeType} $target is not set');
- }
-}
-
-class LinkReader {
- final _map = <Type, Map<int, BytecodeDeclaration>>{};
-
- void setOffset<T extends BytecodeDeclaration>(T target, int offset) {
- final offsetToObject = (_map[T] ??= <int, BytecodeDeclaration>{});
- final previous = offsetToObject[offset];
- if (previous != null) {
- throw 'Unable to associate offset $T/$offset with ${target.runtimeType} $target.'
- ' It is already associated with ${previous.runtimeType} $previous';
- }
- offsetToObject[offset] = target;
- }
-
- T get<T extends BytecodeDeclaration>(int offset) {
- return _map[T][offset] ?? (throw 'No object at offset $T/$offset');
- }
-}
-
-// Placeholder for an object which will be read in future.
-class ForwardReference<T extends BytecodeDeclaration> {
- final int offset;
- final LinkReader linkReader;
-
- ForwardReference(this.offset, this.linkReader);
-
- T get() => linkReader.get<T>(offset);
-}
-
-class NamedEntryStatistics {
- final String name;
- int size = 0;
- int count = 0;
-
- NamedEntryStatistics(this.name);
-
- String toString() => "${name.padRight(40)}: ${size.toString().padLeft(10)}"
- " (count: ${count.toString().padLeft(8)})";
-}
-
-class BytecodeSizeStatistics {
- static int componentSize = 0;
- static int objectTableSize = 0;
- static int objectTableEntriesCount = 0;
- static int stringTableSize = 0;
- static int librariesSize = 0;
- static int classesSize = 0;
- static int membersSize = 0;
- static int codeSize = 0;
- static int sourcePositionsSize = 0;
- static int sourceFilesSize = 0;
- static int lineStartsSize = 0;
- static int localVariablesSize = 0;
- static int annotationsSize = 0;
- static int constantPoolSize = 0;
- static int instructionsSize = 0;
- static List<NamedEntryStatistics> constantPoolStats =
- <NamedEntryStatistics>[];
- static List<NamedEntryStatistics> objectTableStats = <NamedEntryStatistics>[];
-
- static void reset() {
- componentSize = 0;
- objectTableSize = 0;
- objectTableEntriesCount = 0;
- stringTableSize = 0;
- librariesSize = 0;
- classesSize = 0;
- membersSize = 0;
- codeSize = 0;
- sourcePositionsSize = 0;
- sourceFilesSize = 0;
- lineStartsSize = 0;
- localVariablesSize = 0;
- annotationsSize = 0;
- constantPoolSize = 0;
- instructionsSize = 0;
- constantPoolStats = <NamedEntryStatistics>[];
- objectTableStats = <NamedEntryStatistics>[];
- }
-
- static void dump() {
- print("Bytecode size statistics:");
- print(" Bytecode component: $componentSize");
- print(
- " - object table: $objectTableSize (count: $objectTableEntriesCount)");
- for (var entry in objectTableStats) {
- print(" - $entry");
- }
- print(" - string table: $stringTableSize");
- print(" Libraries: $librariesSize");
- print(" Classes: $classesSize");
- print(" Members: $membersSize");
- print(" Source positions: $sourcePositionsSize");
- print(" Source files: $sourceFilesSize");
- print(" Line starts: $lineStartsSize");
- print(" Local variables: $localVariablesSize");
- print(" Annotations: $annotationsSize");
- print(" Code: $codeSize");
- print(" - constant pool: $constantPoolSize");
- for (var entry in constantPoolStats) {
- print(" - $entry");
- }
- print(" - instructions: $instructionsSize");
- }
-}
diff --git a/pkg/vm/lib/bytecode/constant_pool.dart b/pkg/vm/lib/bytecode/constant_pool.dart
deleted file mode 100644
index ee869ec..0000000
--- a/pkg/vm/lib/bytecode/constant_pool.dart
+++ /dev/null
@@ -1,911 +0,0 @@
-// 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.
-
-library vm.bytecode.constant_pool;
-
-import 'package:kernel/ast.dart' hide MapEntry;
-
-import 'dbc.dart' show constantPoolIndexLimit, BytecodeLimitExceededException;
-import 'bytecode_serialization.dart'
- show
- BufferedWriter,
- BufferedReader,
- BytecodeSizeStatistics,
- NamedEntryStatistics,
- StringTable;
-import 'object_table.dart' show ObjectHandle, ObjectTable;
-
-/*
-
-In kernel binary, constant pool is encoded in the following way
-(using notation from pkg/kernel/binary.md):
-
-type ConstantPool {
- List<ConstantPoolEntry>
-}
-
-type ConstantIndex = UInt;
-
-abstract type ConstantPoolEntry {
- Byte tag;
-}
-
-type ConstantStaticField extends ConstantPoolEntry {
- Byte tag = 9;
- PackedObject field;
-}
-
-// Occupies 2 entries in the constant pool.
-type ConstantInstanceField extends ConstantPoolEntry {
- Byte tag = 10;
- PackedObject field;
-}
-
-type ConstantClass extends ConstantPoolEntry {
- Byte tag = 11;
- PackedObject class;
-}
-
-type ConstantTypeArgumentsField extends ConstantPoolEntry {
- Byte tag = 12;
- PackedObject class;
-}
-
-type ConstantType extends ConstantPoolEntry {
- Byte tag = 14;
- PackedObject type;
-}
-
-type ConstantClosureFunction extends ConstantPoolEntry {
- Byte tag = 19;
- UInt closureIndex;
-}
-
-type ConstantEndClosureFunctionScope extends ConstantPoolEntry {
- Byte tag = 20;
-}
-
-type ConstantNativeEntry extends ConstantPoolEntry {
- Byte tag = 21;
- PackedString nativeName;
-}
-
-type ConstantSubtypeTestCache extends ConstantPoolEntry {
- Byte tag = 22;
-}
-
-type ConstantEmptyTypeArguments extends ConstantPoolEntry {
- Byte tag = 24;
-}
-
-type ConstantObjectRef extends ConstantPoolEntry {
- Byte tag = 27;
- PackedObject object;
-}
-
-// Occupies 2 entries in the constant pool.
-type ConstantDirectCall extends ConstantPoolEntry {
- Byte tag = 28;
- PackedObject target;
- PackedObject argDesc;
-}
-
-// Occupies 2 entries in the constant pool.
-type ConstantInterfaceCall extends ConstantPoolEntry {
- Byte tag = 29;
- PackedObject target;
- PackedObject argDesc;
-}
-
-// Occupies 3 entries in the constant pool.
-type ConstantInstantiatedInterfaceCall extends ConstantPoolEntry {
- Byte tag = 30;
- PackedObject target;
- PackedObject argDesc;
- PackedObject staticReceiverType;
-}
-
-// Occupies 2 entries in the constant pool
-type ConstantDynamicCall extends ConstantPoolEntry {
- Byte tag = 31;
- PackedObject selectorName;
- PackedObject argDesc;
-}
-
-// Occupies 2 entries in the constant pool.
-type ConstantDirectCallViaDynamicForwarder extends ConstantPoolEntry {
- Byte tag = 32;
- PackedObject target;
- PackedObject argDesc;
-}
-
-*/
-
-enum ConstantTag {
- kInvalid,
- kUnused1,
- kUnused2,
- kUnused3,
- kUnused4,
- kUnused5,
- kUnused6,
- kUnused6a,
- kUnused7,
- kStaticField,
- kInstanceField,
- kClass,
- kTypeArgumentsField,
- kUnused8,
- kType,
- kUnused9,
- kUnused10,
- kUnused11,
- kUnused12,
- kClosureFunction,
- kEndClosureFunctionScope,
- kNativeEntry,
- kSubtypeTestCache,
- kUnused13,
- kEmptyTypeArguments,
- kUnused14,
- kUnused15,
- kObjectRef,
- kDirectCall,
- kInterfaceCall,
- kInstantiatedInterfaceCall,
- kDynamicCall,
- kDirectCallViaDynamicForwarder,
-}
-
-String constantTagToString(ConstantTag tag) =>
- tag.toString().substring('ConstantTag.k'.length);
-
-abstract class ConstantPoolEntry {
- const ConstantPoolEntry();
-
- ConstantTag get tag;
-
- // Returns number of extra reserved constant pool entries
- // following this entry.
- int get numReservedEntries => 0;
-
- void write(BufferedWriter writer) {
- writer.writeByte(tag.index);
- writeValue(writer);
- }
-
- void writeValue(BufferedWriter writer);
-
- factory ConstantPoolEntry.read(BufferedReader reader) {
- ConstantTag tag = ConstantTag.values[reader.readByte()];
- switch (tag) {
- case ConstantTag.kInvalid:
- break;
- case ConstantTag.kStaticField:
- return new ConstantStaticField.read(reader);
- case ConstantTag.kInstanceField:
- return new ConstantInstanceField.read(reader);
- case ConstantTag.kClass:
- return new ConstantClass.read(reader);
- case ConstantTag.kTypeArgumentsField:
- return new ConstantTypeArgumentsField.read(reader);
- case ConstantTag.kType:
- return new ConstantType.read(reader);
- case ConstantTag.kClosureFunction:
- return new ConstantClosureFunction.read(reader);
- case ConstantTag.kEndClosureFunctionScope:
- return new ConstantEndClosureFunctionScope.read(reader);
- case ConstantTag.kNativeEntry:
- return new ConstantNativeEntry.read(reader);
- case ConstantTag.kSubtypeTestCache:
- return new ConstantSubtypeTestCache.read(reader);
- case ConstantTag.kEmptyTypeArguments:
- return new ConstantEmptyTypeArguments.read(reader);
- case ConstantTag.kObjectRef:
- return new ConstantObjectRef.read(reader);
- case ConstantTag.kDirectCall:
- return new ConstantDirectCall.read(reader);
- case ConstantTag.kInterfaceCall:
- return new ConstantInterfaceCall.read(reader);
- case ConstantTag.kInstantiatedInterfaceCall:
- return new ConstantInstantiatedInterfaceCall.read(reader);
- case ConstantTag.kDynamicCall:
- return new ConstantDynamicCall.read(reader);
- case ConstantTag.kDirectCallViaDynamicForwarder:
- return new ConstantDirectCallViaDynamicForwarder.read(reader);
- // Make analyzer happy.
- case ConstantTag.kUnused1:
- case ConstantTag.kUnused2:
- case ConstantTag.kUnused3:
- case ConstantTag.kUnused4:
- case ConstantTag.kUnused5:
- case ConstantTag.kUnused6:
- case ConstantTag.kUnused6a:
- case ConstantTag.kUnused7:
- case ConstantTag.kUnused8:
- case ConstantTag.kUnused9:
- case ConstantTag.kUnused10:
- case ConstantTag.kUnused11:
- case ConstantTag.kUnused12:
- case ConstantTag.kUnused13:
- case ConstantTag.kUnused14:
- case ConstantTag.kUnused15:
- break;
- }
- throw 'Unexpected constant tag $tag';
- }
-}
-
-enum InvocationKind {
- method, // x.foo(...) or foo(...)
- getter, // x.foo
- setter // x.foo = ...
-}
-
-class ConstantStaticField extends ConstantPoolEntry {
- final ObjectHandle field;
-
- ConstantStaticField(this.field);
-
- @override
- ConstantTag get tag => ConstantTag.kStaticField;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(field);
- }
-
- ConstantStaticField.read(BufferedReader reader)
- : field = reader.readPackedObject();
-
- @override
- String toString() => 'StaticField $field';
-
- @override
- int get hashCode => field.hashCode;
-
- @override
- bool operator ==(other) =>
- other is ConstantStaticField && this.field == other.field;
-}
-
-class ConstantInstanceField extends ConstantPoolEntry {
- final ObjectHandle field;
-
- int get numReservedEntries => 1;
-
- ConstantInstanceField(this.field);
-
- @override
- ConstantTag get tag => ConstantTag.kInstanceField;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(field);
- }
-
- ConstantInstanceField.read(BufferedReader reader)
- : field = reader.readPackedObject();
-
- @override
- String toString() => 'InstanceField $field';
-
- @override
- int get hashCode => field.hashCode;
-
- @override
- bool operator ==(other) =>
- other is ConstantInstanceField && this.field == other.field;
-}
-
-class ConstantClass extends ConstantPoolEntry {
- final ObjectHandle classHandle;
-
- ConstantClass(this.classHandle);
-
- @override
- ConstantTag get tag => ConstantTag.kClass;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(classHandle);
- }
-
- ConstantClass.read(BufferedReader reader)
- : classHandle = reader.readPackedObject();
-
- @override
- String toString() => 'Class $classHandle';
-
- @override
- int get hashCode => classHandle.hashCode;
-
- @override
- bool operator ==(other) =>
- other is ConstantClass && this.classHandle == other.classHandle;
-}
-
-class ConstantTypeArgumentsField extends ConstantPoolEntry {
- final ObjectHandle classHandle;
-
- ConstantTypeArgumentsField(this.classHandle);
-
- @override
- ConstantTag get tag => ConstantTag.kTypeArgumentsField;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(classHandle);
- }
-
- ConstantTypeArgumentsField.read(BufferedReader reader)
- : classHandle = reader.readPackedObject();
-
- @override
- String toString() => 'TypeArgumentsField $classHandle';
-
- @override
- int get hashCode => classHandle.hashCode;
-
- @override
- bool operator ==(other) =>
- other is ConstantTypeArgumentsField &&
- this.classHandle == other.classHandle;
-}
-
-class ConstantType extends ConstantPoolEntry {
- final ObjectHandle type;
-
- ConstantType(this.type);
-
- @override
- ConstantTag get tag => ConstantTag.kType;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(type);
- }
-
- ConstantType.read(BufferedReader reader) : type = reader.readPackedObject();
-
- @override
- String toString() => 'Type $type';
-
- @override
- int get hashCode => type.hashCode;
-
- @override
- bool operator ==(other) => other is ConstantType && this.type == other.type;
-}
-
-class ConstantClosureFunction extends ConstantPoolEntry {
- final int closureIndex;
-
- ConstantClosureFunction(this.closureIndex);
-
- @override
- ConstantTag get tag => ConstantTag.kClosureFunction;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedUInt30(closureIndex);
- }
-
- ConstantClosureFunction.read(BufferedReader reader)
- : closureIndex = reader.readPackedUInt30();
-
- @override
- String toString() {
- return 'ClosureFunction $closureIndex';
- }
-
- @override
- int get hashCode => closureIndex;
-
- @override
- bool operator ==(other) =>
- other is ConstantClosureFunction &&
- this.closureIndex == other.closureIndex;
-}
-
-class ConstantEndClosureFunctionScope extends ConstantPoolEntry {
- ConstantEndClosureFunctionScope();
-
- @override
- ConstantTag get tag => ConstantTag.kEndClosureFunctionScope;
-
- @override
- void writeValue(BufferedWriter writer) {}
-
- ConstantEndClosureFunctionScope.read(BufferedReader reader) {}
-
- @override
- String toString() => 'EndClosureFunctionScope';
-
- // ConstantEndClosureFunctionScope entries are created per closure and should
- // not be merged, so ConstantEndClosureFunctionScope class uses identity
- // [hashCode] and [operator ==].
-}
-
-class ConstantNativeEntry extends ConstantPoolEntry {
- final String nativeName;
-
- ConstantNativeEntry(this.nativeName);
-
- @override
- ConstantTag get tag => ConstantTag.kNativeEntry;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedStringReference(nativeName);
- }
-
- ConstantNativeEntry.read(BufferedReader reader)
- : nativeName = reader.readPackedStringReference();
-
- @override
- String toString() => 'NativeEntry $nativeName';
-
- @override
- int get hashCode => nativeName.hashCode;
-
- @override
- bool operator ==(other) =>
- other is ConstantNativeEntry && this.nativeName == other.nativeName;
-}
-
-class ConstantSubtypeTestCache extends ConstantPoolEntry {
- ConstantSubtypeTestCache();
-
- @override
- ConstantTag get tag => ConstantTag.kSubtypeTestCache;
-
- @override
- void writeValue(BufferedWriter writer) {}
-
- ConstantSubtypeTestCache.read(BufferedReader reader);
-
- @override
- String toString() => 'SubtypeTestCache';
-
- // ConstantSubtypeTestCache entries are created per subtype test site and
- // should not be merged, so ConstantSubtypeTestCache class uses identity
- // [hashCode] and [operator ==].
-
- @override
- int get hashCode => identityHashCode(this);
-
- @override
- bool operator ==(other) => identical(this, other);
-}
-
-class ConstantEmptyTypeArguments extends ConstantPoolEntry {
- const ConstantEmptyTypeArguments();
-
- @override
- ConstantTag get tag => ConstantTag.kEmptyTypeArguments;
-
- @override
- void writeValue(BufferedWriter writer) {}
-
- ConstantEmptyTypeArguments.read(BufferedReader reader);
-
- @override
- String toString() => 'EmptyTypeArguments';
-
- @override
- int get hashCode => 997;
-
- @override
- bool operator ==(other) => other is ConstantEmptyTypeArguments;
-}
-
-class ConstantObjectRef extends ConstantPoolEntry {
- final ObjectHandle object;
-
- ConstantObjectRef(this.object);
-
- @override
- ConstantTag get tag => ConstantTag.kObjectRef;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(object);
- }
-
- ConstantObjectRef.read(BufferedReader reader)
- : object = reader.readPackedObject();
-
- @override
- String toString() => 'ObjectRef $object';
-
- @override
- int get hashCode => object.hashCode;
-
- @override
- bool operator ==(other) =>
- other is ConstantObjectRef && this.object == other.object;
-}
-
-class ConstantDirectCall extends ConstantPoolEntry {
- final ObjectHandle target;
- final ObjectHandle argDesc;
-
- ConstantDirectCall(this.target, this.argDesc);
-
- // Reserve 1 extra slot for arguments descriptor, following target slot.
- int get numReservedEntries => 1;
-
- @override
- ConstantTag get tag => ConstantTag.kDirectCall;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(target);
- writer.writePackedObject(argDesc);
- }
-
- ConstantDirectCall.read(BufferedReader reader)
- : target = reader.readPackedObject(),
- argDesc = reader.readPackedObject();
-
- @override
- String toString() => "DirectCall '$target', $argDesc";
-
- @override
- int get hashCode => _combineHashes(target.hashCode, argDesc.hashCode);
-
- @override
- bool operator ==(other) =>
- other is ConstantDirectCall &&
- this.target == other.target &&
- this.argDesc == other.argDesc;
-}
-
-class ConstantDirectCallViaDynamicForwarder extends ConstantPoolEntry {
- final ObjectHandle target;
- final ObjectHandle argDesc;
-
- ConstantDirectCallViaDynamicForwarder(this.target, this.argDesc);
-
- // Reserve 1 extra slot for arguments descriptor, following target slot.
- int get numReservedEntries => 1;
-
- @override
- ConstantTag get tag => ConstantTag.kDirectCallViaDynamicForwarder;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(target);
- writer.writePackedObject(argDesc);
- }
-
- ConstantDirectCallViaDynamicForwarder.read(BufferedReader reader)
- : target = reader.readPackedObject(),
- argDesc = reader.readPackedObject();
-
- @override
- String toString() => "DirectCallViaDynamicForwarder '$target', $argDesc";
-
- @override
- int get hashCode => _combineHashes(target.hashCode, argDesc.hashCode);
-
- @override
- bool operator ==(other) =>
- other is ConstantDirectCallViaDynamicForwarder &&
- this.target == other.target &&
- this.argDesc == other.argDesc;
-}
-
-class ConstantInterfaceCall extends ConstantPoolEntry {
- final ObjectHandle target;
- final ObjectHandle argDesc;
-
- ConstantInterfaceCall(this.target, this.argDesc);
-
- // Reserve 1 extra slot for arguments descriptor, following target slot.
- int get numReservedEntries => 1;
-
- @override
- ConstantTag get tag => ConstantTag.kInterfaceCall;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(target);
- writer.writePackedObject(argDesc);
- }
-
- ConstantInterfaceCall.read(BufferedReader reader)
- : target = reader.readPackedObject(),
- argDesc = reader.readPackedObject();
-
- @override
- String toString() => "InterfaceCall '$target', $argDesc";
-
- @override
- int get hashCode => _combineHashes(target.hashCode, argDesc.hashCode);
-
- @override
- bool operator ==(other) =>
- other is ConstantInterfaceCall &&
- this.target == other.target &&
- this.argDesc == other.argDesc;
-}
-
-class ConstantInstantiatedInterfaceCall extends ConstantPoolEntry {
- final ObjectHandle target;
- final ObjectHandle argDesc;
- final ObjectHandle staticReceiverType;
-
- ConstantInstantiatedInterfaceCall(
- this.target, this.argDesc, this.staticReceiverType);
-
- // Reserve 2 extra slots (3 slots total).
- int get numReservedEntries => 2;
-
- @override
- ConstantTag get tag => ConstantTag.kInstantiatedInterfaceCall;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(target);
- writer.writePackedObject(argDesc);
- writer.writePackedObject(staticReceiverType);
- }
-
- ConstantInstantiatedInterfaceCall.read(BufferedReader reader)
- : target = reader.readPackedObject(),
- argDesc = reader.readPackedObject(),
- staticReceiverType = reader.readPackedObject();
-
- @override
- String toString() =>
- "InstantiatedInterfaceCall '$target', $argDesc, receiver $staticReceiverType";
-
- @override
- int get hashCode => _combineHashes(
- _combineHashes(target.hashCode, argDesc.hashCode),
- staticReceiverType.hashCode);
-
- @override
- bool operator ==(other) =>
- other is ConstantInstantiatedInterfaceCall &&
- this.target == other.target &&
- this.argDesc == other.argDesc &&
- this.staticReceiverType == other.staticReceiverType;
-}
-
-class ConstantDynamicCall extends ConstantPoolEntry {
- final ObjectHandle selectorName;
- final ObjectHandle argDesc;
-
- ConstantDynamicCall(this.selectorName, this.argDesc);
-
- // Reserve 1 extra slot for arguments descriptor, following selector slot.
- int get numReservedEntries => 1;
-
- @override
- ConstantTag get tag => ConstantTag.kDynamicCall;
-
- @override
- void writeValue(BufferedWriter writer) {
- writer.writePackedObject(selectorName);
- writer.writePackedObject(argDesc);
- }
-
- ConstantDynamicCall.read(BufferedReader reader)
- : selectorName = reader.readPackedObject(),
- argDesc = reader.readPackedObject();
-
- @override
- String toString() => 'DynamicCall $selectorName, $argDesc';
-
- @override
- int get hashCode => _combineHashes(selectorName.hashCode, argDesc.hashCode);
-
- @override
- bool operator ==(other) =>
- other is ConstantDynamicCall &&
- this.selectorName == other.selectorName &&
- this.argDesc == other.argDesc;
-}
-
-/// Reserved constant pool entry.
-class _ReservedConstantPoolEntry extends ConstantPoolEntry {
- const _ReservedConstantPoolEntry();
-
- ConstantTag get tag => throw 'This constant pool entry is reserved';
- void writeValue(BufferedWriter writer) =>
- throw 'This constant pool entry is reserved';
-
- @override
- String toString() => 'Reserved';
-}
-
-class ConstantPool {
- final StringTable stringTable;
- final ObjectTable objectTable;
- final List<ConstantPoolEntry> entries = <ConstantPoolEntry>[];
- final Map<ConstantPoolEntry, int> _canonicalizationCache =
- <ConstantPoolEntry, int>{};
-
- ConstantPool(this.stringTable, this.objectTable);
-
- int addString(String value) => addObjectRef(new StringConstant(value));
-
- int addName(String name) =>
- _add(new ConstantObjectRef(objectTable.getPublicNameHandle(name)));
-
- int addArgDesc(int numArguments,
- {int numTypeArgs = 0, List<String> argNames = const <String>[]}) =>
- _add(new ConstantObjectRef(
- objectTable.getArgDescHandle(numArguments, numTypeArgs, argNames)));
-
- int addArgDescByArguments(Arguments args,
- {bool hasReceiver: false, bool isFactory: false}) =>
- _add(new ConstantObjectRef(objectTable.getArgDescHandleByArguments(args,
- hasReceiver: hasReceiver, isFactory: isFactory)));
-
- int addDirectCall(
- InvocationKind invocationKind, Member target, ObjectHandle argDesc,
- [bool isDynamicForwarder = false]) {
- final targetHandle = objectTable.getMemberHandle(target,
- isGetter: invocationKind == InvocationKind.getter,
- isSetter: invocationKind == InvocationKind.setter);
- return _add(isDynamicForwarder
- ? new ConstantDirectCallViaDynamicForwarder(targetHandle, argDesc)
- : new ConstantDirectCall(targetHandle, argDesc));
- }
-
- int addInterfaceCall(
- InvocationKind invocationKind, Member target, ObjectHandle argDesc) =>
- _add(new ConstantInterfaceCall(
- objectTable.getMemberHandle(target,
- isGetter: invocationKind == InvocationKind.getter,
- isSetter: invocationKind == InvocationKind.setter),
- argDesc));
-
- int addInstantiatedInterfaceCall(InvocationKind invocationKind, Member target,
- ObjectHandle argDesc, DartType staticReceiverType) =>
- _add(new ConstantInstantiatedInterfaceCall(
- objectTable.getMemberHandle(target,
- isGetter: invocationKind == InvocationKind.getter,
- isSetter: invocationKind == InvocationKind.setter),
- argDesc,
- objectTable.getHandle(staticReceiverType)));
-
- int addDynamicCall(
- InvocationKind invocationKind, Name selector, ObjectHandle argDesc) =>
- _add(new ConstantDynamicCall(
- objectTable.getSelectorNameHandle(selector,
- isGetter: invocationKind == InvocationKind.getter,
- isSetter: invocationKind == InvocationKind.setter),
- argDesc));
-
- int addInstanceCall(InvocationKind invocationKind, Member target,
- Name targetName, ObjectHandle argDesc) =>
- (target == null)
- ? addDynamicCall(invocationKind, targetName, argDesc)
- : addInterfaceCall(invocationKind, target, argDesc);
-
- int addStaticField(Field field) =>
- _add(new ConstantStaticField(objectTable.getHandle(field)));
-
- int addInstanceField(Field field) =>
- _add(new ConstantInstanceField(objectTable.getHandle(field)));
-
- int addClass(Class node) =>
- _add(new ConstantClass(objectTable.getHandle(node)));
-
- int addTypeArgumentsField(Class node) =>
- _add(new ConstantTypeArgumentsField(objectTable.getHandle(node)));
-
- int addType(DartType type) =>
- _add(new ConstantType(objectTable.getHandle(type)));
-
- int addTypeArguments(List<DartType> typeArgs) =>
- _add(new ConstantObjectRef(objectTable.getTypeArgumentsHandle(typeArgs)));
-
- int addClosureFunction(int closureIndex) =>
- _add(new ConstantClosureFunction(closureIndex));
-
- int addEndClosureFunctionScope() =>
- _add(new ConstantEndClosureFunctionScope());
-
- int addNativeEntry(String nativeName) =>
- _add(new ConstantNativeEntry(_indexString(nativeName)));
-
- int addSubtypeTestCache() => _add(new ConstantSubtypeTestCache());
-
- int addEmptyTypeArguments() => _add(const ConstantEmptyTypeArguments());
-
- int addObjectRef(Node node) =>
- _add(new ConstantObjectRef(objectTable.getHandle(node)));
-
- int addSelectorName(Name name, InvocationKind invocationKind) =>
- _add(new ConstantObjectRef(objectTable.getSelectorNameHandle(name,
- isGetter: invocationKind == InvocationKind.getter,
- isSetter: invocationKind == InvocationKind.setter)));
-
- int _add(ConstantPoolEntry entry) {
- int index = _canonicalizationCache[entry];
- if (index == null) {
- index = entries.length;
- if (index >= constantPoolIndexLimit) {
- throw new ConstantPoolIndexOverflowException();
- }
- _addEntry(entry);
- _canonicalizationCache[entry] = index;
- }
- return index;
- }
-
- void _addEntry(ConstantPoolEntry entry) {
- entries.add(entry);
- for (int i = 0; i < entry.numReservedEntries; ++i) {
- entries.add(const _ReservedConstantPoolEntry());
- }
- }
-
- // Currently, string table is written as a part of Component's metadata
- // *before* constant pools are written.
- // So we need to index all strings when filling up constant pools.
- String _indexString(String str) {
- stringTable.put(str);
- return str;
- }
-
- void write(BufferedWriter writer) {
- final start = writer.offset;
- if (BytecodeSizeStatistics.constantPoolStats.isEmpty) {
- for (var tag in ConstantTag.values) {
- BytecodeSizeStatistics.constantPoolStats
- .add(new NamedEntryStatistics(constantTagToString(tag)));
- }
- }
- writer.writePackedUInt30(entries.length);
- entries.forEach((e) {
- if (e is _ReservedConstantPoolEntry) {
- return;
- }
-
- final entryStart = writer.offset;
-
- e.write(writer);
-
- final entryStat = BytecodeSizeStatistics.constantPoolStats[e.tag.index];
- entryStat.size += (writer.offset - entryStart);
- ++entryStat.count;
- });
- BytecodeSizeStatistics.constantPoolSize += (writer.offset - start);
- }
-
- ConstantPool.read(BufferedReader reader)
- : stringTable = reader.stringReader,
- objectTable = reader.objectReader {
- int len = reader.readPackedUInt30();
- for (int i = 0; i < len; i++) {
- final e = new ConstantPoolEntry.read(reader);
- _addEntry(e);
- i += e.numReservedEntries;
- }
- }
-
- @override
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.writeln('ConstantPool {');
- for (int i = 0; i < entries.length; i++) {
- sb.writeln(' [$i] = ${entries[i]}');
- }
- sb.writeln('}');
- return sb.toString();
- }
-}
-
-int _combineHashes(int hash1, int hash2) =>
- (((hash1 * 31) & 0x3fffffff) + hash2) & 0x3fffffff;
-
-class ConstantPoolIndexOverflowException
- extends BytecodeLimitExceededException {}
diff --git a/pkg/vm/lib/bytecode/dbc.dart b/pkg/vm/lib/bytecode/dbc.dart
deleted file mode 100644
index 39ae12a..0000000
--- a/pkg/vm/lib/bytecode/dbc.dart
+++ /dev/null
@@ -1,677 +0,0 @@
-// 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.
-
-/// Dart kernel bytecode instructions (described in runtime/vm/constants_kbc.h).
-
-library vm.bytecode.dbc;
-
-/// Version of bytecode format, produced by default.
-/// Before bumping current bytecode version format, make sure that
-/// all users have switched to a VM which is able to consume new
-/// version of bytecode.
-const int currentBytecodeFormatVersion = 28;
-
-enum Opcode {
- kUnusedOpcode000,
- kUnusedOpcode001,
- kUnusedOpcode002,
- kUnusedOpcode003,
- kUnusedOpcode004,
- kUnusedOpcode005,
- kUnusedOpcode006,
- kUnusedOpcode007,
- kUnusedOpcode008,
- kUnusedOpcode009,
- kUnusedOpcode010,
- kUnusedOpcode011,
- kUnusedOpcode012,
- kUnusedOpcode013,
- kUnusedOpcode014,
- kUnusedOpcode015,
- kUnusedOpcode016,
- kUnusedOpcode017,
- kUnusedOpcode018,
- kUnusedOpcode019,
- kUnusedOpcode020,
- kUnusedOpcode021,
- kUnusedOpcode022,
- kUnusedOpcode023,
- kUnusedOpcode024,
- kUnusedOpcode025,
- kUnusedOpcode026,
- kUnusedOpcode027,
- kUnusedOpcode028,
- kUnusedOpcode029,
- kUnusedOpcode030,
- kUnusedOpcode031,
- kUnusedOpcode032,
- kUnusedOpcode033,
- kUnusedOpcode034,
- kUnusedOpcode035,
- kUnusedOpcode036,
- kUnusedOpcode037,
- kUnusedOpcode038,
- kUnusedOpcode039,
- kUnusedOpcode040,
- kUnusedOpcode041,
- kUnusedOpcode042,
- kUnusedOpcode043,
- kUnusedOpcode044,
- kUnusedOpcode045,
- kUnusedOpcode046,
- kUnusedOpcode047,
- kUnusedOpcode048,
- kUnusedOpcode049,
- kUnusedOpcode050,
- kUnusedOpcode051,
- kUnusedOpcode052,
- kUnusedOpcode053,
- kUnusedOpcode054,
- kUnusedOpcode055,
- kUnusedOpcode056,
- kUnusedOpcode057,
- kUnusedOpcode058,
- kUnusedOpcode059,
- kUnusedOpcode060,
- kUnusedOpcode061,
- kUnusedOpcode062,
- kUnusedOpcode063,
- kUnusedOpcode064,
- kUnusedOpcode065,
- kUnusedOpcode066,
- kUnusedOpcode067,
- kUnusedOpcode068,
- kUnusedOpcode069,
- kUnusedOpcode070,
- kUnusedOpcode071,
- kUnusedOpcode072,
- kUnusedOpcode073,
- kUnusedOpcode074,
- kUnusedOpcode075,
- kUnusedOpcode076,
- kUnusedOpcode077,
- kUnusedOpcode078,
- kUnusedOpcode079,
- kUnusedOpcode080,
- kUnusedOpcode081,
-
- // Late variables.
- kJumpIfInitialized,
- kJumpIfInitialized_Wide,
- kPushUninitializedSentinel,
-
- kTrap,
-
- // Prologue and stack management.
- kEntry,
- kEntry_Wide,
- // TODO(alexmarkov): cleanup now unused EntryFixed instruction.
- kEntryFixed,
- kEntryFixed_Wide,
- kEntryOptional,
- kUnused00, // Reserved for EntryNoLocals.
- kLoadConstant,
- kLoadConstant_Wide,
- kFrame,
- kFrame_Wide,
- kCheckFunctionTypeArgs,
- kCheckFunctionTypeArgs_Wide,
- kCheckStack,
- kDebugCheck,
- kJumpIfUnchecked,
- kJumpIfUnchecked_Wide,
-
- // Object allocation.
- kAllocate,
- kAllocate_Wide,
- kAllocateT,
- kCreateArrayTOS,
- kAllocateClosure,
- kAllocateClosure_Wide,
-
- // Context allocation and access.
- kAllocateContext,
- kAllocateContext_Wide,
- kCloneContext,
- kCloneContext_Wide,
- kLoadContextParent,
- kStoreContextParent,
- kLoadContextVar,
- kLoadContextVar_Wide,
- kUnused04, // Reserved for LoadContextVar0
- kUnused05,
- kStoreContextVar,
- kStoreContextVar_Wide,
-
- // Constants.
- kPushConstant,
- kPushConstant_Wide,
- kUnused06, // Reserved for PushConstant0
- kUnused07,
- kPushTrue,
- kPushFalse,
- kPushInt,
- kPushInt_Wide,
- kUnused08, // Reserved for PushInt0
- kUnused09, // Reserved for PushInt1
- kUnused10, // Reserved for PushInt2
- kUnused11,
- kPushNull,
-
- // Locals and expression stack.
- kDrop1,
- kPush,
- kPush_Wide,
- kUnused12, // Reserved for PushLocal0
- kUnused13, // Reserved for PushLocal1
- kUnused14, // Reserved for PushLocal2
- kUnused15, // Reserved for PushLocal3
- kUnused16, // Reserved for PushParamLast0
- kUnused17, // Reserved for PushParamLast1
- kPopLocal,
- kPopLocal_Wide,
- kLoadStatic,
- kLoadStatic_Wide,
- kStoreLocal,
- kStoreLocal_Wide,
-
- // Instance fields and arrays.
- kLoadFieldTOS,
- kLoadFieldTOS_Wide,
- kStoreFieldTOS,
- kStoreFieldTOS_Wide,
- kStoreIndexedTOS,
- kUnused20,
-
- // Late fields.
- kInitLateField,
- kInitLateField_Wide,
-
- // Static fields.
- kStoreStaticTOS,
- kStoreStaticTOS_Wide,
-
- // Jumps.
- kJump,
- kJump_Wide,
- kJumpIfNoAsserts,
- kJumpIfNoAsserts_Wide,
- kJumpIfNotZeroTypeArgs,
- kJumpIfNotZeroTypeArgs_Wide,
- kJumpIfEqStrict,
- kJumpIfEqStrict_Wide,
- kJumpIfNeStrict,
- kJumpIfNeStrict_Wide,
- kJumpIfTrue,
- kJumpIfTrue_Wide,
- kJumpIfFalse,
- kJumpIfFalse_Wide,
- kJumpIfNull,
- kJumpIfNull_Wide,
- kJumpIfNotNull,
- kJumpIfNotNull_Wide,
-
- // Calls.
- kDirectCall,
- kDirectCall_Wide,
- kUncheckedDirectCall,
- kUncheckedDirectCall_Wide,
- kInterfaceCall,
- kInterfaceCall_Wide,
- kUnused23, // Reserved for InterfaceCall1
- kUnused24, // Reserved for InterfaceCall1_Wide
- kInstantiatedInterfaceCall,
- kInstantiatedInterfaceCall_Wide,
- kUncheckedClosureCall,
- kUncheckedClosureCall_Wide,
- kUncheckedInterfaceCall,
- kUncheckedInterfaceCall_Wide,
- kDynamicCall,
- kDynamicCall_Wide,
- kNativeCall,
- kNativeCall_Wide,
- kReturnTOS,
- kUnused29,
-
- // Types and type checks.
- kAssertAssignable,
- kAssertAssignable_Wide,
- kUnused30, // Reserved for AsSimpleType
- kUnused31, // Reserved for AsSimpleType_Wide
- kAssertBoolean,
- kAssertSubtype,
- kLoadTypeArgumentsField,
- kLoadTypeArgumentsField_Wide,
- kInstantiateType,
- kInstantiateType_Wide,
- kInstantiateTypeArgumentsTOS,
- kInstantiateTypeArgumentsTOS_Wide,
- kUnused32, // Reserved for IsType
- kUnused33, // Reserved for IsType_Wide
- kUnused34, // Reserved for IsSimpleType
- kUnused35, // Reserved for IsSimpleType_Wide
-
- // Exception handling.
- kThrow,
- kSetFrame,
- kMoveSpecial,
- kMoveSpecial_Wide,
-
- // Bool operations.
- kBooleanNegateTOS,
-
- // Null operations.
- kEqualsNull,
- kNullCheck,
- kNullCheck_Wide,
-
- // Int operations.
- kNegateInt,
- kAddInt,
- kSubInt,
- kMulInt,
- kTruncDivInt,
- kModInt,
- kBitAndInt,
- kBitOrInt,
- kBitXorInt,
- kShlInt,
- kShrInt,
- kCompareIntEq,
- kCompareIntGt,
- kCompareIntLt,
- kCompareIntGe,
- kCompareIntLe,
-
- // Double operations.
- kNegateDouble,
- kAddDouble,
- kSubDouble,
- kMulDouble,
- kDivDouble,
- kCompareDoubleEq,
- kCompareDoubleGt,
- kCompareDoubleLt,
- kCompareDoubleGe,
- kCompareDoubleLe,
-}
-
-/// Compact variants of opcodes are always even.
-/// Wide variant = opcode + kWideModifier.
-const int kWideModifier = 1;
-
-/// Opcode should fit into 1 byte.
-const int kMaxOpcodes = 256;
-
-enum Encoding {
- k0, // No operands.
- kA, // 1 operand: A = 8-bit unsigned.
- kD, // 1 operand: D = 8/32-bit unsigned.
- kX, // 1 operand: X = 8/32-bit signed.
- kT, // 1 operand: T = 8/24-bit signed.
- kAE, // 2 operands: A = 8-bit unsigned, E = 8/32-bit unsigned
- kAY, // 2 operands: A = 8-bit unsigned, Y = 8/32-bit signed
- kDF, // 2 operands: D = 8/32-bit unsigned, F = 8-bit unsigned
- kABC, // 3 operands: A, B, C - 8-bit unsigned.
-}
-
-int instructionSize(Encoding encoding, bool isWide) {
- switch (encoding) {
- case Encoding.k0:
- return 1;
- case Encoding.kA:
- return 2;
- case Encoding.kD:
- return isWide ? 5 : 2;
- case Encoding.kX:
- return isWide ? 5 : 2;
- case Encoding.kT:
- return isWide ? 4 : 2;
- case Encoding.kAE:
- return isWide ? 6 : 3;
- case Encoding.kAY:
- return isWide ? 6 : 3;
- case Encoding.kDF:
- return isWide ? 6 : 3;
- case Encoding.kABC:
- return 4;
- }
- throw 'Unexpected instruction encoding $encoding';
-}
-
-enum Operand {
- none, // ignored / non-existent operand
- imm, // immediate operand
- lit, // constant literal from object pool
- reg, // register (unsigned FP relative local)
- xeg, // x-register (signed FP relative local)
- tgt, // jump target relative to the PC of the current instruction
- spe, // SpecialIndex
-}
-
-class Format {
- final Encoding encoding;
- final List<Operand> operands;
- const Format(this.encoding, this.operands);
-}
-
-const Map<Opcode, Format> BytecodeFormats = const {
- Opcode.kTrap: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kEntry: const Format(
- Encoding.kD, const [Operand.imm, Operand.none, Operand.none]),
- Opcode.kEntryFixed: const Format(
- Encoding.kAE, const [Operand.imm, Operand.imm, Operand.none]),
- Opcode.kEntryOptional: const Format(
- Encoding.kABC, const [Operand.imm, Operand.imm, Operand.imm]),
- Opcode.kLoadConstant: const Format(
- Encoding.kAE, const [Operand.reg, Operand.lit, Operand.none]),
- Opcode.kFrame: const Format(
- Encoding.kD, const [Operand.imm, Operand.none, Operand.none]),
- Opcode.kCheckFunctionTypeArgs: const Format(
- Encoding.kAE, const [Operand.imm, Operand.reg, Operand.none]),
- Opcode.kCheckStack: const Format(
- Encoding.kA, const [Operand.imm, Operand.none, Operand.none]),
- Opcode.kDebugCheck: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kAllocate: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kAllocateT: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCreateArrayTOS: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kAllocateContext: const Format(
- Encoding.kAE, const [Operand.imm, Operand.imm, Operand.none]),
- Opcode.kCloneContext: const Format(
- Encoding.kAE, const [Operand.imm, Operand.imm, Operand.none]),
- Opcode.kLoadContextParent: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kStoreContextParent: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kLoadContextVar: const Format(
- Encoding.kAE, const [Operand.imm, Operand.imm, Operand.none]),
- Opcode.kStoreContextVar: const Format(
- Encoding.kAE, const [Operand.imm, Operand.imm, Operand.none]),
- Opcode.kPushConstant: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kPushNull: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kPushTrue: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kPushFalse: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kPushInt: const Format(
- Encoding.kX, const [Operand.imm, Operand.none, Operand.none]),
- Opcode.kDrop1: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kPush: const Format(
- Encoding.kX, const [Operand.xeg, Operand.none, Operand.none]),
- Opcode.kPopLocal: const Format(
- Encoding.kX, const [Operand.xeg, Operand.none, Operand.none]),
- Opcode.kStoreLocal: const Format(
- Encoding.kX, const [Operand.xeg, Operand.none, Operand.none]),
- Opcode.kLoadFieldTOS: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kStoreFieldTOS: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kStoreIndexedTOS: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kInitLateField: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kPushUninitializedSentinel: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kJumpIfInitialized: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kLoadStatic: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kStoreStaticTOS: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kJump: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kJumpIfNoAsserts: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kJumpIfNotZeroTypeArgs: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kJumpIfEqStrict: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kJumpIfNeStrict: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kJumpIfTrue: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kJumpIfFalse: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kJumpIfNull: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kJumpIfNotNull: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kJumpIfUnchecked: const Format(
- Encoding.kT, const [Operand.tgt, Operand.none, Operand.none]),
- Opcode.kInterfaceCall: const Format(
- Encoding.kDF, const [Operand.lit, Operand.imm, Operand.none]),
- Opcode.kInstantiatedInterfaceCall: const Format(
- Encoding.kDF, const [Operand.lit, Operand.imm, Operand.none]),
- Opcode.kDynamicCall: const Format(
- Encoding.kDF, const [Operand.lit, Operand.imm, Operand.none]),
- Opcode.kNativeCall: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kReturnTOS: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kAssertAssignable: const Format(
- Encoding.kAE, const [Operand.imm, Operand.lit, Operand.none]),
- Opcode.kAssertBoolean: const Format(
- Encoding.kA, const [Operand.imm, Operand.none, Operand.none]),
- Opcode.kAssertSubtype: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kLoadTypeArgumentsField: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kInstantiateType: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kInstantiateTypeArgumentsTOS: const Format(
- Encoding.kAE, const [Operand.imm, Operand.lit, Operand.none]),
- Opcode.kThrow: const Format(
- Encoding.kA, const [Operand.imm, Operand.none, Operand.none]),
- Opcode.kMoveSpecial: const Format(
- Encoding.kAY, const [Operand.spe, Operand.xeg, Operand.none]),
- Opcode.kSetFrame: const Format(
- Encoding.kA, const [Operand.imm, Operand.none, Operand.none]),
- Opcode.kBooleanNegateTOS: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kEqualsNull: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kNullCheck: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kNegateInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kAddInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kSubInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kMulInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kTruncDivInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kModInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kBitAndInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kBitOrInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kBitXorInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kShlInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kShrInt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCompareIntEq: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCompareIntGt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCompareIntLt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCompareIntGe: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCompareIntLe: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kDirectCall: const Format(
- Encoding.kDF, const [Operand.lit, Operand.imm, Operand.none]),
- Opcode.kUncheckedDirectCall: const Format(
- Encoding.kDF, const [Operand.lit, Operand.imm, Operand.none]),
- Opcode.kAllocateClosure: const Format(
- Encoding.kD, const [Operand.lit, Operand.none, Operand.none]),
- Opcode.kUncheckedClosureCall: const Format(
- Encoding.kDF, const [Operand.lit, Operand.imm, Operand.none]),
- Opcode.kUncheckedInterfaceCall: const Format(
- Encoding.kDF, const [Operand.lit, Operand.imm, Operand.none]),
- Opcode.kNegateDouble: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kAddDouble: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kSubDouble: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kMulDouble: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kDivDouble: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCompareDoubleEq: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCompareDoubleGt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCompareDoubleLt: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCompareDoubleGe: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
- Opcode.kCompareDoubleLe: const Format(
- Encoding.k0, const [Operand.none, Operand.none, Operand.none]),
-};
-
-// Should match constant in runtime/vm/stack_frame_kbc.h.
-const int kParamEndSlotFromFp = 4;
-
-enum SpecialIndex {
- exception,
- stackTrace,
-}
-
-/// Returns [true] if there is a wide variant for the given opcode.
-bool hasWideVariant(Opcode opcode) {
- final encoding = BytecodeFormats[opcode].encoding;
- switch (encoding) {
- case Encoding.k0:
- case Encoding.kA:
- case Encoding.kABC:
- return false;
- case Encoding.kD:
- case Encoding.kX:
- case Encoding.kT:
- case Encoding.kAE:
- case Encoding.kAY:
- case Encoding.kDF:
- return true;
- }
- throw 'Unexpected instruction encoding $encoding';
-}
-
-bool isWideOpcode(Opcode opcode) {
- return (BytecodeFormats[opcode] == null) &&
- hasWideVariant(Opcode.values[opcode.index - kWideModifier]);
-}
-
-Opcode fromWideOpcode(Opcode opcode) {
- assert(isWideOpcode(opcode));
- return Opcode.values[opcode.index - kWideModifier];
-}
-
-void verifyBytecodeInstructionDeclarations() {
- const String kWideSuffix = '_Wide';
- for (Opcode opcode in Opcode.values) {
- final format = BytecodeFormats[opcode];
- if (opcode.toString().endsWith(kWideSuffix)) {
- if (format != null) {
- throw 'Bytecode format should not be defined for wide opcode $opcode.';
- }
- final Opcode compact = Opcode.values[opcode.index - kWideModifier];
- if (compact.toString() + kWideSuffix != opcode.toString()) {
- throw 'Wide opcode $opcode should immediately follow its compact opcode (previous opcode is $compact).';
- }
- if (!hasWideVariant(compact)) {
- throw 'Wide opcode $opcode should not be defined for opcode $compact with encoding ${BytecodeFormats[compact].encoding}.';
- }
- }
- if (format == null) {
- continue;
- }
- if (hasWideVariant(opcode)) {
- if (Opcode.values[opcode.index + kWideModifier].toString() !=
- opcode.toString() + kWideSuffix) {
- throw 'Opcode $opcode$kWideSuffix should immedialy follow $opcode.';
- }
- if (opcode.index.isOdd) {
- throw 'Opcode $opcode (${format.encoding}) has a wide variant and should be even';
- }
- }
- }
- if (Opcode.values.length > kMaxOpcodes) {
- throw 'Too many opcodes';
- }
-}
-
-bool isJump(Opcode opcode) => BytecodeFormats[opcode].encoding == Encoding.kT;
-
-bool isThrow(Opcode opcode) => opcode == Opcode.kThrow;
-
-bool isCall(Opcode opcode) {
- switch (opcode) {
- case Opcode.kDirectCall:
- case Opcode.kUncheckedDirectCall:
- case Opcode.kInterfaceCall:
- case Opcode.kInstantiatedInterfaceCall:
- case Opcode.kUncheckedClosureCall:
- case Opcode.kUncheckedInterfaceCall:
- case Opcode.kDynamicCall:
- case Opcode.kNativeCall:
- return true;
- default:
- return false;
- }
-}
-
-bool isReturn(Opcode opcode) => opcode == Opcode.kReturnTOS;
-
-bool isControlFlow(Opcode opcode) =>
- isJump(opcode) || isThrow(opcode) || isCall(opcode) || isReturn(opcode);
-
-bool isPush(Opcode opcode) {
- switch (opcode) {
- case Opcode.kPush:
- case Opcode.kPushConstant:
- case Opcode.kPushNull:
- case Opcode.kPushTrue:
- case Opcode.kPushFalse:
- case Opcode.kPushInt:
- case Opcode.kPushUninitializedSentinel:
- return true;
- default:
- return false;
- }
-}
-
-// Bytecode instructions reference constant pool indices using
-// unsigned 32-bit operands.
-const int constantPoolIndexLimit = 1 << 32;
-
-// Local variables are referenced using 32-bit signed operands.
-const int localVariableIndexLimit = 1 << 31;
-
-// Captured variables are referenced using 32-bit unsigned operands.
-const int capturedVariableIndexLimit = 1 << 32;
-
-// Context IDs are referenced using 8-bit unsigned operands.
-const int contextIdLimit = 1 << 8;
-
-// Number of arguments is encoded as 8-bit unsigned operand.
-const int argumentsLimit = 1 << 8;
-
-// Base class for exceptions thrown when certain limit of bytecode
-// format is exceeded.
-abstract class BytecodeLimitExceededException {}
diff --git a/pkg/vm/lib/bytecode/declarations.dart b/pkg/vm/lib/bytecode/declarations.dart
deleted file mode 100644
index 9b247c9..0000000
--- a/pkg/vm/lib/bytecode/declarations.dart
+++ /dev/null
@@ -1,1659 +0,0 @@
-// Copyright (c) 2019, 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 vm.bytecode.declarations;
-
-import 'package:kernel/ast.dart' show TreeNode, listHashCode, listEquals;
-import 'package:kernel/core_types.dart' show CoreTypes;
-import 'bytecode_serialization.dart'
- show
- BufferedWriter,
- BufferedReader,
- BytecodeDeclaration,
- BytecodeSizeStatistics,
- StringTable;
-import 'constant_pool.dart' show ConstantPool;
-import 'dbc.dart' show currentBytecodeFormatVersion;
-import 'disassembler.dart' show BytecodeDisassembler;
-import 'exceptions.dart' show ExceptionsTable;
-import 'local_variable_table.dart' show LocalVariableTable;
-import 'object_table.dart' show ObjectTable, ObjectHandle, NameAndType;
-import 'source_positions.dart' show LineStarts, SourcePositions;
-
-import 'dart:typed_data' show Uint8List;
-
-class LibraryDeclaration extends BytecodeDeclaration {
- static const usesDartMirrorsFlag = 1 << 0;
- static const usesDartFfiFlag = 1 << 1;
- static const hasExtensionsFlag = 1 << 2;
- static const isNonNullableByDefaultFlag = 1 << 3;
-
- ObjectHandle importUri;
- final int flags;
- final ObjectHandle name;
- final ObjectHandle script;
- final List<ObjectHandle> extensionUris;
- final List<ClassDeclaration> classes;
-
- LibraryDeclaration(this.importUri, this.flags, this.name, this.script,
- this.extensionUris, this.classes);
-
- void write(BufferedWriter writer) {
- final start = writer.offset;
- writer.writePackedUInt30(flags);
- writer.writePackedObject(name);
- writer.writePackedObject(script);
- if ((flags & hasExtensionsFlag) != 0) {
- writer.writePackedList(extensionUris);
- }
- writer.writePackedUInt30(classes.length);
- for (var cls in classes) {
- writer.writePackedObject(cls.name);
- writer.writeLinkOffset(cls);
- }
- BytecodeSizeStatistics.librariesSize += (writer.offset - start);
- }
-
- factory LibraryDeclaration.read(BufferedReader reader) {
- final flags = reader.readPackedUInt30();
- final name = reader.readPackedObject();
- final script = reader.readPackedObject();
- final classes =
- List<ClassDeclaration>.generate(reader.readPackedUInt30(), (_) {
- final className = reader.readPackedObject();
- return reader.readLinkOffset<ClassDeclaration>()..name = className;
- });
- final extensionUris = ((flags & hasExtensionsFlag) != 0)
- ? reader.readPackedList<ObjectHandle>()
- : const <ObjectHandle>[];
- return new LibraryDeclaration(
- null, flags, name, script, extensionUris, classes);
- }
-
- @override
- String toString() {
- final StringBuffer sb = new StringBuffer();
- sb.writeln('Library $importUri');
- sb.writeln(' name $name');
- sb.writeln(' script $script');
- if ((flags & usesDartMirrorsFlag) != 0) {
- sb.writeln(' uses dart:mirrors');
- }
- if ((flags & usesDartFfiFlag) != 0) {
- sb.writeln(' uses dart:ffi');
- }
- if ((flags & hasExtensionsFlag) != 0) {
- sb.writeln(' extensions: $extensionUris');
- }
- if ((flags & isNonNullableByDefaultFlag) != 0) {
- sb.writeln(' is nnbd');
- }
- sb.writeln();
- for (var cls in classes) {
- sb.write(cls);
- }
- return sb.toString();
- }
-}
-
-class ClassDeclaration extends BytecodeDeclaration {
- static const isAbstractFlag = 1 << 0;
- static const isEnumFlag = 1 << 1;
- static const hasTypeParamsFlag = 1 << 2;
- static const hasTypeArgumentsFlag = 1 << 3;
- static const isTransformedMixinApplicationFlag = 1 << 4;
- static const hasSourcePositionsFlag = 1 << 5;
- static const hasAnnotationsFlag = 1 << 6;
- static const hasPragmaFlag = 1 << 7;
-
- ObjectHandle name;
- final int flags;
- final ObjectHandle script;
- final int position;
- final int endPosition;
- final TypeParametersDeclaration typeParameters;
- final int numTypeArguments;
- final ObjectHandle superType;
- final List<ObjectHandle> interfaces;
- final Members members;
- final AnnotationsDeclaration annotations;
-
- ClassDeclaration(
- this.name,
- this.flags,
- this.script,
- this.position,
- this.endPosition,
- this.typeParameters,
- this.numTypeArguments,
- this.superType,
- this.interfaces,
- this.members,
- this.annotations);
-
- void write(BufferedWriter writer) {
- final start = writer.offset;
- writer.writePackedUInt30(flags);
- writer.writePackedObject(script);
-
- if ((flags & hasSourcePositionsFlag) != 0) {
- writer.writePackedUInt30(position + 1);
- writer.writePackedUInt30(endPosition + 1);
- }
- if ((flags & hasTypeArgumentsFlag) != 0) {
- writer.writePackedUInt30(numTypeArguments);
- }
- if ((flags & hasTypeParamsFlag) != 0) {
- typeParameters.write(writer);
- }
- writer.writePackedObject(superType);
- writer.writePackedList(interfaces);
- if ((flags & hasAnnotationsFlag) != 0) {
- writer.writeLinkOffset(annotations);
- }
- writer.writeLinkOffset(members);
- BytecodeSizeStatistics.classesSize += (writer.offset - start);
- }
-
- factory ClassDeclaration.read(BufferedReader reader) {
- final flags = reader.readPackedUInt30();
- final script = reader.readPackedObject();
- final position = ((flags & hasSourcePositionsFlag) != 0)
- ? reader.readPackedUInt30() - 1
- : TreeNode.noOffset;
- final endPosition = ((flags & hasSourcePositionsFlag) != 0)
- ? reader.readPackedUInt30() - 1
- : TreeNode.noOffset;
- final numTypeArguments =
- ((flags & hasTypeArgumentsFlag) != 0) ? reader.readPackedUInt30() : 0;
- final typeParameters = ((flags & hasTypeParamsFlag) != 0)
- ? new TypeParametersDeclaration.read(reader)
- : null;
- final superType = reader.readPackedObject();
- final interfaces = reader.readPackedList<ObjectHandle>();
- final annotations = ((flags & hasAnnotationsFlag) != 0)
- ? reader.readLinkOffset<AnnotationsDeclaration>()
- : null;
- final members = reader.readLinkOffset<Members>();
- return new ClassDeclaration(
- null,
- flags,
- script,
- position,
- endPosition,
- typeParameters,
- numTypeArguments,
- superType,
- interfaces,
- members,
- annotations);
- }
-
- @override
- String toString() {
- final StringBuffer sb = new StringBuffer();
- sb.write('Class $name, script = $script');
- if ((flags & isAbstractFlag) != 0) {
- sb.write(', abstract');
- }
- if ((flags & isEnumFlag) != 0) {
- sb.write(', enum');
- }
- if ((flags & isTransformedMixinApplicationFlag) != 0) {
- sb.write(', mixin-application');
- }
- if ((flags & hasPragmaFlag) != 0) {
- sb.write(', has-pragma');
- }
- if ((flags & hasSourcePositionsFlag) != 0) {
- sb.write(', pos = $position, end-pos = $endPosition');
- }
- sb.writeln();
- if ((flags & hasTypeParamsFlag) != 0) {
- sb.write(' type-params $typeParameters (args: $numTypeArguments)\n');
- }
- if (superType != null) {
- sb.write(' extends $superType\n');
- }
- if (interfaces.isNotEmpty) {
- sb.write(' implements $interfaces\n');
- }
- if ((flags & hasAnnotationsFlag) != 0) {
- sb.write(' annotations $annotations\n');
- }
- sb.writeln();
- sb.write(members.toString());
- return sb.toString();
- }
-}
-
-class SourceFile extends BytecodeDeclaration {
- static const hasLineStartsFlag = 1 << 0;
- static const hasSourceFlag = 1 << 1;
-
- final ObjectHandle importUri;
- LineStarts lineStarts;
- String source;
-
- SourceFile(this.importUri, [this.lineStarts, this.source]);
-
- void write(BufferedWriter writer) {
- int flags = 0;
- if (lineStarts != null) {
- flags |= hasLineStartsFlag;
- }
- if (source != null && source != '') {
- flags |= hasSourceFlag;
- }
- writer.writePackedUInt30(flags);
- writer.writePackedObject(importUri);
- if ((flags & hasLineStartsFlag) != 0) {
- writer.writeLinkOffset(lineStarts);
- }
- if ((flags & hasSourceFlag) != 0) {
- writer.writePackedStringReference(source);
- }
- }
-
- factory SourceFile.read(BufferedReader reader) {
- final flags = reader.readPackedUInt30();
- final importUri = reader.readPackedObject();
- final lineStarts = ((flags & hasLineStartsFlag) != 0)
- ? reader.readLinkOffset<LineStarts>()
- : null;
- final source = ((flags & hasSourceFlag) != 0)
- ? reader.readPackedStringReference()
- : null;
- return new SourceFile(importUri, lineStarts, source);
- }
-
- @override
- String toString() {
- final StringBuffer sb = new StringBuffer();
- sb.write('source: import-uri $importUri');
- if (source != null && source != '') {
- sb.write(', ${source.length} text chars');
- }
- if (lineStarts != null) {
- sb.write(', ${lineStarts.lineStarts.length} line starts');
- }
- return sb.toString();
- }
-}
-
-class Members extends BytecodeDeclaration {
- final List<FieldDeclaration> fields;
- final List<FunctionDeclaration> functions;
-
- Members(this.fields, this.functions);
-
- int countFunctions() {
- int count = functions.length;
- for (var field in fields) {
- if ((field.flags & FieldDeclaration.hasGetterFlag) != 0) {
- ++count;
- }
- if ((field.flags & FieldDeclaration.hasSetterFlag) != 0) {
- ++count;
- }
- }
- return count;
- }
-
- void write(BufferedWriter writer) {
- final start = writer.offset;
- writer.writePackedUInt30(countFunctions());
- writer.writePackedUInt30(fields.length);
- for (var field in fields) {
- field.write(writer);
- }
- writer.writePackedUInt30(functions.length);
- for (var func in functions) {
- func.write(writer);
- }
- BytecodeSizeStatistics.membersSize += (writer.offset - start);
- }
-
- factory Members.read(BufferedReader reader) {
- reader.readPackedUInt30(); // numFunctions
- final fields = new List<FieldDeclaration>.generate(
- reader.readPackedUInt30(), (_) => new FieldDeclaration.read(reader));
- final functions = new List<FunctionDeclaration>.generate(
- reader.readPackedUInt30(), (_) => new FunctionDeclaration.read(reader));
- return new Members(fields, functions);
- }
-
- @override
- String toString() => "${fields.join('\n')}\n"
- "${functions.join('\n')}";
-}
-
-class FieldDeclaration {
- static const hasNontrivialInitializerFlag = 1 << 0;
- static const hasGetterFlag = 1 << 1;
- static const hasSetterFlag = 1 << 2;
- static const isReflectableFlag = 1 << 3;
- static const isStaticFlag = 1 << 4;
- static const isConstFlag = 1 << 5;
- static const isFinalFlag = 1 << 6;
- static const isCovariantFlag = 1 << 7;
- static const isGenericCovariantImplFlag = 1 << 8;
- static const hasSourcePositionsFlag = 1 << 9;
- static const hasAnnotationsFlag = 1 << 10;
- static const hasPragmaFlag = 1 << 11;
- static const hasCustomScriptFlag = 1 << 12;
- static const hasInitializerCodeFlag = 1 << 13;
- static const hasAttributesFlag = 1 << 14;
- static const isLateFlag = 1 << 15;
- static const isExtensionMemberFlag = 1 << 16;
- static const hasInitializerFlag = 1 << 17;
-
- final int flags;
- final ObjectHandle name;
- final ObjectHandle type;
- final ObjectHandle value;
- final ObjectHandle script;
- final int position;
- final int endPosition;
- final ObjectHandle getterName;
- final ObjectHandle setterName;
- final Code initializerCode;
- final AnnotationsDeclaration annotations;
- final ObjectHandle attributes;
-
- FieldDeclaration(
- this.flags,
- this.name,
- this.type,
- this.value,
- this.script,
- this.position,
- this.endPosition,
- this.getterName,
- this.setterName,
- this.initializerCode,
- this.annotations,
- this.attributes);
-
- void write(BufferedWriter writer) {
- writer.writePackedUInt30(flags);
- writer.writePackedObject(name);
- writer.writePackedObject(type);
-
- if ((flags & hasCustomScriptFlag) != 0) {
- writer.writePackedObject(script);
- }
- if ((flags & hasSourcePositionsFlag) != 0) {
- writer.writePackedUInt30(position + 1);
- writer.writePackedUInt30(endPosition + 1);
- }
- if ((flags & hasInitializerCodeFlag) != 0) {
- writer.writeLinkOffset(initializerCode);
- }
- if ((flags & hasNontrivialInitializerFlag) == 0) {
- writer.writePackedObject(value);
- }
- if ((flags & hasGetterFlag) != 0) {
- writer.writePackedObject(getterName);
- }
- if ((flags & hasSetterFlag) != 0) {
- writer.writePackedObject(setterName);
- }
- if ((flags & hasAnnotationsFlag) != 0) {
- writer.writeLinkOffset(annotations);
- }
- if ((flags & hasAttributesFlag) != 0) {
- writer.writePackedObject(attributes);
- }
- }
-
- factory FieldDeclaration.read(BufferedReader reader) {
- final flags = reader.readPackedUInt30();
- final name = reader.readPackedObject();
- final type = reader.readPackedObject();
- final script =
- ((flags & hasCustomScriptFlag) != 0) ? reader.readPackedObject() : null;
- final position = ((flags & hasSourcePositionsFlag) != 0)
- ? reader.readPackedUInt30() - 1
- : TreeNode.noOffset;
- final endPosition = ((flags & hasSourcePositionsFlag) != 0)
- ? reader.readPackedUInt30() - 1
- : TreeNode.noOffset;
- final initializerCode = ((flags & hasInitializerCodeFlag) != 0)
- ? reader.readLinkOffset<Code>()
- : null;
- final value = ((flags & hasNontrivialInitializerFlag) == 0)
- ? reader.readPackedObject()
- : null;
- final getterName =
- ((flags & hasGetterFlag) != 0) ? reader.readPackedObject() : null;
- final setterName =
- ((flags & hasSetterFlag) != 0) ? reader.readPackedObject() : null;
- final annotations = ((flags & hasAnnotationsFlag) != 0)
- ? reader.readLinkOffset<AnnotationsDeclaration>()
- : null;
- final attributes =
- ((flags & hasAttributesFlag) != 0) ? reader.readPackedObject() : null;
- return new FieldDeclaration(
- flags,
- name,
- type,
- value,
- script,
- position,
- endPosition,
- getterName,
- setterName,
- initializerCode,
- annotations,
- attributes);
- }
-
- @override
- String toString() {
- final StringBuffer sb = new StringBuffer();
- sb.write('Field $name, type = $type');
- if ((flags & hasGetterFlag) != 0) {
- sb.write(', getter = $getterName');
- }
- if ((flags & hasSetterFlag) != 0) {
- sb.write(', setter = $setterName');
- }
- if ((flags & isReflectableFlag) != 0) {
- sb.write(', reflectable');
- }
- if ((flags & isStaticFlag) != 0) {
- sb.write(', static');
- }
- if ((flags & isConstFlag) != 0) {
- sb.write(', const');
- }
- if ((flags & isFinalFlag) != 0) {
- sb.write(', final');
- }
- if ((flags & isLateFlag) != 0) {
- sb.write(', is-late');
- }
- if ((flags & isExtensionMemberFlag) != 0) {
- sb.write(', extension-member');
- }
- if ((flags & hasPragmaFlag) != 0) {
- sb.write(', has-pragma');
- }
- if ((flags & hasCustomScriptFlag) != 0) {
- sb.write(', custom-script = $script');
- }
- if ((flags & hasSourcePositionsFlag) != 0) {
- sb.write(', pos = $position, end-pos = $endPosition');
- }
- if ((flags & hasInitializerFlag) != 0) {
- sb.write(', has-initializer');
- }
- sb.writeln();
- if ((flags & hasInitializerCodeFlag) != 0) {
- sb.write(' initializer\n$initializerCode\n');
- }
- if ((flags & hasNontrivialInitializerFlag) == 0) {
- sb.write(' value = $value\n');
- }
- if ((flags & hasAnnotationsFlag) != 0) {
- sb.write(' annotations $annotations\n');
- }
- if ((flags & hasAttributesFlag) != 0) {
- sb.write(' attributes $attributes\n');
- }
- return sb.toString();
- }
-}
-
-class FunctionDeclaration {
- static const isConstructorFlag = 1 << 0;
- static const isGetterFlag = 1 << 1;
- static const isSetterFlag = 1 << 2;
- static const isFactoryFlag = 1 << 3;
- static const isStaticFlag = 1 << 4;
- static const isAbstractFlag = 1 << 5;
- static const isConstFlag = 1 << 6;
- static const hasOptionalPositionalParamsFlag = 1 << 7;
- static const hasOptionalNamedParamsFlag = 1 << 8;
- static const hasTypeParamsFlag = 1 << 9;
- static const isReflectableFlag = 1 << 10;
- static const isDebuggableFlag = 1 << 11;
- static const isAsyncFlag = 1 << 12;
- static const isAsyncStarFlag = 1 << 13;
- static const isSyncStarFlag = 1 << 14;
- static const isForwardingStubFlag = 1 << 15;
- static const isNoSuchMethodForwarderFlag = 1 << 16;
- static const isNativeFlag = 1 << 17;
- static const isExternalFlag = 1 << 18;
- static const hasSourcePositionsFlag = 1 << 19;
- static const hasAnnotationsFlag = 1 << 20;
- static const hasPragmaFlag = 1 << 21;
- static const hasCustomScriptFlag = 1 << 22;
- static const hasAttributesFlag = 1 << 23;
- static const isExtensionMemberFlag = 1 << 24;
- static const hasParameterFlagsFlag = 1 << 25;
-
- final int flags;
- final ObjectHandle name;
- final ObjectHandle script;
- final int position;
- final int endPosition;
- final TypeParametersDeclaration typeParameters;
- final int numRequiredParameters;
- final List<ParameterDeclaration> parameters;
- // Only contains the required flag for parameters when present.
- final List<int> parameterFlags;
- final ObjectHandle returnType;
- final ObjectHandle nativeName;
- final Code code;
- final AnnotationsDeclaration annotations;
- final ObjectHandle attributes;
-
- FunctionDeclaration(
- this.flags,
- this.name,
- this.script,
- this.position,
- this.endPosition,
- this.typeParameters,
- this.numRequiredParameters,
- this.parameters,
- this.parameterFlags,
- this.returnType,
- this.nativeName,
- this.code,
- this.annotations,
- this.attributes);
-
- void write(BufferedWriter writer) {
- writer.writePackedUInt30(flags);
- writer.writePackedObject(name);
- if ((flags & hasCustomScriptFlag) != 0) {
- writer.writePackedObject(script);
- }
- if ((flags & hasSourcePositionsFlag) != 0) {
- writer.writePackedUInt30(position + 1);
- writer.writePackedUInt30(endPosition + 1);
- }
- if ((flags & hasTypeParamsFlag) != 0) {
- typeParameters.write(writer);
- }
- writer.writePackedUInt30(parameters.length);
- if ((flags & hasOptionalPositionalParamsFlag) != 0 ||
- (flags & hasOptionalNamedParamsFlag) != 0) {
- writer.writePackedUInt30(numRequiredParameters);
- }
- for (var param in parameters) {
- param.write(writer);
- }
- if ((flags & hasParameterFlagsFlag) != 0) {
- writer.writePackedUInt30(parameterFlags.length);
- parameterFlags.forEach((flags) => writer.writePackedUInt30(flags));
- }
- writer.writePackedObject(returnType);
- if ((flags & isNativeFlag) != 0) {
- writer.writePackedObject(nativeName);
- }
- if ((flags & isAbstractFlag) == 0) {
- writer.writeLinkOffset(code);
- }
- if ((flags & hasAnnotationsFlag) != 0) {
- writer.writeLinkOffset(annotations);
- }
- if ((flags & hasAttributesFlag) != 0) {
- writer.writePackedObject(attributes);
- }
- }
-
- factory FunctionDeclaration.read(BufferedReader reader) {
- final flags = reader.readPackedUInt30();
- final name = reader.readPackedObject();
-
- final script =
- ((flags & hasCustomScriptFlag) != 0) ? reader.readPackedObject() : null;
- final position = ((flags & hasSourcePositionsFlag) != 0)
- ? reader.readPackedUInt30() - 1
- : TreeNode.noOffset;
- final endPosition = ((flags & hasSourcePositionsFlag) != 0)
- ? reader.readPackedUInt30() - 1
- : TreeNode.noOffset;
- final typeParameters = ((flags & hasTypeParamsFlag) != 0)
- ? new TypeParametersDeclaration.read(reader)
- : null;
-
- final numParameters = reader.readPackedUInt30();
- final numRequiredParameters =
- ((flags & hasOptionalPositionalParamsFlag) != 0 ||
- (flags & hasOptionalNamedParamsFlag) != 0)
- ? reader.readPackedUInt30()
- : numParameters;
-
- final parameters = new List<ParameterDeclaration>.generate(
- numParameters, (_) => new ParameterDeclaration.read(reader));
- final parameterFlags = ((flags & hasParameterFlagsFlag) != 0)
- ? List<int>.generate(
- reader.readPackedUInt30(), (_) => reader.readPackedUInt30())
- : null;
- final returnType = reader.readPackedObject();
- final nativeName =
- ((flags & isNativeFlag) != 0) ? reader.readPackedObject() : null;
- final code =
- ((flags & isAbstractFlag) == 0) ? reader.readLinkOffset<Code>() : null;
- final annotations = ((flags & hasAnnotationsFlag) != 0)
- ? reader.readLinkOffset<AnnotationsDeclaration>()
- : null;
- final attributes =
- ((flags & hasAttributesFlag) != 0) ? reader.readPackedObject() : null;
- return new FunctionDeclaration(
- flags,
- name,
- script,
- position,
- endPosition,
- typeParameters,
- numRequiredParameters,
- parameters,
- parameterFlags,
- returnType,
- nativeName,
- code,
- annotations,
- attributes);
- }
-
- @override
- String toString() {
- final StringBuffer sb = new StringBuffer();
- sb.write('Function $name');
- if ((flags & isConstructorFlag) != 0) {
- sb.write(', constructor');
- }
- if ((flags & isGetterFlag) != 0) {
- sb.write(', getter');
- }
- if ((flags & isSetterFlag) != 0) {
- sb.write(', setter');
- }
- if ((flags & isFactoryFlag) != 0) {
- sb.write(', factory');
- }
- if ((flags & isStaticFlag) != 0) {
- sb.write(', static');
- }
- if ((flags & isAbstractFlag) != 0) {
- sb.write(', abstract');
- }
- if ((flags & isConstFlag) != 0) {
- sb.write(', const');
- }
- if ((flags & isExtensionMemberFlag) != 0) {
- sb.write(', extension-member');
- }
- if ((flags & hasOptionalPositionalParamsFlag) != 0) {
- sb.write(', has-optional-positional-params');
- }
- if ((flags & hasOptionalNamedParamsFlag) != 0) {
- sb.write(', has-optional-named-params');
- }
- if ((flags & isReflectableFlag) != 0) {
- sb.write(', reflectable');
- }
- if ((flags & isDebuggableFlag) != 0) {
- sb.write(', debuggable');
- }
- if ((flags & isAsyncFlag) != 0) {
- sb.write(', async');
- }
- if ((flags & isAsyncStarFlag) != 0) {
- sb.write(', async*');
- }
- if ((flags & isSyncStarFlag) != 0) {
- sb.write(', sync*');
- }
- if ((flags & isForwardingStubFlag) != 0) {
- sb.write(', forwarding-stub');
- }
- if ((flags & isNoSuchMethodForwarderFlag) != 0) {
- sb.write(', no-such-method-forwarder');
- }
- if ((flags & isNativeFlag) != 0) {
- sb.write(', native $nativeName');
- }
- if ((flags & isExternalFlag) != 0) {
- sb.write(', external');
- }
- if ((flags & hasPragmaFlag) != 0) {
- sb.write(', has-pragma');
- }
- if ((flags & hasCustomScriptFlag) != 0) {
- sb.write(', custom-script = $script');
- }
- if ((flags & hasSourcePositionsFlag) != 0) {
- sb.write(', pos = $position, end-pos = $endPosition');
- }
- sb.writeln();
- if ((flags & hasTypeParamsFlag) != 0) {
- sb.write(' type-params $typeParameters\n');
- }
- sb.write(' parameters $parameters (required: $numRequiredParameters)\n');
- if ((flags & hasParameterFlagsFlag) != 0) {
- sb.write(' parameter-flags $parameterFlags\n');
- }
- sb.write(' return-type $returnType\n');
- if ((flags & hasAnnotationsFlag) != 0) {
- sb.write(' annotations $annotations\n');
- }
- if ((flags & hasAttributesFlag) != 0) {
- sb.write(' attributes $attributes\n');
- }
- if ((flags & isAbstractFlag) == 0 && (flags & isExternalFlag) == 0) {
- sb.write('\n$code\n');
- }
- return sb.toString();
- }
-}
-
-class TypeParametersDeclaration {
- final List<NameAndType> typeParams;
-
- TypeParametersDeclaration(this.typeParams);
-
- void write(BufferedWriter writer) {
- writer.writePackedUInt30(typeParams.length);
- for (var tp in typeParams) {
- writer.writePackedObject(tp.name);
- }
- for (var tp in typeParams) {
- writer.writePackedObject(tp.type);
- }
- }
-
- factory TypeParametersDeclaration.read(BufferedReader reader) {
- final int numTypeParams = reader.readPackedUInt30();
- List<ObjectHandle> names = new List<ObjectHandle>.generate(
- numTypeParams, (_) => reader.readPackedObject());
- List<ObjectHandle> bounds = new List<ObjectHandle>.generate(
- numTypeParams, (_) => reader.readPackedObject());
- return new TypeParametersDeclaration(new List<NameAndType>.generate(
- numTypeParams, (int i) => new NameAndType(names[i], bounds[i])));
- }
-
- @override
- int get hashCode => listHashCode(typeParams);
-
- @override
- bool operator ==(other) =>
- other is TypeParametersDeclaration &&
- listEquals(this.typeParams, other.typeParams);
-
- @override
- String toString() => '<${typeParams.join(', ')}>';
-}
-
-class ParameterDeclaration {
- // Parameter flags are written separately (in Code).
- static const isCovariantFlag = 1 << 0;
- static const isGenericCovariantImplFlag = 1 << 1;
- static const isFinalFlag = 1 << 2;
- static const isRequiredFlag = 1 << 3;
-
- final ObjectHandle name;
- final ObjectHandle type;
-
- ParameterDeclaration(this.name, this.type);
-
- void write(BufferedWriter writer) {
- writer.writePackedObject(name);
- writer.writePackedObject(type);
- }
-
- factory ParameterDeclaration.read(BufferedReader reader) {
- final name = reader.readPackedObject();
- final type = reader.readPackedObject();
- return new ParameterDeclaration(name, type);
- }
-
- @override
- String toString() => '$type $name';
-}
-
-class Code extends BytecodeDeclaration {
- static const hasExceptionsTableFlag = 1 << 0;
- static const hasSourcePositionsFlag = 1 << 1;
- static const hasNullableFieldsFlag = 1 << 2;
- static const hasClosuresFlag = 1 << 3;
- static const hasParameterFlagsFlag = 1 << 4;
- static const hasForwardingStubTargetFlag = 1 << 5;
- static const hasDefaultFunctionTypeArgsFlag = 1 << 6;
- static const hasLocalVariablesFlag = 1 << 7;
-
- final ConstantPool constantPool;
- final Uint8List bytecodes;
- final ExceptionsTable exceptionsTable;
- final SourcePositions sourcePositions;
- final LocalVariableTable localVariables;
- final List<ObjectHandle> nullableFields;
- final List<ClosureDeclaration> closures;
- // Contains all parameter flags except for the required flags, which are
- // kept instead in the FunctionDeclaration and ClosureDeclaration.
- final List<int> parameterFlags;
- final int forwardingStubTargetCpIndex;
- final int defaultFunctionTypeArgsCpIndex;
-
- bool get hasExceptionsTable => exceptionsTable.blocks.isNotEmpty;
- bool get hasSourcePositions =>
- sourcePositions != null && sourcePositions.isNotEmpty;
- bool get hasLocalVariables =>
- localVariables != null && localVariables.isNotEmpty;
- bool get hasNullableFields => nullableFields.isNotEmpty;
- bool get hasClosures => closures.isNotEmpty;
-
- int get flags =>
- (hasExceptionsTable ? hasExceptionsTableFlag : 0) |
- (hasSourcePositions ? hasSourcePositionsFlag : 0) |
- (hasNullableFields ? hasNullableFieldsFlag : 0) |
- (hasClosures ? hasClosuresFlag : 0) |
- (parameterFlags != null ? hasParameterFlagsFlag : 0) |
- (forwardingStubTargetCpIndex != null ? hasForwardingStubTargetFlag : 0) |
- (defaultFunctionTypeArgsCpIndex != null
- ? hasDefaultFunctionTypeArgsFlag
- : 0) |
- (hasLocalVariables ? hasLocalVariablesFlag : 0);
-
- Code(
- this.constantPool,
- this.bytecodes,
- this.exceptionsTable,
- this.sourcePositions,
- this.localVariables,
- this.nullableFields,
- this.closures,
- this.parameterFlags,
- this.forwardingStubTargetCpIndex,
- this.defaultFunctionTypeArgsCpIndex);
-
- void write(BufferedWriter writer) {
- final start = writer.offset;
- writer.writePackedUInt30(flags);
- if (parameterFlags != null) {
- writer.writePackedUInt30(parameterFlags.length);
- parameterFlags.forEach((flags) => writer.writePackedUInt30(flags));
- }
- if (forwardingStubTargetCpIndex != null) {
- writer.writePackedUInt30(forwardingStubTargetCpIndex);
- }
- if (defaultFunctionTypeArgsCpIndex != null) {
- writer.writePackedUInt30(defaultFunctionTypeArgsCpIndex);
- }
- if (hasClosures) {
- writer.writePackedUInt30(closures.length);
- closures.forEach((c) => c.write(writer));
- }
- constantPool.write(writer);
- _writeBytecodeInstructions(writer, bytecodes);
- if (hasExceptionsTable) {
- exceptionsTable.write(writer);
- }
- if (hasSourcePositions) {
- writer.writeLinkOffset(sourcePositions);
- }
- if (hasLocalVariables) {
- writer.writeLinkOffset(localVariables);
- }
- if (hasNullableFields) {
- writer.writePackedList(nullableFields);
- }
- if (hasClosures) {
- closures.forEach((c) => c.code.write(writer));
- }
- BytecodeSizeStatistics.codeSize += (writer.offset - start);
- }
-
- factory Code.read(BufferedReader reader) {
- int flags = reader.readPackedUInt30();
- final parameterFlags = ((flags & hasParameterFlagsFlag) != 0)
- ? new List<int>.generate(
- reader.readPackedUInt30(), (_) => reader.readPackedUInt30())
- : null;
- final forwardingStubTargetCpIndex =
- ((flags & hasForwardingStubTargetFlag) != 0)
- ? reader.readPackedUInt30()
- : null;
- final defaultFunctionTypeArgsCpIndex =
- ((flags & hasDefaultFunctionTypeArgsFlag) != 0)
- ? reader.readPackedUInt30()
- : null;
- final List<ClosureDeclaration> closures = ((flags & hasClosuresFlag) != 0)
- ? new List<ClosureDeclaration>.generate(reader.readPackedUInt30(),
- (_) => new ClosureDeclaration.read(reader))
- : const <ClosureDeclaration>[];
- final ConstantPool constantPool = new ConstantPool.read(reader);
- final Uint8List bytecodes = _readBytecodeInstructions(reader);
- final exceptionsTable = ((flags & hasExceptionsTableFlag) != 0)
- ? new ExceptionsTable.read(reader)
- : new ExceptionsTable();
- final sourcePositions = ((flags & hasSourcePositionsFlag) != 0)
- ? reader.readLinkOffset<SourcePositions>()
- : null;
- final localVariables = ((flags & hasLocalVariablesFlag) != 0)
- ? reader.readLinkOffset<LocalVariableTable>()
- : null;
- final List<ObjectHandle> nullableFields =
- ((flags & hasNullableFieldsFlag) != 0)
- ? reader.readPackedList<ObjectHandle>()
- : const <ObjectHandle>[];
- for (var c in closures) {
- c.code = new ClosureCode.read(reader);
- }
- return new Code(
- constantPool,
- bytecodes,
- exceptionsTable,
- sourcePositions,
- localVariables,
- nullableFields,
- closures,
- parameterFlags,
- forwardingStubTargetCpIndex,
- defaultFunctionTypeArgsCpIndex);
- }
-
- // TODO(alexmarkov): Consider printing constant pool before bytecode.
- @override
- String toString() => "Bytecode {\n"
- "${new BytecodeDisassembler().disassemble(bytecodes, exceptionsTable, annotations: [
- hasSourcePositions
- ? sourcePositions.getBytecodeAnnotations()
- : const <int, String>{},
- hasLocalVariables
- ? localVariables.getBytecodeAnnotations()
- : const <int, String>{}
- ])}}\n"
- "$exceptionsTable"
- "${nullableFields.isEmpty ? '' : 'Nullable fields: $nullableFields\n'}"
- "${parameterFlags == null ? '' : 'Parameter flags: $parameterFlags\n'}"
- "${forwardingStubTargetCpIndex == null ? '' : 'Forwarding stub target: CP#$forwardingStubTargetCpIndex\n'}"
- "${defaultFunctionTypeArgsCpIndex == null ? '' : 'Default function type arguments: CP#$defaultFunctionTypeArgsCpIndex\n'}"
- "$constantPool"
- "${closures.join('\n')}";
-}
-
-class ClosureDeclaration {
- static const hasOptionalPositionalParamsFlag = 1 << 0;
- static const hasOptionalNamedParamsFlag = 1 << 1;
- static const hasTypeParamsFlag = 1 << 2;
- static const hasSourcePositionsFlag = 1 << 3;
- static const isAsyncFlag = 1 << 4;
- static const isAsyncStarFlag = 1 << 5;
- static const isSyncStarFlag = 1 << 6;
- static const isDebuggableFlag = 1 << 7;
- static const hasAttributesFlag = 1 << 8;
- static const hasParameterFlagsFlag = 1 << 9;
-
- int flags;
- final ObjectHandle parent;
- final ObjectHandle name;
- final int position;
- final int endPosition;
- final List<NameAndType> typeParams;
- final int numRequiredParams;
- final int numNamedParams;
- final List<NameAndType> parameters;
- // Only contains the required flag for parameters when present.
- final List<int> parameterFlags;
- final ObjectHandle returnType;
- ObjectHandle attributes;
- ClosureCode code;
-
- ClosureDeclaration(
- this.flags,
- this.parent,
- this.name,
- this.position,
- this.endPosition,
- this.typeParams,
- this.numRequiredParams,
- this.numNamedParams,
- this.parameters,
- this.parameterFlags,
- this.returnType,
- [this.attributes]);
-
- void write(BufferedWriter writer) {
- writer.writePackedUInt30(flags);
- writer.writePackedObject(parent);
- writer.writePackedObject(name);
-
- if (flags & hasSourcePositionsFlag != 0) {
- writer.writePackedUInt30(position + 1);
- writer.writePackedUInt30(endPosition + 1);
- }
-
- if (flags & hasTypeParamsFlag != 0) {
- writer.writePackedUInt30(typeParams.length);
- for (var tp in typeParams) {
- writer.writePackedObject(tp.name);
- }
- for (var tp in typeParams) {
- writer.writePackedObject(tp.type);
- }
- }
- writer.writePackedUInt30(parameters.length);
- if (flags &
- (hasOptionalPositionalParamsFlag | hasOptionalNamedParamsFlag) !=
- 0) {
- writer.writePackedUInt30(numRequiredParams);
- }
- for (var param in parameters) {
- writer.writePackedObject(param.name);
- writer.writePackedObject(param.type);
- }
- if ((flags & hasParameterFlagsFlag) != 0) {
- writer.writePackedUInt30(parameterFlags.length);
- for (var pf in parameterFlags) {
- writer.writePackedUInt30(pf);
- }
- }
- writer.writePackedObject(returnType);
- if ((flags & hasAttributesFlag) != 0) {
- writer.writePackedObject(attributes);
- }
- }
-
- factory ClosureDeclaration.read(BufferedReader reader) {
- final int flags = reader.readPackedUInt30();
- final parent = reader.readPackedObject();
- final name = reader.readPackedObject();
- final position = ((flags & hasSourcePositionsFlag) != 0)
- ? reader.readPackedUInt30() - 1
- : TreeNode.noOffset;
- final endPosition = ((flags & hasSourcePositionsFlag) != 0)
- ? reader.readPackedUInt30() - 1
- : TreeNode.noOffset;
- List<NameAndType> typeParams;
- if ((flags & hasTypeParamsFlag) != 0) {
- final int numTypeParams = reader.readPackedUInt30();
- List<ObjectHandle> names = new List<ObjectHandle>.generate(
- numTypeParams, (_) => reader.readPackedObject());
- List<ObjectHandle> bounds = new List<ObjectHandle>.generate(
- numTypeParams, (_) => reader.readPackedObject());
- typeParams = new List<NameAndType>.generate(
- numTypeParams, (int i) => new NameAndType(names[i], bounds[i]));
- } else {
- typeParams = const <NameAndType>[];
- }
- final numParams = reader.readPackedUInt30();
- final numRequiredParams = (flags &
- (hasOptionalPositionalParamsFlag |
- hasOptionalNamedParamsFlag) !=
- 0)
- ? reader.readPackedUInt30()
- : numParams;
- final numNamedParams = (flags & hasOptionalNamedParamsFlag != 0)
- ? (numParams - numRequiredParams)
- : 0;
- final List<NameAndType> parameters = new List<NameAndType>.generate(
- numParams,
- (_) => new NameAndType(
- reader.readPackedObject(), reader.readPackedObject()));
- List<int> parameterFlags;
- if ((flags & hasParameterFlagsFlag) != 0) {
- final int numParameterFlags = reader.readPackedUInt30();
- new List<int>.generate(
- numParameterFlags, (_) => reader.readPackedUInt30());
- } else {
- parameterFlags = const <int>[];
- }
- final returnType = reader.readPackedObject();
- final attributes =
- ((flags & hasAttributesFlag) != 0) ? reader.readPackedObject() : null;
- return new ClosureDeclaration(
- flags,
- parent,
- name,
- position,
- endPosition,
- typeParams,
- numRequiredParams,
- numNamedParams,
- parameters,
- parameterFlags,
- returnType,
- attributes);
- }
-
- void _writeParamsToBuffer(
- StringBuffer sb, List<NameAndType> params, List<int> flags) {
- assert(flags == null || (params.length == flags.length));
- for (int i = 0; i < params.length; i++) {
- if (i != 0) {
- sb.write(', ');
- }
- // We only store the required flag for ClosureDeclarations.
- if (flags != null && flags[i] != 0) {
- sb.write('required ');
- }
- sb.write(params[i]);
- }
- }
-
- @override
- String toString() {
- final StringBuffer sb = new StringBuffer();
- sb.write('Closure $parent::$name');
- if ((flags & isAsyncFlag) != 0) {
- sb.write(' async');
- }
- if ((flags & isAsyncStarFlag) != 0) {
- sb.write(' async*');
- }
- if ((flags & isSyncStarFlag) != 0) {
- sb.write(' sync*');
- }
- if (position != TreeNode.noOffset) {
- sb.write(' pos = $position, end-pos = $endPosition');
- }
- if (typeParams.isNotEmpty) {
- sb.write(' <${typeParams.join(', ')}>');
- }
- sb.write(' (');
- final requiredFlags = (flags & hasParameterFlagsFlag) != 0
- ? parameterFlags.sublist(0, numRequiredParams)
- : null;
- _writeParamsToBuffer(
- sb, parameters.sublist(0, numRequiredParams), requiredFlags);
- if (numRequiredParams != parameters.length) {
- if (numRequiredParams > 0) {
- sb.write(', ');
- }
- sb.write(numNamedParams > 0 ? '{ ' : '[ ');
- final optionalFlags = (flags & hasParameterFlagsFlag) != 0
- ? parameterFlags.sublist(numRequiredParams)
- : null;
- _writeParamsToBuffer(
- sb, parameters.sublist(numRequiredParams), optionalFlags);
- sb.write(numNamedParams > 0 ? ' }' : ' ]');
- }
- sb.write(') -> ');
- sb.writeln(returnType);
- if ((flags & hasAttributesFlag) != 0) {
- sb.write(' attributes $attributes\n');
- }
- if (code != null) {
- sb.write(code.toString());
- }
- return sb.toString();
- }
-}
-
-/// Bytecode of a nested function (closure).
-/// Closures share the constant pool of a top-level member.
-class ClosureCode {
- static const hasExceptionsTableFlag = 1 << 0;
- static const hasSourcePositionsFlag = 1 << 1;
- static const hasLocalVariablesFlag = 1 << 2;
-
- final Uint8List bytecodes;
- final ExceptionsTable exceptionsTable;
- final SourcePositions sourcePositions;
- final LocalVariableTable localVariables;
-
- bool get hasExceptionsTable => exceptionsTable.blocks.isNotEmpty;
- bool get hasSourcePositions =>
- sourcePositions != null && sourcePositions.isNotEmpty;
- bool get hasLocalVariables =>
- localVariables != null && localVariables.isNotEmpty;
-
- int get flags =>
- (hasExceptionsTable ? hasExceptionsTableFlag : 0) |
- (hasSourcePositions ? hasSourcePositionsFlag : 0) |
- (hasLocalVariables ? hasLocalVariablesFlag : 0);
-
- ClosureCode(this.bytecodes, this.exceptionsTable, this.sourcePositions,
- this.localVariables);
-
- void write(BufferedWriter writer) {
- writer.writePackedUInt30(flags);
- _writeBytecodeInstructions(writer, bytecodes);
- if (hasExceptionsTable) {
- exceptionsTable.write(writer);
- }
- if (hasSourcePositions) {
- writer.writeLinkOffset(sourcePositions);
- }
- if (hasLocalVariables) {
- writer.writeLinkOffset(localVariables);
- }
- }
-
- factory ClosureCode.read(BufferedReader reader) {
- final int flags = reader.readPackedUInt30();
- final Uint8List bytecodes = _readBytecodeInstructions(reader);
- final exceptionsTable = ((flags & hasExceptionsTableFlag) != 0)
- ? new ExceptionsTable.read(reader)
- : new ExceptionsTable();
- final sourcePositions = ((flags & hasSourcePositionsFlag) != 0)
- ? reader.readLinkOffset<SourcePositions>()
- : null;
- final localVariables = ((flags & hasLocalVariablesFlag) != 0)
- ? reader.readLinkOffset<LocalVariableTable>()
- : null;
- return new ClosureCode(
- bytecodes, exceptionsTable, sourcePositions, localVariables);
- }
-
- @override
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.writeln('ClosureCode {');
- sb.write(new BytecodeDisassembler()
- .disassemble(bytecodes, exceptionsTable, annotations: [
- hasSourcePositions
- ? sourcePositions.getBytecodeAnnotations()
- : const <int, String>{},
- hasLocalVariables
- ? localVariables.getBytecodeAnnotations()
- : const <int, String>{}
- ]));
- sb.writeln('}');
- return sb.toString();
- }
-}
-
-class AnnotationsDeclaration extends BytecodeDeclaration {
- final ObjectHandle object;
-
- AnnotationsDeclaration(this.object);
-
- void write(BufferedWriter writer) {
- writer.writePackedObject(object);
- }
-
- factory AnnotationsDeclaration.read(BufferedReader reader) {
- return new AnnotationsDeclaration(reader.readPackedObject());
- }
-
- @override
- String toString() => object.toString();
-}
-
-class _Section {
- int numItems;
- int offset;
- BufferedWriter writer;
-
- _Section(this.numItems, this.writer);
-
- int get size => writer.offset;
-}
-
-class Component {
- static const int magicValue = 0x44424332; // 'DBC2'
- static const int numSections = 14;
- static const int sectionAlignment = 4;
-
- // UInt32 magic, version, numSections x (numItems, offset)
- static const int headerSize = (2 + numSections * 2) * 4;
-
- int version;
- StringTable stringTable;
- ObjectTable objectTable;
- final List<LibraryDeclaration> libraries = <LibraryDeclaration>[];
- final List<ClassDeclaration> classes = <ClassDeclaration>[];
- final List<Members> members = <Members>[];
- final List<Code> codes = <Code>[];
- final List<SourcePositions> sourcePositions = <SourcePositions>[];
- final List<LineStarts> lineStarts = <LineStarts>[];
- final List<SourceFile> sourceFiles = <SourceFile>[];
- final Map<Uri, SourceFile> uriToSource = <Uri, SourceFile>{};
- final List<LocalVariableTable> localVariables = <LocalVariableTable>[];
- final List<AnnotationsDeclaration> annotations = <AnnotationsDeclaration>[];
- Set<String> protectedNames;
- ObjectHandle mainLibrary;
-
- Component(this.version, CoreTypes coreTypes)
- : stringTable = new StringTable(),
- objectTable = new ObjectTable(coreTypes);
-
- void write(BufferedWriter writer) {
- objectTable.allocateIndexTable();
-
- // Write sections to their own buffers in reverse order as section may
- // reference data structures from successor sections by offsets.
-
- final protectedNamesWriter = new BufferedWriter.fromWriter(writer);
- if (protectedNames != null && protectedNames.isNotEmpty) {
- for (var name in protectedNames) {
- protectedNamesWriter.writePackedStringReference(name);
- }
- }
-
- final annotationsWriter = new BufferedWriter.fromWriter(writer);
- for (var annot in annotations) {
- writer.linkWriter.put(annot, annotationsWriter.offset);
- annot.write(annotationsWriter);
- }
- BytecodeSizeStatistics.annotationsSize += annotationsWriter.offset;
-
- final localVariablesWriter = new BufferedWriter.fromWriter(writer);
- for (var lv in localVariables) {
- writer.linkWriter.put(lv, localVariablesWriter.offset);
- lv.write(localVariablesWriter);
- }
- BytecodeSizeStatistics.localVariablesSize += localVariablesWriter.offset;
-
- final lineStartsWriter = new BufferedWriter.fromWriter(writer);
- for (var ls in lineStarts) {
- writer.linkWriter.put(ls, lineStartsWriter.offset);
- ls.write(lineStartsWriter);
- }
- BytecodeSizeStatistics.lineStartsSize += lineStartsWriter.offset;
-
- final sourceFilesWriter = new BufferedWriter.fromWriter(writer);
- for (var sf in sourceFiles) {
- writer.linkWriter.put(sf, sourceFilesWriter.offset);
- sf.write(sourceFilesWriter);
- }
- BytecodeSizeStatistics.sourceFilesSize += sourceFilesWriter.offset;
-
- final sourcePositionsWriter = new BufferedWriter.fromWriter(writer);
- for (var sp in sourcePositions) {
- writer.linkWriter.put(sp, sourcePositionsWriter.offset);
- sp.write(sourcePositionsWriter);
- }
- BytecodeSizeStatistics.sourcePositionsSize += sourcePositionsWriter.offset;
-
- final codesWriter = new BufferedWriter.fromWriter(writer);
- for (var code in codes) {
- writer.linkWriter.put(code, codesWriter.offset);
- code.write(codesWriter);
- }
-
- final membersWriter = new BufferedWriter.fromWriter(writer);
- for (var m in members) {
- writer.linkWriter.put(m, membersWriter.offset);
- m.write(membersWriter);
- }
-
- final classesWriter = new BufferedWriter.fromWriter(writer);
- for (var cls in classes) {
- writer.linkWriter.put(cls, classesWriter.offset);
- cls.write(classesWriter);
- }
-
- final librariesWriter = new BufferedWriter.fromWriter(writer);
- for (var library in libraries) {
- writer.linkWriter.put(library, librariesWriter.offset);
- library.write(librariesWriter);
- }
-
- final libraryIndexWriter = new BufferedWriter.fromWriter(writer);
- for (var library in libraries) {
- libraryIndexWriter.writePackedObject(library.importUri);
- libraryIndexWriter.writeLinkOffset(library);
- }
- BytecodeSizeStatistics.librariesSize += libraryIndexWriter.offset;
-
- BufferedWriter mainWriter;
- if (mainLibrary != null) {
- mainWriter = new BufferedWriter.fromWriter(writer);
- mainWriter.writePackedObject(mainLibrary);
- }
-
- final objectsWriter = new BufferedWriter.fromWriter(writer);
- objectTable.write(objectsWriter);
-
- final stringsWriter = new BufferedWriter.fromWriter(writer);
- stringTable.write(stringsWriter);
-
- List<_Section> sections = [
- new _Section(0, stringsWriter),
- new _Section(0, objectsWriter),
- new _Section(0, mainWriter),
- new _Section(libraries.length, libraryIndexWriter),
- new _Section(libraries.length, librariesWriter),
- new _Section(classes.length, classesWriter),
- new _Section(members.length, membersWriter),
- new _Section(codes.length, codesWriter),
- new _Section(sourcePositions.length, sourcePositionsWriter),
- new _Section(sourceFiles.length, sourceFilesWriter),
- new _Section(lineStarts.length, lineStartsWriter),
- new _Section(localVariables.length, localVariablesWriter),
- new _Section(annotations.length, annotationsWriter),
- new _Section(protectedNames != null ? protectedNames.length : 0,
- protectedNamesWriter),
- ];
- assert(sections.length == numSections);
-
- int offset = headerSize;
- for (var section in sections) {
- if (section.writer != null) {
- section.offset = offset;
- offset += section.size;
- } else {
- section.offset = 0;
- }
- }
-
- final start = writer.offset;
-
- writer.writeUInt32(magicValue);
- writer.writeUInt32(version);
- for (var section in sections) {
- writer.writeUInt32(section.numItems);
- writer.writeUInt32(section.offset);
- }
- assert(writer.offset - start == headerSize);
- for (var section in sections) {
- if (section.writer != null) {
- assert(writer.offset - start == section.offset);
- writer.appendWriter(section.writer);
- }
- }
-
- BytecodeSizeStatistics.componentSize += (writer.offset - start);
- }
-
- Component.read(BufferedReader reader) {
- final int start = reader.offset;
-
- final int magic = reader.readUInt32();
- if (magic != magicValue) {
- throw 'Error: unexpected bytecode magic $magic';
- }
-
- version = reader.readUInt32();
- if (version != currentBytecodeFormatVersion) {
- throw 'Error: unexpected bytecode format version $version';
- }
-
- reader.formatVersion = version;
-
- reader.readUInt32();
- final stringTableOffset = reader.readUInt32();
-
- reader.readUInt32();
- final objectTableOffset = reader.readUInt32();
-
- reader.readUInt32();
- final mainOffset = reader.readUInt32();
-
- final librariesNum = reader.readUInt32();
- final libraryIndexOffset = reader.readUInt32();
-
- reader.readUInt32();
- final librariesOffset = reader.readUInt32();
-
- final classesNum = reader.readUInt32();
- final classesOffset = reader.readUInt32();
-
- final membersNum = reader.readUInt32();
- final membersOffset = reader.readUInt32();
-
- final codesNum = reader.readUInt32();
- final codesOffset = reader.readUInt32();
-
- final sourcePositionsNum = reader.readUInt32();
- final sourcePositionsOffset = reader.readUInt32();
-
- final sourceFilesNum = reader.readUInt32();
- final sourceFilesOffset = reader.readUInt32();
-
- final lineStartsNum = reader.readUInt32();
- final lineStartsOffset = reader.readUInt32();
-
- final localVariablesNum = reader.readUInt32();
- final localVariablesOffset = reader.readUInt32();
-
- final annotationsNum = reader.readUInt32();
- final annotationsOffset = reader.readUInt32();
-
- final protectedNamesNum = reader.readUInt32();
- final protectedNamesOffset = reader.readUInt32();
-
- reader.offset = start + stringTableOffset;
- stringTable = new StringTable.read(reader);
- reader.stringReader = stringTable;
-
- reader.offset = start + objectTableOffset;
- objectTable = new ObjectTable.read(reader);
- reader.objectReader = objectTable;
-
- // Read sections in the reverse order as section may reference
- // successor sections by offsets.
-
- if (protectedNamesNum != 0) {
- protectedNames = new Set<String>();
- reader.offset = start + protectedNamesOffset;
- for (int i = 0; i < protectedNamesNum; ++i) {
- protectedNames.add(reader.readPackedStringReference());
- }
- }
-
- final annotationsStart = start + annotationsOffset;
- reader.offset = annotationsStart;
- for (int i = 0; i < annotationsNum; ++i) {
- int offset = reader.offset - annotationsStart;
- AnnotationsDeclaration annot = new AnnotationsDeclaration.read(reader);
- reader.linkReader.setOffset(annot, offset);
- annotations.add(annot);
- }
-
- final lineStartsStart = start + lineStartsOffset;
- reader.offset = lineStartsStart;
- for (int i = 0; i < lineStartsNum; ++i) {
- int offset = reader.offset - lineStartsStart;
- LineStarts ls = new LineStarts.read(reader);
- reader.linkReader.setOffset(ls, offset);
- lineStarts.add(ls);
- }
-
- final sourceFilesStart = start + sourceFilesOffset;
- reader.offset = sourceFilesStart;
- for (int i = 0; i < sourceFilesNum; ++i) {
- int offset = reader.offset - sourceFilesStart;
- SourceFile sf = new SourceFile.read(reader);
- reader.linkReader.setOffset(sf, offset);
- sourceFiles.add(sf);
- }
-
- final sourcePositionsStart = start + sourcePositionsOffset;
- reader.offset = sourcePositionsStart;
- for (int i = 0; i < sourcePositionsNum; ++i) {
- int offset = reader.offset - sourcePositionsStart;
- SourcePositions sp = new SourcePositions.read(reader);
- reader.linkReader.setOffset(sp, offset);
- sourcePositions.add(sp);
- }
-
- final localVariablesStart = start + localVariablesOffset;
- reader.offset = localVariablesStart;
- for (int i = 0; i < localVariablesNum; ++i) {
- int offset = reader.offset - localVariablesStart;
- LocalVariableTable lv = new LocalVariableTable.read(reader);
- reader.linkReader.setOffset(lv, offset);
- localVariables.add(lv);
- }
-
- final codesStart = start + codesOffset;
- reader.offset = codesStart;
- for (int i = 0; i < codesNum; ++i) {
- int offset = reader.offset - codesStart;
- Code code = new Code.read(reader);
- reader.linkReader.setOffset(code, offset);
- codes.add(code);
- }
-
- final membersStart = start + membersOffset;
- reader.offset = membersStart;
- for (int i = 0; i < membersNum; ++i) {
- int offset = reader.offset - membersStart;
- Members m = new Members.read(reader);
- reader.linkReader.setOffset(m, offset);
- members.add(m);
- }
-
- final classesStart = start + classesOffset;
- reader.offset = classesStart;
- for (int i = 0; i < classesNum; ++i) {
- int offset = reader.offset - classesStart;
- ClassDeclaration cls = new ClassDeclaration.read(reader);
- reader.linkReader.setOffset(cls, offset);
- classes.add(cls);
- }
-
- final librariesStart = start + librariesOffset;
- reader.offset = librariesStart;
- for (int i = 0; i < librariesNum; ++i) {
- int offset = reader.offset - librariesStart;
- LibraryDeclaration library = new LibraryDeclaration.read(reader);
- reader.linkReader.setOffset(library, offset);
- libraries.add(library);
- }
-
- final libraryIndexStart = start + libraryIndexOffset;
- reader.offset = libraryIndexStart;
- for (int i = 0; i < librariesNum; ++i) {
- final importUri = reader.readPackedObject();
- final library = reader.readLinkOffset<LibraryDeclaration>();
- library.importUri = importUri;
- }
-
- if (mainOffset != 0) {
- reader.offset = start + mainOffset;
- mainLibrary = reader.readPackedObject();
- }
- }
-
- @override
- String toString() {
- final StringBuffer sb = new StringBuffer();
- sb.write("Bytecode (version: ");
- if (version == currentBytecodeFormatVersion) {
- sb.write("stable");
- } else {
- sb.write("v$version");
- }
- sb.writeln(")");
- if (mainLibrary != null) {
- sb.writeln("Main library: $mainLibrary");
- }
- for (var library in libraries) {
- sb.write(library);
- }
- return sb.toString();
- }
-}
-
-void _writeBytecodeInstructions(BufferedWriter writer, Uint8List bytecodes) {
- writer.writePackedUInt30(bytecodes.length);
- writer.appendUint8List(bytecodes);
- BytecodeSizeStatistics.instructionsSize += bytecodes.length;
-}
-
-Uint8List _readBytecodeInstructions(BufferedReader reader) {
- int len = reader.readPackedUInt30();
- return reader.readBytesAsUint8List(len);
-}
diff --git a/pkg/vm/lib/bytecode/disassembler.dart b/pkg/vm/lib/bytecode/disassembler.dart
deleted file mode 100644
index 5d53446..0000000
--- a/pkg/vm/lib/bytecode/disassembler.dart
+++ /dev/null
@@ -1,242 +0,0 @@
-// 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.
-
-library vm.bytecode.disassembler;
-
-import 'dart:typed_data';
-
-import 'package:kernel/ast.dart' show listEquals, listHashCode;
-
-import 'dbc.dart';
-import 'exceptions.dart';
-
-class Instruction {
- final Opcode opcode;
- final bool isWide;
- final List<int> operands;
- final int pc;
-
- Instruction(this.opcode, this.isWide, this.operands, this.pc);
-
- Format get format => BytecodeFormats[opcode];
-
- int get length => instructionSize(format.encoding, isWide);
-
- @override
- int get hashCode => opcode.index.hashCode ^ listHashCode(operands);
-
- @override
- bool operator ==(other) {
- return (other is Instruction) &&
- (opcode == other.opcode) &&
- listEquals(operands, other.operands);
- }
-}
-
-class BytecodeDisassembler {
- Uint8List _bytecode;
- List<Instruction> _instructions;
- int _labelCount;
- Map<int, String> _labels;
- Map<int, List<String>> _markers;
-
- String disassemble(List<int> bytecode, ExceptionsTable exceptionsTable,
- {List<Map<int, String>> annotations}) {
- _init(bytecode);
- _scanForJumpTargets();
- _markTryBlocks(exceptionsTable);
- if (annotations != null) {
- _markAnnotations(annotations);
- }
- return _disasm();
- }
-
- List<Instruction> decode(Uint8List bytecode) {
- _init(bytecode);
- return _instructions;
- }
-
- void _init(List<int> bytecode) {
- _bytecode = new Uint8List.fromList(bytecode);
-
- _instructions = new List<Instruction>();
- for (int pos = 0; pos < _bytecode.length;) {
- final instr = decodeInstructionAt(pos);
- _instructions.add(instr);
- pos += instr.length;
- }
-
- _labelCount = 0;
- _labels = <int, String>{};
- _markers = <int, List<String>>{};
- }
-
- Instruction decodeInstructionAt(int pos) {
- Opcode opcode = Opcode.values[_bytecode[pos]];
- bool isWide = isWideOpcode(opcode);
- if (isWide) {
- opcode = fromWideOpcode(opcode);
- }
-
- final format = BytecodeFormats[opcode];
- final operands = _decodeOperands(format, pos, isWide);
- return new Instruction(opcode, isWide, operands, pos);
- }
-
- List<int> _decodeOperands(Format format, int pos, bool isWide) {
- switch (format.encoding) {
- case Encoding.k0:
- return const [];
- case Encoding.kA:
- return [_bytecode[pos + 1]];
- case Encoding.kD:
- return isWide ? [_decodeUint32At(pos + 1)] : [_bytecode[pos + 1]];
- case Encoding.kX:
- return isWide
- ? [_decodeUint32At(pos + 1).toSigned(32)]
- : [_bytecode[pos + 1].toSigned(8)];
- case Encoding.kT:
- return isWide
- ? [
- (_bytecode[pos + 1] +
- (_bytecode[pos + 2] << 8) +
- (_bytecode[pos + 3] << 16))
- .toSigned(24)
- ]
- : [_bytecode[pos + 1].toSigned(8)];
- case Encoding.kAE:
- return [
- _bytecode[pos + 1],
- isWide ? _decodeUint32At(pos + 2) : _bytecode[pos + 2],
- ];
- case Encoding.kAY:
- return [
- _bytecode[pos + 1],
- isWide
- ? _decodeUint32At(pos + 2).toSigned(32)
- : _bytecode[pos + 2].toSigned(8)
- ];
- case Encoding.kDF:
- return isWide
- ? [_decodeUint32At(pos + 1), _bytecode[pos + 5]]
- : [_bytecode[pos + 1], _bytecode[pos + 2]];
- case Encoding.kABC:
- return [_bytecode[pos + 1], _bytecode[pos + 2], _bytecode[pos + 3]];
- }
- throw 'Unexpected format $format';
- }
-
- _decodeUint32At(int pos) =>
- _bytecode[pos] +
- (_bytecode[pos + 1] << 8) +
- (_bytecode[pos + 2] << 16) +
- (_bytecode[pos + 3] << 24);
-
- void _scanForJumpTargets() {
- for (int i = 0; i < _instructions.length; i++) {
- final instr = _instructions[i];
- if (isJump(instr.opcode)) {
- final target = instr.pc + instr.operands[0];
- assert(0 <= target && target < _bytecode.length);
- if (!_labels.containsKey(target)) {
- final label = 'L${++_labelCount}';
- _labels[target] = label;
- _addMarker(target, '$label:');
- }
- }
- }
- }
-
- void _markTryBlocks(ExceptionsTable exceptionsTable) {
- for (var tryBlock in exceptionsTable.blocks) {
- final int tryIndex = tryBlock.tryIndex;
- _addMarker(tryBlock.startPC, 'Try #$tryIndex start:');
- _addMarker(tryBlock.endPC, 'Try #$tryIndex end:');
- _addMarker(tryBlock.handlerPC, 'Try #$tryIndex handler:');
- }
- }
-
- void _markAnnotations(List<Map<int, String>> annotations) {
- for (var map in annotations) {
- map.forEach((int pc, String annotation) {
- _addMarker(pc, '# $annotation');
- });
- }
- }
-
- void _addMarker(int pc, String marker) {
- final markers = (_markers[pc] ??= <String>[]);
- markers.add(marker);
- }
-
- String _disasm() {
- StringBuffer out = new StringBuffer();
- for (Instruction instr in _instructions) {
- List<String> markers = _markers[instr.pc];
- if (markers != null) {
- markers.forEach(out.writeln);
- }
- writeInstruction(out, instr);
- }
- return out.toString();
- }
-
- void writeInstruction(StringBuffer out, Instruction instr) {
- final format = BytecodeFormats[instr.opcode];
- assert(format != null);
-
- out.write(' ');
-
- const int kOpcodeWidth = 20;
- const String kOpcodePrefix = 'Opcode.k';
-
- String opcode = instr.opcode.toString();
- assert(opcode.startsWith(kOpcodePrefix));
- opcode = opcode.substring(kOpcodePrefix.length);
-
- if (instr.operands.isEmpty) {
- out.writeln(opcode);
- return;
- }
-
- out.write(opcode.padRight(kOpcodeWidth));
-
- for (int i = 0; i < instr.operands.length; i++) {
- if (i == 0) {
- out.write(' ');
- } else {
- out.write(', ');
- }
- final operand =
- _formatOperand(instr.pc, format.operands[i], instr.operands[i]);
- out.write(operand);
- }
-
- out.writeln();
- }
-
- String _formatOperand(int pc, Operand fmt, int value) {
- switch (fmt) {
- case Operand.none:
- break;
- case Operand.imm:
- return '$value';
- case Operand.lit:
- return 'CP#$value';
- case Operand.reg:
- return 'r$value';
- case Operand.xeg:
- return (value < 0) ? 'FP[$value]' : 'r$value';
- case Operand.tgt:
- return (_labels == null)
- ? value.toString()
- : _labels[pc + value] ?? (throw 'Label not found');
- case Operand.spe:
- return SpecialIndex.values[value]
- .toString()
- .substring('SpecialIndex.'.length);
- }
- throw 'Unexpected operand format $fmt';
- }
-}
diff --git a/pkg/vm/lib/bytecode/exceptions.dart b/pkg/vm/lib/bytecode/exceptions.dart
deleted file mode 100644
index 3ae6e1c..0000000
--- a/pkg/vm/lib/bytecode/exceptions.dart
+++ /dev/null
@@ -1,139 +0,0 @@
-// 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.
-
-library vm.bytecode.exceptions;
-
-import 'bytecode_serialization.dart' show BufferedWriter, BufferedReader;
-
-/*
-
-In kernel binary, try blocks are encoded in the following way
-(using notation from pkg/kernel/binary.md):
-
-// Offset of a bytecode instruction.
-type BytecodeOffset = UInt;
-
-type TryBlock {
- UInt outerTryIndexPlus1;
- BytecodeOffset startPC; // Inclusive.
- BytecodeOffset endPC; // Exclusive.
- BytecodeOffset handlerPC;
- Byte flags (needsStackTrace, isSynthetic);
- List<ConstantIndex> types;
-}
-
-type ExceptionsTable {
- // Ordered by startPC, then by nesting (outer precedes inner).
- // Try blocks are properly nested. It means there are no partially
- // overlapping try blocks - each pair of try block regions either
- // has no intersection or one try block region encloses another.
- List<TryBlock> tryBlocks;
-}
-
-*/
-
-class TryBlock {
- static const int flagNeedsStackTrace = 1 << 0;
- static const int flagIsSynthetic = 1 << 1;
-
- final int tryIndex;
- final int outerTryIndex;
- final int startPC;
- int endPC;
- int handlerPC;
- int flags = 0;
- List<int> types = <int>[];
-
- TryBlock._(this.tryIndex, this.outerTryIndex, this.startPC);
-
- bool get needsStackTrace => (flags & flagNeedsStackTrace) != 0;
-
- void set needsStackTrace(bool value) {
- flags = (flags & ~flagNeedsStackTrace) | (value ? flagNeedsStackTrace : 0);
- }
-
- bool get isSynthetic => (flags & flagIsSynthetic) != 0;
-
- void set isSynthetic(bool value) {
- flags = (flags & ~flagIsSynthetic) | (value ? flagIsSynthetic : 0);
- }
-
- void write(BufferedWriter writer) {
- writer.writePackedUInt30(outerTryIndex + 1);
- writer.writePackedUInt30(startPC);
- writer.writePackedUInt30(endPC);
- writer.writePackedUInt30(handlerPC);
- writer.writeByte(flags);
- writer.writePackedUInt30(types.length);
- types.forEach(writer.writePackedUInt30);
- }
-
- factory TryBlock.read(BufferedReader reader, int tryIndex) {
- final outerTryIndex = reader.readPackedUInt30() - 1;
- final startPC = reader.readPackedUInt30();
- final tryBlock = new TryBlock._(tryIndex, outerTryIndex, startPC);
-
- tryBlock.endPC = reader.readPackedUInt30();
- tryBlock.handlerPC = reader.readPackedUInt30();
- tryBlock.flags = reader.readByte();
- tryBlock.types = new List<int>.generate(
- reader.readPackedUInt30(), (_) => reader.readPackedUInt30());
-
- return tryBlock;
- }
-
- @override
- String toString() => 'try-index $tryIndex, outer $outerTryIndex, '
- 'start $startPC, end $endPC, handler $handlerPC, '
- '${needsStackTrace ? 'needs-stack-trace, ' : ''}'
- '${isSynthetic ? 'synthetic, ' : ''}'
- 'types ${types.map((t) => 'CP#$t').toList()}';
-}
-
-class ExceptionsTable {
- List<TryBlock> blocks = <TryBlock>[];
-
- ExceptionsTable();
-
- TryBlock enterTryBlock(int startPC) {
- assert(blocks.isEmpty || blocks.last.startPC <= startPC);
- final tryBlock =
- new TryBlock._(blocks.length, _outerTryBlockIndex(startPC), startPC);
- blocks.add(tryBlock);
- return tryBlock;
- }
-
- int _outerTryBlockIndex(int startPC) {
- for (int i = blocks.length - 1; i >= 0; --i) {
- final tryBlock = blocks[i];
- if (tryBlock.endPC == null || tryBlock.endPC > startPC) {
- return i;
- }
- }
- return -1;
- }
-
- void write(BufferedWriter writer) {
- writer.writePackedUInt30(blocks.length);
- blocks.forEach((b) => b.write(writer));
- }
-
- ExceptionsTable.read(BufferedReader reader)
- : blocks = new List<TryBlock>.generate(reader.readPackedUInt30(),
- (int index) => new TryBlock.read(reader, index));
-
- @override
- String toString() {
- if (blocks.isEmpty) {
- return '';
- }
- StringBuffer sb = new StringBuffer();
- sb.writeln('ExceptionsTable {');
- for (var tryBlock in blocks) {
- sb.writeln(' $tryBlock');
- }
- sb.writeln('}');
- return sb.toString();
- }
-}
diff --git a/pkg/vm/lib/bytecode/gen_bytecode.dart b/pkg/vm/lib/bytecode/gen_bytecode.dart
deleted file mode 100644
index 189bc39..0000000
--- a/pkg/vm/lib/bytecode/gen_bytecode.dart
+++ /dev/null
@@ -1,4659 +0,0 @@
-// 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.
-
-library vm.bytecode.gen_bytecode;
-
-import 'package:front_end/src/api_unstable/vm.dart'
- show
- CompilerContext,
- Severity,
- isRedirectingFactoryField,
- messageBytecodeLimitExceededTooManyArguments,
- noLength,
- templateIllegalRecursiveType;
-
-import 'package:kernel/ast.dart' hide MapEntry, Component, FunctionDeclaration;
-import 'package:kernel/ast.dart' as ast show Component, FunctionDeclaration;
-import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
-import 'package:kernel/core_types.dart' show CoreTypes;
-import 'package:kernel/external_name.dart'
- show getExternalName, getNativeExtensionUris;
-import 'package:kernel/library_index.dart' show LibraryIndex;
-import 'package:kernel/text/ast_to_text.dart'
- show globalDebuggingNames, NameSystem;
-import 'package:kernel/type_algebra.dart'
- show Substitution, containsTypeVariable;
-import 'package:kernel/type_environment.dart'
- show StatefulStaticTypeContext, SubtypeCheckMode, TypeEnvironment;
-import 'assembler.dart';
-import 'bytecode_serialization.dart' show StringTable;
-import 'constant_pool.dart';
-import 'dbc.dart';
-import 'declarations.dart';
-import 'exceptions.dart';
-import 'generics.dart'
- show
- flattenInstantiatorTypeArguments,
- getDefaultFunctionTypeArguments,
- getInstantiatorTypeArguments,
- getStaticType,
- getTypeParameterTypes,
- hasFreeTypeParameters,
- hasInstantiatorTypeArguments,
- isAllDynamic,
- isInstantiatedInterfaceCall,
- isUncheckedCall,
- isUncheckedClosureCall;
-import 'local_variable_table.dart' show LocalVariableTable;
-import 'local_vars.dart' show LocalVariables;
-import 'nullability_detector.dart' show NullabilityDetector;
-import 'object_table.dart'
- show ObjectHandle, ObjectTable, NameAndType, topLevelClassName;
-import 'options.dart' show BytecodeOptions;
-import 'recognized_methods.dart' show RecognizedMethods;
-import 'recursive_types_validator.dart' show IllegalRecursiveTypeException;
-import 'source_positions.dart' show LineStarts, SourcePositions;
-import '../metadata/bytecode.dart';
-import '../metadata/direct_call.dart'
- show DirectCallMetadata, DirectCallMetadataRepository;
-import '../metadata/inferred_type.dart'
- show InferredType, InferredTypeMetadataRepository;
-import '../metadata/obfuscation_prohibitions.dart'
- show ObfuscationProhibitionsMetadataRepository;
-import '../metadata/procedure_attributes.dart'
- show ProcedureAttributesMetadata, ProcedureAttributesMetadataRepository;
-
-import 'dart:convert' show utf8;
-import 'dart:developer';
-import 'dart:math' as math;
-
-// This symbol is used as the name in assert assignable's to indicate it comes
-// from an explicit 'as' check. This will cause the runtime to throw the right
-// exception.
-const String symbolForTypeCast = ' in type cast';
-
-void generateBytecode(
- ast.Component component, {
- BytecodeOptions options,
- List<Library> libraries,
- CoreTypes coreTypes,
- ClassHierarchy hierarchy,
-}) {
- Timeline.timeSync("generateBytecode", () {
- options ??= new BytecodeOptions();
- verifyBytecodeInstructionDeclarations();
- coreTypes ??= new CoreTypes(component);
- void ignoreAmbiguousSupertypes(Class cls, Supertype a, Supertype b) {}
- hierarchy ??= new ClassHierarchy(component, coreTypes,
- onAmbiguousSupertypes: ignoreAmbiguousSupertypes);
- final typeEnvironment = new TypeEnvironment(coreTypes, hierarchy);
- libraries ??= component.libraries;
-
- // Save/restore global NameSystem to avoid accumulating garbage.
- // NameSystem holds the whole AST as it is strongly connected due to
- // parent pointers. Objects are added to NameSystem when toString()
- // is called from AST nodes. Bytecode generator widely uses
- // Expression.getStaticType, which calls Expression.getStaticTypeAsInstanceOf,
- // which uses toString() when it crashes due to http://dartbug.com/34496.
- final savedGlobalDebuggingNames = globalDebuggingNames;
- globalDebuggingNames = new NameSystem();
-
- Library library;
- try {
- final bytecodeGenerator = new BytecodeGenerator(
- component, coreTypes, hierarchy, typeEnvironment, options);
- for (library in libraries) {
- bytecodeGenerator.visitLibrary(library);
- }
- } on IllegalRecursiveTypeException catch (e) {
- CompilerContext.current.options.report(
- templateIllegalRecursiveType
- .withArguments(e.type, library.isNonNullableByDefault)
- .withoutLocation(),
- Severity.error);
- } finally {
- globalDebuggingNames = savedGlobalDebuggingNames;
- }
- });
-}
-
-class BytecodeGenerator extends RecursiveVisitor<Null> {
- static final Name callName = new Name('call');
- static final Name noSuchMethodName = new Name('noSuchMethod');
-
- final CoreTypes coreTypes;
- final ClassHierarchy hierarchy;
- final TypeEnvironment typeEnvironment;
- final StatefulStaticTypeContext staticTypeContext;
- final BytecodeOptions options;
- final BytecodeMetadataRepository metadata = new BytecodeMetadataRepository();
- final RecognizedMethods recognizedMethods;
- final int formatVersion;
- final Map<Uri, Source> astUriToSource;
- StringTable stringTable;
- ObjectTable objectTable;
- Component bytecodeComponent;
- NullabilityDetector nullabilityDetector;
- Map<TreeNode, DirectCallMetadata> directCallMetadata;
- ProcedureAttributesMetadataRepository procedureAttributesMetadataRepository;
- ProcedureAttributesMetadata procedureAttributesMetadata;
- Map<TreeNode, InferredType> inferredTypeMetadata;
- List<Constant> inferredTypesAttribute;
-
- List<ClassDeclaration> classDeclarations;
- List<FieldDeclaration> fieldDeclarations;
- List<FunctionDeclaration> functionDeclarations;
- Class enclosingClass;
- Member enclosingMember;
- FunctionNode enclosingFunction;
- FunctionNode parentFunction;
- bool isClosure;
- Set<TypeParameter> classTypeParameters;
- List<TypeParameter> functionTypeParameters;
- Set<TypeParameter> functionTypeParametersSet;
- List<DartType> instantiatorTypeArguments;
- LocalVariables locals;
- Map<LabeledStatement, Label> labeledStatements;
- Map<SwitchCase, Label> switchCases;
- Map<TryCatch, TryBlock> tryCatches;
- Map<TryFinally, List<FinallyBlock>> finallyBlocks;
- List<Label> yieldPoints;
- Map<TreeNode, int> contextLevels;
- List<ClosureDeclaration> closures;
- Set<Field> initializedFields;
- List<ObjectHandle> nullableFields;
- ConstantPool cp;
- BytecodeAssembler asm;
- List<BytecodeAssembler> savedAssemblers;
- bool hasErrors;
- int currentLoopDepth;
- List<int> savedMaxSourcePositions;
- int maxSourcePosition;
-
- BytecodeGenerator(
- ast.Component component,
- CoreTypes coreTypes,
- ClassHierarchy hierarchy,
- TypeEnvironment typeEnvironment,
- BytecodeOptions options)
- : this._internal(component, coreTypes, hierarchy, typeEnvironment,
- options, new StatefulStaticTypeContext.flat(typeEnvironment));
-
- BytecodeGenerator._internal(
- ast.Component component,
- this.coreTypes,
- this.hierarchy,
- this.typeEnvironment,
- this.options,
- this.staticTypeContext)
- : recognizedMethods = new RecognizedMethods(staticTypeContext),
- formatVersion = currentBytecodeFormatVersion,
- astUriToSource = component.uriToSource {
- nullabilityDetector = new NullabilityDetector(recognizedMethods);
- component.addMetadataRepository(metadata);
-
- bytecodeComponent = new Component(formatVersion, coreTypes);
- metadata.mapping[component] = new BytecodeMetadata(bytecodeComponent);
-
- stringTable = bytecodeComponent.stringTable;
- objectTable = bytecodeComponent.objectTable;
-
- if (component.mainMethod != null) {
- bytecodeComponent.mainLibrary =
- objectTable.getHandle(component.mainMethod.enclosingLibrary);
- }
-
- directCallMetadata =
- component.metadata[DirectCallMetadataRepository.repositoryTag]?.mapping;
-
- procedureAttributesMetadataRepository =
- component.metadata[ProcedureAttributesMetadataRepository.repositoryTag];
-
- inferredTypeMetadata = component
- .metadata[InferredTypeMetadataRepository.repositoryTag]?.mapping;
-
- final obfuscationProhibitionsMetadataRepository = component
- .metadata[ObfuscationProhibitionsMetadataRepository.repositoryTag];
- if (obfuscationProhibitionsMetadataRepository != null) {
- bytecodeComponent.protectedNames =
- obfuscationProhibitionsMetadataRepository
- .mapping[component]?.protectedNames;
- }
- }
-
- @override
- visitLibrary(Library node) {
- staticTypeContext.enterLibrary(node);
-
- startMembers();
- visitList(node.procedures, this);
- visitList(node.fields, this);
- final members = endMembers(node);
-
- classDeclarations = <ClassDeclaration>[
- getTopLevelClassDeclaration(node, members)
- ];
-
- visitList(node.classes, this);
-
- bytecodeComponent.libraries
- .add(getLibraryDeclaration(node, classDeclarations));
- classDeclarations = null;
- staticTypeContext.leaveLibrary(node);
- }
-
- @override
- visitClass(Class node) {
- startMembers();
- visitList(node.constructors, this);
- visitList(node.procedures, this);
- visitList(node.fields, this);
- final members = endMembers(node);
-
- classDeclarations.add(getClassDeclaration(node, members));
- }
-
- void startMembers() {
- fieldDeclarations = <FieldDeclaration>[];
- functionDeclarations = <FunctionDeclaration>[];
- }
-
- Members endMembers(TreeNode node) {
- final members = new Members(fieldDeclarations, functionDeclarations);
- bytecodeComponent.members.add(members);
- fieldDeclarations = null;
- functionDeclarations = null;
- return members;
- }
-
- ObjectHandle getScript(Uri uri, bool includeSourceInfo) {
- SourceFile source;
- if (options.emitSourceFiles || options.emitSourcePositions) {
- final astSource = astUriToSource[uri];
- if (astSource != null) {
- source = bytecodeComponent.uriToSource[uri];
- if (source == null) {
- final importUri =
- objectTable.getConstStringHandle(astSource.importUri.toString());
- source = new SourceFile(importUri);
- bytecodeComponent.sourceFiles.add(source);
- bytecodeComponent.uriToSource[uri] = source;
- }
- if (options.emitSourcePositions &&
- includeSourceInfo &&
- source.lineStarts == null) {
- LineStarts lineStarts = new LineStarts(astSource.lineStarts);
- bytecodeComponent.lineStarts.add(lineStarts);
- source.lineStarts = lineStarts;
- }
- if (options.emitSourceFiles &&
- includeSourceInfo &&
- source.source == null) {
- String text = astSource.cachedText ??
- utf8.decode(astSource.source, allowMalformed: true);
- source.source = text;
- }
- }
- }
- return objectTable.getScriptHandle(uri, source);
- }
-
- LibraryDeclaration getLibraryDeclaration(
- Library library, List<ClassDeclaration> classes) {
- final importUri =
- objectTable.getConstStringHandle(library.importUri.toString());
- int flags = 0;
- for (var dependency in library.dependencies) {
- final targetLibrary = dependency.targetLibrary;
- assert(targetLibrary != null);
- if (targetLibrary == coreTypes.mirrorsLibrary) {
- flags |= LibraryDeclaration.usesDartMirrorsFlag;
- } else if (targetLibrary == dartFfiLibrary) {
- flags |= LibraryDeclaration.usesDartFfiFlag;
- }
- }
- final name = objectTable.getPublicNameHandle(library.name ?? '');
- final script = getScript(library.fileUri, true);
- final extensionUris =
- objectTable.getConstStringHandles(getNativeExtensionUris(library));
- if (extensionUris.isNotEmpty) {
- flags |= LibraryDeclaration.hasExtensionsFlag;
- }
- if (library.isNonNullableByDefault) {
- flags |= LibraryDeclaration.isNonNullableByDefaultFlag;
- }
- return new LibraryDeclaration(
- importUri, flags, name, script, extensionUris, classes);
- }
-
- ClassDeclaration getClassDeclaration(Class cls, Members members) {
- int flags = 0;
- if (cls.isAbstract) {
- flags |= ClassDeclaration.isAbstractFlag;
- }
- if (cls.isEnum) {
- flags |= ClassDeclaration.isEnumFlag;
- }
- int numTypeArguments = 0;
- TypeParametersDeclaration typeParameters;
- if (hasInstantiatorTypeArguments(cls)) {
- flags |= ClassDeclaration.hasTypeArgumentsFlag;
- numTypeArguments = flattenInstantiatorTypeArguments(
- cls, getTypeParameterTypes(cls.typeParameters))
- .length;
- assert(numTypeArguments > 0);
- if (cls.typeParameters.isNotEmpty) {
- flags |= ClassDeclaration.hasTypeParamsFlag;
- typeParameters = getTypeParametersDeclaration(cls.typeParameters);
- }
- }
- if (cls.isEliminatedMixin) {
- flags |= ClassDeclaration.isTransformedMixinApplicationFlag;
- }
- int position = TreeNode.noOffset;
- int endPosition = TreeNode.noOffset;
- if (options.emitSourcePositions && cls.fileOffset != TreeNode.noOffset) {
- flags |= ClassDeclaration.hasSourcePositionsFlag;
- position = cls.startFileOffset;
- endPosition = cls.fileEndOffset;
- }
- Annotations annotations = getAnnotations(cls.annotations);
- if (annotations.object != null) {
- flags |= ClassDeclaration.hasAnnotationsFlag;
- if (annotations.hasPragma) {
- flags |= ClassDeclaration.hasPragmaFlag;
- }
- }
-
- final nameHandle = objectTable.getNameHandle(
- cls.name.startsWith('_') ? cls.enclosingLibrary : null, cls.name);
- final script = getScript(cls.fileUri, !cls.isAnonymousMixin);
- final superType = objectTable.getHandle(cls.supertype?.asInterfaceType);
- final interfaces = objectTable.getHandles(
- cls.implementedTypes.map((t) => t.asInterfaceType).toList());
-
- final classDeclaration = new ClassDeclaration(
- nameHandle,
- flags,
- script,
- position,
- endPosition,
- typeParameters,
- numTypeArguments,
- superType,
- interfaces,
- members,
- annotations.object);
- bytecodeComponent.classes.add(classDeclaration);
- return classDeclaration;
- }
-
- ClassDeclaration getTopLevelClassDeclaration(
- Library library, Members members) {
- int flags = 0;
- int position = TreeNode.noOffset;
- if (options.emitSourcePositions &&
- library.fileOffset != TreeNode.noOffset) {
- flags |= ClassDeclaration.hasSourcePositionsFlag;
- position = library.fileOffset;
- }
- Annotations annotations = getLibraryAnnotations(library);
- if (annotations.object != null) {
- flags |= ClassDeclaration.hasAnnotationsFlag;
- if (annotations.hasPragma) {
- flags |= ClassDeclaration.hasPragmaFlag;
- }
- }
-
- final nameHandle = objectTable.getPublicNameHandle(topLevelClassName);
- final script = getScript(library.fileUri, true);
-
- final classDeclaration = new ClassDeclaration(
- nameHandle,
- flags,
- script,
- position,
- /* endPosition */ TreeNode.noOffset,
- /* typeParameters */ null,
- /* numTypeArguments */ 0,
- /* superType */ null,
- /* interfaces */ const <ObjectHandle>[],
- members,
- annotations.object);
- bytecodeComponent.classes.add(classDeclaration);
- return classDeclaration;
- }
-
- bool _isPragma(Constant annotation) =>
- annotation is InstanceConstant &&
- annotation.classNode == coreTypes.pragmaClass;
-
- Annotations getAnnotations(List<Expression> nodes) {
- if (nodes.isEmpty) {
- return const Annotations(null, false);
- }
- List<Constant> constants = nodes.map(_getConstant).toList();
- bool hasPragma = constants.any(_isPragma);
- if (!options.emitAnnotations) {
- if (hasPragma) {
- constants = constants.where(_isPragma).toList();
- } else {
- return const Annotations(null, false);
- }
- }
- final object =
- objectTable.getHandle(new ListConstant(const DynamicType(), constants));
- final decl = new AnnotationsDeclaration(object);
- bytecodeComponent.annotations.add(decl);
- return new Annotations(decl, hasPragma);
- }
-
- ObjectHandle getMemberAttributes() {
- if (procedureAttributesMetadata == null && inferredTypesAttribute == null) {
- return null;
- }
- // List of pairs (tag, value).
- final attrs = <Constant>[];
- if (procedureAttributesMetadata != null) {
- final attribute = procedureAttributesMetadataRepository
- .getBytecodeAttribute(procedureAttributesMetadata);
- attrs.add(
- StringConstant(ProcedureAttributesMetadataRepository.repositoryTag));
- attrs.add(attribute);
- }
- if (inferredTypesAttribute != null) {
- attrs.add(StringConstant(InferredTypeMetadataRepository.repositoryTag));
- attrs.add(ListConstant(const DynamicType(), inferredTypesAttribute));
- }
- return objectTable.getHandle(ListConstant(const DynamicType(), attrs));
- }
-
- ObjectHandle getClosureAttributes() {
- if (inferredTypesAttribute == null) {
- return null;
- }
- final attrs = <Constant>[
- StringConstant(InferredTypeMetadataRepository.repositoryTag),
- ListConstant(const DynamicType(), inferredTypesAttribute),
- ];
- return objectTable.getHandle(ListConstant(const DynamicType(), attrs));
- }
-
- // Insert annotations for the function and its parameters into the annotations
- // section. Return the annotations for the function only. The bytecode reader
- // will implicitly find the parameter annotations by reading N packed objects
- // after reading the function's annotations, one for each parameter.
- Annotations getFunctionAnnotations(Member member) {
- final functionNodes = member.annotations;
- final parameterNodeLists = new List<List<Expression>>();
- for (VariableDeclaration variable in member.function.positionalParameters) {
- parameterNodeLists.add(variable.annotations);
- }
- for (VariableDeclaration variable in member.function.namedParameters) {
- parameterNodeLists.add(variable.annotations);
- }
-
- if (functionNodes.isEmpty &&
- parameterNodeLists.every((nodes) => nodes.isEmpty)) {
- return const Annotations(null, false);
- }
-
- List<Constant> functionConstants = functionNodes.map(_getConstant).toList();
- bool hasPragma = functionConstants.any(_isPragma);
- if (!options.emitAnnotations && !hasPragma) {
- return const Annotations(null, false);
- }
-
- final functionObject = objectTable
- .getHandle(new ListConstant(const DynamicType(), functionConstants));
- final functionDecl = new AnnotationsDeclaration(functionObject);
- bytecodeComponent.annotations.add(functionDecl);
-
- for (final parameterNodes in parameterNodeLists) {
- List<Constant> parameterConstants =
- parameterNodes.map(_getConstant).toList();
- final parameterObject = objectTable
- .getHandle(new ListConstant(const DynamicType(), parameterConstants));
- final parameterDecl = new AnnotationsDeclaration(parameterObject);
- bytecodeComponent.annotations.add(parameterDecl);
- }
-
- return new Annotations(functionDecl, hasPragma);
- }
-
- // Insert annotations for library and its dependencies into the
- // annotations section. Returns annotations for the library only.
- // Bytecode reader will implicitly find library dependencies by reading
- // an extra object after reading library annotations.
- Annotations getLibraryAnnotations(Library library) {
- Annotations annotations = getAnnotations(library.annotations);
- final bool emitDependencies =
- options.emitAnnotations && library.dependencies.isNotEmpty;
- if (annotations.object == null && !emitDependencies) {
- return annotations;
- }
-
- // We need to emit both annotations and dependencies objects, appending
- // null if an object is missing.
- if (annotations.object == null) {
- final annotationsDecl = new AnnotationsDeclaration(null);
- bytecodeComponent.annotations.add(annotationsDecl);
- annotations = new Annotations(annotationsDecl, false);
- }
- if (!emitDependencies) {
- bytecodeComponent.annotations.add(new AnnotationsDeclaration(null));
- return annotations;
- }
-
- // Create a constant object representing library dependencies.
- // These objects are used by dart:mirrors and vm-service implementation.
- final deps = <Constant>[];
- for (var dependency in library.dependencies) {
- final prefix = dependency.name != null
- ? StringConstant(dependency.name)
- : NullConstant();
- final showNames = dependency.combinators
- .where((c) => c.isShow)
- .expand((c) => c.names)
- .map((name) => StringConstant(name))
- .toList();
- final hideNames = dependency.combinators
- .where((c) => c.isHide)
- .expand((c) => c.names)
- .map((name) => StringConstant(name))
- .toList();
- final depAnnots = dependency.annotations.map(_getConstant).toList();
- deps.add(ListConstant(const DynamicType(), <Constant>[
- StringConstant(dependency.targetLibrary.importUri.toString()),
- BoolConstant(dependency.isExport),
- BoolConstant(dependency.isDeferred),
- prefix,
- ListConstant(const DynamicType(), showNames),
- ListConstant(const DynamicType(), hideNames),
- ListConstant(const DynamicType(), depAnnots),
- ]));
- }
- final ObjectHandle dependenciesObject =
- objectTable.getHandle(ListConstant(const DynamicType(), deps));
- final dependenciesDecl = new AnnotationsDeclaration(dependenciesObject);
- bytecodeComponent.annotations.add(dependenciesDecl);
-
- return annotations;
- }
-
- FieldDeclaration getFieldDeclaration(Field field, Code initializer) {
- int flags = 0;
- Constant value;
- if (_hasNonTrivialInitializer(field)) {
- flags |= FieldDeclaration.hasNontrivialInitializerFlag;
- } else if (field.initializer != null) {
- value = _getConstant(field.initializer);
- }
- if (initializer != null) {
- flags |= FieldDeclaration.hasInitializerCodeFlag;
- }
- if (field.initializer != null) {
- flags |= FieldDeclaration.hasInitializerFlag;
- }
- final name = objectTable.getNameHandle(
- field.name.library, objectTable.mangleMemberName(field, false, false));
- ObjectHandle getterName;
- ObjectHandle setterName;
- if (_needsGetter(field)) {
- flags |= FieldDeclaration.hasGetterFlag;
- getterName = objectTable.getNameHandle(
- field.name.library, objectTable.mangleMemberName(field, true, false));
- }
- if (_needsSetter(field)) {
- flags |= FieldDeclaration.hasSetterFlag;
- setterName = objectTable.getNameHandle(
- field.name.library, objectTable.mangleMemberName(field, false, true));
- }
- if (isReflectable(field)) {
- flags |= FieldDeclaration.isReflectableFlag;
- }
- if (field.isStatic) {
- flags |= FieldDeclaration.isStaticFlag;
- }
- if (field.isConst) {
- flags |= FieldDeclaration.isConstFlag;
- }
- // Const fields are implicitly final.
- if (field.isConst || field.isFinal) {
- flags |= FieldDeclaration.isFinalFlag;
- }
- if (field.isCovariant) {
- flags |= FieldDeclaration.isCovariantFlag;
- }
- if (field.isGenericCovariantImpl) {
- flags |= FieldDeclaration.isGenericCovariantImplFlag;
- }
- if (field.isExtensionMember) {
- flags |= FieldDeclaration.isExtensionMemberFlag;
- }
- // In NNBD libraries, static fields with initializers are implicitly late.
- if (field.isLate ||
- (field.isStatic &&
- field.initializer != null &&
- field.isNonNullableByDefault)) {
- flags |= FieldDeclaration.isLateFlag;
- }
- int position = TreeNode.noOffset;
- int endPosition = TreeNode.noOffset;
- if (options.emitSourcePositions && field.fileOffset != TreeNode.noOffset) {
- flags |= FieldDeclaration.hasSourcePositionsFlag;
- position = field.fileOffset;
- endPosition = field.fileEndOffset;
- }
- Annotations annotations = getAnnotations(field.annotations);
- if (annotations.object != null) {
- flags |= FieldDeclaration.hasAnnotationsFlag;
- if (annotations.hasPragma) {
- flags |= FieldDeclaration.hasPragmaFlag;
- }
- }
- final ObjectHandle attributes = getMemberAttributes();
- if (attributes != null) {
- flags |= FieldDeclaration.hasAttributesFlag;
- }
- ObjectHandle script;
- if (field.fileUri != null &&
- field.fileUri != (field.parent as FileUriNode).fileUri) {
- final isInAnonymousMixin =
- enclosingClass != null && enclosingClass.isAnonymousMixin;
- script = getScript(field.fileUri, !isInAnonymousMixin);
- flags |= FieldDeclaration.hasCustomScriptFlag;
- }
- return new FieldDeclaration(
- flags,
- name,
- objectTable.getHandle(field.type),
- objectTable.getHandle(value),
- script,
- position,
- endPosition,
- getterName,
- setterName,
- initializer,
- annotations.object,
- attributes);
- }
-
- FunctionDeclaration getFunctionDeclaration(Member member, Code code) {
- int flags = 0;
- if (member is Constructor) {
- flags |= FunctionDeclaration.isConstructorFlag;
- }
- if (member is Procedure) {
- if (member.isGetter) {
- flags |= FunctionDeclaration.isGetterFlag;
- } else if (member.isSetter) {
- flags |= FunctionDeclaration.isSetterFlag;
- } else if (member.isFactory) {
- flags |= FunctionDeclaration.isFactoryFlag;
- }
- if (member.isStatic) {
- flags |= FunctionDeclaration.isStaticFlag;
- }
- if (member.isForwardingStub) {
- flags |= FunctionDeclaration.isForwardingStubFlag;
- }
- if (member.isNoSuchMethodForwarder) {
- flags |= FunctionDeclaration.isNoSuchMethodForwarderFlag;
- }
- }
- if (member.isAbstract && !_hasCode(member)) {
- flags |= FunctionDeclaration.isAbstractFlag;
- }
- if (member.isConst) {
- flags |= FunctionDeclaration.isConstFlag;
- }
- if (member.isExtensionMember) {
- flags |= FunctionDeclaration.isExtensionMemberFlag;
- }
-
- FunctionNode function = member.function;
- if (function.requiredParameterCount !=
- function.positionalParameters.length) {
- flags |= FunctionDeclaration.hasOptionalPositionalParamsFlag;
- }
- if (function.namedParameters.isNotEmpty) {
- flags |= FunctionDeclaration.hasOptionalNamedParamsFlag;
- }
- TypeParametersDeclaration typeParameters;
- if (function.typeParameters.isNotEmpty) {
- flags |= FunctionDeclaration.hasTypeParamsFlag;
- typeParameters = getTypeParametersDeclaration(function.typeParameters);
- }
- if (isReflectable(member)) {
- flags |= FunctionDeclaration.isReflectableFlag;
- }
- if (isDebuggable(member)) {
- flags |= FunctionDeclaration.isDebuggableFlag;
- }
- switch (function.dartAsyncMarker) {
- case AsyncMarker.Async:
- flags |= FunctionDeclaration.isAsyncFlag;
- break;
- case AsyncMarker.AsyncStar:
- flags |= FunctionDeclaration.isAsyncStarFlag;
- break;
- case AsyncMarker.SyncStar:
- flags |= FunctionDeclaration.isSyncStarFlag;
- break;
- default:
- break;
- }
- ObjectHandle nativeName;
- if (member.isExternal) {
- final String externalName = getExternalName(member);
- if (externalName == null) {
- flags |= FunctionDeclaration.isExternalFlag;
- } else {
- flags |= FunctionDeclaration.isNativeFlag;
- nativeName = objectTable.getConstStringHandle(externalName);
- }
- }
- int position = TreeNode.noOffset;
- int endPosition = TreeNode.noOffset;
- if (options.emitSourcePositions && member.fileOffset != TreeNode.noOffset) {
- flags |= FunctionDeclaration.hasSourcePositionsFlag;
- position = (member as dynamic).startFileOffset;
- endPosition = member.fileEndOffset;
- }
- final Annotations annotations = getFunctionAnnotations(member);
- if (annotations.object != null) {
- flags |= FunctionDeclaration.hasAnnotationsFlag;
- if (annotations.hasPragma) {
- flags |= FunctionDeclaration.hasPragmaFlag;
- }
- }
- final ObjectHandle attributes = getMemberAttributes();
- if (attributes != null) {
- flags |= FunctionDeclaration.hasAttributesFlag;
- }
- ObjectHandle script;
- if (member.fileUri != null &&
- member.fileUri != (member.parent as FileUriNode).fileUri) {
- final isInAnonymousMixin =
- enclosingClass != null && enclosingClass.isAnonymousMixin;
- final isSynthetic = member is Procedure &&
- (member.isNoSuchMethodForwarder || member.isSyntheticForwarder);
- script = getScript(member.fileUri, !isInAnonymousMixin && !isSynthetic);
- flags |= FunctionDeclaration.hasCustomScriptFlag;
- }
-
- final name = objectTable.getNameHandle(member.name.library,
- objectTable.mangleMemberName(member, false, false));
-
- final parameters = <ParameterDeclaration>[];
- for (var param in function.positionalParameters) {
- parameters.add(getParameterDeclaration(param));
- }
- for (var param in function.namedParameters) {
- parameters.add(getParameterDeclaration(param));
- }
- // We only need the required flags when loading the function declaration.
- final parameterFlags =
- getParameterFlags(function, mask: ParameterDeclaration.isRequiredFlag);
- if (parameterFlags != null) {
- flags |= FunctionDeclaration.hasParameterFlagsFlag;
- }
-
- return new FunctionDeclaration(
- flags,
- name,
- script,
- position,
- endPosition,
- typeParameters,
- function.requiredParameterCount,
- parameters,
- parameterFlags,
- objectTable.getHandle(function.returnType),
- nativeName,
- code,
- annotations.object,
- attributes);
- }
-
- bool isReflectable(Member member) {
- if (member is Field && member.fileOffset == TreeNode.noOffset) {
- return false;
- }
- final library = member.enclosingLibrary;
- if (library.importUri.scheme == 'dart' && member.name.isPrivate) {
- return false;
- }
- if (member is Procedure &&
- member.isStatic &&
- library.importUri.toString() == 'dart:_internal') {
- return false;
- }
- if (member is Procedure && member.isMemberSignature) {
- return false;
- }
- return true;
- }
-
- bool isDebuggable(Member member) {
- if (member is Constructor && member.isSynthetic) {
- return false;
- }
- if (member.function.dartAsyncMarker != AsyncMarker.Sync) {
- return false;
- }
- if (member == asyncAwaitCompleterGetFuture) {
- return false;
- }
- return true;
- }
-
- TypeParametersDeclaration getTypeParametersDeclaration(
- List<TypeParameter> typeParams) {
- return new TypeParametersDeclaration(
- objectTable.getTypeParameterHandles(typeParams));
- }
-
- ParameterDeclaration getParameterDeclaration(VariableDeclaration variable) {
- final name = variable.name;
- final lib = name.startsWith('_') ? enclosingMember.enclosingLibrary : null;
- final nameHandle = objectTable.getNameHandle(lib, name);
- final typeHandle = objectTable.getHandle(variable.type);
- return new ParameterDeclaration(nameHandle, typeHandle);
- }
-
- // Most uses of parameter flags in the VM only nee a subset of the flags,
- // so the optional [mask] argument allows the caller to specify the subset
- // that should be retained.
- List<int> getParameterFlags(FunctionNode function, {int mask = -1}) {
- int getFlags(VariableDeclaration variable, int mask) {
- int flags = 0;
- if (variable.isCovariant) {
- flags |= ParameterDeclaration.isCovariantFlag;
- }
- if (variable.isGenericCovariantImpl) {
- flags |= ParameterDeclaration.isGenericCovariantImplFlag;
- }
- if (variable.isFinal) {
- flags |= ParameterDeclaration.isFinalFlag;
- }
- if (variable.isRequired) {
- flags |= ParameterDeclaration.isRequiredFlag;
- }
- return flags & mask;
- }
-
- final List<int> paramFlags = <int>[];
- for (var param in function.positionalParameters) {
- paramFlags.add(getFlags(param, mask));
- }
- for (var param in function.namedParameters) {
- paramFlags.add(getFlags(param, mask));
- }
-
- for (int flags in paramFlags) {
- if (flags != 0) {
- return paramFlags;
- }
- }
- return null;
- }
-
- @override
- defaultMember(Member node) {
- if (node is Procedure && node.isRedirectingFactoryConstructor) {
- return;
- }
- try {
- final bool hasCode = _hasCode(node);
- start(node, hasCode);
- if (node is Field) {
- if (hasCode) {
- if (node.isConst) {
- _genPushConstExpr(node.initializer);
- } else {
- _generateNode(node.initializer);
- }
- _genReturnTOS();
- }
- } else if ((node is Procedure && !node.isRedirectingFactoryConstructor) ||
- (node is Constructor)) {
- if (hasCode) {
- if (node is Constructor) {
- _genConstructorInitializers(node);
- }
- if (node.isExternal) {
- final String nativeName = getExternalName(node);
- if (nativeName != null) {
- _genNativeCall(nativeName);
- } else {
- // TODO(alexmarkov): generate throwing UnimplementedError
- // ("No definition given for external method Foo.bar").
- asm.emitPushNull();
- }
- } else {
- _generateNode(node.function?.body);
- // BytecodeAssembler eliminates this bytecode if it is unreachable.
- asm.emitPushNull();
- }
- if (node.function != null) {
- _recordSourcePosition(node.function.fileEndOffset);
- }
- _genReturnTOS();
- }
- } else {
- throw 'Unexpected member ${node.runtimeType} $node';
- }
- end(node, hasCode);
- } on TooManyArgumentsException catch (e) {
- CompilerContext.current.options.report(
- messageBytecodeLimitExceededTooManyArguments.withLocation(
- node.fileUri, e.fileOffset, noLength),
- Severity.error);
- hasErrors = true;
- end(node, false);
- }
- }
-
- bool _hasCode(Member member) {
- if (member is Procedure && member.isRedirectingFactoryConstructor) {
- return false;
- }
- // Front-end might set abstract flag on static external procedures,
- // but they can be called and should have a body.
- if (member is Procedure && member.isStatic && member.isExternal) {
- return true;
- }
- if (member.isAbstract) {
- return false;
- }
- if (member is Field) {
- // TODO(dartbug.com/34277)
- // Front-end inserts synthetic static fields "_redirecting#" to record
- // information about redirecting constructors in kernel.
- // The problem is that initializers of these synthetic static fields
- // contain incorrect kernel AST, e.g. StaticGet which takes tear-off
- // of a constructor. Do not generate bytecode for them, as they should
- // never be used.
- if (isRedirectingFactoryField(member)) {
- return false;
- }
- return hasInitializerCode(member);
- }
- return true;
- }
-
- bool hasInitializerCode(Field field) =>
- (field.isStatic ||
- field.isLate ||
- options.emitInstanceFieldInitializers) &&
- _hasNonTrivialInitializer(field);
-
- bool _needsGetter(Field field) {
- // All instance fields need a getter.
- if (!field.isStatic) return true;
-
- // Static fields also need a getter if they have a non-trivial initializer,
- // because it needs to be initialized lazily.
- if (_hasNonTrivialInitializer(field)) return true;
-
- // Static late fields with no initializer also need a getter, to check if
- // it's been initialized.
- return field.isLate && field.initializer == null;
- }
-
- bool _needsSetter(Field field) {
- // Late fields always need a setter, unless they're static and non-final, or
- // final with an initializer.
- if (field.isLate) {
- if (field.isStatic && !field.isFinal) return false;
- if (field.isFinal && field.initializer != null) return false;
- return true;
- }
-
- // Non-late static fields never need a setter.
- if (field.isStatic) return false;
-
- // Otherwise, the field only needs a setter if it isn't final.
- return !field.isFinal;
- }
-
- void _genNativeCall(String nativeName) {
- final function = enclosingMember.function;
- assert(function != null);
-
- if (locals.hasFactoryTypeArgsVar) {
- asm.emitPush(locals.getVarIndexInFrame(locals.factoryTypeArgsVar));
- } else if (locals.hasFunctionTypeArgsVar) {
- asm.emitPush(locals.functionTypeArgsVarIndexInFrame);
- }
- if (locals.hasReceiver) {
- asm.emitPush(locals.getVarIndexInFrame(locals.receiverVar));
- }
- for (var param in function.positionalParameters) {
- asm.emitPush(locals.getVarIndexInFrame(param));
- }
- // Native methods access their parameters by indices, so
- // native wrappers should pass arguments in the original declaration
- // order instead of sorted order.
- for (var param in locals.originalNamedParameters) {
- asm.emitPush(locals.getVarIndexInFrame(param));
- }
-
- final nativeEntryCpIndex = cp.addNativeEntry(nativeName);
- asm.emitNativeCall(nativeEntryCpIndex);
- }
-
- LibraryIndex get libraryIndex => coreTypes.index;
-
- Procedure _listFromLiteral;
- Procedure get listFromLiteral => _listFromLiteral ??=
- libraryIndex.getMember('dart:core', 'List', '_fromLiteral');
-
- Procedure _mapFromLiteral;
- Procedure get mapFromLiteral => _mapFromLiteral ??=
- libraryIndex.getMember('dart:core', 'Map', '_fromLiteral');
-
- Procedure _interpolateSingle;
- Procedure get interpolateSingle => _interpolateSingle ??=
- libraryIndex.getMember('dart:core', '_StringBase', '_interpolateSingle');
-
- Procedure _interpolate;
- Procedure get interpolate => _interpolate ??=
- libraryIndex.getMember('dart:core', '_StringBase', '_interpolate');
-
- Class _closureClass;
- Class get closureClass =>
- _closureClass ??= libraryIndex.getClass('dart:core', '_Closure');
-
- Procedure _objectInstanceOf;
- Procedure get objectInstanceOf => _objectInstanceOf ??=
- libraryIndex.getMember('dart:core', 'Object', '_instanceOf');
-
- Procedure _objectSimpleInstanceOf;
- Procedure get objectSimpleInstanceOf => _objectSimpleInstanceOf ??=
- libraryIndex.getMember('dart:core', 'Object', '_simpleInstanceOf');
-
- Field _closureInstantiatorTypeArguments;
- Field get closureInstantiatorTypeArguments =>
- _closureInstantiatorTypeArguments ??= libraryIndex.getMember(
- 'dart:core', '_Closure', '_instantiator_type_arguments');
-
- Field _closureFunctionTypeArguments;
- Field get closureFunctionTypeArguments =>
- _closureFunctionTypeArguments ??= libraryIndex.getMember(
- 'dart:core', '_Closure', '_function_type_arguments');
-
- Field _closureDelayedTypeArguments;
- Field get closureDelayedTypeArguments =>
- _closureDelayedTypeArguments ??= libraryIndex.getMember(
- 'dart:core', '_Closure', '_delayed_type_arguments');
-
- Field _closureFunction;
- Field get closureFunction => _closureFunction ??=
- libraryIndex.getMember('dart:core', '_Closure', '_function');
-
- Field _closureContext;
- Field get closureContext => _closureContext ??=
- libraryIndex.getMember('dart:core', '_Closure', '_context');
-
- Procedure _prependTypeArguments;
- Procedure get prependTypeArguments => _prependTypeArguments ??=
- libraryIndex.getTopLevelMember('dart:_internal', '_prependTypeArguments');
-
- Procedure _boundsCheckForPartialInstantiation;
- Procedure get boundsCheckForPartialInstantiation =>
- _boundsCheckForPartialInstantiation ??= libraryIndex.getTopLevelMember(
- 'dart:_internal', '_boundsCheckForPartialInstantiation');
-
- Procedure _futureValue;
- Procedure get futureValue =>
- _futureValue ??= libraryIndex.getMember('dart:async', 'Future', 'value');
-
- Procedure _throwNewLateInitializationError;
- Procedure get throwNewLateInitializationError =>
- _throwNewLateInitializationError ??= libraryIndex.getMember(
- 'dart:core', '_LateInitializationError', '_throwNew');
-
- Procedure _throwNewAssertionError;
- Procedure get throwNewAssertionError => _throwNewAssertionError ??=
- libraryIndex.getMember('dart:core', '_AssertionError', '_throwNew');
-
- Procedure _allocateInvocationMirror;
- Procedure get allocateInvocationMirror =>
- _allocateInvocationMirror ??= libraryIndex.getMember(
- 'dart:core', '_InvocationMirror', '_allocateInvocationMirror');
-
- Procedure _unsafeCast;
- Procedure get unsafeCast => _unsafeCast ??=
- libraryIndex.getTopLevelMember('dart:_internal', 'unsafeCast');
-
- Procedure _iterableIterator;
- Procedure get iterableIterator => _iterableIterator ??=
- libraryIndex.getMember('dart:core', 'Iterable', 'get:iterator');
-
- Procedure _iteratorMoveNext;
- Procedure get iteratorMoveNext => _iteratorMoveNext ??=
- libraryIndex.getMember('dart:core', 'Iterator', 'moveNext');
-
- Procedure _iteratorCurrent;
- Procedure get iteratorCurrent => _iteratorCurrent ??=
- libraryIndex.getMember('dart:core', 'Iterator', 'get:current');
-
- Procedure _asyncAwaitCompleterGetFuture;
- Procedure get asyncAwaitCompleterGetFuture =>
- _asyncAwaitCompleterGetFuture ??= libraryIndex.tryGetMember(
- 'dart:async', '_AsyncAwaitCompleter', 'get:future');
-
- Procedure _setAsyncThreadStackTrace;
- Procedure get setAsyncThreadStackTrace => _setAsyncThreadStackTrace ??=
- libraryIndex.getTopLevelMember('dart:async', '_setAsyncThreadStackTrace');
-
- Procedure _clearAsyncThreadStackTrace;
- Procedure get clearAsyncThreadStackTrace =>
- _clearAsyncThreadStackTrace ??= libraryIndex.getTopLevelMember(
- 'dart:async', '_clearAsyncThreadStackTrace');
-
- Library _dartFfiLibrary;
- Library get dartFfiLibrary =>
- _dartFfiLibrary ??= libraryIndex.tryGetLibrary('dart:ffi');
-
- void _recordSourcePosition(int fileOffset) {
- asm.currentSourcePosition = fileOffset;
- maxSourcePosition = math.max(maxSourcePosition, fileOffset);
- }
-
- void _generateNode(TreeNode node) {
- if (node == null) {
- return;
- }
- final savedSourcePosition = asm.currentSourcePosition;
- _recordSourcePosition(node.fileOffset);
- node.accept(this);
- asm.currentSourcePosition = savedSourcePosition;
- }
-
- void _generateNodeList(List<TreeNode> nodes) {
- nodes.forEach(_generateNode);
- }
-
- void _genConstructorInitializers(Constructor node) {
- bool isRedirecting = false;
- Set<Field> initializedInInitializersList = new Set<Field>();
- for (var initializer in node.initializers) {
- if (initializer is RedirectingInitializer) {
- isRedirecting = true;
- } else if (initializer is FieldInitializer) {
- initializedInInitializersList.add(initializer.field);
- }
- }
-
- if (!isRedirecting) {
- initializedFields = new Set<Field>();
- for (var field in node.enclosingClass.fields) {
- if (!field.isStatic) {
- if (field.isLate) {
- if (!initializedInInitializersList.contains(field)) {
- _genLateFieldInitializer(field);
- }
- } else if (field.initializer != null) {
- if (initializedInInitializersList.contains(field)) {
- // Do not store a value into the field as it is going to be
- // overwritten by initializers list.
- _generateNode(field.initializer);
- asm.emitDrop1();
- } else {
- _genFieldInitializer(field, field.initializer);
- }
- }
- }
- }
- }
-
- _generateNodeList(node.initializers);
-
- if (!isRedirecting) {
- nullableFields = <ObjectHandle>[];
- for (var field in node.enclosingClass.fields) {
- if (!field.isStatic &&
- !field.isLate &&
- !initializedFields.contains(field)) {
- nullableFields.add(objectTable.getHandle(field));
- }
- }
- initializedFields = null; // No more initialized fields, please.
- }
- }
-
- void _genFieldInitializer(Field field, Expression initializer) {
- assert(!field.isStatic);
-
- if (initializer is NullLiteral && !initializedFields.contains(field)) {
- return;
- }
-
- _genPushReceiver();
- _generateNode(initializer);
-
- final int cpIndex = cp.addInstanceField(field);
- asm.emitStoreFieldTOS(cpIndex);
-
- initializedFields.add(field);
- }
-
- void _genLateFieldInitializer(Field field) {
- assert(!field.isStatic);
-
- if (_isTrivialInitializer(field.initializer)) {
- _genFieldInitializer(field, field.initializer);
- return;
- }
-
- _genPushReceiver();
-
- final int cpIndex = cp.addInstanceField(field);
- asm.emitInitLateField(cpIndex);
-
- initializedFields.add(field);
- }
-
- void _genArguments(Expression receiver, Arguments arguments,
- {int storeReceiverToLocal}) {
- if (arguments.types.isNotEmpty) {
- _genTypeArguments(arguments.types);
- }
- _generateNode(receiver);
- if (storeReceiverToLocal != null) {
- asm.emitStoreLocal(storeReceiverToLocal);
- }
- _generateNodeList(arguments.positional);
- arguments.named.forEach((NamedExpression ne) => _generateNode(ne.value));
- }
-
- void _genPushBool(bool value) {
- if (value) {
- asm.emitPushTrue();
- } else {
- asm.emitPushFalse();
- }
- }
-
- void _genPushInt(int value) {
- // TODO(alexmarkov): relax this constraint as PushInt instruction can
- // hold up to 32-bit signed operand (note that interpreter assumes
- // it is Smi).
- if (value.bitLength + 1 <= 16) {
- asm.emitPushInt(value);
- } else {
- asm.emitPushConstant(cp.addObjectRef(new IntConstant(value)));
- }
- }
-
- Constant _getConstant(Expression expr) {
- if (expr is ConstantExpression) {
- return expr.constant;
- }
-
- // Literals outside of const expressions are not transformed by the
- // constant transformer, but they need to be treated as constants here.
- if (expr is BoolLiteral) return new BoolConstant(expr.value);
- if (expr is DoubleLiteral) return new DoubleConstant(expr.value);
- if (expr is IntLiteral) return new IntConstant(expr.value);
- if (expr is NullLiteral) return new NullConstant();
- if (expr is StringLiteral) return new StringConstant(expr.value);
-
- throw 'Expected constant, got ${expr.runtimeType}';
- }
-
- void _genPushConstant(Constant constant) {
- if (constant is NullConstant) {
- asm.emitPushNull();
- } else if (constant is BoolConstant) {
- _genPushBool(constant.value);
- } else if (constant is IntConstant) {
- _genPushInt(constant.value);
- } else {
- asm.emitPushConstant(cp.addObjectRef(constant));
- }
- }
-
- void _genPushConstExpr(Expression expr) {
- if (expr is ConstantExpression) {
- _genPushConstant(expr.constant);
- } else if (expr is NullLiteral) {
- asm.emitPushNull();
- } else if (expr is BoolLiteral) {
- _genPushBool(expr.value);
- } else if (expr is IntLiteral) {
- _genPushInt(expr.value);
- } else {
- _genPushConstant(_getConstant(expr));
- }
- }
-
- void _genReturnTOS([int yieldSourcePosition = null]) {
- if (options.causalAsyncStacks &&
- parentFunction != null &&
- (parentFunction.dartAsyncMarker == AsyncMarker.Async ||
- parentFunction.dartAsyncMarker == AsyncMarker.AsyncStar)) {
- final savedSourcePosition = asm.currentSourcePosition;
- _recordSourcePosition(TreeNode.noOffset);
- _genDirectCall(
- clearAsyncThreadStackTrace, objectTable.getArgDescHandle(0), 0);
- asm.emitDrop1();
- asm.currentSourcePosition = savedSourcePosition;
- }
-
- if (yieldSourcePosition != null && options.emitSourcePositions) {
- asm.emitYieldPointSourcePosition(yieldSourcePosition);
- }
- asm.emitReturnTOS();
- }
-
- void _genDirectCall(Member target, ObjectHandle argDesc, int totalArgCount,
- {bool isGet: false,
- bool isSet: false,
- bool isDynamicForwarder: false,
- bool isUnchecked: false,
- TreeNode node}) {
- assert(!isGet || !isSet);
- final kind = isGet
- ? InvocationKind.getter
- : (isSet ? InvocationKind.setter : InvocationKind.method);
- final cpIndex = cp.addDirectCall(kind, target, argDesc, isDynamicForwarder);
-
- if (totalArgCount >= argumentsLimit) {
- throw new TooManyArgumentsException(node.fileOffset);
- }
- if (inferredTypeMetadata != null && node != null) {
- _appendInferredType(node, asm.offset);
- }
- if (isUnchecked) {
- asm.emitUncheckedDirectCall(cpIndex, totalArgCount);
- } else {
- asm.emitDirectCall(cpIndex, totalArgCount);
- }
- if (inferredTypeMetadata != null && node != null) {
- _replaceWithConstantValue(node);
- }
- }
-
- void _genDirectCallWithArgs(Member target, Arguments args,
- {bool hasReceiver: false,
- bool isFactory: false,
- bool isUnchecked: false,
- TreeNode node}) {
- final argDesc = objectTable.getArgDescHandleByArguments(args,
- hasReceiver: hasReceiver, isFactory: isFactory);
-
- int totalArgCount = args.positional.length + args.named.length;
- if (hasReceiver) {
- totalArgCount++;
- }
- if (args.types.isNotEmpty || isFactory) {
- // VM needs type arguments for every invocation of a factory constructor.
- // TODO(alexmarkov): Clean this up.
- totalArgCount++;
- }
-
- _genDirectCall(target, argDesc, totalArgCount,
- isUnchecked: isUnchecked, node: node);
- }
-
- void _genTypeArguments(List<DartType> typeArgs, {Class instantiatingClass}) {
- int typeArgsCPIndex() {
- if (instantiatingClass != null) {
- typeArgs = getInstantiatorTypeArguments(instantiatingClass, typeArgs);
- }
- return cp.addTypeArguments(typeArgs);
- }
-
- if (typeArgs.isEmpty || !hasFreeTypeParameters(typeArgs)) {
- asm.emitPushConstant(typeArgsCPIndex());
- } else {
- final flattenedTypeArgs = (instantiatingClass != null &&
- (instantiatorTypeArguments != null ||
- functionTypeParameters != null))
- ? flattenInstantiatorTypeArguments(instantiatingClass, typeArgs)
- : typeArgs;
- if (_canReuseInstantiatorTypeArguments(flattenedTypeArgs)) {
- _genPushInstantiatorTypeArguments();
- } else if (_canReuseFunctionTypeArguments(flattenedTypeArgs)) {
- _genPushFunctionTypeArguments();
- } else {
- _genPushInstantiatorAndFunctionTypeArguments(typeArgs);
- // TODO(alexmarkov): Optimize type arguments instantiation
- // by passing rA = 1 in InstantiateTypeArgumentsTOS.
- // For this purpose, we need to detect if type arguments
- // would be all-dynamic in case of all-dynamic instantiator and
- // function type arguments.
- // Corresponding check is implemented in VM in
- // TypeArguments::IsRawWhenInstantiatedFromRaw.
- asm.emitInstantiateTypeArgumentsTOS(0, typeArgsCPIndex());
- }
- }
- }
-
- void _genPushInstantiatorAndFunctionTypeArguments(List<DartType> types) {
- if (classTypeParameters != null &&
- types.any((t) => containsTypeVariable(t, classTypeParameters))) {
- assert(instantiatorTypeArguments != null);
- _genPushInstantiatorTypeArguments();
- } else {
- asm.emitPushNull();
- }
- if (functionTypeParametersSet != null &&
- types.any((t) => containsTypeVariable(t, functionTypeParametersSet))) {
- _genPushFunctionTypeArguments();
- } else {
- asm.emitPushNull();
- }
- }
-
- void _genPushInstantiatorTypeArguments() {
- if (instantiatorTypeArguments != null) {
- if (locals.hasFactoryTypeArgsVar) {
- assert(enclosingMember is Procedure &&
- (enclosingMember as Procedure).isFactory);
- _genLoadVar(locals.factoryTypeArgsVar);
- } else {
- _genPushReceiver();
- final int cpIndex = cp.addTypeArgumentsField(enclosingClass);
- asm.emitLoadTypeArgumentsField(cpIndex);
- }
- } else {
- asm.emitPushNull();
- }
- }
-
- bool _canReuseInstantiatorTypeArguments(List<DartType> typeArgs) {
- if (instantiatorTypeArguments == null) {
- return false;
- }
-
- if (typeArgs.length > instantiatorTypeArguments.length) {
- return false;
- }
-
- for (int i = 0; i < typeArgs.length; ++i) {
- if (typeArgs[i] != instantiatorTypeArguments[i]) {
- return false;
- }
- }
-
- return true;
- }
-
- bool _canReuseFunctionTypeArguments(List<DartType> typeArgs) {
- if (functionTypeParameters == null) {
- return false;
- }
-
- if (typeArgs.length > functionTypeParameters.length) {
- return false;
- }
-
- for (int i = 0; i < typeArgs.length; ++i) {
- final typeArg = typeArgs[i];
- if (!(typeArg is TypeParameterType &&
- typeArg.parameter == functionTypeParameters[i] &&
- (typeArg.nullability == Nullability.nonNullable ||
- typeArg.nullability == Nullability.undetermined))) {
- return false;
- }
- }
-
- return true;
- }
-
- void _genPushFunctionTypeArguments() {
- if (locals.hasFunctionTypeArgsVar) {
- asm.emitPush(locals.functionTypeArgsVarIndexInFrame);
- } else {
- asm.emitPushNull();
- }
- }
-
- void _genPushContextForVariable(VariableDeclaration variable,
- {int currentContextLevel}) {
- currentContextLevel ??= locals.currentContextLevel;
- int depth = currentContextLevel - locals.getContextLevelOfVar(variable);
- assert(depth >= 0);
-
- asm.emitPush(locals.contextVarIndexInFrame);
- if (depth > 0) {
- for (; depth > 0; --depth) {
- asm.emitLoadContextParent();
- }
- }
- }
-
- void _genPushContextIfCaptured(VariableDeclaration variable) {
- if (locals.isCaptured(variable)) {
- _genPushContextForVariable(variable);
- }
- }
-
- void _genLoadVar(VariableDeclaration v, {int currentContextLevel}) {
- if (locals.isCaptured(v)) {
- _genPushContextForVariable(v, currentContextLevel: currentContextLevel);
- asm.emitLoadContextVar(
- locals.getVarContextId(v), locals.getVarIndexInContext(v));
- } else {
- asm.emitPush(locals.getVarIndexInFrame(v));
- }
- }
-
- void _genPushReceiver() {
- // TODO(alexmarkov): generate more efficient access to receiver
- // even if it is captured.
- _genLoadVar(locals.receiverVar);
- }
-
- // Stores value into variable.
- // If variable is captured, context should be pushed before value.
- void _genStoreVar(VariableDeclaration variable) {
- if (locals.isCaptured(variable)) {
- asm.emitStoreContextVar(locals.getVarContextId(variable),
- locals.getVarIndexInContext(variable));
- } else {
- asm.emitPopLocal(locals.getVarIndexInFrame(variable));
- }
- }
-
- /// Generates bool condition. Returns `true` if condition is negated.
- bool _genCondition(Expression condition) {
- bool negated = false;
- if (condition is Not) {
- condition = (condition as Not).operand;
- negated = true;
- }
- _generateNode(condition);
- if (nullabilityDetector.isNullable(condition)) {
- asm.emitAssertBoolean(0);
- }
- return negated;
- }
-
- /// Returns value of the given expression if it is a bool constant.
- /// Otherwise, returns `null`.
- bool _constantConditionValue(Expression condition) {
- if (options.keepUnreachableCode) {
- return null;
- }
- // TODO(dartbug.com/34585): use constant evaluator to evaluate
- // expressions in a non-constant context.
- if (condition is Not) {
- final operand = _constantConditionValue(condition.operand);
- return (operand != null) ? !operand : null;
- }
- if (condition is BoolLiteral) {
- return condition.value;
- }
- if (condition is ConstantExpression) {
- Constant constant = condition.constant;
- if (constant is BoolConstant) {
- return constant.value;
- }
- }
- return null;
- }
-
- void _genConditionAndJumpIf(Expression condition, bool value, Label dest) {
- final bool constantValue = _constantConditionValue(condition);
- if (constantValue != null) {
- if (constantValue == value) {
- asm.emitJump(dest);
- }
- return;
- }
- if (condition is MethodInvocation &&
- condition.name.text == '==' &&
- (condition.receiver is NullLiteral ||
- condition.arguments.positional.single is NullLiteral)) {
- if (condition.receiver is NullLiteral) {
- _generateNode(condition.arguments.positional.single);
- } else {
- _generateNode(condition.receiver);
- }
- if (options.emitDebuggerStops &&
- condition.fileOffset != TreeNode.noOffset) {
- final savedSourcePosition = asm.currentSourcePosition;
- _recordSourcePosition(condition.fileOffset);
- asm.emitDebugCheck();
- asm.currentSourcePosition = savedSourcePosition;
- }
- if (value) {
- asm.emitJumpIfNull(dest);
- } else {
- asm.emitJumpIfNotNull(dest);
- }
- return;
- }
- if (condition is Not) {
- _genConditionAndJumpIf(condition.operand, !value, dest);
- } else if (condition is LogicalExpression) {
- final isOR = (condition.operatorEnum == LogicalExpressionOperator.OR);
-
- Label shortCircuit, done;
- if (isOR == value) {
- shortCircuit = dest;
- } else {
- shortCircuit = done = new Label();
- }
- _genConditionAndJumpIf(condition.left, isOR, shortCircuit);
- _genConditionAndJumpIf(condition.right, value, dest);
- if (done != null) {
- asm.bind(done);
- }
- } else {
- bool negated = _genCondition(condition);
- if (negated) {
- value = !value;
- }
- if (value) {
- asm.emitJumpIfTrue(dest);
- } else {
- asm.emitJumpIfFalse(dest);
- }
- }
- }
-
- int _getDefaultParamConstIndex(VariableDeclaration param) {
- if (param.initializer == null) {
- return cp.addObjectRef(null);
- }
- final constant = _getConstant(param.initializer);
- return cp.addObjectRef(constant);
- }
-
- // Duplicates value on top of the stack using temporary variable with
- // given index.
- void _genDupTOS(int tempIndexInFrame) {
- // TODO(alexmarkov): Consider introducing Dup bytecode or keeping track of
- // expression stack depth.
- asm.emitStoreLocal(tempIndexInFrame);
- asm.emitPush(tempIndexInFrame);
- }
-
- /// Generates is-test for the value at TOS.
- void _genInstanceOf(DartType type) {
- if (typeEnvironment.isTop(type)) {
- asm.emitDrop1();
- asm.emitPushTrue();
- return;
- }
-
- if (type is InterfaceType &&
- (type.typeArguments.isEmpty || isAllDynamic(type.typeArguments))) {
- asm.emitPushConstant(cp.addType(type));
- final argDesc = objectTable.getArgDescHandle(2);
- final cpIndex = cp.addInterfaceCall(
- InvocationKind.method, objectSimpleInstanceOf, argDesc);
- asm.emitInterfaceCall(cpIndex, 2);
- return;
- }
-
- if (hasFreeTypeParameters([type])) {
- _genPushInstantiatorAndFunctionTypeArguments([type]);
- } else {
- asm.emitPushNull(); // Instantiator type arguments.
- asm.emitPushNull(); // Function type arguments.
- }
- asm.emitPushConstant(cp.addType(type));
- final argDesc = objectTable.getArgDescHandle(4);
- final cpIndex =
- cp.addInterfaceCall(InvocationKind.method, objectInstanceOf, argDesc);
- asm.emitInterfaceCall(cpIndex, 4);
- }
-
- void start(Member node, bool hasCode) {
- enclosingClass = node.enclosingClass;
- enclosingMember = node;
- enclosingFunction = node.function;
- parentFunction = null;
- isClosure = false;
- hasErrors = false;
- staticTypeContext.enterMember(node);
- final isFactory = node is Procedure && node.isFactory;
- if (node.isInstanceMember || node is Constructor || isFactory) {
- if (enclosingClass.typeParameters.isNotEmpty) {
- classTypeParameters =
- new Set<TypeParameter>.from(enclosingClass.typeParameters);
- // Treat type arguments of factory constructors as class
- // type parameters.
- if (isFactory) {
- classTypeParameters.addAll(node.function.typeParameters);
- }
- }
- if (hasInstantiatorTypeArguments(enclosingClass)) {
- final typeParameters = getTypeParameterTypes(isFactory
- ? node.function.typeParameters
- : enclosingClass.typeParameters);
- instantiatorTypeArguments =
- flattenInstantiatorTypeArguments(enclosingClass, typeParameters);
- }
- }
- if (enclosingFunction != null &&
- enclosingFunction.typeParameters.isNotEmpty) {
- functionTypeParameters =
- new List<TypeParameter>.from(enclosingFunction.typeParameters);
- functionTypeParametersSet = functionTypeParameters.toSet();
- }
- procedureAttributesMetadata = procedureAttributesMetadataRepository != null
- ? procedureAttributesMetadataRepository.mapping[node]
- : null;
-
- if (inferredTypeMetadata != null) {
- if (node is Field) {
- // Field type is at PC = -1.
- _appendInferredType(node, -1);
- } else if (enclosingFunction != null && hasCode) {
- assert(node is Procedure || node is Constructor);
- // Parameter types are at PC = -N,..,-1 where N - number of declared
- // (explicit) parameters.
- int i = -(enclosingFunction.positionalParameters.length +
- enclosingFunction.namedParameters.length);
- for (var v in enclosingFunction.positionalParameters) {
- _appendInferredType(v, i);
- ++i;
- }
- for (var v in enclosingFunction.namedParameters) {
- _appendInferredType(v, i);
- ++i;
- }
- }
- }
-
- if (!hasCode) {
- return;
- }
-
- labeledStatements = null;
- switchCases = null;
- tryCatches = null;
- finallyBlocks = null;
- yieldPoints = null; // Initialized when entering sync-yielding closure.
- contextLevels = null;
- closures = null;
- initializedFields = null; // Tracked for constructors only.
- nullableFields = const <ObjectHandle>[];
- cp = new ConstantPool(stringTable, objectTable);
- asm = new BytecodeAssembler(options);
- savedAssemblers = null;
- currentLoopDepth = 0;
- savedMaxSourcePositions = <int>[];
- maxSourcePosition = node.fileOffset;
-
- locals = new LocalVariables(
- node, options, staticTypeContext, directCallMetadata);
- locals.enterScope(node);
- assert(!locals.isSyncYieldingFrame);
-
- int position;
- if (node is Procedure) {
- position = node.startFileOffset;
- } else if (node is Constructor) {
- position = node.startFileOffset;
- } else {
- position = node.fileOffset;
- }
- _recordSourcePosition(position);
- _genPrologue(node, node.function);
- _setupInitialContext(node.function);
- _emitFirstDebugCheck(node.function);
- if (node is Procedure && node.isInstanceMember) {
- _checkArguments(node.function);
- }
- _genEqualsOperatorNullHandling(node);
- }
-
- void _appendInferredType(TreeNode node, int pc) {
- final InferredType md = inferredTypeMetadata[node];
- if (md == null || (pc >= 0 && asm.isUnreachable)) {
- return;
- }
- inferredTypesAttribute ??= <Constant>[];
- // List of triplets (PC, concreteClass, flags).
- // Verify that PCs are monotonically increasing.
- assert(inferredTypesAttribute.isEmpty ||
- (inferredTypesAttribute[inferredTypesAttribute.length - 3]
- as IntConstant)
- .value <
- pc);
- inferredTypesAttribute.add(IntConstant(pc));
- Class concreteClass = md.concreteClass;
- // VM uses more specific function type and doesn't expect to
- // see inferred _Closure class.
- if (concreteClass != null && concreteClass != closureClass) {
- inferredTypesAttribute.add(TypeLiteralConstant(coreTypes.rawType(
- concreteClass,
- (concreteClass == coreTypes.nullClass)
- ? Nullability.nullable
- : staticTypeContext.nonNullable)));
- } else {
- inferredTypesAttribute.add(NullConstant());
- }
- // Inferred constant values are handled in bytecode generator
- // (_replaceWithConstantValue, _initConstantParameters) and
- // not propagated to VM.
- final flags = md.flags & ~InferredType.flagConstant;
- inferredTypesAttribute.add(IntConstant(flags));
- }
-
- void _replaceWithConstantValue(TreeNode node) {
- final InferredType md = inferredTypeMetadata[node];
- if (md == null || md.constantValue == null || asm.isUnreachable) {
- return;
- }
- asm.emitDrop1();
- _genPushConstant(md.constantValue);
- }
-
- // Generate additional code for 'operator ==' to handle nulls.
- void _genEqualsOperatorNullHandling(Member member) {
- if (member.name.text != '==' ||
- locals.numParameters != 2 ||
- member.enclosingClass == coreTypes.objectClass) {
- return;
- }
-
- Label done = new Label();
-
- _genLoadVar(member.function.positionalParameters[0]);
- asm.emitJumpIfNotNull(done);
-
- asm.emitPushFalse();
- _genReturnTOS();
-
- asm.bind(done);
- }
-
- void end(Member node, bool hasCode) {
- if (!hasErrors) {
- Code code;
- if (hasCode) {
- if (options.emitLocalVarInfo) {
- // Leave the scopes which were entered in _genPrologue and
- // _setupInitialContext.
- asm.localVariableTable.leaveAllScopes(
- asm.offset,
- node.function != null
- ? node.function.fileEndOffset
- : node.fileEndOffset);
- }
-
- List<int> parameterFlags = null;
- int forwardingStubTargetCpIndex = null;
- int defaultFunctionTypeArgsCpIndex = null;
-
- // We don't need the required flag when loading the code, but do need
- // all other parameter flags.
- final parameterFlagMask = ~ParameterDeclaration.isRequiredFlag;
-
- if (node is Constructor) {
- parameterFlags =
- getParameterFlags(node.function, mask: parameterFlagMask);
- } else if (node is Procedure) {
- parameterFlags =
- getParameterFlags(node.function, mask: parameterFlagMask);
-
- if (node.isForwardingStub) {
- forwardingStubTargetCpIndex =
- cp.addObjectRef(node.forwardingStubSuperTarget);
- }
-
- final defaultTypes = getDefaultFunctionTypeArguments(node.function);
- if (defaultTypes != null) {
- defaultFunctionTypeArgsCpIndex = cp.addTypeArguments(defaultTypes);
- }
- }
- code = new Code(
- cp,
- asm.bytecode,
- asm.exceptionsTable,
- finalizeSourcePositions(),
- finalizeLocalVariables(),
- nullableFields,
- closures ?? const <ClosureDeclaration>[],
- parameterFlags,
- forwardingStubTargetCpIndex,
- defaultFunctionTypeArgsCpIndex);
- bytecodeComponent.codes.add(code);
- }
- if (node is Field) {
- fieldDeclarations.add(getFieldDeclaration(node, code));
- } else {
- functionDeclarations.add(getFunctionDeclaration(node, code));
- }
- }
-
- staticTypeContext.leaveMember(node);
- enclosingClass = null;
- enclosingMember = null;
- enclosingFunction = null;
- parentFunction = null;
- isClosure = null;
- classTypeParameters = null;
- functionTypeParameters = null;
- functionTypeParametersSet = null;
- instantiatorTypeArguments = null;
- locals = null;
- labeledStatements = null;
- switchCases = null;
- tryCatches = null;
- finallyBlocks = null;
- yieldPoints = null;
- contextLevels = null;
- closures = null;
- initializedFields = null;
- nullableFields = null;
- cp = null;
- asm = null;
- savedAssemblers = null;
- hasErrors = false;
- procedureAttributesMetadata = null;
- inferredTypesAttribute = null;
- }
-
- SourcePositions finalizeSourcePositions() {
- if (asm.sourcePositions.isEmpty) {
- return null;
- }
- bytecodeComponent.sourcePositions.add(asm.sourcePositions);
- return asm.sourcePositions;
- }
-
- LocalVariableTable finalizeLocalVariables() {
- final localVariables = asm.localVariableTable;
- assert(!localVariables.hasActiveScopes);
- if (localVariables.isEmpty) {
- return null;
- }
- bytecodeComponent.localVariables.add(localVariables);
- return localVariables;
- }
-
- void _genPrologue(Node node, FunctionNode function) {
- if (locals.hasOptionalParameters) {
- final int numOptionalPositional = function.positionalParameters.length -
- function.requiredParameterCount;
- final int numOptionalNamed = function.namedParameters.length;
- final int numFixed =
- locals.numParameters - (numOptionalPositional + numOptionalNamed);
-
- asm.emitEntryOptional(numFixed, numOptionalPositional, numOptionalNamed);
-
- if (numOptionalPositional != 0) {
- assert(numOptionalNamed == 0);
- for (int i = 0; i < numOptionalPositional; i++) {
- final param = function
- .positionalParameters[function.requiredParameterCount + i];
- asm.emitLoadConstant(numFixed + i, _getDefaultParamConstIndex(param));
- }
- } else {
- assert(numOptionalNamed != 0);
- for (int i = 0; i < numOptionalNamed; i++) {
- final param = locals.sortedNamedParameters[i];
- asm.emitLoadConstant(numFixed + i, cp.addName(param.name));
- asm.emitLoadConstant(numFixed + i, _getDefaultParamConstIndex(param));
- }
- }
-
- asm.emitFrame(locals.frameSize - locals.numParameters);
- } else {
- asm.emitEntry(locals.frameSize);
- }
-
- if (isClosure) {
- asm.emitPush(locals.closureVarIndexInFrame);
- asm.emitLoadFieldTOS(cp.addInstanceField(closureContext));
- asm.emitPopLocal(locals.contextVarIndexInFrame);
- }
-
- if (locals.hasFunctionTypeArgsVar && function.typeParameters.isNotEmpty) {
- assert(!(node is Procedure && node.isFactory));
-
- Label done = new Label();
-
- if (isClosure) {
- _handleDelayedTypeArguments(done);
- }
-
- asm.emitCheckFunctionTypeArgs(function.typeParameters.length,
- locals.functionTypeArgsVarIndexInFrame);
-
- _handleDefaultTypeArguments(function, done);
-
- asm.bind(done);
- }
-
- // Open initial scope before the first CheckStack, as VM might
- // need to know context level.
- if (options.emitLocalVarInfo && function != null) {
- asm.localVariableTable.enterScope(
- asm.offset,
- isClosure ? locals.contextLevelAtEntry : locals.currentContextLevel,
- function.fileOffset);
- if (locals.hasContextVar) {
- asm.localVariableTable
- .recordContextVariable(asm.offset, locals.contextVarIndexInFrame);
- }
- if (locals.hasReceiver &&
- (!isClosure || locals.isCaptured(locals.receiverVar))) {
- _declareLocalVariable(locals.receiverVar, function.fileOffset);
- }
- for (var v in function.positionalParameters) {
- if (!locals.isCaptured(v)) {
- _declareLocalVariable(v, function.fileOffset);
- }
- }
- for (var v in locals.sortedNamedParameters) {
- if (!locals.isCaptured(v)) {
- _declareLocalVariable(v, function.fileOffset);
- }
- }
- if (locals.hasFunctionTypeArgsVar) {
- _declareLocalVariable(locals.functionTypeArgsVar, function.fileOffset);
- }
- }
-
- // CheckStack must see a properly initialized context when stress-testing
- // stack trace collection.
- asm.emitCheckStack(0);
-
- if (locals.hasFunctionTypeArgsVar && isClosure) {
- if (function.typeParameters.isNotEmpty) {
- final int numParentTypeArgs = locals.numParentTypeArguments;
- asm.emitPush(locals.functionTypeArgsVarIndexInFrame);
- asm.emitPush(locals.closureVarIndexInFrame);
- asm.emitLoadFieldTOS(cp.addInstanceField(closureFunctionTypeArguments));
- _genPushInt(numParentTypeArgs);
- _genPushInt(numParentTypeArgs + function.typeParameters.length);
- _genDirectCall(
- prependTypeArguments, objectTable.getArgDescHandle(4), 4);
- asm.emitPopLocal(locals.functionTypeArgsVarIndexInFrame);
- } else {
- asm.emitPush(locals.closureVarIndexInFrame);
- asm.emitLoadFieldTOS(cp.addInstanceField(closureFunctionTypeArguments));
- asm.emitPopLocal(locals.functionTypeArgsVarIndexInFrame);
- }
- }
-
- if (inferredTypeMetadata != null && function != null) {
- _initConstantParameters(function);
- }
- }
-
- void _handleDelayedTypeArguments(Label doneCheckingTypeArguments) {
- Label noDelayedTypeArgs = new Label();
-
- asm.emitPush(locals.closureVarIndexInFrame);
- asm.emitLoadFieldTOS(cp.addInstanceField(closureDelayedTypeArguments));
- asm.emitStoreLocal(locals.functionTypeArgsVarIndexInFrame);
- asm.emitPushConstant(cp.addEmptyTypeArguments());
- asm.emitJumpIfEqStrict(noDelayedTypeArgs);
-
- // There are non-empty delayed type arguments, and they are stored
- // into function type args variable already.
- // Just verify that there are no passed type arguments.
- asm.emitCheckFunctionTypeArgs(0, locals.scratchVarIndexInFrame);
- asm.emitJump(doneCheckingTypeArguments);
-
- asm.bind(noDelayedTypeArgs);
- }
-
- void _handleDefaultTypeArguments(
- FunctionNode function, Label doneCheckingTypeArguments) {
- List<DartType> defaultTypes = getDefaultFunctionTypeArguments(function);
- if (defaultTypes == null) {
- return;
- }
-
- asm.emitJumpIfNotZeroTypeArgs(doneCheckingTypeArguments);
-
- // Load parent function type arguments if they are used to
- // instantiate default types.
- if (isClosure &&
- defaultTypes
- .any((t) => containsTypeVariable(t, functionTypeParametersSet))) {
- asm.emitPush(locals.closureVarIndexInFrame);
- asm.emitLoadFieldTOS(cp.addInstanceField(closureFunctionTypeArguments));
- asm.emitPopLocal(locals.functionTypeArgsVarIndexInFrame);
- }
-
- _genTypeArguments(defaultTypes);
- asm.emitPopLocal(locals.functionTypeArgsVarIndexInFrame);
- }
-
- void _initConstantParameters(FunctionNode function) {
- function.positionalParameters.forEach(_initParameterIfConstant);
- locals.sortedNamedParameters.forEach(_initParameterIfConstant);
- }
-
- void _initParameterIfConstant(VariableDeclaration variable) {
- final md = inferredTypeMetadata[variable];
- if (md != null && md.constantValue != null) {
- _genPushConstant(md.constantValue);
- asm.emitPopLocal(locals.isCaptured(variable)
- ? locals.getOriginalParamSlotIndex(variable)
- : locals.getVarIndexInFrame(variable));
- }
- }
-
- void _setupInitialContext(FunctionNode function) {
- _allocateContextIfNeeded();
-
- if (options.emitLocalVarInfo && locals.currentContextSize > 0) {
- // Open a new scope after allocating context.
- asm.localVariableTable.enterScope(asm.offset, locals.currentContextLevel,
- function != null ? function.fileOffset : enclosingMember.fileOffset);
- }
-
- if (locals.hasCapturedParameters) {
- // Copy captured parameters to their respective locations in the context.
- if (!isClosure) {
- if (locals.hasFactoryTypeArgsVar) {
- _copyParamIfCaptured(locals.factoryTypeArgsVar);
- }
- if (locals.hasCapturedReceiverVar) {
- _genPushContextForVariable(locals.capturedReceiverVar);
- asm.emitPush(locals.getVarIndexInFrame(locals.receiverVar));
- _genStoreVar(locals.capturedReceiverVar);
- }
- }
- if (function != null) {
- function.positionalParameters.forEach(_copyParamIfCaptured);
- locals.sortedNamedParameters.forEach(_copyParamIfCaptured);
- }
- }
- }
-
- void _emitFirstDebugCheck(FunctionNode function) {
- if (options.emitDebuggerStops) {
- // DebugCheck instruction should be emitted after parameter variables
- // are declared and copied into context.
- // The debugger expects the source position to correspond to the
- // declaration position of the last parameter, if any, or of the function.
- // The DebugCheck must be encountered each time an async op is reentered.
- if (options.emitSourcePositions && function != null) {
- var pos = TreeNode.noOffset;
- if (function.namedParameters.isNotEmpty) {
- pos = function.namedParameters.last.fileOffset;
- } else if (function.positionalParameters.isNotEmpty) {
- pos = function.positionalParameters.last.fileOffset;
- }
- if (pos == TreeNode.noOffset) {
- pos = function.fileOffset;
- }
- _recordSourcePosition(pos);
- }
- asm.emitDebugCheck();
- }
- }
-
- void _copyParamIfCaptured(VariableDeclaration variable) {
- if (locals.isCaptured(variable)) {
- if (options.emitLocalVarInfo) {
- _declareLocalVariable(variable, enclosingFunction.fileOffset);
- }
- _genPushContextForVariable(variable);
- asm.emitPush(locals.getOriginalParamSlotIndex(variable));
- _genStoreVar(variable);
- // TODO(alexmarkov): We need to store null at the original parameter
- // location, because the original value may need to be GC'ed.
- }
- }
-
- void _declareLocalVariable(
- VariableDeclaration variable, int initializedPosition) {
- assert(variable.name != null);
- bool isCaptured = locals.isCaptured(variable);
- asm.localVariableTable.declareVariable(
- asm.offset,
- isCaptured,
- isCaptured
- ? locals.getVarIndexInContext(variable)
- : locals.getVarIndexInFrame(variable),
- cp.addName(variable.name),
- cp.addType(variable.type),
- variable.fileOffset,
- initializedPosition);
- }
-
- // TODO(dartbug.com/40813): Remove the closure case when we move the
- // type checks out of closure bodies.
- bool get canSkipTypeChecksForNonCovariantArguments => !isClosure;
-
- bool get skipTypeChecksForGenericCovariantImplArguments =>
- procedureAttributesMetadata != null &&
- !procedureAttributesMetadata.hasNonThisUses &&
- // TODO(alexmarkov): fix building of flow graph for implicit closures so
- // it would include missing checks and remove this condition.
- !procedureAttributesMetadata.hasTearOffUses;
-
- Member _getForwardingStubSuperTarget() {
- if (!isClosure) {
- final member = enclosingMember;
- if (member.isInstanceMember &&
- member is Procedure &&
- member.isForwardingStub) {
- return member.forwardingStubSuperTarget;
- }
- }
- return null;
- }
-
- // Types in a target of a forwarding stub are encoded in terms of target type
- // parameters. Substitute them with host type parameters to be able
- // to use them (e.g. instantiate) in the context of host.
- Substitution _getForwardingSubstitution(
- FunctionNode host, Member forwardingTarget) {
- if (forwardingTarget == null) {
- return null;
- }
- final Class targetClass = forwardingTarget.enclosingClass;
- final Supertype instantiatedTargetClass =
- hierarchy.getClassAsInstanceOf(enclosingClass, targetClass);
- if (instantiatedTargetClass == null) {
- throw 'Class $targetClass is not found among implemented interfaces of'
- ' $enclosingClass (for forwarding stub $enclosingMember)';
- }
- assert(instantiatedTargetClass.classNode == targetClass);
- assert(instantiatedTargetClass.typeArguments.length ==
- targetClass.typeParameters.length);
- final Map<TypeParameter, DartType> map =
- new Map<TypeParameter, DartType>.fromIterables(
- targetClass.typeParameters, instantiatedTargetClass.typeArguments);
- if (forwardingTarget.function != null) {
- final targetTypeParameters = forwardingTarget.function.typeParameters;
- assert(host.typeParameters.length == targetTypeParameters.length);
- for (int i = 0; i < targetTypeParameters.length; ++i) {
- map[targetTypeParameters[i]] =
- new TypeParameterType(host.typeParameters[i], Nullability.legacy);
- }
- }
- return Substitution.fromMap(map);
- }
-
- /// If member being compiled is a forwarding stub, then returns type
- /// parameter bounds to check for the forwarding stub target.
- Map<TypeParameter, DartType> _getForwardingBounds(FunctionNode function,
- Member forwardingTarget, Substitution forwardingSubstitution) {
- if (function.typeParameters.isEmpty || forwardingTarget == null) {
- return null;
- }
- final forwardingBounds = <TypeParameter, DartType>{};
- for (int i = 0; i < function.typeParameters.length; ++i) {
- DartType bound = forwardingSubstitution
- .substituteType(forwardingTarget.function.typeParameters[i].bound);
- forwardingBounds[function.typeParameters[i]] = bound;
- }
- return forwardingBounds;
- }
-
- /// If member being compiled is a forwarding stub, then returns parameter
- /// types to check for the forwarding stub target.
- Map<VariableDeclaration, DartType> _getForwardingParameterTypes(
- FunctionNode function,
- Member forwardingTarget,
- Substitution forwardingSubstitution) {
- if (forwardingTarget == null) {
- return null;
- }
-
- if (forwardingTarget is Field) {
- if ((enclosingMember as Procedure).isGetter) {
- return const <VariableDeclaration, DartType>{};
- } else {
- // Forwarding stub for a covariant field setter.
- assert((enclosingMember as Procedure).isSetter);
- assert(function.typeParameters.isEmpty &&
- function.positionalParameters.length == 1 &&
- function.namedParameters.length == 0);
- return <VariableDeclaration, DartType>{
- function.positionalParameters.single:
- forwardingSubstitution.substituteType(forwardingTarget.type)
- };
- }
- }
-
- final forwardingParams = <VariableDeclaration, DartType>{};
- for (int i = 0; i < function.positionalParameters.length; ++i) {
- DartType type = forwardingSubstitution.substituteType(
- forwardingTarget.function.positionalParameters[i].type);
- forwardingParams[function.positionalParameters[i]] = type;
- }
- for (var hostParam in function.namedParameters) {
- VariableDeclaration targetParam = forwardingTarget
- .function.namedParameters
- .firstWhere((p) => p.name == hostParam.name);
- forwardingParams[hostParam] =
- forwardingSubstitution.substituteType(targetParam.type);
- }
- return forwardingParams;
- }
-
- void _checkArguments(FunctionNode function) {
- // When checking arguments of a forwarding stub, we need to use parameter
- // types (and bounds of type parameters) from stub's target.
- // These more accurate type checks is the sole purpose of a forwarding stub.
- final forwardingTarget = _getForwardingStubSuperTarget();
- final forwardingSubstitution =
- _getForwardingSubstitution(function, forwardingTarget);
- final forwardingBounds = _getForwardingBounds(
- function, forwardingTarget, forwardingSubstitution);
- final forwardingParamTypes = _getForwardingParameterTypes(
- function, forwardingTarget, forwardingSubstitution);
-
- if (_hasSkippableTypeChecks(
- function, forwardingBounds, forwardingParamTypes)) {
- final Label skipChecks = new Label();
- asm.emitJumpIfUnchecked(skipChecks);
-
- // We can skip bounds checks of type parameter and type checks of
- // non-covariant parameters if function is called via unchecked call.
-
- for (var typeParam in function.typeParameters) {
- if (_typeParameterNeedsBoundCheck(typeParam, forwardingBounds)) {
- _genTypeParameterBoundCheck(typeParam, forwardingBounds);
- }
- }
- for (var param in function.positionalParameters) {
- if (!param.isCovariant &&
- _parameterNeedsTypeCheck(param, forwardingParamTypes)) {
- _genArgumentTypeCheck(param, forwardingParamTypes);
- }
- }
- for (var param in locals.sortedNamedParameters) {
- if (!param.isCovariant &&
- _parameterNeedsTypeCheck(param, forwardingParamTypes)) {
- _genArgumentTypeCheck(param, forwardingParamTypes);
- }
- }
-
- asm.bind(skipChecks);
- }
-
- // Covariant parameters need to be checked even if function is called
- // via unchecked call, so they are generated outside of JumpIfUnchecked.
-
- for (var param in function.positionalParameters) {
- if (param.isCovariant &&
- _parameterNeedsTypeCheck(param, forwardingParamTypes)) {
- _genArgumentTypeCheck(param, forwardingParamTypes);
- }
- }
- for (var param in locals.sortedNamedParameters) {
- if (param.isCovariant &&
- _parameterNeedsTypeCheck(param, forwardingParamTypes)) {
- _genArgumentTypeCheck(param, forwardingParamTypes);
- }
- }
- }
-
- /// Returns true if bound of [typeParam] should be checked.
- bool _typeParameterNeedsBoundCheck(TypeParameter typeParam,
- Map<TypeParameter, DartType> forwardingTypeParameterBounds) {
- if (canSkipTypeChecksForNonCovariantArguments &&
- (!typeParam.isGenericCovariantImpl ||
- skipTypeChecksForGenericCovariantImplArguments)) {
- return false;
- }
- final DartType bound = (forwardingTypeParameterBounds != null)
- ? forwardingTypeParameterBounds[typeParam]
- : typeParam.bound;
- if (typeEnvironment.isTop(bound)) {
- return false;
- }
- return true;
- }
-
- /// Returns true if type of [param] should be checked.
- bool _parameterNeedsTypeCheck(VariableDeclaration param,
- Map<VariableDeclaration, DartType> forwardingParameterTypes) {
- if (canSkipTypeChecksForNonCovariantArguments &&
- !param.isCovariant &&
- (!param.isGenericCovariantImpl ||
- skipTypeChecksForGenericCovariantImplArguments)) {
- return false;
- }
- final DartType type = (forwardingParameterTypes != null)
- ? forwardingParameterTypes[param]
- : param.type;
- if (typeEnvironment.isTop(type)) {
- return false;
- }
- return true;
- }
-
- /// Returns true if there are parameter type/bound checks which can
- /// be skipped on unchecked call.
- bool _hasSkippableTypeChecks(
- FunctionNode function,
- Map<TypeParameter, DartType> forwardingBounds,
- Map<VariableDeclaration, DartType> forwardingParamTypes) {
- for (var typeParam in function.typeParameters) {
- if (_typeParameterNeedsBoundCheck(typeParam, forwardingBounds)) {
- return true;
- }
- }
- for (var param in function.positionalParameters) {
- if (!param.isCovariant &&
- _parameterNeedsTypeCheck(param, forwardingParamTypes)) {
- return true;
- }
- }
- for (var param in locals.sortedNamedParameters) {
- if (!param.isCovariant &&
- _parameterNeedsTypeCheck(param, forwardingParamTypes)) {
- return true;
- }
- }
- return false;
- }
-
- void _genTypeParameterBoundCheck(TypeParameter typeParam,
- Map<TypeParameter, DartType> forwardingTypeParameterBounds) {
- final DartType bound = (forwardingTypeParameterBounds != null)
- ? forwardingTypeParameterBounds[typeParam]
- : typeParam.bound;
- final DartType type = new TypeParameterType(typeParam, Nullability.legacy);
- _genPushInstantiatorAndFunctionTypeArguments([type, bound]);
- asm.emitPushConstant(cp.addType(type));
- asm.emitPushConstant(cp.addType(bound));
- asm.emitPushConstant(cp.addName(typeParam.name));
- asm.emitAssertSubtype();
- }
-
- void _genArgumentTypeCheck(VariableDeclaration variable,
- Map<VariableDeclaration, DartType> forwardingParameterTypes) {
- final DartType type = (forwardingParameterTypes != null)
- ? forwardingParameterTypes[variable]
- : variable.type;
- if (locals.isCaptured(variable)) {
- asm.emitPush(locals.getOriginalParamSlotIndex(variable));
- } else {
- asm.emitPush(locals.getVarIndexInFrame(variable));
- }
- _genAssertAssignable(type, name: variable.name);
- asm.emitDrop1();
- }
-
- void _genAssertAssignable(DartType type, {String name, String message}) {
- assert(!typeEnvironment.isTop(type));
- asm.emitPushConstant(cp.addType(type));
- _genPushInstantiatorAndFunctionTypeArguments([type]);
- asm.emitPushConstant(
- name != null ? cp.addName(name) : cp.addString(message));
- bool isIntOk = typeEnvironment.isSubtypeOf(
- typeEnvironment.coreTypes.intLegacyRawType,
- type,
- SubtypeCheckMode.ignoringNullabilities);
- int subtypeTestCacheCpIndex = cp.addSubtypeTestCache();
- asm.emitAssertAssignable(isIntOk ? 1 : 0, subtypeTestCacheCpIndex);
- }
-
- void _pushAssemblerState() {
- savedAssemblers ??= <BytecodeAssembler>[];
- savedAssemblers.add(asm);
- asm = new BytecodeAssembler(options);
- }
-
- void _popAssemblerState() {
- asm = savedAssemblers.removeLast();
- }
-
- int _genClosureBytecode(
- LocalFunction node, String name, FunctionNode function) {
- _pushAssemblerState();
-
- locals.enterScope(node);
-
- final savedParentFunction = parentFunction;
- parentFunction = enclosingFunction;
- final savedIsClosure = isClosure;
- isClosure = true;
- enclosingFunction = function;
- final savedLoopDepth = currentLoopDepth;
- currentLoopDepth = 0;
- final savedInferredTypesAttribute = inferredTypesAttribute;
- inferredTypesAttribute = null;
-
- if (function.typeParameters.isNotEmpty) {
- functionTypeParameters ??= new List<TypeParameter>();
- functionTypeParameters.addAll(function.typeParameters);
- functionTypeParametersSet = functionTypeParameters.toSet();
- }
-
- List<Label> savedYieldPoints = yieldPoints;
- yieldPoints = locals.isSyncYieldingFrame ? <Label>[] : null;
-
- closures ??= <ClosureDeclaration>[];
- final int closureIndex = closures.length;
- final closure = getClosureDeclaration(node, function, name, closureIndex,
- savedIsClosure ? parentFunction : enclosingMember);
- closures.add(closure);
-
- final int closureFunctionIndex = cp.addClosureFunction(closureIndex);
-
- _recordSourcePosition(function.fileOffset);
- _genPrologue(node, function);
-
- if (options.causalAsyncStacks &&
- parentFunction != null &&
- (parentFunction.dartAsyncMarker == AsyncMarker.Async ||
- parentFunction.dartAsyncMarker == AsyncMarker.AsyncStar)) {
- final savedSourcePosition = asm.currentSourcePosition;
- _recordSourcePosition(TreeNode.noOffset);
- _genLoadVar(locals.asyncStackTraceVar,
- currentContextLevel: locals.contextLevelAtEntry);
- _genDirectCall(
- setAsyncThreadStackTrace, objectTable.getArgDescHandle(1), 1);
- asm.emitDrop1();
- asm.currentSourcePosition = savedSourcePosition;
- }
-
- Label continuationSwitchLabel;
- int continuationSwitchVar;
- if (locals.isSyncYieldingFrame) {
- continuationSwitchLabel = new Label();
- continuationSwitchVar = locals.scratchVarIndexInFrame;
- _genSyncYieldingPrologue(
- function, continuationSwitchLabel, continuationSwitchVar);
- } else {
- _setupInitialContext(function);
- _emitFirstDebugCheck(function);
- }
- _checkArguments(function);
-
- _generateNode(function.body);
-
- // BytecodeAssembler eliminates this bytecode if it is unreachable.
- _recordSourcePosition(function.fileEndOffset);
- asm.emitPushNull();
- _genReturnTOS();
-
- if (locals.isSyncYieldingFrame) {
- _genSyncYieldingEpilogue(
- function, continuationSwitchLabel, continuationSwitchVar);
- }
-
- if (options.emitLocalVarInfo) {
- // Leave the scopes which were entered in _genPrologue and
- // _setupInitialContext.
- asm.localVariableTable.leaveAllScopes(asm.offset, function.fileEndOffset);
- }
-
- cp.addEndClosureFunctionScope();
-
- if (function.typeParameters.isNotEmpty) {
- functionTypeParameters.length -= function.typeParameters.length;
- functionTypeParametersSet = functionTypeParameters.toSet();
- }
-
- enclosingFunction = parentFunction;
- parentFunction = savedParentFunction;
- isClosure = savedIsClosure;
- currentLoopDepth = savedLoopDepth;
-
- final attributes = getClosureAttributes();
- if (attributes != null) {
- closure.attributes = attributes;
- closure.flags |= ClosureDeclaration.hasAttributesFlag;
- }
- inferredTypesAttribute = savedInferredTypesAttribute;
-
- locals.leaveScope();
-
- closure.code = new ClosureCode(asm.bytecode, asm.exceptionsTable,
- finalizeSourcePositions(), finalizeLocalVariables());
-
- _popAssemblerState();
- yieldPoints = savedYieldPoints;
-
- return closureFunctionIndex;
- }
-
- ClosureDeclaration getClosureDeclaration(LocalFunction node,
- FunctionNode function, String name, int closureIndex, TreeNode parent) {
- objectTable.declareClosure(function, enclosingMember, closureIndex);
-
- int flags = 0;
- int position = TreeNode.noOffset;
- int endPosition = TreeNode.noOffset;
- if (options.emitSourcePositions) {
- position = (node is ast.FunctionDeclaration)
- ? node.fileOffset
- : function.fileOffset;
- endPosition = function.fileEndOffset;
- if (position != TreeNode.noOffset) {
- flags |= ClosureDeclaration.hasSourcePositionsFlag;
- }
- }
-
- switch (function.dartAsyncMarker) {
- case AsyncMarker.Async:
- flags |= ClosureDeclaration.isAsyncFlag;
- break;
- case AsyncMarker.AsyncStar:
- flags |= ClosureDeclaration.isAsyncStarFlag;
- break;
- case AsyncMarker.SyncStar:
- flags |= ClosureDeclaration.isSyncStarFlag;
- break;
- default:
- flags |= ClosureDeclaration.isDebuggableFlag;
- break;
- }
-
- final List<NameAndType> parameters = <NameAndType>[];
- for (var v in function.positionalParameters) {
- parameters.add(new NameAndType(objectTable.getPublicNameHandle(v.name),
- objectTable.getHandle(v.type)));
- }
- for (var v in function.namedParameters) {
- parameters.add(new NameAndType(objectTable.getPublicNameHandle(v.name),
- objectTable.getHandle(v.type)));
- }
- if (function.requiredParameterCount != parameters.length) {
- if (function.namedParameters.isNotEmpty) {
- flags |= ClosureDeclaration.hasOptionalNamedParamsFlag;
- } else {
- flags |= ClosureDeclaration.hasOptionalPositionalParamsFlag;
- }
- }
-
- final typeParams =
- objectTable.getTypeParameterHandles(function.typeParameters);
- if (typeParams.isNotEmpty) {
- flags |= ClosureDeclaration.hasTypeParamsFlag;
- }
-
- // We only need the required flags when loading the closure declaration.
- final parameterFlags =
- getParameterFlags(function, mask: ParameterDeclaration.isRequiredFlag);
- if (parameterFlags != null) {
- flags |= ClosureDeclaration.hasParameterFlagsFlag;
- }
-
- return new ClosureDeclaration(
- flags,
- objectTable.getHandle(parent),
- objectTable.getPublicNameHandle(name),
- position,
- endPosition,
- typeParams,
- function.requiredParameterCount,
- function.namedParameters.length,
- parameters,
- parameterFlags,
- objectTable.getHandle(function.returnType));
- }
-
- void _genSyncYieldingPrologue(FunctionNode function, Label continuationLabel,
- int switchVarIndexInFrame) {
- Label debugCheckLabel = new Label();
-
- // switch_var = :await_jump_var
- _genLoadVar(locals.awaitJumpVar);
- asm.emitStoreLocal(switchVarIndexInFrame);
-
- _genPushInt(0);
-
- if (options.emitDebuggerStops) {
- // if (switch_var != 0) goto debugCheckLabel
- asm.emitJumpIfNeStrict(debugCheckLabel);
-
- _setupInitialContext(function);
-
- asm.bind(debugCheckLabel);
- // The debugger may set a breakpoint on this DebugCheck opcode and it
- // expects to hit it on the first entry to the async op, as well as on
- // each subsequent reentry.
- _emitFirstDebugCheck(function);
-
- _genLoadVar(locals.awaitJumpVar);
-
- // if (switch_var != 0) goto continuationLabel
- _genPushInt(0);
- asm.emitJumpIfNeStrict(continuationLabel);
- } else {
- // if (switch_var != 0) goto continuationLabel
- asm.emitJumpIfNeStrict(continuationLabel);
-
- _setupInitialContext(function);
- }
-
- // Proceed to normal entry.
- }
-
- void _genSyncYieldingEpilogue(FunctionNode function, Label continuationLabel,
- int switchVarIndexInFrame) {
- asm.bind(continuationLabel);
-
- if (yieldPoints.isEmpty) {
- asm.emitTrap();
- return;
- }
-
- // context = :await_ctx_var
- _genLoadVar(locals.awaitContextVar);
- asm.emitPopLocal(locals.contextVarIndexInFrame);
-
- for (int i = 0; i < yieldPoints.length; i++) {
- // 0 is reserved for normal entry, yield points are counted from 1.
- final int index = i + 1;
-
- // if (switch_var == #index) goto yieldPoints[i]
- // There is no need to test switch_var for the last yield statement.
- if (i != yieldPoints.length - 1) {
- asm.emitPush(switchVarIndexInFrame);
- _genPushInt(index);
- asm.emitJumpIfEqStrict(yieldPoints[i]);
- } else {
- asm.emitJump(yieldPoints[i]);
- }
- }
- }
-
- void _genAllocateClosureInstance(
- TreeNode node, int closureFunctionIndex, FunctionNode function) {
- asm.emitAllocateClosure(closureFunctionIndex);
-
- final int temp = locals.tempIndexInFrame(node);
- asm.emitStoreLocal(temp);
-
- // TODO(alexmarkov): We need to fill _instantiator_type_arguments field
- // only if function signature uses instantiator type arguments.
- asm.emitPush(temp);
- _genPushInstantiatorTypeArguments();
- asm.emitStoreFieldTOS(
- cp.addInstanceField(closureInstantiatorTypeArguments));
-
- asm.emitPush(temp);
- _genPushFunctionTypeArguments();
- asm.emitStoreFieldTOS(cp.addInstanceField(closureFunctionTypeArguments));
-
- // Delayed type arguments are only used by generic closures.
- if (function.typeParameters.isNotEmpty) {
- asm.emitPush(temp);
- asm.emitPushConstant(cp.addEmptyTypeArguments());
- asm.emitStoreFieldTOS(cp.addInstanceField(closureDelayedTypeArguments));
- }
-
- asm.emitPush(temp);
- asm.emitPushConstant(closureFunctionIndex);
- asm.emitStoreFieldTOS(cp.addInstanceField(closureFunction));
-
- asm.emitPush(temp);
- asm.emitPush(locals.contextVarIndexInFrame);
- asm.emitStoreFieldTOS(cp.addInstanceField(closureContext));
- }
-
- void _genClosure(LocalFunction node, String name, FunctionNode function) {
- final int closureFunctionIndex = _genClosureBytecode(node, name, function);
- _genAllocateClosureInstance(node, closureFunctionIndex, function);
- }
-
- void _allocateContextIfNeeded() {
- final int contextSize = locals.currentContextSize;
- if (contextSize > 0) {
- asm.emitAllocateContext(locals.currentContextId, contextSize);
-
- if (locals.currentContextLevel > 0) {
- _genDupTOS(locals.scratchVarIndexInFrame);
- asm.emitPush(locals.contextVarIndexInFrame);
- asm.emitStoreContextParent();
- }
-
- asm.emitPopLocal(locals.contextVarIndexInFrame);
- }
- }
-
- void _enterScope(TreeNode node) {
- locals.enterScope(node);
- _allocateContextIfNeeded();
- if (options.emitLocalVarInfo) {
- asm.localVariableTable
- .enterScope(asm.offset, locals.currentContextLevel, node.fileOffset);
- _startRecordingMaxPosition(node.fileOffset);
- }
- }
-
- void _leaveScope() {
- if (options.emitLocalVarInfo) {
- asm.localVariableTable.leaveScope(asm.offset, _endRecordingMaxPosition());
- }
- if (locals.currentContextSize > 0) {
- _genUnwindContext(locals.currentContextLevel - 1);
- }
- locals.leaveScope();
- }
-
- void _startRecordingMaxPosition(int fileOffset) {
- savedMaxSourcePositions.add(maxSourcePosition);
- maxSourcePosition = fileOffset;
- }
-
- int _endRecordingMaxPosition() {
- int localMax = maxSourcePosition;
- maxSourcePosition =
- math.max(localMax, savedMaxSourcePositions.removeLast());
- return localMax;
- }
-
- void _genUnwindContext(int targetContextLevel) {
- int currentContextLevel = locals.currentContextLevel;
- assert(currentContextLevel >= targetContextLevel);
- while (currentContextLevel > targetContextLevel) {
- asm.emitPush(locals.contextVarIndexInFrame);
- asm.emitLoadContextParent();
- asm.emitPopLocal(locals.contextVarIndexInFrame);
- --currentContextLevel;
- }
- }
-
- /// Returns the list of try-finally blocks between [from] and [to],
- /// ordered from inner to outer. If [to] is null, returns all enclosing
- /// try-finally blocks up to the function boundary.
- List<TryFinally> _getEnclosingTryFinallyBlocks(TreeNode from, TreeNode to) {
- List<TryFinally> blocks = <TryFinally>[];
- TreeNode node = from;
- for (;;) {
- if (node == to) {
- return blocks;
- }
- if (node == null || node is FunctionNode || node is Member) {
- if (to == null) {
- return blocks;
- } else {
- throw 'Unable to find node $to up from $from';
- }
- }
- // Inspect parent as we only need try-finally blocks enclosing [node]
- // in the body, and not in the finally-block.
- final parent = node.parent;
- if (parent is TryFinally && parent.body == node) {
- blocks.add(parent);
- }
- node = parent;
- }
- }
-
- /// Appends chained [FinallyBlock]s to each try-finally in the given
- /// list [tryFinallyBlocks] (ordered from inner to outer).
- /// [continuation] is invoked to generate control transfer code following
- /// the last finally block.
- void _addFinallyBlocks(
- List<TryFinally> tryFinallyBlocks, GenerateContinuation continuation) {
- // Add finally blocks to all try-finally from outer to inner.
- // The outermost finally block should generate continuation, each inner
- // finally block should proceed to a corresponding outer block.
- for (var tryFinally in tryFinallyBlocks.reversed) {
- final finallyBlock = new FinallyBlock(continuation);
- finallyBlocks[tryFinally].add(finallyBlock);
-
- final Label nextFinally = finallyBlock.entry;
- continuation = () {
- asm.emitJump(nextFinally);
- };
- }
-
- // Generate jump to the innermost finally (or to the original
- // continuation if there are no try-finally blocks).
- continuation();
- }
-
- /// Generates non-local transfer from inner node [from] into the outer
- /// node, executing finally blocks on the way out. [to] can be null,
- /// in such case all enclosing finally blocks are executed.
- /// [continuation] is invoked to generate control transfer code following
- /// the last finally block.
- void _generateNonLocalControlTransfer(
- TreeNode from, TreeNode to, GenerateContinuation continuation) {
- if (options.emitDebuggerStops && from.fileOffset != TreeNode.noOffset) {
- asm.emitDebugCheck(); // Before context is unwound.
- }
- List<TryFinally> tryFinallyBlocks = _getEnclosingTryFinallyBlocks(from, to);
- _addFinallyBlocks(tryFinallyBlocks, continuation);
- }
-
- // For certain expressions wrapped into ExpressionStatement we can
- // omit pushing result on the stack.
- bool isExpressionWithoutResult(Expression expr) =>
- expr.parent is ExpressionStatement &&
- (expr is VariableSet ||
- expr is PropertySet ||
- expr is StaticSet ||
- expr is SuperPropertySet);
-
- void _createArgumentsArray(int temp, List<DartType> typeArgs,
- List<Expression> args, bool storeLastArgumentToTemp) {
- final int totalCount = (typeArgs.isNotEmpty ? 1 : 0) + args.length;
-
- _genTypeArguments([const DynamicType()]);
- _genPushInt(totalCount);
- asm.emitCreateArrayTOS();
-
- asm.emitStoreLocal(temp);
-
- int index = 0;
- if (typeArgs.isNotEmpty) {
- asm.emitPush(temp);
- _genPushInt(index++);
- _genTypeArguments(typeArgs);
- asm.emitStoreIndexedTOS();
- }
-
- for (Expression arg in args) {
- asm.emitPush(temp);
- _genPushInt(index++);
- _generateNode(arg);
- if (storeLastArgumentToTemp && index == totalCount) {
- // Arguments array in 'temp' is replaced with the last argument
- // in order to return result of RHS value in case of setter.
- asm.emitStoreLocal(temp);
- }
- asm.emitStoreIndexedTOS();
- }
- }
-
- void _genNoSuchMethodForSuperCall(String name, int temp, int argDescCpIndex,
- List<DartType> typeArgs, List<Expression> args,
- {bool storeLastArgumentToTemp: false}) {
- // Receiver for noSuchMethod() call.
- _genPushReceiver();
-
- // Argument 0 for _allocateInvocationMirror(): function name.
- asm.emitPushConstant(cp.addName(name));
-
- // Argument 1 for _allocateInvocationMirror(): arguments descriptor.
- asm.emitPushConstant(argDescCpIndex);
-
- // Argument 2 for _allocateInvocationMirror(): list of arguments.
- _createArgumentsArray(temp, typeArgs, args, storeLastArgumentToTemp);
-
- // Argument 3 for _allocateInvocationMirror(): isSuperInvocation flag.
- asm.emitPushTrue();
-
- _genDirectCall(
- allocateInvocationMirror, objectTable.getArgDescHandle(4), 4);
-
- final Member target = hierarchy.getDispatchTarget(
- enclosingClass.superclass, noSuchMethodName);
- assert(target != null);
- _genDirectCall(target, objectTable.getArgDescHandle(2), 2);
- }
-
- @override
- defaultTreeNode(Node node) => throw new UnsupportedOperationError(
- 'Unsupported node ${node.runtimeType}');
-
- @override
- visitAsExpression(AsExpression node) {
- _generateNode(node.operand);
-
- final type = node.type;
- if (typeEnvironment.isTop(type)) {
- return;
- }
-
- _genAssertAssignable(type,
- message: node.isTypeError ? '' : symbolForTypeCast);
- }
-
- @override
- visitBoolLiteral(BoolLiteral node) {
- _genPushBool(node.value);
- }
-
- @override
- visitIntLiteral(IntLiteral node) {
- _genPushInt(node.value);
- }
-
- @override
- visitDoubleLiteral(DoubleLiteral node) {
- final cpIndex = cp.addObjectRef(new DoubleConstant(node.value));
- asm.emitPushConstant(cpIndex);
- }
-
- @override
- visitConditionalExpression(ConditionalExpression node) {
- final Label otherwisePart = new Label();
- final Label done = new Label();
- final int temp = locals.tempIndexInFrame(node);
-
- _genConditionAndJumpIf(node.condition, false, otherwisePart);
-
- _generateNode(node.then);
- asm.emitPopLocal(temp);
- asm.emitJump(done);
-
- asm.bind(otherwisePart);
- _generateNode(node.otherwise);
- asm.emitPopLocal(temp);
-
- asm.bind(done);
- asm.emitPush(temp);
- }
-
- @override
- visitConstructorInvocation(ConstructorInvocation node) {
- if (node.isConst) {
- _genPushConstExpr(node);
- return;
- }
-
- final constructedClass = node.constructedType.classNode;
- final classIndex = cp.addClass(constructedClass);
-
- if (hasInstantiatorTypeArguments(constructedClass)) {
- _genTypeArguments(node.arguments.types,
- instantiatingClass: constructedClass);
- asm.emitPushConstant(cp.addClass(constructedClass));
- asm.emitAllocateT();
- } else {
- assert(node.arguments.types.isEmpty);
- asm.emitAllocate(classIndex);
- }
-
- _genDupTOS(locals.tempIndexInFrame(node));
-
- // Remove type arguments as they are only passed to instance allocation,
- // and not passed to a constructor.
- final args =
- new Arguments(node.arguments.positional, named: node.arguments.named)
- ..parent = node;
- _genArguments(null, args);
- _genDirectCallWithArgs(node.target, args, hasReceiver: true, node: node);
- asm.emitDrop1();
- }
-
- @override
- visitFunctionExpression(FunctionExpression node) {
- _genClosure(node, '<anonymous closure>', node.function);
- }
-
- @override
- visitInstantiation(Instantiation node) {
- final int oldClosure = locals.tempIndexInFrame(node, tempIndex: 0);
- final int newClosure = locals.tempIndexInFrame(node, tempIndex: 1);
- final int typeArguments = locals.tempIndexInFrame(node, tempIndex: 2);
-
- _generateNode(node.expression);
- asm.emitStoreLocal(oldClosure);
-
- _genTypeArguments(node.typeArguments);
- asm.emitStoreLocal(typeArguments);
-
- _genDirectCall(
- boundsCheckForPartialInstantiation, objectTable.getArgDescHandle(2), 2);
- asm.emitDrop1();
-
- assert(closureClass.typeParameters.isEmpty);
- asm.emitAllocate(cp.addClass(closureClass));
- asm.emitStoreLocal(newClosure);
-
- asm.emitPush(typeArguments);
- asm.emitStoreFieldTOS(cp.addInstanceField(closureDelayedTypeArguments));
-
- // Copy the rest of the fields from old closure to a new closure.
- final fieldsToCopy = <Field>[
- closureInstantiatorTypeArguments,
- closureFunctionTypeArguments,
- closureFunction,
- closureContext,
- ];
-
- for (Field field in fieldsToCopy) {
- final fieldOffsetCpIndex = cp.addInstanceField(field);
- asm.emitPush(newClosure);
- asm.emitPush(oldClosure);
- asm.emitLoadFieldTOS(fieldOffsetCpIndex);
- asm.emitStoreFieldTOS(fieldOffsetCpIndex);
- }
-
- asm.emitPush(newClosure);
- }
-
- @override
- visitIsExpression(IsExpression node) {
- _generateNode(node.operand);
- _genInstanceOf(node.type);
- }
-
- @override
- visitLet(Let node) {
- _enterScope(node);
- _generateNode(node.variable);
- _generateNode(node.body);
- _leaveScope();
- }
-
- @override
- visitListLiteral(ListLiteral node) {
- if (node.isConst) {
- _genPushConstExpr(node);
- return;
- }
-
- _genTypeArguments([node.typeArgument]);
-
- if (node.expressions.isEmpty) {
- asm.emitPushConstant(
- cp.addObjectRef(new ListConstant(const DynamicType(), const [])));
- } else {
- _genDupTOS(locals.tempIndexInFrame(node));
- _genPushInt(node.expressions.length);
- asm.emitCreateArrayTOS();
- final int temp = locals.tempIndexInFrame(node);
- asm.emitStoreLocal(temp);
-
- for (int i = 0; i < node.expressions.length; i++) {
- asm.emitPush(temp);
- _genPushInt(i);
- _generateNode(node.expressions[i]);
- asm.emitStoreIndexedTOS();
- }
- }
-
- // List._fromLiteral is a factory constructor.
- // Type arguments passed to a factory constructor are counted as a normal
- // argument and not counted in number of type arguments.
- assert(listFromLiteral.isFactory);
- _genDirectCall(listFromLiteral, objectTable.getArgDescHandle(2), 2);
- }
-
- @override
- visitLogicalExpression(LogicalExpression node) {
- final Label shortCircuit = new Label();
- final Label done = new Label();
- final int temp = locals.tempIndexInFrame(node);
- final isOR = (node.operatorEnum == LogicalExpressionOperator.OR);
-
- _genConditionAndJumpIf(node.left, isOR, shortCircuit);
-
- bool negated = _genCondition(node.right);
- if (negated) {
- asm.emitBooleanNegateTOS();
- }
- asm.emitPopLocal(temp);
- asm.emitJump(done);
-
- asm.bind(shortCircuit);
- _genPushBool(isOR);
- asm.emitPopLocal(temp);
-
- asm.bind(done);
- asm.emitPush(temp);
- }
-
- @override
- visitMapLiteral(MapLiteral node) {
- if (node.isConst) {
- _genPushConstExpr(node);
- return;
- }
-
- _genTypeArguments([node.keyType, node.valueType]);
-
- if (node.entries.isEmpty) {
- asm.emitPushConstant(
- cp.addObjectRef(new ListConstant(const DynamicType(), const [])));
- } else {
- _genTypeArguments([const DynamicType()]);
- _genPushInt(node.entries.length * 2);
- asm.emitCreateArrayTOS();
-
- final int temp = locals.tempIndexInFrame(node);
- asm.emitStoreLocal(temp);
-
- for (int i = 0; i < node.entries.length; i++) {
- // key
- asm.emitPush(temp);
- _genPushInt(i * 2);
- _generateNode(node.entries[i].key);
- asm.emitStoreIndexedTOS();
- // value
- asm.emitPush(temp);
- _genPushInt(i * 2 + 1);
- _generateNode(node.entries[i].value);
- asm.emitStoreIndexedTOS();
- }
- }
-
- // Map._fromLiteral is a factory constructor.
- // Type arguments passed to a factory constructor are counted as a normal
- // argument and not counted in number of type arguments.
- assert(mapFromLiteral.isFactory);
- _genDirectCall(mapFromLiteral, objectTable.getArgDescHandle(2), 2);
- }
-
- void _genMethodInvocationUsingSpecializedBytecode(
- Opcode opcode, MethodInvocation node) {
- switch (opcode) {
- case Opcode.kEqualsNull:
- if (node.receiver is NullLiteral) {
- _generateNode(node.arguments.positional.single);
- } else {
- _generateNode(node.receiver);
- }
- break;
-
- case Opcode.kNegateInt:
- case Opcode.kNegateDouble:
- _generateNode(node.receiver);
- break;
-
- case Opcode.kAddInt:
- case Opcode.kSubInt:
- case Opcode.kMulInt:
- case Opcode.kTruncDivInt:
- case Opcode.kModInt:
- case Opcode.kBitAndInt:
- case Opcode.kBitOrInt:
- case Opcode.kBitXorInt:
- case Opcode.kShlInt:
- case Opcode.kShrInt:
- case Opcode.kCompareIntEq:
- case Opcode.kCompareIntGt:
- case Opcode.kCompareIntLt:
- case Opcode.kCompareIntGe:
- case Opcode.kCompareIntLe:
- case Opcode.kAddDouble:
- case Opcode.kSubDouble:
- case Opcode.kMulDouble:
- case Opcode.kDivDouble:
- case Opcode.kCompareDoubleEq:
- case Opcode.kCompareDoubleGt:
- case Opcode.kCompareDoubleLt:
- case Opcode.kCompareDoubleGe:
- case Opcode.kCompareDoubleLe:
- _generateNode(node.receiver);
- _generateNode(node.arguments.positional.single);
- break;
-
- default:
- throw 'Unexpected specialized bytecode $opcode';
- }
-
- asm.emitSpecializedBytecode(opcode);
- }
-
- bool _isUncheckedCall(
- Node node, Member interfaceTarget, Expression receiver) =>
- isUncheckedCall(interfaceTarget, receiver, staticTypeContext) ||
- (inferredTypeMetadata != null &&
- inferredTypeMetadata[node]?.skipCheck == true);
-
- void _genInstanceCall(
- Node node,
- InvocationKind invocationKind,
- Member interfaceTarget,
- Name targetName,
- Expression receiver,
- int totalArgCount,
- ObjectHandle argDesc) {
- final isDynamic = interfaceTarget == null;
- final isUnchecked = invocationKind != InvocationKind.getter &&
- _isUncheckedCall(node, interfaceTarget, receiver);
-
- if (inferredTypeMetadata != null && node != null) {
- _appendInferredType(node, asm.offset);
- }
-
- bool generated = false;
- if (invocationKind != InvocationKind.getter && !isDynamic && !isUnchecked) {
- final staticReceiverType = getStaticType(receiver, staticTypeContext);
- if (isInstantiatedInterfaceCall(interfaceTarget, staticReceiverType)) {
- final callCpIndex = cp.addInstantiatedInterfaceCall(
- invocationKind, interfaceTarget, argDesc, staticReceiverType);
- asm.emitInstantiatedInterfaceCall(callCpIndex, totalArgCount);
- generated = true;
- }
- }
-
- if (!generated) {
- final callCpIndex = cp.addInstanceCall(
- invocationKind, interfaceTarget, targetName, argDesc);
- if (isDynamic) {
- assert(!isUnchecked);
- asm.emitDynamicCall(callCpIndex, totalArgCount);
- } else if (isUnchecked) {
- asm.emitUncheckedInterfaceCall(callCpIndex, totalArgCount);
- } else {
- asm.emitInterfaceCall(callCpIndex, totalArgCount);
- }
- }
-
- if (inferredTypeMetadata != null && node != null) {
- _replaceWithConstantValue(node);
- }
- }
-
- @override
- visitMethodInvocation(MethodInvocation node) {
- final directCall =
- directCallMetadata != null ? directCallMetadata[node] : null;
- final Opcode opcode = recognizedMethods.specializedBytecodeFor(node);
- if (opcode != null && directCall == null) {
- _genMethodInvocationUsingSpecializedBytecode(opcode, node);
- return;
- }
- final args = node.arguments;
- final totalArgCount = args.positional.length +
- args.named.length +
- 1 /* receiver */ +
- (args.types.isNotEmpty ? 1 : 0) /* type arguments */;
- if (totalArgCount >= argumentsLimit) {
- throw new TooManyArgumentsException(node.fileOffset);
- }
- // Front-end guarantees that all calls with known function type
- // do not need any argument type checks.
- if (isUncheckedClosureCall(node, staticTypeContext, options)) {
- final int receiverTemp = locals.tempIndexInFrame(node);
- _genArguments(node.receiver, args, storeReceiverToLocal: receiverTemp);
- // Duplicate receiver (closure) for UncheckedClosureCall.
- asm.emitPush(receiverTemp);
- final argDescCpIndex = cp.addArgDescByArguments(args, hasReceiver: true);
- asm.emitUncheckedClosureCall(argDescCpIndex, totalArgCount);
- return;
- }
-
- final Member interfaceTarget = node.interfaceTarget;
- if (!(interfaceTarget == null ||
- interfaceTarget is Procedure && !interfaceTarget.isGetter)) {
- throw new UnsupportedOperationError(
- 'Unsupported MethodInvocation with interface target ${interfaceTarget.runtimeType} $interfaceTarget');
- }
-
- if (directCall != null && directCall.checkReceiverForNull) {
- final int receiverTemp = locals.tempIndexInFrame(node);
- _genArguments(node.receiver, args, storeReceiverToLocal: receiverTemp);
- asm.emitPush(receiverTemp);
- asm.emitNullCheck(cp.addSelectorName(node.name, InvocationKind.method));
- } else {
- _genArguments(node.receiver, args);
- }
-
- final argDesc =
- objectTable.getArgDescHandleByArguments(args, hasReceiver: true);
-
- if (directCall != null) {
- final isDynamicForwarder = (interfaceTarget == null);
- final isUnchecked =
- _isUncheckedCall(node, interfaceTarget, node.receiver);
- _genDirectCall(directCall.target, argDesc, totalArgCount,
- isDynamicForwarder: isDynamicForwarder,
- isUnchecked: isUnchecked,
- node: node);
- } else {
- _genInstanceCall(node, InvocationKind.method, interfaceTarget, node.name,
- node.receiver, totalArgCount, argDesc);
- }
- }
-
- @override
- visitPropertyGet(PropertyGet node) {
- _generateNode(node.receiver);
- final argDesc = objectTable.getArgDescHandle(1);
-
- final directCall =
- directCallMetadata != null ? directCallMetadata[node] : null;
- if (directCall != null) {
- if (directCall.checkReceiverForNull) {
- final int receiverTemp = locals.tempIndexInFrame(node);
- asm.emitStoreLocal(receiverTemp);
- asm.emitPush(receiverTemp);
- asm.emitNullCheck(cp.addSelectorName(node.name, InvocationKind.getter));
- }
- _genDirectCall(directCall.target, argDesc, 1, isGet: true, node: node);
- } else {
- _genInstanceCall(node, InvocationKind.getter, node.interfaceTarget,
- node.name, node.receiver, 1, argDesc);
- }
- }
-
- @override
- visitPropertySet(PropertySet node) {
- final int temp = locals.tempIndexInFrame(node);
- final bool hasResult = !isExpressionWithoutResult(node);
-
- _generateNode(node.receiver);
-
- final directCall =
- directCallMetadata != null ? directCallMetadata[node] : null;
- if (directCall != null && directCall.checkReceiverForNull) {
- asm.emitStoreLocal(temp);
- _generateNode(node.value);
- asm.emitPush(temp);
- asm.emitNullCheck(cp.addSelectorName(node.name, InvocationKind.setter));
- } else {
- _generateNode(node.value);
- }
-
- if (hasResult) {
- asm.emitStoreLocal(temp);
- }
-
- const int numArguments = 2;
- final argDesc = objectTable.getArgDescHandle(numArguments);
-
- if (directCall != null) {
- final isDynamicForwarder = (node.interfaceTarget == null);
- final isUnchecked =
- _isUncheckedCall(node, node.interfaceTarget, node.receiver);
- _genDirectCall(directCall.target, argDesc, numArguments,
- isSet: true,
- isDynamicForwarder: isDynamicForwarder,
- isUnchecked: isUnchecked,
- node: node);
- } else {
- _genInstanceCall(node, InvocationKind.setter, node.interfaceTarget,
- node.name, node.receiver, numArguments, argDesc);
- }
-
- asm.emitDrop1();
-
- if (hasResult) {
- asm.emitPush(temp);
- }
- }
-
- @override
- visitSuperMethodInvocation(SuperMethodInvocation node) {
- final args = node.arguments;
- final Member target =
- hierarchy.getDispatchTarget(enclosingClass.superclass, node.name);
- if (target == null) {
- final int temp = locals.tempIndexInFrame(node);
- _genNoSuchMethodForSuperCall(
- node.name.text,
- temp,
- cp.addArgDescByArguments(args, hasReceiver: true),
- args.types,
- <Expression>[new ThisExpression()]
- ..addAll(args.positional)
- ..addAll(args.named.map((x) => x.value)));
- return;
- }
- if (!(target is Procedure && !target.isGetter)) {
- throw new UnsupportedOperationError(
- 'Unsupported SuperMethodInvocation with target ${target.runtimeType} $target');
- }
- _genArguments(new ThisExpression(), args);
- _genDirectCallWithArgs(target, args,
- hasReceiver: true, isUnchecked: true, node: node);
- }
-
- @override
- visitSuperPropertyGet(SuperPropertyGet node) {
- final Member target =
- hierarchy.getDispatchTarget(enclosingClass.superclass, node.name);
- if (target == null) {
- final int temp = locals.tempIndexInFrame(node);
- _genNoSuchMethodForSuperCall(node.name.text, temp, cp.addArgDesc(1), [],
- <Expression>[new ThisExpression()]);
- return;
- }
- _genPushReceiver();
- _genDirectCall(target, objectTable.getArgDescHandle(1), 1,
- isGet: true, node: node);
- }
-
- @override
- visitSuperPropertySet(SuperPropertySet node) {
- final int temp = locals.tempIndexInFrame(node);
- final bool hasResult = !isExpressionWithoutResult(node);
-
- final Member target = hierarchy
- .getDispatchTarget(enclosingClass.superclass, node.name, setter: true);
- if (target == null) {
- _genNoSuchMethodForSuperCall(node.name.text, temp, cp.addArgDesc(2), [],
- <Expression>[new ThisExpression(), node.value],
- storeLastArgumentToTemp: hasResult);
- } else {
- _genPushReceiver();
- _generateNode(node.value);
-
- if (hasResult) {
- asm.emitStoreLocal(temp);
- }
-
- assert(target is Field || (target is Procedure && target.isSetter));
- _genDirectCall(target, objectTable.getArgDescHandle(2), 2,
- isSet: true, isUnchecked: true, node: node);
- }
-
- asm.emitDrop1();
-
- if (hasResult) {
- asm.emitPush(temp);
- }
- }
-
- @override
- visitNot(Not node) {
- bool negated = _genCondition(node.operand);
- if (!negated) {
- asm.emitBooleanNegateTOS();
- }
- }
-
- @override
- visitNullCheck(NullCheck node) {
- _generateNode(node.operand);
- final operandTemp = locals.tempIndexInFrame(node);
- asm.emitStoreLocal(operandTemp);
- asm.emitPush(operandTemp);
- asm.emitNullCheck(cp.addObjectRef(null));
- }
-
- @override
- visitNullLiteral(NullLiteral node) {
- asm.emitPushNull();
- }
-
- @override
- visitRethrow(Rethrow node) {
- TryCatch tryCatch;
- for (var parent = node.parent;; parent = parent.parent) {
- if (parent is Catch) {
- tryCatch = parent.parent as TryCatch;
- break;
- }
- if (parent == null || parent is FunctionNode) {
- throw 'Unable to find enclosing catch for $node';
- }
- }
- tryCatches[tryCatch].needsStackTrace = true;
-
- if (options.emitDebuggerStops) {
- asm.emitDebugCheck(); // Allow breakpoint on explicit rethrow statement.
- }
- _genRethrow(tryCatch);
- }
-
- bool _hasNonTrivialInitializer(Field field) {
- if (field.initializer == null) return false;
- return !_isTrivialInitializer(field.initializer);
- }
-
- bool _isTrivialInitializer(Expression initializer) {
- if (initializer == null) return false;
- if (initializer is StringLiteral ||
- initializer is BoolLiteral ||
- initializer is IntLiteral ||
- initializer is DoubleLiteral ||
- initializer is NullLiteral) {
- return true;
- }
- if (initializer is ConstantExpression &&
- initializer.constant is PrimitiveConstant) {
- return true;
- }
- return false;
- }
-
- @override
- visitStaticGet(StaticGet node) {
- final target = node.target;
- if (target is Field) {
- if (target.isConst) {
- _genPushConstExpr(target.initializer);
- } else if (!_needsGetter(target)) {
- if (inferredTypeMetadata != null) {
- final InferredType md = inferredTypeMetadata[node];
- if (md != null && md.constantValue != null) {
- _genPushConstant(md.constantValue);
- return;
- }
- }
- asm.emitLoadStatic(cp.addStaticField(target));
- } else {
- _genDirectCall(target, objectTable.getArgDescHandle(0), 0,
- isGet: true, node: node);
- }
- } else if (target is Procedure) {
- if (target.isGetter) {
- _genDirectCall(target, objectTable.getArgDescHandle(0), 0,
- isGet: true, node: node);
- } else if (target.isFactory || target.isRedirectingFactoryConstructor) {
- throw 'Unexpected target for StaticGet: factory $target';
- } else {
- asm.emitPushConstant(cp.addObjectRef(new TearOffConstant(target)));
- }
- } else {
- throw 'Unexpected target for StaticGet: ${target.runtimeType} $target';
- }
- }
-
- @override
- visitStaticInvocation(StaticInvocation node) {
- if (node.isConst) {
- _genPushConstExpr(node);
- return;
- }
- Arguments args = node.arguments;
- final target = node.target;
- if (target == unsafeCast) {
- // The result of the unsafeCast() intrinsic method is its sole argument,
- // without any additional checks or type casts.
- assert(args.named.isEmpty);
- _generateNode(args.positional.single);
- return;
- }
- if (!options.causalAsyncStacks &&
- target == coreTypes.asyncStackTraceHelperProcedure) {
- // Eliminate calls to _asyncStackTraceHelper as causal async stacks are
- // disabled. These calls are inserted by async transformation
- // (pkg/kernel/lib/transformations/continuation.dart), but they should be
- // consistent with _setAsyncThreadStackTrace and
- // _clearAsyncThreadStackTrace calls generated by bytecode generator.
- //
- // Push null as _asyncStackTraceHelper call should leave result
- // on the stack.
- asm.emitPushNull();
- return;
- }
- if (target.isFactory) {
- final constructedClass = target.enclosingClass;
- if (hasInstantiatorTypeArguments(constructedClass)) {
- _genTypeArguments(args.types, instantiatingClass: constructedClass);
- } else {
- assert(args.types.isEmpty);
- // VM needs type arguments for every invocation of a factory
- // constructor. TODO(alexmarkov): Clean this up.
- asm.emitPushNull();
- }
- args =
- new Arguments(node.arguments.positional, named: node.arguments.named)
- ..parent = node;
- }
- _genArguments(null, args);
- _genDirectCallWithArgs(target, args,
- isFactory: target.isFactory, node: node);
- }
-
- @override
- visitStaticSet(StaticSet node) {
- final bool hasResult = !isExpressionWithoutResult(node);
-
- _generateNode(node.value);
-
- if (hasResult) {
- _genDupTOS(locals.tempIndexInFrame(node));
- }
-
- final target = node.target;
- if (target is Field && !_needsSetter(target)) {
- if (options.emitDebuggerStops &&
- _variableSetNeedsDebugCheck(node.value)) {
- asm.emitDebugCheck();
- }
- int cpIndex = cp.addStaticField(target);
- asm.emitStoreStaticTOS(cpIndex);
- } else {
- _genDirectCall(target, objectTable.getArgDescHandle(1), 1,
- isSet: true, node: node);
- asm.emitDrop1();
- }
- }
-
- @override
- visitStringConcatenation(StringConcatenation node) {
- if (node.expressions.length == 1) {
- _generateNode(node.expressions.single);
- _genDirectCall(interpolateSingle, objectTable.getArgDescHandle(1), 1);
- } else {
- asm.emitPushNull();
- _genPushInt(node.expressions.length);
- asm.emitCreateArrayTOS();
-
- final int temp = locals.tempIndexInFrame(node);
- asm.emitStoreLocal(temp);
-
- for (int i = 0; i < node.expressions.length; i++) {
- asm.emitPush(temp);
- _genPushInt(i);
- _generateNode(node.expressions[i]);
- asm.emitStoreIndexedTOS();
- }
-
- _genDirectCall(interpolate, objectTable.getArgDescHandle(1), 1);
- }
- }
-
- @override
- visitStringLiteral(StringLiteral node) {
- final cpIndex = cp.addString(node.value);
- asm.emitPushConstant(cpIndex);
- }
-
- @override
- visitSymbolLiteral(SymbolLiteral node) {
- _genPushConstExpr(node);
- }
-
- @override
- visitThisExpression(ThisExpression node) {
- _genPushReceiver();
- }
-
- @override
- visitThrow(Throw node) {
- _generateNode(node.expression);
-
- if (options.emitDebuggerStops) {
- asm.emitDebugCheck();
- }
- asm.emitThrow(0);
- }
-
- @override
- visitTypeLiteral(TypeLiteral node) {
- final DartType type = node.type;
- final int typeCPIndex = cp.addType(type);
- if (!hasFreeTypeParameters([type])) {
- asm.emitPushConstant(typeCPIndex);
- } else {
- _genPushInstantiatorAndFunctionTypeArguments([type]);
- asm.emitInstantiateType(typeCPIndex);
- }
- }
-
- @override
- visitVariableGet(VariableGet node) {
- final v = node.variable;
- if (v.isConst) {
- _genPushConstExpr(v.initializer);
- } else if (v.isLate) {
- _genLoadVar(v);
-
- final Label done = new Label();
- asm.emitJumpIfInitialized(done);
-
- if (v.initializer != null) {
- final init = v.initializer;
- _genPushContextIfCaptured(v);
- // Late local variable initializers are transformed to wrap the
- // initializer in a closure (see late_var_init_transformer.dart). The
- // closure call needs one temporary, so withTemp lets us use this
- // VariableGet's temporary when visiting the initializer.
- assert(init is MethodInvocation &&
- init.name.text == "call" &&
- init.arguments.positional.length == 0);
- locals.withTemp(
- init, locals.tempIndexInFrame(node), () => _generateNode(init));
- _genStoreVar(v);
- } else {
- asm.emitPushConstant(cp.addName(v.name));
- _genDirectCall(throwNewLateInitializationError,
- objectTable.getArgDescHandle(1), 1);
- asm.emitDrop1();
- }
-
- asm.bind(done);
- _genLoadVar(v);
- } else {
- _genLoadVar(v);
- }
- }
-
- @override
- visitVariableSet(VariableSet node) {
- final v = node.variable;
- final bool hasResult = !isExpressionWithoutResult(node);
- final bool isLateFinal = v.isLate && v.isFinal;
-
- if (!isLateFinal) {
- _genPushContextIfCaptured(v);
- }
-
- _generateNode(node.value);
-
- if (options.emitDebuggerStops && _variableSetNeedsDebugCheck(node.value)) {
- asm.emitDebugCheck();
- }
-
- if (isLateFinal) {
- final int temp = locals.tempIndexInFrame(node);
- asm.emitPopLocal(temp);
-
- final Label error = new Label();
- final Label done = new Label();
- _genLoadVar(v);
- asm.emitJumpIfInitialized(error);
-
- _genPushContextIfCaptured(v);
- asm.emitPush(temp);
- _genStoreVar(v);
- asm.emitJump(done);
-
- asm.bind(error);
- asm.emitPushConstant(cp.addName(v.name));
- _genDirectCall(
- throwNewLateInitializationError, objectTable.getArgDescHandle(1), 1);
- asm.emitDrop1();
-
- asm.bind(done);
-
- if (hasResult) {
- asm.emitPush(temp);
- }
- } else if (locals.isCaptured(v)) {
- final int temp = locals.tempIndexInFrame(node);
- if (hasResult) {
- asm.emitStoreLocal(temp);
- }
-
- _genStoreVar(v);
-
- if (hasResult) {
- asm.emitPush(temp);
- }
- } else {
- final int localIndex = locals.getVarIndexInFrame(v);
- if (hasResult) {
- asm.emitStoreLocal(localIndex);
- } else {
- asm.emitPopLocal(localIndex);
- }
- }
- }
-
- bool _variableSetNeedsDebugCheck(Expression rhs) =>
- rhs is BasicLiteral ||
- rhs is ConstantExpression ||
- rhs is StaticGet ||
- rhs is FunctionExpression ||
- rhs is VariableGet ||
- rhs is AsExpression;
-
- void _genFutureNull() {
- asm.emitPushNull();
- _genDirectCall(futureValue, objectTable.getArgDescHandle(1), 1);
- }
-
- @override
- visitLoadLibrary(LoadLibrary node) {
- _genFutureNull();
- }
-
- @override
- visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) {
- _genFutureNull();
- }
-
- @override
- visitAssertStatement(AssertStatement node) {
- if (!options.enableAsserts) {
- return;
- }
-
- final Label done = new Label();
- asm.emitJumpIfNoAsserts(done);
-
- _genConditionAndJumpIf(node.condition, true, done);
-
- _genPushInt(
- options.omitAssertSourcePositions ? 0 : node.conditionStartOffset);
- _genPushInt(
- options.omitAssertSourcePositions ? 0 : node.conditionEndOffset);
-
- if (node.message != null) {
- _generateNode(node.message);
- } else {
- asm.emitPushNull();
- }
-
- _genDirectCall(throwNewAssertionError, objectTable.getArgDescHandle(3), 3);
- asm.emitDrop1();
-
- asm.bind(done);
- }
-
- @override
- visitBlock(Block node) {
- _enterScope(node);
- _generateNodeList(node.statements);
- _leaveScope();
- }
-
- @override
- visitAssertBlock(AssertBlock node) {
- if (!options.enableAsserts) {
- return;
- }
-
- final Label done = new Label();
- asm.emitJumpIfNoAsserts(done);
-
- _enterScope(node);
- _generateNodeList(node.statements);
- _leaveScope();
-
- asm.bind(done);
- }
-
- @override
- visitBlockExpression(BlockExpression node) {
- _enterScope(node);
- _generateNodeList(node.body.statements);
- _generateNode(node.value);
- _leaveScope();
- }
-
- @override
- visitBreakStatement(BreakStatement node) {
- final targetLabel = labeledStatements[node.target] ??
- (throw 'Target label ${node.target} was not registered for break $node');
- final targetContextLevel = contextLevels[node.target];
-
- _generateNonLocalControlTransfer(node, node.target, () {
- _genUnwindContext(targetContextLevel);
- asm.emitJump(targetLabel);
- });
- }
-
- @override
- visitContinueSwitchStatement(ContinueSwitchStatement node) {
- final targetLabel = switchCases[node.target] ??
- (throw 'Target label ${node.target} was not registered for continue-switch $node');
- final targetContextLevel = contextLevels[node.target.parent];
-
- _generateNonLocalControlTransfer(node, node.target.parent, () {
- _genUnwindContext(targetContextLevel);
- asm.emitJump(targetLabel);
- });
- }
-
- @override
- visitDoStatement(DoStatement node) {
- if (asm.isUnreachable) {
- // Bail out before binding a label which allows backward jumps,
- // as it is not handled by local unreachable code elimination.
- return;
- }
-
- final Label join = new Label(allowsBackwardJumps: true);
- asm.bind(join);
-
- asm.emitCheckStack(++currentLoopDepth);
-
- _generateNode(node.body);
-
- _genConditionAndJumpIf(node.condition, true, join);
-
- --currentLoopDepth;
- }
-
- @override
- visitEmptyStatement(EmptyStatement node) {
- // no-op
- }
-
- @override
- visitExpressionStatement(ExpressionStatement node) {
- final expr = node.expression;
- _generateNode(expr);
- if (!isExpressionWithoutResult(expr)) {
- asm.emitDrop1();
- }
- }
-
- @override
- visitForInStatement(ForInStatement node) {
- // Should be lowered by the async transformation.
- throw "unreachable";
- }
-
- @override
- visitForStatement(ForStatement node) {
- _enterScope(node);
- try {
- _generateNodeList(node.variables);
-
- if (asm.isUnreachable) {
- // Bail out before binding a label which allows backward jumps,
- // as it is not handled by local unreachable code elimination.
- return;
- }
-
- final Label done = new Label();
- final Label join = new Label(allowsBackwardJumps: true);
- asm.bind(join);
-
- asm.emitCheckStack(++currentLoopDepth);
-
- if (node.condition != null) {
- _genConditionAndJumpIf(node.condition, false, done);
- }
-
- _generateNode(node.body);
-
- if (locals.currentContextSize > 0) {
- asm.emitPush(locals.contextVarIndexInFrame);
- asm.emitCloneContext(
- locals.currentContextId, locals.currentContextSize);
- asm.emitPopLocal(locals.contextVarIndexInFrame);
- }
-
- for (var update in node.updates) {
- _generateNode(update);
- asm.emitDrop1();
- }
-
- asm.emitJump(join);
-
- asm.bind(done);
- --currentLoopDepth;
- } finally {
- _leaveScope();
- }
- }
-
- @override
- visitFunctionDeclaration(ast.FunctionDeclaration node) {
- if (options.emitDebuggerStops) {
- asm.emitDebugCheck();
- }
- _genPushContextIfCaptured(node.variable);
- _genClosure(node, node.variable.name, node.function);
- _genStoreVar(node.variable);
- }
-
- @override
- visitIfStatement(IfStatement node) {
- final Label otherwisePart = new Label();
-
- _genConditionAndJumpIf(node.condition, false, otherwisePart);
-
- _generateNode(node.then);
-
- if (node.otherwise != null) {
- final Label done = new Label();
- asm.emitJump(done);
- asm.bind(otherwisePart);
- _generateNode(node.otherwise);
- asm.bind(done);
- } else {
- asm.bind(otherwisePart);
- }
- }
-
- @override
- visitLabeledStatement(LabeledStatement node) {
- final label = new Label();
- labeledStatements ??= new Map<LabeledStatement, Label>();
- labeledStatements[node] = label;
- contextLevels ??= new Map<TreeNode, int>();
- contextLevels[node] = locals.currentContextLevel;
- _generateNode(node.body);
- asm.bind(label);
- labeledStatements.remove(node);
- contextLevels.remove(node);
- }
-
- @override
- visitReturnStatement(ReturnStatement node) {
- final expr = node.expression ?? new NullLiteral();
-
- final List<TryFinally> tryFinallyBlocks =
- _getEnclosingTryFinallyBlocks(node, null);
- if (tryFinallyBlocks.isEmpty) {
- _generateNode(expr);
- _genReturnTOS();
- } else {
- if (options.emitDebuggerStops) {
- // Stop on the return statement before executing finally blocks.
- asm.emitDebugCheck();
- }
- if (expr is BasicLiteral) {
- _addFinallyBlocks(tryFinallyBlocks, () {
- _generateNode(expr);
- _genReturnTOS();
- });
- } else {
- // Keep return value in a variable as try-catch statements
- // inside finally can zap expression stack.
- _generateNode(node.expression);
- asm.emitPopLocal(locals.returnVarIndexInFrame);
-
- _addFinallyBlocks(tryFinallyBlocks, () {
- asm.emitPush(locals.returnVarIndexInFrame);
- _genReturnTOS();
- });
- }
- }
- }
-
- @override
- visitSwitchStatement(SwitchStatement node) {
- contextLevels ??= new Map<TreeNode, int>();
- contextLevels[node] = locals.currentContextLevel;
-
- _generateNode(node.expression);
-
- if (asm.isUnreachable) {
- // Bail out before binding labels which allow backward jumps,
- // as they are not handled by local unreachable code elimination.
- return;
- }
-
- final int temp = locals.tempIndexInFrame(node);
- asm.emitPopLocal(temp);
-
- final Label done = new Label();
- final List<Label> caseLabels = new List<Label>.generate(
- node.cases.length, (_) => new Label(allowsBackwardJumps: true));
- final equalsArgDesc = objectTable.getArgDescHandle(2);
-
- switchCases ??= new Map<SwitchCase, Label>();
-
- Label defaultLabel = done;
- for (int i = 0; i < node.cases.length; i++) {
- final SwitchCase switchCase = node.cases[i];
- final Label caseLabel = caseLabels[i];
- switchCases[switchCase] = caseLabel;
-
- if (switchCase.isDefault) {
- defaultLabel = caseLabel;
- } else {
- final savedSourcePosition = asm.currentSourcePosition;
- for (int i = 0; i < switchCase.expressions.length; ++i) {
- _recordSourcePosition(switchCase.expressionOffsets[i]);
- _genPushConstExpr(switchCase.expressions[i]);
- asm.emitPush(temp);
- asm.emitInterfaceCall(
- cp.addInterfaceCall(
- InvocationKind.method, coreTypes.objectEquals, equalsArgDesc),
- 2);
- asm.emitJumpIfTrue(caseLabel);
- }
- asm.currentSourcePosition = savedSourcePosition;
- }
- }
-
- asm.emitJump(defaultLabel);
-
- for (int i = 0; i < node.cases.length; i++) {
- final SwitchCase switchCase = node.cases[i];
- final Label caseLabel = caseLabels[i];
-
- asm.bind(caseLabel);
- _generateNode(switchCase.body);
-
- // Front-end issues a compile-time error if there is a fallthrough
- // between cases. Also, default case should be the last one.
- }
-
- asm.bind(done);
- node.cases.forEach(switchCases.remove);
- contextLevels.remove(node);
- }
-
- bool _isTryBlock(TreeNode node) => node is TryCatch || node is TryFinally;
-
- int _savedContextVar(TreeNode node) {
- assert(_isTryBlock(node));
- assert(locals.capturedSavedContextVar(node) == null);
- return locals.tempIndexInFrame(node, tempIndex: 0);
- }
-
- // Exception var occupies the same slot as saved context, so context
- // should be restored first, before loading exception.
- int _exceptionVar(TreeNode node) {
- assert(_isTryBlock(node));
- return locals.tempIndexInFrame(node, tempIndex: 0);
- }
-
- int _stackTraceVar(TreeNode node) {
- assert(_isTryBlock(node));
- return locals.tempIndexInFrame(node, tempIndex: 1);
- }
-
- _saveContextForTryBlock(TreeNode node) {
- if (!locals.hasContextVar) {
- return;
- }
- final capturedSavedContextVar = locals.capturedSavedContextVar(node);
- if (capturedSavedContextVar != null) {
- assert(locals.isSyncYieldingFrame);
- _genPushContextForVariable(capturedSavedContextVar);
- asm.emitPush(locals.contextVarIndexInFrame);
- _genStoreVar(capturedSavedContextVar);
- } else {
- asm.emitPush(locals.contextVarIndexInFrame);
- asm.emitPopLocal(_savedContextVar(node));
- }
- }
-
- _restoreContextForTryBlock(TreeNode node) {
- if (!locals.hasContextVar) {
- return;
- }
- final capturedSavedContextVar = locals.capturedSavedContextVar(node);
- if (capturedSavedContextVar != null) {
- // 1. Restore context from closure var.
- // This context has a context level at frame entry.
- asm.emitPush(locals.closureVarIndexInFrame);
- asm.emitLoadFieldTOS(cp.addInstanceField(closureContext));
- asm.emitPopLocal(locals.contextVarIndexInFrame);
-
- // 2. Restore context from captured :saved_try_context_var${depth}.
- assert(locals.isCaptured(capturedSavedContextVar));
- _genLoadVar(capturedSavedContextVar,
- currentContextLevel: locals.contextLevelAtEntry);
- } else {
- asm.emitPush(_savedContextVar(node));
- }
- asm.emitPopLocal(locals.contextVarIndexInFrame);
- }
-
- /// Start try block
- TryBlock _startTryBlock(TreeNode node) {
- assert(_isTryBlock(node));
-
- _saveContextForTryBlock(node);
-
- return asm.exceptionsTable.enterTryBlock(asm.offset);
- }
-
- /// End try block and start its handler.
- void _endTryBlock(TreeNode node, TryBlock tryBlock) {
- tryBlock.endPC = asm.offset;
- tryBlock.handlerPC = asm.offset;
-
- // Exception handlers are reachable although there are no labels or jumps.
- asm.isUnreachable = false;
-
- asm.emitSetFrame(locals.frameSize);
-
- _restoreContextForTryBlock(node);
-
- asm.emitMoveSpecial(SpecialIndex.exception, _exceptionVar(node));
- asm.emitMoveSpecial(SpecialIndex.stackTrace, _stackTraceVar(node));
-
- final capturedExceptionVar = locals.capturedExceptionVar(node);
- if (capturedExceptionVar != null) {
- _genPushContextForVariable(capturedExceptionVar);
- asm.emitPush(_exceptionVar(node));
- _genStoreVar(capturedExceptionVar);
- }
-
- final capturedStackTraceVar = locals.capturedStackTraceVar(node);
- if (capturedStackTraceVar != null) {
- _genPushContextForVariable(capturedStackTraceVar);
- asm.emitPush(_stackTraceVar(node));
- _genStoreVar(capturedStackTraceVar);
- }
- }
-
- void _genRethrow(TreeNode node) {
- final capturedExceptionVar = locals.capturedExceptionVar(node);
- if (capturedExceptionVar != null) {
- assert(locals.isCaptured(capturedExceptionVar));
- _genLoadVar(capturedExceptionVar);
- } else {
- asm.emitPush(_exceptionVar(node));
- }
-
- final capturedStackTraceVar = locals.capturedStackTraceVar(node);
- if (capturedStackTraceVar != null) {
- assert(locals.isCaptured(capturedStackTraceVar));
- _genLoadVar(capturedStackTraceVar);
- } else {
- asm.emitPush(_stackTraceVar(node));
- }
-
- asm.emitThrow(1);
- }
-
- @override
- visitTryCatch(TryCatch node) {
- if (asm.isUnreachable) {
- return;
- }
-
- final Label done = new Label();
-
- final TryBlock tryBlock = _startTryBlock(node);
- tryBlock.isSynthetic = node.isSynthetic;
- tryCatches ??= new Map<TryCatch, TryBlock>();
- tryCatches[node] = tryBlock; // Used by rethrow.
-
- _generateNode(node.body);
- asm.emitJump(done);
-
- _endTryBlock(node, tryBlock);
-
- final int exception = _exceptionVar(node);
- final int stackTrace = _stackTraceVar(node);
-
- bool hasCatchAll = false;
-
- final savedSourcePosition = asm.currentSourcePosition;
- for (Catch catchClause in node.catches) {
- _recordSourcePosition(catchClause.fileOffset);
- tryBlock.types.add(cp.addType(catchClause.guard));
-
- Label skipCatch;
- final guardType = catchClause.guard;
- // Exception objects are guaranteed to be non-nullable, so
- // non-nullable Object is also a catch-all type.
- if (guardType is DynamicType ||
- (guardType is InterfaceType &&
- guardType.classNode == coreTypes.objectClass)) {
- hasCatchAll = true;
- } else {
- asm.emitPush(exception);
- _genInstanceOf(catchClause.guard);
-
- skipCatch = new Label();
- asm.emitJumpIfFalse(skipCatch);
- }
-
- _enterScope(catchClause);
-
- if (catchClause.exception != null) {
- _genPushContextIfCaptured(catchClause.exception);
- asm.emitPush(exception);
- _genStoreVar(catchClause.exception);
- }
-
- if (catchClause.stackTrace != null) {
- tryBlock.needsStackTrace = true;
- _genPushContextIfCaptured(catchClause.stackTrace);
- asm.emitPush(stackTrace);
- _genStoreVar(catchClause.stackTrace);
- }
-
- _generateNode(catchClause.body);
-
- _leaveScope();
- asm.emitJump(done);
-
- if (skipCatch != null) {
- asm.bind(skipCatch);
- }
- }
- asm.currentSourcePosition = savedSourcePosition;
-
- if (!hasCatchAll) {
- tryBlock.needsStackTrace = true;
- _genRethrow(node);
- }
-
- asm.bind(done);
- tryCatches.remove(node);
- }
-
- @override
- visitTryFinally(TryFinally node) {
- if (asm.isUnreachable) {
- return;
- }
-
- final TryBlock tryBlock = _startTryBlock(node);
- tryBlock.isSynthetic = true;
- finallyBlocks ??= new Map<TryFinally, List<FinallyBlock>>();
- finallyBlocks[node] = <FinallyBlock>[];
-
- _generateNode(node.body);
-
- if (!asm.isUnreachable) {
- final normalContinuation = new FinallyBlock(() {
- /* do nothing (fall through) */
- });
- finallyBlocks[node].add(normalContinuation);
- asm.emitJump(normalContinuation.entry);
- }
-
- _endTryBlock(node, tryBlock);
-
- tryBlock.types.add(cp.addType(const DynamicType()));
-
- _generateNode(node.finalizer);
-
- tryBlock.needsStackTrace = true; // For rethrowing.
- _genRethrow(node);
-
- for (var finallyBlock in finallyBlocks[node]) {
- asm.bind(finallyBlock.entry);
- _restoreContextForTryBlock(node);
- _generateNode(node.finalizer);
- finallyBlock.generateContinuation();
- }
-
- finallyBlocks.remove(node);
- }
-
- bool _skipVariableInitialization(VariableDeclaration v, bool isCaptured) {
- // We can skip variable initialization if the variable is supposed to be
- // initialized to null and it's captured. This is because all the slots in
- // the capture context are implicitly initialized to null.
-
- // Check if the variable is supposed to be initialized to null.
- if (!(v.initializer == null || v.initializer is NullLiteral)) {
- return false;
- }
-
- // Late variables need to be initialized to a sentinel, not null.
- if (v.isLate) return false;
-
- // Non-captured variables go in stack slots that aren't implicitly nulled.
- return isCaptured;
- }
-
- @override
- visitVariableDeclaration(VariableDeclaration node) {
- if (!node.isConst) {
- final bool isCaptured = locals.isCaptured(node);
- final initializer = node.initializer;
- final bool emitStore = !_skipVariableInitialization(node, isCaptured);
- int maxInitializerPosition = node.fileOffset;
- if (emitStore) {
- if (isCaptured) {
- _genPushContextForVariable(node);
- }
- if (node.isLate && !_isTrivialInitializer(initializer)) {
- asm.emitPushUninitializedSentinel();
- } else if (initializer != null) {
- _startRecordingMaxPosition(node.fileOffset);
- _generateNode(initializer);
- maxInitializerPosition = _endRecordingMaxPosition();
- } else {
- asm.emitPushNull();
- }
- }
-
- if (options.emitDebuggerStops &&
- (initializer == null || _variableSetNeedsDebugCheck(initializer))) {
- final savedSourcePosition = asm.currentSourcePosition;
- if (node.fileEqualsOffset != TreeNode.noOffset) {
- _recordSourcePosition(node.fileEqualsOffset);
- }
- asm.emitDebugCheck();
- asm.currentSourcePosition = savedSourcePosition;
- }
-
- if (options.emitLocalVarInfo && !asm.isUnreachable && node.name != null) {
- _declareLocalVariable(node, maxInitializerPosition + 1);
- }
-
- if (emitStore) {
- _genStoreVar(node);
- }
- }
- }
-
- @override
- visitWhileStatement(WhileStatement node) {
- if (asm.isUnreachable) {
- // Bail out before binding a label which allows backward jumps,
- // as it is not handled by local unreachable code elimination.
- return;
- }
-
- final Label done = new Label();
- final Label join = new Label(allowsBackwardJumps: true);
- asm.bind(join);
-
- asm.emitCheckStack(++currentLoopDepth);
-
- _genConditionAndJumpIf(node.condition, false, done);
-
- _generateNode(node.body);
-
- asm.emitJump(join);
- --currentLoopDepth;
-
- asm.bind(done);
- }
-
- @override
- visitYieldStatement(YieldStatement node) {
- if (!node.isNative) {
- throw 'YieldStatement must be desugared: $node';
- }
-
- if (asm.isUnreachable) {
- return;
- }
-
- // 0 is reserved for normal entry, yield points are counted from 1.
- final int yieldIndex = yieldPoints.length + 1;
- final Label continuationLabel = new Label(allowsBackwardJumps: true);
- yieldPoints.add(continuationLabel);
-
- // :await_jump_var = #index
- assert(locals.isCaptured(locals.awaitJumpVar));
- _genPushContextForVariable(locals.awaitJumpVar);
- _genPushInt(yieldIndex);
- _genStoreVar(locals.awaitJumpVar);
-
- // :await_ctx_var = context
- assert(locals.isCaptured(locals.awaitContextVar));
- _genPushContextForVariable(locals.awaitContextVar);
- asm.emitPush(locals.contextVarIndexInFrame);
- _genStoreVar(locals.awaitContextVar);
-
- // return <expression>
- // Note: finally blocks are *not* executed on the way out.
- _generateNode(node.expression);
- _genReturnTOS(node.fileOffset);
-
- asm.bind(continuationLabel);
-
- if (parentFunction.dartAsyncMarker == AsyncMarker.Async ||
- parentFunction.dartAsyncMarker == AsyncMarker.AsyncStar) {
- final int exceptionParam = locals.asyncExceptionParamIndexInFrame;
- final int stackTraceParam = locals.asyncStackTraceParamIndexInFrame;
-
- // if (:exception != null) rethrow (:exception, :stack_trace)
- final Label cont = new Label();
- asm.emitPush(exceptionParam);
- asm.emitJumpIfNull(cont);
-
- asm.emitPush(exceptionParam);
- asm.emitPush(stackTraceParam);
- asm.emitThrow(1);
-
- asm.bind(cont);
- }
- }
-
- @override
- visitFieldInitializer(FieldInitializer node) {
- _genFieldInitializer(node.field, node.value);
- }
-
- @override
- visitRedirectingInitializer(RedirectingInitializer node) {
- final args = node.arguments;
- assert(args.types.isEmpty);
- _genArguments(new ThisExpression(), args);
- _genDirectCallWithArgs(node.target, args, hasReceiver: true, node: node);
- asm.emitDrop1();
- }
-
- @override
- visitSuperInitializer(SuperInitializer node) {
- final args = node.arguments;
- assert(args.types.isEmpty);
- _genArguments(new ThisExpression(), args);
- // Re-resolve target due to partial mixin resolution.
- Member target;
- for (var replacement in enclosingClass.superclass.constructors) {
- if (node.target.name == replacement.name) {
- target = replacement;
- break;
- }
- }
- assert(target != null);
- _genDirectCallWithArgs(target, args, hasReceiver: true, node: node);
- asm.emitDrop1();
- }
-
- @override
- visitLocalInitializer(LocalInitializer node) {
- _generateNode(node.variable);
- }
-
- @override
- visitAssertInitializer(AssertInitializer node) {
- _generateNode(node.statement);
- }
-
- @override
- visitConstantExpression(ConstantExpression node) {
- _genPushConstant(node.constant);
- }
-}
-
-class UnsupportedOperationError {
- final String message;
- UnsupportedOperationError(this.message);
-
- @override
- String toString() => message;
-}
-
-class TooManyArgumentsException extends BytecodeLimitExceededException {
- final int fileOffset;
- TooManyArgumentsException(this.fileOffset);
-}
-
-typedef void GenerateContinuation();
-
-class FinallyBlock {
- final Label entry = new Label();
- final GenerateContinuation generateContinuation;
-
- FinallyBlock(this.generateContinuation);
-}
-
-class Annotations {
- final AnnotationsDeclaration object;
- final bool hasPragma;
-
- const Annotations(this.object, this.hasPragma);
-}
-
-ast.Component createFreshComponentWithBytecode(ast.Component component) {
- final newComponent = new ast.Component();
- newComponent.setMainMethodAndMode(null, false, component.mode);
- final newRepository = new BytecodeMetadataRepository();
- newComponent.addMetadataRepository(newRepository);
-
- final oldRepository = component.metadata.remove(newRepository.tag);
- final metadata = oldRepository.mapping[component];
- newRepository.mapping[newComponent] = metadata;
-
- return newComponent;
-}
diff --git a/pkg/vm/lib/bytecode/generics.dart b/pkg/vm/lib/bytecode/generics.dart
deleted file mode 100644
index 6fc5829..0000000
--- a/pkg/vm/lib/bytecode/generics.dart
+++ /dev/null
@@ -1,311 +0,0 @@
-// Copyright (c) 2019, 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 vm.bytecode.generics;
-
-import 'dart:math' show min;
-
-import 'package:kernel/ast.dart' hide MapEntry;
-import 'package:kernel/core_types.dart' show CoreTypes;
-import 'package:kernel/type_algebra.dart' show Substitution;
-import 'package:kernel/type_environment.dart' show StaticTypeContext;
-
-import 'options.dart' show BytecodeOptions;
-
-bool hasInstantiatorTypeArguments(Class c) {
- for (; c != null; c = c.superclass) {
- if (c.typeParameters.isNotEmpty) {
- return true;
- }
- }
- return false;
-}
-
-List<DartType> getTypeParameterTypes(List<TypeParameter> typeParameters) {
- if (typeParameters.isEmpty) {
- return const <DartType>[];
- }
- final types = new List<DartType>(typeParameters.length);
- for (int i = 0; i < typeParameters.length; ++i) {
- final tp = typeParameters[i];
- types[i] = new TypeParameterType(
- tp, TypeParameterType.computeNullabilityFromBound(tp));
- }
- return types;
-}
-
-bool _canReuseSuperclassTypeArguments(List<DartType> superTypeArgs,
- List<TypeParameter> typeParameters, int overlap) {
- for (int i = 0; i < overlap; ++i) {
- final superTypeArg = superTypeArgs[superTypeArgs.length - overlap + i];
- final typeParam = typeParameters[i];
- if (!(superTypeArg is TypeParameterType &&
- superTypeArg.parameter == typeParameters[i] &&
- superTypeArg.nullability ==
- TypeParameterType.computeNullabilityFromBound(typeParam))) {
- return false;
- }
- }
- return true;
-}
-
-List<DartType> flattenInstantiatorTypeArguments(
- Class instantiatedClass, List<DartType> typeArgs) {
- final typeParameters = instantiatedClass.typeParameters;
- assert(typeArgs.length == typeParameters.length);
-
- final supertype = instantiatedClass.supertype;
- if (supertype == null) {
- return typeArgs;
- }
-
- final superTypeArgs = flattenInstantiatorTypeArguments(
- supertype.classNode, supertype.typeArguments);
-
- // Shrink type arguments by reusing portion of superclass type arguments
- // if there is an overlapping. This optimization should be consistent with
- // VM in order to correctly reuse instantiator type arguments.
- int overlap = min(superTypeArgs.length, typeArgs.length);
- for (; overlap > 0; --overlap) {
- if (_canReuseSuperclassTypeArguments(
- superTypeArgs, typeParameters, overlap)) {
- break;
- }
- }
-
- assert(typeParameters.length == typeArgs.length);
-
- final substitution = Substitution.fromPairs(typeParameters, typeArgs);
-
- List<DartType> flatTypeArgs = <DartType>[];
- for (var type in superTypeArgs) {
- flatTypeArgs.add(substitution.substituteType(type));
- }
- flatTypeArgs.addAll(typeArgs.getRange(overlap, typeArgs.length));
-
- return flatTypeArgs;
-}
-
-List<DartType> getInstantiatorTypeArguments(
- Class instantiatedClass, List<DartType> typeArgs) {
- final flatTypeArgs =
- flattenInstantiatorTypeArguments(instantiatedClass, typeArgs);
- if (isAllDynamic(flatTypeArgs)) {
- return null;
- }
- return flatTypeArgs;
-}
-
-List<DartType> getDefaultFunctionTypeArguments(FunctionNode function) {
- final typeParameters = function.typeParameters;
- if (typeParameters.isEmpty) {
- return null;
- }
- bool dynamicOnly = true;
- for (var tp in typeParameters) {
- if (tp.defaultType != null && tp.defaultType != const DynamicType()) {
- dynamicOnly = false;
- break;
- }
- }
- if (dynamicOnly) {
- return null;
- }
- List<DartType> defaultTypes = <DartType>[];
- for (var tp in typeParameters) {
- defaultTypes.add(tp.defaultType ?? const DynamicType());
- }
- return defaultTypes;
-}
-
-bool isAllDynamic(List<DartType> typeArgs) {
- for (var t in typeArgs) {
- if (t != const DynamicType()) {
- return false;
- }
- }
- return true;
-}
-
-bool isInstantiatedGenericType(DartType type) =>
- (type is InterfaceType) &&
- type.typeArguments.isNotEmpty &&
- !hasFreeTypeParameters(type.typeArguments);
-
-bool hasFreeTypeParameters(List<DartType> typeArgs) {
- final findTypeParams = new FindFreeTypeParametersVisitor();
- return typeArgs.any((t) => t.accept(findTypeParams));
-}
-
-class FindFreeTypeParametersVisitor extends DartTypeVisitor<bool> {
- Set<TypeParameter> _declaredTypeParameters;
-
- bool visit(DartType type) => type.accept(this);
-
- @override
- bool defaultDartType(DartType node) =>
- throw 'Unexpected type ${node.runtimeType} $node';
-
- @override
- bool visitInvalidType(InvalidType node) => false;
-
- @override
- bool visitDynamicType(DynamicType node) => false;
-
- @override
- bool visitVoidType(VoidType node) => false;
-
- @override
- bool visitBottomType(BottomType node) => false;
-
- @override
- bool visitNeverType(NeverType node) => false;
-
- @override
- bool visitTypeParameterType(TypeParameterType node) =>
- _declaredTypeParameters == null ||
- !_declaredTypeParameters.contains(node.parameter);
-
- @override
- bool visitInterfaceType(InterfaceType node) =>
- node.typeArguments.any((t) => t.accept(this));
-
- @override
- bool visitFutureOrType(FutureOrType node) => node.typeArgument.accept(this);
-
- @override
- bool visitTypedefType(TypedefType node) =>
- node.typeArguments.any((t) => t.accept(this));
-
- @override
- bool visitFunctionType(FunctionType node) {
- if (node.typeParameters.isNotEmpty) {
- _declaredTypeParameters ??= new Set<TypeParameter>();
- _declaredTypeParameters.addAll(node.typeParameters);
- }
-
- final bool result = node.positionalParameters.any((t) => t.accept(this)) ||
- node.namedParameters.any((p) => p.type.accept(this)) ||
- node.returnType.accept(this);
-
- if (node.typeParameters.isNotEmpty) {
- _declaredTypeParameters.removeAll(node.typeParameters);
- }
-
- return result;
- }
-}
-
-/// Returns static type of [expr].
-DartType getStaticType(Expression expr, StaticTypeContext staticTypeContext) =>
- expr.getStaticType(staticTypeContext);
-
-/// Returns `true` if [type] cannot be extended in user code.
-bool isSealedType(DartType type, CoreTypes coreTypes) {
- if (type is InterfaceType) {
- final cls = type.classNode;
- return cls == coreTypes.intClass ||
- cls == coreTypes.doubleClass ||
- cls == coreTypes.boolClass ||
- cls == coreTypes.stringClass ||
- cls == coreTypes.nullClass;
- }
- return false;
-}
-
-/// Returns true if an instance call to [interfaceTarget] with given
-/// [receiver] can omit argument type checks needed due to generic-covariant
-/// parameters.
-bool isUncheckedCall(Member interfaceTarget, Expression receiver,
- StaticTypeContext staticTypeContext) {
- if (interfaceTarget == null) {
- // Dynamic call cannot be unchecked.
- return false;
- }
-
- if (!_hasGenericCovariantParameters(interfaceTarget)) {
- // Unchecked call makes sense only if there are generic-covariant parameters.
- return false;
- }
-
- // Calls via [this] do not require checks.
- if (receiver is ThisExpression) {
- return true;
- }
-
- DartType receiverStaticType = getStaticType(receiver, staticTypeContext);
- if (receiverStaticType is InterfaceType) {
- final typeArguments = receiverStaticType.typeArguments;
- if (typeArguments.isEmpty) {
- return true;
- }
-
- final typeParameters = receiverStaticType.classNode.typeParameters;
- assert(typeArguments.length == typeParameters.length);
- for (int i = 0; i < typeArguments.length; ++i) {
- switch (typeParameters[i].variance) {
- case Variance.covariant:
- if (!isSealedType(
- typeArguments[i], staticTypeContext.typeEnvironment.coreTypes)) {
- return false;
- }
- break;
- case Variance.invariant:
- break;
- case Variance.contravariant:
- return false;
- default:
- throw 'Unexpected variance ${typeParameters[i].variance} of '
- '${typeParameters[i]} in ${receiverStaticType.classNode}';
- }
- }
- return true;
- }
- return false;
-}
-
-/// If receiver type at run time matches static type we can omit argument type
-/// checks. This condition can be efficiently tested if static receiver type is
-/// fully instantiated (e.g. doesn't have type parameters).
-/// [isInstantiatedInterfaceCall] tests if an instance call to
-/// [interfaceTarget] with given [staticReceiverType] may benefit from
-/// this optimization.
-bool isInstantiatedInterfaceCall(
- Member interfaceTarget, DartType staticReceiverType) {
- // Providing instantiated receiver type wouldn't help in case of a
- // dynamic call or call without any parameter type checks.
- if (interfaceTarget == null ||
- !_hasGenericCovariantParameters(interfaceTarget)) {
- return false;
- }
- return isInstantiatedGenericType(staticReceiverType);
-}
-
-bool _hasGenericCovariantParameters(Member target) {
- if (target is Field) {
- return target.isGenericCovariantImpl;
- } else if (target is Procedure) {
- for (var param in target.function.positionalParameters) {
- if (param.isGenericCovariantImpl) {
- return true;
- }
- }
- for (var param in target.function.namedParameters) {
- if (param.isGenericCovariantImpl) {
- return true;
- }
- }
- return false;
- } else {
- throw 'Unexpected instance call target ${target.runtimeType} $target';
- }
-}
-
-/// Returns true if invocation [node] is a closure call with statically known
-/// function type. Such invocations can omit argument type checks.
-bool isUncheckedClosureCall(MethodInvocation node,
- StaticTypeContext staticTypeContext, BytecodeOptions options) =>
- node.name.text == 'call' &&
- getStaticType(node.receiver, staticTypeContext) is FunctionType &&
- !options.avoidClosureCallInstructions;
diff --git a/pkg/vm/lib/bytecode/local_variable_table.dart b/pkg/vm/lib/bytecode/local_variable_table.dart
deleted file mode 100644
index cdbeb45..0000000
--- a/pkg/vm/lib/bytecode/local_variable_table.dart
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright (c) 2019, 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 vm.bytecode.local_variable_table;
-
-import 'bytecode_serialization.dart';
-
-enum LocalVariableEntryKind {
- invalid,
- scope,
- variableDeclaration,
- contextVariable,
-}
-
-abstract class LocalVariableEntry {
- static const KindMask = 0x0F;
- static const IsCapturedFlag = 1 << 4;
-
- LocalVariableEntryKind get kind;
- int get flags => 0;
- final int startPC;
- void writeContents(BufferedWriter writer);
-
- LocalVariableEntry(this.startPC);
-}
-
-class Scope extends LocalVariableEntry {
- int endPC;
- int contextLevel;
- int position;
- int endPosition;
- final List<VariableDeclaration> variables = <VariableDeclaration>[];
-
- Scope(int startPC, this.endPC, this.contextLevel, this.position,
- this.endPosition)
- : super(startPC);
-
- @override
- LocalVariableEntryKind get kind => LocalVariableEntryKind.scope;
-
- @override
- void writeContents(BufferedWriter writer) {
- if (endPC == null) {
- throw '$this is not closed';
- }
- writer.writePackedUInt30(endPC - startPC);
- writer.writeSLEB128(contextLevel);
- writer.writePackedUInt30(position + 1);
- writer.writePackedUInt30(endPosition + 1);
- }
-
- Scope.readContents(BufferedReader reader, int startPC) : super(startPC) {
- endPC = startPC + reader.readPackedUInt30();
- contextLevel = reader.readSLEB128();
- position = reader.readPackedUInt30() - 1;
- endPosition = reader.readPackedUInt30() - 1;
- }
-
- @override
- String toString() =>
- 'scope (pc $startPC-$endPC pos $position-$endPosition context-level $contextLevel)';
-}
-
-class VariableDeclaration extends LocalVariableEntry {
- bool isCaptured;
- int index;
- int name;
- int type;
- int position;
- int initializedPosition;
-
- VariableDeclaration(int startPC, this.isCaptured, this.index, this.name,
- this.type, this.position, this.initializedPosition)
- : super(startPC);
-
- @override
- LocalVariableEntryKind get kind => LocalVariableEntryKind.variableDeclaration;
-
- @override
- int get flags => (isCaptured ? LocalVariableEntry.IsCapturedFlag : 0);
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writeSLEB128(index);
- writer.writePackedUInt30(name);
- writer.writePackedUInt30(type);
- writer.writePackedUInt30(position + 1);
- writer.writePackedUInt30(initializedPosition + 1);
- }
-
- VariableDeclaration.readContents(
- BufferedReader reader, int startPC, int flags)
- : super(startPC) {
- isCaptured = (flags & LocalVariableEntry.IsCapturedFlag) != 0;
- index = reader.readSLEB128();
- name = reader.readPackedUInt30();
- type = reader.readPackedUInt30();
- position = reader.readPackedUInt30() - 1;
- initializedPosition = reader.readPackedUInt30() - 1;
- }
-
- @override
- String toString() =>
- 'variable $index${isCaptured ? ' (captured)' : ''} pc $startPC, name CP#$name, type CP#$type, pos $position, init-pos $initializedPosition';
-}
-
-class ContextVariable extends LocalVariableEntry {
- int index;
-
- ContextVariable(int startPC, this.index) : super(startPC);
-
- @override
- LocalVariableEntryKind get kind => LocalVariableEntryKind.contextVariable;
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writeSLEB128(index);
- }
-
- ContextVariable.readContents(BufferedReader reader, int startPC)
- : super(startPC) {
- index = reader.readSLEB128();
- }
-
- @override
- String toString() => 'context variable $index';
-}
-
-/// Keeps information about declared local variables.
-class LocalVariableTable extends BytecodeDeclaration {
- final scopes = <Scope>[];
- final activeScopes = <Scope>[];
- ContextVariable contextVariable;
-
- LocalVariableTable();
-
- void enterScope(int pc, int contextLevel, int position) {
- final scope = new Scope(pc, null, contextLevel, position, null);
- activeScopes.add(scope);
- scopes.add(scope);
- }
-
- void declareVariable(int pc, bool isCaptured, int index, int nameCpIndex,
- int typeCpIndex, int position, int initializedPosition) {
- final variable = new VariableDeclaration(pc, isCaptured, index, nameCpIndex,
- typeCpIndex, position, initializedPosition);
- activeScopes.last.variables.add(variable);
- }
-
- void leaveScope(int pc, int endPosition) {
- final scope = activeScopes.removeLast();
- scope.endPC = pc;
- scope.endPosition = endPosition;
- if (scope.variables.isEmpty &&
- activeScopes.isNotEmpty &&
- scope.contextLevel == activeScopes.last.contextLevel) {
- scopes.remove(scope);
- }
- }
-
- void leaveAllScopes(int pc, int endPosition) {
- while (activeScopes.isNotEmpty) {
- leaveScope(pc, endPosition);
- }
- }
-
- void recordContextVariable(int pc, int index) {
- assert(contextVariable == null);
- contextVariable = new ContextVariable(pc, index);
- }
-
- bool get isEmpty => scopes.isEmpty && contextVariable == null;
-
- bool get isNotEmpty => !isEmpty;
-
- bool get hasActiveScopes => activeScopes.isNotEmpty;
-
- List<LocalVariableEntry> getEntries() {
- final entries = <LocalVariableEntry>[];
- if (contextVariable != null) {
- entries.add(contextVariable);
- }
- for (Scope scope in scopes) {
- entries.add(scope);
- entries.addAll(scope.variables);
- }
- return entries;
- }
-
- void write(BufferedWriter writer) {
- final entries = getEntries();
- writer.writePackedUInt30(entries.length);
- final encodeStartPC = new SLEB128DeltaEncoder();
- for (var entry in entries) {
- writer.writeByte(entry.kind.index | entry.flags);
- encodeStartPC.write(writer, entry.startPC);
- entry.writeContents(writer);
- }
- }
-
- LocalVariableTable.read(BufferedReader reader) {
- final int numEntries = reader.readPackedUInt30();
- final decodeStartPC = new SLEB128DeltaDecoder();
- Scope scope;
- for (int i = 0; i < numEntries; ++i) {
- final int kindAndFlags = reader.readByte();
- final LocalVariableEntryKind kind = LocalVariableEntryKind
- .values[kindAndFlags & LocalVariableEntry.KindMask];
- final int flags = kindAndFlags & ~LocalVariableEntry.KindMask;
- final int startPC = decodeStartPC.read(reader);
- switch (kind) {
- case LocalVariableEntryKind.scope:
- scope = new Scope.readContents(reader, startPC);
- scopes.add(scope);
- break;
- case LocalVariableEntryKind.variableDeclaration:
- scope.variables.add(
- new VariableDeclaration.readContents(reader, startPC, flags));
- break;
- case LocalVariableEntryKind.contextVariable:
- contextVariable = new ContextVariable.readContents(reader, startPC);
- break;
- default:
- throw 'Unexpected entry kind ${kind}';
- }
- }
- }
-
- Map<int, String> getBytecodeAnnotations() {
- final map = <int, String>{};
- for (var entry in getEntries()) {
- final pc = entry.startPC;
- if (map[pc] == null) {
- map[pc] = entry.toString();
- } else {
- map[pc] = "${map[pc]}; $entry";
- }
- }
- return map;
- }
-}
diff --git a/pkg/vm/lib/bytecode/local_vars.dart b/pkg/vm/lib/bytecode/local_vars.dart
deleted file mode 100644
index 882fb58..0000000
--- a/pkg/vm/lib/bytecode/local_vars.dart
+++ /dev/null
@@ -1,1430 +0,0 @@
-// 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.
-
-library vm.bytecode.local_vars;
-
-import 'dart:math' show min, max;
-
-import 'package:kernel/ast.dart';
-import 'package:kernel/transformations/continuation.dart'
- show ContinuationVariables;
-import 'package:kernel/type_environment.dart';
-import 'package:vm/bytecode/generics.dart';
-
-import 'dbc.dart';
-import 'options.dart' show BytecodeOptions;
-import '../metadata/direct_call.dart' show DirectCallMetadata;
-
-// Keep in sync with runtime/vm/object.h:Context::kAwaitJumpVarIndex.
-const int awaitJumpVarContextIndex = 0;
-const int asyncCompleterContextIndex = 1;
-const int controllerContextIndex = 1;
-
-class LocalVariables {
- final _scopes = new Map<TreeNode, Scope>();
- final _vars = new Map<VariableDeclaration, VarDesc>();
- Map<TreeNode, List<int>> _temps;
- Map<TreeNode, VariableDeclaration> _capturedSavedContextVars;
- Map<TreeNode, VariableDeclaration> _capturedExceptionVars;
- Map<TreeNode, VariableDeclaration> _capturedStackTraceVars;
- Map<ForInStatement, VariableDeclaration> _capturedIteratorVars;
- final BytecodeOptions options;
- final StaticTypeContext staticTypeContext;
- final Map<TreeNode, DirectCallMetadata> directCallMetadata;
-
- Scope _currentScope;
- Frame _currentFrame;
-
- VarDesc _getVarDesc(VariableDeclaration variable) =>
- _vars[variable] ??
- (throw 'Variable descriptor is not created for $variable');
-
- int _getVarIndex(VariableDeclaration variable, bool isCaptured) {
- final v = _getVarDesc(variable);
- if (v.isCaptured != isCaptured) {
- throw 'Mismatch in captured state of $variable';
- }
- return v.index ?? (throw 'Variable $variable is not allocated');
- }
-
- bool isCaptured(VariableDeclaration variable) =>
- _getVarDesc(variable).isCaptured;
-
- int getVarIndexInFrame(VariableDeclaration variable) =>
- _getVarIndex(variable, false);
-
- int getVarIndexInContext(VariableDeclaration variable) =>
- _getVarIndex(variable, true);
-
- int getOriginalParamSlotIndex(VariableDeclaration variable) =>
- _getVarDesc(variable).originalParamSlotIndex ??
- (throw 'Variable $variable does not have originalParamSlotIndex');
-
- int tempIndexInFrame(TreeNode node, {int tempIndex: 0}) {
- final temps = _temps[node];
- if (temps == null) {
- throw 'Temp is not allocated for node ${node.runtimeType} $node';
- }
- return temps[tempIndex];
- }
-
- int get currentContextSize => _currentScope.contextSize;
- int get currentContextLevel => _currentScope.contextLevel;
- int get currentContextId => _currentScope.contextId;
-
- int get contextLevelAtEntry =>
- _currentFrame.contextLevelAtEntry ??
- (throw "Current frame is top level and it doesn't have a context at entry");
-
- int getContextLevelOfVar(VariableDeclaration variable) {
- final v = _getVarDesc(variable);
- assert(v.isCaptured);
- return v.scope.contextLevel;
- }
-
- int getVarContextId(VariableDeclaration variable) {
- final v = _getVarDesc(variable);
- assert(v.isCaptured);
- return v.scope.contextId;
- }
-
- int get closureVarIndexInFrame => getVarIndexInFrame(_currentFrame
- .closureVar ??
- (throw 'Closure variable is not declared in ${_currentFrame.function}'));
-
- int get contextVarIndexInFrame => getVarIndexInFrame(_currentFrame
- .contextVar ??
- (throw 'Context variable is not declared in ${_currentFrame.function}'));
-
- bool get hasContextVar => _currentFrame.contextVar != null;
-
- int get scratchVarIndexInFrame => getVarIndexInFrame(_currentFrame
- .scratchVar ??
- (throw 'Scratch variable is not declared in ${_currentFrame.function}'));
-
- int get returnVarIndexInFrame => getVarIndexInFrame(_currentFrame.returnVar ??
- (throw 'Return variable is not declared in ${_currentFrame.function}'));
-
- VariableDeclaration get functionTypeArgsVar =>
- _currentFrame.functionTypeArgsVar ??
- (throw 'FunctionTypeArgs variable is not declared in ${_currentFrame.function}');
-
- int get functionTypeArgsVarIndexInFrame =>
- getVarIndexInFrame(functionTypeArgsVar);
-
- bool get hasFunctionTypeArgsVar => _currentFrame.functionTypeArgsVar != null;
-
- VariableDeclaration get factoryTypeArgsVar =>
- _currentFrame.factoryTypeArgsVar ??
- (throw 'FactoryTypeArgs variable is not declared in ${_currentFrame.function}');
-
- bool get hasFactoryTypeArgsVar => _currentFrame.factoryTypeArgsVar != null;
-
- VariableDeclaration get receiverVar =>
- _currentFrame.receiverVar ??
- (throw 'Receiver variable is not declared in ${_currentFrame.function}');
-
- bool get hasCapturedReceiverVar => _currentFrame.capturedReceiverVar != null;
-
- VariableDeclaration get capturedReceiverVar =>
- _currentFrame.capturedReceiverVar ??
- (throw 'Captured receiver variable is not declared in ${_currentFrame.function}');
-
- bool get hasReceiver => _currentFrame.receiverVar != null;
-
- bool get isSyncYieldingFrame => _currentFrame.isSyncYielding;
-
- VariableDeclaration get awaitJumpVar {
- assert(_currentFrame.isSyncYielding);
- return _currentFrame.parent
- .getSyntheticVar(ContinuationVariables.awaitJumpVar);
- }
-
- VariableDeclaration get awaitContextVar {
- assert(_currentFrame.isSyncYielding);
- return _currentFrame.parent
- .getSyntheticVar(ContinuationVariables.awaitContextVar);
- }
-
- VariableDeclaration get asyncStackTraceVar {
- assert(options.causalAsyncStacks);
- assert(_currentFrame.isSyncYielding);
- return _currentFrame.parent
- .getSyntheticVar(ContinuationVariables.asyncStackTraceVar);
- }
-
- VariableDeclaration capturedSavedContextVar(TreeNode node) =>
- _capturedSavedContextVars != null
- ? _capturedSavedContextVars[node]
- : null;
- VariableDeclaration capturedExceptionVar(TreeNode node) =>
- _capturedExceptionVars != null ? _capturedExceptionVars[node] : null;
- VariableDeclaration capturedStackTraceVar(TreeNode node) =>
- _capturedStackTraceVars != null ? _capturedStackTraceVars[node] : null;
- VariableDeclaration capturedIteratorVar(ForInStatement node) =>
- _capturedIteratorVars != null ? _capturedIteratorVars[node] : null;
-
- int get asyncExceptionParamIndexInFrame {
- assert(_currentFrame.isSyncYielding);
- final function = (_currentFrame.function as FunctionDeclaration).function;
- final param = function.positionalParameters
- .firstWhere((p) => p.name == ContinuationVariables.exceptionParam);
- return getVarIndexInFrame(param);
- }
-
- int get asyncStackTraceParamIndexInFrame {
- assert(_currentFrame.isSyncYielding);
- final function = (_currentFrame.function as FunctionDeclaration).function;
- final param = function.positionalParameters
- .firstWhere((p) => p.name == ContinuationVariables.stackTraceParam);
- return getVarIndexInFrame(param);
- }
-
- int get frameSize => _currentFrame.frameSize;
-
- int get numParameters => _currentFrame.numParameters;
-
- int get numParentTypeArguments => _currentFrame.parent?.numTypeArguments ?? 0;
-
- bool get hasOptionalParameters => _currentFrame.hasOptionalParameters;
- bool get hasCapturedParameters => _currentFrame.hasCapturedParameters;
-
- List<VariableDeclaration> get originalNamedParameters =>
- _currentFrame.originalNamedParameters;
- List<VariableDeclaration> get sortedNamedParameters =>
- _currentFrame.sortedNamedParameters;
-
- LocalVariables(Member node, this.options, this.staticTypeContext,
- this.directCallMetadata) {
- final scopeBuilder = new _ScopeBuilder(this);
- node.accept(scopeBuilder);
-
- final allocator = new _Allocator(this);
- node.accept(allocator);
- }
-
- void enterScope(TreeNode node) {
- _currentScope = _scopes[node];
- _currentFrame = _currentScope.frame;
- }
-
- void leaveScope() {
- _currentScope = _currentScope.parent;
- _currentFrame = _currentScope?.frame;
- }
-
- void withTemp(TreeNode node, int temp, void action()) {
- final old = _temps[node];
- assert(old == null || old.length == 1);
- _temps[node] = [temp];
- action();
- _temps[node] = old;
- }
-}
-
-class VarDesc {
- final VariableDeclaration declaration;
- Scope scope;
- bool isCaptured = false;
- int index;
- int originalParamSlotIndex;
-
- VarDesc(this.declaration, this.scope) {
- scope.vars.add(this);
- }
-
- Frame get frame => scope.frame;
-
- bool get isAllocated => index != null;
-
- void capture() {
- assert(!isAllocated);
- isCaptured = true;
- }
-
- void moveToScope(Scope newScope) {
- assert(index == null);
- scope.vars.remove(this);
- newScope.vars.add(this);
- scope = newScope;
- }
-
- String toString() => 'var ${declaration.name}';
-}
-
-class Frame {
- final TreeNode function;
- final Frame parent;
- Scope topScope;
-
- List<VariableDeclaration> originalNamedParameters;
- List<VariableDeclaration> sortedNamedParameters;
- int numParameters = 0;
- int numTypeArguments = 0;
- bool hasOptionalParameters = false;
- bool hasCapturedParameters = false;
- bool hasClosures = false;
- AsyncMarker dartAsyncMarker = AsyncMarker.Sync;
- bool isSyncYielding = false;
- VariableDeclaration receiverVar;
- VariableDeclaration capturedReceiverVar;
- VariableDeclaration functionTypeArgsVar;
- VariableDeclaration factoryTypeArgsVar;
- VariableDeclaration closureVar;
- VariableDeclaration contextVar;
- VariableDeclaration scratchVar;
- VariableDeclaration returnVar;
- Map<String, VariableDeclaration> syntheticVars;
- int frameSize = 0;
- List<int> temporaries = <int>[];
- int contextLevelAtEntry;
-
- Frame(this.function, this.parent);
-
- VariableDeclaration getSyntheticVar(String name) {
- if (syntheticVars == null) {
- throw 'No synthetic variables declared in ${function}!';
- }
- if (syntheticVars[name] == null) {
- throw '${name} variable is not declared in ${function}';
- }
- return syntheticVars[name];
- }
-}
-
-class Scope {
- final Scope parent;
- final Frame frame;
- final int loopDepth;
- final List<VarDesc> vars = <VarDesc>[];
-
- int localsUsed;
- int tempsUsed;
-
- Scope contextOwner;
- int contextUsed = 0;
- int contextSize = 0;
- int contextLevel;
- int contextId;
-
- Scope(this.parent, this.frame, this.loopDepth);
-
- bool get hasContext => contextSize > 0;
-}
-
-bool _hasReceiverParameter(TreeNode node) {
- return node is Constructor ||
- (node is Procedure && !node.isStatic) ||
- (node is Field && !node.isStatic);
-}
-
-class _ScopeBuilder extends RecursiveVisitor<Null> {
- final LocalVariables locals;
-
- // Set of synthetic variables we need to keep track of in Frame.
- static final registeredSyntheticVars = RegExp(r'^(' +
- '${ContinuationVariables.awaitJumpVar}|' +
- '${ContinuationVariables.awaitContextVar}|' +
- '${ContinuationVariables.asyncCompleter}|' +
- '${ContinuationVariables.asyncStackTraceVar}|' +
- '${ContinuationVariables.controller}|' +
- '${ContinuationVariables.controllerStreamVar}|' +
- // :exception0, :stack_trace17, etc..
- '${ContinuationVariables.savedTryContextVarPrefix}[0-9]+|' +
- '${ContinuationVariables.exceptionVarPrefix}[0-9]+|' +
- '${ContinuationVariables.stackTraceVarPrefix}[0-9]+' +
- r')$');
-
- Scope _currentScope;
- Frame _currentFrame;
- List<TreeNode> _enclosingTryBlocks;
- List<TreeNode> _enclosingTryCatches;
- int _loopDepth;
-
- _ScopeBuilder(this.locals);
-
- List<VariableDeclaration> _sortNamedParameters(FunctionNode function) {
- final params = function.namedParameters.toList();
- params.sort((VariableDeclaration a, VariableDeclaration b) =>
- a.name.compareTo(b.name));
- return params;
- }
-
- void _visitFunction(TreeNode node) {
- final savedEnclosingTryBlocks = _enclosingTryBlocks;
- _enclosingTryBlocks = <TreeNode>[];
- final savedEnclosingTryCatches = _enclosingTryCatches;
- _enclosingTryCatches = <TreeNode>[];
- final saveLoopDepth = _loopDepth;
- _loopDepth = 0;
-
- _enterFrame(node);
-
- if (node is Field) {
- if (_hasReceiverParameter(node)) {
- _currentFrame.receiverVar = new VariableDeclaration('this');
- _declareVariable(_currentFrame.receiverVar);
- }
- node.initializer?.accept(this);
- } else {
- assert(node is Procedure ||
- node is Constructor ||
- node is FunctionDeclaration ||
- node is FunctionExpression);
-
- FunctionNode function = (node as dynamic).function;
- assert(function != null);
-
- _currentFrame.dartAsyncMarker = function.dartAsyncMarker;
-
- _currentFrame.isSyncYielding =
- function.asyncMarker == AsyncMarker.SyncYielding;
-
- if (node is Procedure && node.isFactory) {
- assert(_currentFrame.parent == null);
- _currentFrame.numTypeArguments = 0;
- _currentFrame.factoryTypeArgsVar =
- new VariableDeclaration(':type_arguments');
- _declareVariable(_currentFrame.factoryTypeArgsVar);
- } else {
- _currentFrame.numTypeArguments =
- (_currentFrame.parent?.numTypeArguments ?? 0) +
- function.typeParameters.length;
-
- if (_currentFrame.numTypeArguments > 0) {
- _currentFrame.functionTypeArgsVar =
- new VariableDeclaration(':function_type_arguments_var')
- ..fileOffset = function.fileOffset;
- _declareVariable(_currentFrame.functionTypeArgsVar);
- }
-
- if (_currentFrame.parent?.factoryTypeArgsVar != null) {
- _currentFrame.factoryTypeArgsVar =
- _currentFrame.parent.factoryTypeArgsVar;
- }
- }
-
- if (_hasReceiverParameter(node)) {
- _currentFrame.receiverVar = new VariableDeclaration('this');
- _declareVariable(_currentFrame.receiverVar);
- } else if (_currentFrame.parent?.receiverVar != null) {
- _currentFrame.receiverVar = _currentFrame.parent.receiverVar;
- }
- if (node is FunctionDeclaration || node is FunctionExpression) {
- _currentFrame.closureVar = new VariableDeclaration(':closure');
- _declareVariable(_currentFrame.closureVar);
- }
-
- _currentFrame.originalNamedParameters = function.namedParameters;
- _currentFrame.sortedNamedParameters = _sortNamedParameters(function);
-
- visitList(function.positionalParameters, this);
- visitList(_currentFrame.sortedNamedParameters, this);
-
- // Inner (a)sync_op(..).
- if (_currentFrame.isSyncYielding) {
- // The following variables from parent frame are used implicitly and need
- // to be captured to preserve state across closure invocations.
- _useVariable(_currentFrame.parent
- .getSyntheticVar(ContinuationVariables.awaitJumpVar));
- _useVariable(_currentFrame.parent
- .getSyntheticVar(ContinuationVariables.awaitContextVar));
-
- // Debugger looks for :controller_stream variable among captured
- // variables in a context, so make sure to capture it.
- if (_currentFrame.parent.dartAsyncMarker == AsyncMarker.AsyncStar) {
- _useVariable(_currentFrame.parent
- .getSyntheticVar(ContinuationVariables.controllerStreamVar));
- }
-
- if (locals.options.causalAsyncStacks &&
- (_currentFrame.parent.dartAsyncMarker == AsyncMarker.Async ||
- _currentFrame.parent.dartAsyncMarker ==
- AsyncMarker.AsyncStar)) {
- _useVariable(_currentFrame.parent
- .getSyntheticVar(ContinuationVariables.asyncStackTraceVar));
- }
- } // _currentFrame.isSyncYielding
-
- if (node is Constructor) {
- for (var field in node.enclosingClass.fields) {
- if (!field.isStatic && field.initializer != null) {
- field.initializer.accept(this);
- }
- }
- visitList(node.initializers, this);
- }
-
- function.body?.accept(this);
-
- // sync* is transformed to have two nested synthetic functions.
- // The first such function defines :await_jump_var, which needs to be
- // made part of the outer function's scope.
- if (_currentFrame.parent?.dartAsyncMarker == AsyncMarker.SyncStar) {
- locals
- ._getVarDesc(_currentFrame
- .getSyntheticVar(ContinuationVariables.awaitJumpVar))
- .moveToScope(_currentScope);
- }
-
- // Outer, original async/async*.
- if (_currentFrame.dartAsyncMarker == AsyncMarker.Async ||
- _currentFrame.dartAsyncMarker == AsyncMarker.AsyncStar) {
- locals
- ._getVarDesc(_currentFrame
- .getSyntheticVar(ContinuationVariables.awaitJumpVar))
- .moveToScope(_currentScope);
-
- // Depending on the type of async, an additional synth. var. is needed.
- if (_currentFrame.dartAsyncMarker == AsyncMarker.Async) {
- locals
- ._getVarDesc(_currentFrame
- .getSyntheticVar(ContinuationVariables.asyncCompleter))
- .moveToScope(_currentScope);
- } else if (_currentFrame.dartAsyncMarker == AsyncMarker.AsyncStar) {
- locals
- ._getVarDesc(_currentFrame
- .getSyntheticVar(ContinuationVariables.controller))
- .moveToScope(_currentScope);
- }
- }
- }
-
- if (node is FunctionDeclaration ||
- node is FunctionExpression ||
- _currentFrame.hasClosures) {
- _currentFrame.contextVar = new VariableDeclaration(':context');
- _declareVariable(_currentFrame.contextVar);
- _currentFrame.scratchVar = new VariableDeclaration(':scratch');
- _declareVariable(_currentFrame.scratchVar);
- }
-
- if (_hasReceiverParameter(node)) {
- if (locals.isCaptured(_currentFrame.receiverVar)) {
- // Duplicate receiver variable for local use.
- _currentFrame.capturedReceiverVar = _currentFrame.receiverVar;
- _currentFrame.receiverVar = new VariableDeclaration('this');
- _declareVariable(_currentFrame.receiverVar);
- }
- }
-
- _leaveFrame();
-
- _enclosingTryBlocks = savedEnclosingTryBlocks;
- _enclosingTryCatches = savedEnclosingTryCatches;
- _loopDepth = saveLoopDepth;
- }
-
- _enterFrame(TreeNode node) {
- _currentFrame = new Frame(node, _currentFrame);
- _enterScope(node);
- _currentFrame.topScope = _currentScope;
- }
-
- _leaveFrame() {
- _leaveScope();
- _currentFrame = _currentFrame.parent;
- }
-
- void _enterScope(TreeNode node) {
- _currentScope = new Scope(_currentScope, _currentFrame, _loopDepth);
- assert(locals._scopes[node] == null);
- locals._scopes[node] = _currentScope;
- }
-
- void _leaveScope() {
- _currentScope = _currentScope.parent;
- }
-
- void _declareVariable(VariableDeclaration variable, [Scope scope]) {
- if (scope == null) {
- scope = _currentScope;
- }
- final VarDesc v = new VarDesc(variable, scope);
- assert(locals._vars[variable] == null,
- 'Double declaring variable ${variable}!');
- locals._vars[variable] = v;
- }
-
- void _useVariable(VariableDeclaration variable) {
- assert(variable != null);
- final VarDesc v = locals._vars[variable];
- if (v == null) {
- throw 'Variable $variable is used before declared';
- }
- if (v.frame != _currentFrame) {
- v.capture();
- }
- }
-
- void _useThis() {
- assert(_currentFrame.receiverVar != null);
- _useVariable(_currentFrame.receiverVar);
- }
-
- void _captureAllVisibleVariablesInCurrentFrame() {
- assert(_currentFrame.isSyncYielding);
- final transient = new Set<VariableDeclaration>();
- transient
- ..addAll([
- _currentFrame.functionTypeArgsVar,
- _currentFrame.closureVar,
- _currentFrame.contextVar,
- _currentFrame.scratchVar,
- _currentFrame.returnVar,
- ]);
- transient.addAll((_currentFrame.function as LocalFunction)
- .function
- .positionalParameters);
- for (Scope scope = _currentScope;
- scope != null && scope.frame == _currentFrame;
- scope = scope.parent) {
- for (VarDesc v in scope.vars) {
- if (!transient.contains(v.declaration)) {
- v.capture();
- }
- }
- }
- }
-
- // Capture synthetic variables for control flow statements.
- void _captureSyntheticVariables() {
- int depth = 0;
- for (TreeNode tryBlock in _enclosingTryBlocks) {
- locals._capturedSavedContextVars ??=
- new Map<TreeNode, VariableDeclaration>();
- _captureSyntheticVariable(ContinuationVariables.savedTryContextVar(depth),
- tryBlock, locals._capturedSavedContextVars);
- ++depth;
- }
- depth = 0;
- for (TreeNode tryBlock in _enclosingTryCatches) {
- locals._capturedExceptionVars ??=
- new Map<TreeNode, VariableDeclaration>();
- locals._capturedStackTraceVars ??=
- new Map<TreeNode, VariableDeclaration>();
- _captureSyntheticVariable(ContinuationVariables.exceptionVar(depth),
- tryBlock, locals._capturedExceptionVars);
- _captureSyntheticVariable(ContinuationVariables.stackTraceVar(depth),
- tryBlock, locals._capturedStackTraceVars);
- ++depth;
- }
- }
-
- void _captureSyntheticVariable(
- String name, TreeNode node, Map<TreeNode, VariableDeclaration> map) {
- final variable = _currentFrame.parent.getSyntheticVar(name);
- _useVariable(variable);
- assert(map[node] == null || map[node] == variable);
- map[node] = variable;
- }
-
- void _visitWithScope(TreeNode node) {
- _enterScope(node);
- node.visitChildren(this);
- _leaveScope();
- }
-
- @override
- defaultMember(Member node) {
- _visitFunction(node);
- }
-
- @override
- visitFunctionDeclaration(FunctionDeclaration node) {
- _currentFrame.hasClosures = true;
- if (_currentFrame.receiverVar != null) {
- // Closure creation may load receiver to get instantiator type arguments.
- _useThis();
- }
- node.variable.accept(this);
- _visitFunction(node);
- }
-
- @override
- visitFunctionExpression(FunctionExpression node) {
- _currentFrame.hasClosures = true;
- if (_currentFrame.receiverVar != null) {
- // Closure creation may load receiver to get instantiator type arguments.
- _useThis();
- }
- _visitFunction(node);
- }
-
- @override
- visitVariableDeclaration(VariableDeclaration node) {
- _declareVariable(node);
- // Register synthetic variables so we can reference them later where
- // they're implicitely used.
- if (node.name != null && registeredSyntheticVars.hasMatch(node.name)) {
- _currentFrame.syntheticVars ??= <String, VariableDeclaration>{};
- assert(_currentFrame.syntheticVars[node.name] == null,
- "Synthetic variable ${node} double declared!");
- _currentFrame.syntheticVars[node.name] = node;
- }
-
- node.visitChildren(this);
- }
-
- @override
- visitVariableGet(VariableGet node) {
- _useVariable(node.variable);
- if (node.variable.isLate && node.variable.initializer != null) {
- node.variable.initializer.accept(this);
- }
- }
-
- @override
- visitVariableSet(VariableSet node) {
- _useVariable(node.variable);
- node.visitChildren(this);
- }
-
- @override
- visitThisExpression(ThisExpression node) {
- _useThis();
- }
-
- @override
- visitSuperMethodInvocation(SuperMethodInvocation node) {
- _useThis();
- node.visitChildren(this);
- }
-
- @override
- visitSuperPropertyGet(SuperPropertyGet node) {
- _useThis();
- node.visitChildren(this);
- }
-
- @override
- visitSuperPropertySet(SuperPropertySet node) {
- _useThis();
- node.visitChildren(this);
- }
-
- @override
- visitTypeParameterType(TypeParameterType node) {
- var parent = node.parameter.parent;
- if (parent is Class) {
- _useThis();
- } else if (parent is FunctionNode) {
- parent = parent.parent;
- if (parent is Procedure && parent.isFactory) {
- assert(_currentFrame.factoryTypeArgsVar != null);
- _useVariable(_currentFrame.factoryTypeArgsVar);
- }
- }
-
- // Erase promoted bound in type parameter types as it makes no
- // difference at run time, but types which are different only in
- // promoted bounds are not equal when compared using DartType.operator==,
- // which prevents reusing of type arguments.
- // See dartbug.com/39240 for context.
- node.promotedBound = null;
-
- node.visitChildren(this);
- }
-
- @override
- visitBlock(Block node) {
- _visitWithScope(node);
- }
-
- @override
- visitBlockExpression(BlockExpression node) {
- // Not using _visitWithScope as Block inside BlockExpression does not have
- // a scope.
- _enterScope(node);
- visitList(node.body.statements, this);
- node.value.accept(this);
- _leaveScope();
- }
-
- @override
- visitAssertStatement(AssertStatement node) {
- if (!locals.options.enableAsserts) {
- return;
- }
- super.visitAssertStatement(node);
- }
-
- @override
- visitAssertBlock(AssertBlock node) {
- if (!locals.options.enableAsserts) {
- return;
- }
- _visitWithScope(node);
- }
-
- @override
- visitForStatement(ForStatement node) {
- ++_loopDepth;
- _visitWithScope(node);
- --_loopDepth;
- }
-
- @override
- visitForInStatement(ForInStatement node) {
- node.iterable.accept(this);
-
- VariableDeclaration iteratorVar;
- if (_currentFrame.isSyncYielding) {
- // Declare a variable to hold 'iterator' so it could be captured.
- iteratorVar = VariableDeclaration(':for-in-iterator');
- _declareVariable(iteratorVar);
- locals._capturedIteratorVars ??=
- new Map<ForInStatement, VariableDeclaration>();
- locals._capturedIteratorVars[node] = iteratorVar;
- }
-
- ++_loopDepth;
- _enterScope(node);
- node.variable.accept(this);
- node.body.accept(this);
- _leaveScope();
- --_loopDepth;
-
- if (_currentFrame.isSyncYielding && !locals.isCaptured(iteratorVar)) {
- // Iterator variable was not captured, as there are no yield points
- // inside for-in statement body. The variable is needed only if captured,
- // so undeclare it.
- assert(_currentScope.vars.last == locals._vars[iteratorVar]);
- _currentScope.vars.removeLast();
- locals._vars.remove(iteratorVar);
- locals._capturedIteratorVars.remove(node);
- }
- }
-
- @override
- visitCatch(Catch node) {
- _visitWithScope(node);
- }
-
- @override
- visitLet(Let node) {
- _visitWithScope(node);
- }
-
- @override
- visitYieldStatement(YieldStatement node) {
- assert(_currentFrame.isSyncYielding);
- _captureAllVisibleVariablesInCurrentFrame();
- _captureSyntheticVariables();
- node.visitChildren(this);
- }
-
- @override
- visitTryCatch(TryCatch node) {
- _enclosingTryBlocks.add(node);
- node.body?.accept(this);
- _enclosingTryBlocks.removeLast();
-
- _enclosingTryCatches.add(node);
- visitList(node.catches, this);
- _enclosingTryCatches.removeLast();
- }
-
- @override
- visitTryFinally(TryFinally node) {
- _enclosingTryBlocks.add(node);
- node.body?.accept(this);
- _enclosingTryBlocks.removeLast();
-
- _enclosingTryCatches.add(node);
- node.finalizer?.accept(this);
- _enclosingTryCatches.removeLast();
- }
-
- @override
- visitReturnStatement(ReturnStatement node) {
- // If returning from within a try-finally block, need to allocate
- // an extra variable to hold a return value.
- // Return value can't be kept on the stack as try-catch statements
- // inside finally can zap expression stack.
- // Literals (including implicit 'null' in 'return;') do not require
- // an extra variable as they can be generated after all finally blocks.
- if (_enclosingTryBlocks.isNotEmpty &&
- (node.expression != null && node.expression is! BasicLiteral)) {
- _currentFrame.returnVar = new VariableDeclaration(':return');
- _declareVariable(_currentFrame.returnVar, _currentFrame.topScope);
- }
- node.visitChildren(this);
- }
-
- @override
- visitWhileStatement(WhileStatement node) {
- ++_loopDepth;
- node.visitChildren(this);
- --_loopDepth;
- }
-
- @override
- visitDoStatement(DoStatement node) {
- ++_loopDepth;
- node.visitChildren(this);
- --_loopDepth;
- }
-}
-
-// Allocate context slots for each local variable.
-class _Allocator extends RecursiveVisitor<Null> {
- final LocalVariables locals;
-
- Scope _currentScope;
- Frame _currentFrame;
- int _contextIdCounter = 0;
-
- _Allocator(this.locals);
-
- void _enterScope(TreeNode node) {
- final scope = locals._scopes[node];
- assert(scope != null);
- assert(scope.parent == _currentScope);
- _currentScope = scope;
-
- if (_currentScope.frame != _currentFrame) {
- _currentFrame = _currentScope.frame;
-
- if (_currentScope.parent != null) {
- _currentFrame.contextLevelAtEntry = _currentScope.parent.contextLevel;
- }
-
- _currentScope.localsUsed = 0;
- _currentScope.tempsUsed = 0;
- } else {
- _currentScope.localsUsed = _currentScope.parent.localsUsed;
- _currentScope.tempsUsed = _currentScope.parent.tempsUsed;
- }
-
- assert(_currentScope.contextOwner == null);
- assert(_currentScope.contextLevel == null);
- assert(_currentScope.contextId == null);
-
- final int parentContextLevel =
- _currentScope.parent != null ? _currentScope.parent.contextLevel : -1;
-
- assert(parentContextLevel != null);
-
- final int numCaptured =
- _currentScope.vars.where((v) => v.isCaptured).length;
- if (numCaptured > 0) {
- // Share contexts between scopes which belong to the same frame and
- // have the same loop depth.
- _currentScope.contextOwner = _currentScope;
- for (Scope contextOwner = _currentScope;
- contextOwner != null &&
- contextOwner.frame == _currentScope.frame &&
- contextOwner.loopDepth == _currentScope.loopDepth;
- contextOwner = contextOwner.parent) {
- if (contextOwner.hasContext) {
- _currentScope.contextOwner = contextOwner;
- break;
- }
- }
-
- _currentScope.contextOwner.contextSize += numCaptured;
-
- if (_currentScope.contextOwner == _currentScope) {
- _currentScope.contextLevel = parentContextLevel + 1;
- int saturatedContextId = min(_contextIdCounter++, contextIdLimit - 1);
- _currentScope.contextId = saturatedContextId;
- } else {
- _currentScope.contextLevel = _currentScope.contextOwner.contextLevel;
- _currentScope.contextId = _currentScope.contextOwner.contextId;
- }
- } else {
- _currentScope.contextLevel = parentContextLevel;
- }
- }
-
- void _leaveScope() {
- assert(_currentScope.contextUsed == _currentScope.contextSize);
-
- _currentScope = _currentScope.parent;
- _currentFrame = _currentScope?.frame;
-
- // Remove temporary variables which are out of scope.
- if (_currentScope != null) {
- int tempsToRetain = _currentFrame.temporaries.length;
- while (tempsToRetain > 0 &&
- _currentFrame.temporaries[tempsToRetain - 1] >=
- _currentScope.localsUsed) {
- --tempsToRetain;
- }
- assert(tempsToRetain >= _currentScope.tempsUsed);
- _currentFrame.temporaries.length = tempsToRetain;
- assert(_currentFrame.temporaries
- .every((index) => index < _currentScope.localsUsed));
- }
- }
-
- void _updateFrameSize() {
- _currentFrame.frameSize =
- max(_currentFrame.frameSize, _currentScope.localsUsed);
- }
-
- void _allocateTemp(TreeNode node, {int count: 1}) {
- locals._temps ??= new Map<TreeNode, List<int>>();
- assert(locals._temps[node] == null);
- if (_currentScope.tempsUsed + count > _currentFrame.temporaries.length) {
- // Allocate new local slots for temporary variables.
- final int newSlots =
- (_currentScope.tempsUsed + count) - _currentFrame.temporaries.length;
- int local = _currentScope.localsUsed;
- _currentScope.localsUsed += newSlots;
- if (_currentScope.localsUsed > localVariableIndexLimit) {
- throw new LocalVariableIndexOverflowException();
- }
- _updateFrameSize();
- for (int i = 0; i < newSlots; i++) {
- _currentFrame.temporaries.add(local + i);
- }
- }
- locals._temps[node] = _currentFrame.temporaries
- .sublist(_currentScope.tempsUsed, _currentScope.tempsUsed + count);
- _currentScope.tempsUsed += count;
- }
-
- void _freeTemp(TreeNode node, {int count: 1}) {
- assert(_currentScope.tempsUsed >= count);
- _currentScope.tempsUsed -= count;
- assert(listEquals(
- locals._temps[node],
- _currentFrame.temporaries.sublist(
- _currentScope.tempsUsed, _currentScope.tempsUsed + count)));
- }
-
- void _allocateVariable(VariableDeclaration variable, {int paramSlotIndex}) {
- final VarDesc v = locals._getVarDesc(variable);
-
- assert(!v.isAllocated);
- assert(v.scope == _currentScope);
-
- if (v.isCaptured) {
- v.index = _currentScope.contextOwner.contextUsed++;
- if (v.index >= capturedVariableIndexLimit) {
- throw new LocalVariableIndexOverflowException();
- }
- v.originalParamSlotIndex = paramSlotIndex;
- return;
- }
-
- if (paramSlotIndex != null) {
- assert(paramSlotIndex < 0 ||
- (_currentFrame.hasOptionalParameters &&
- paramSlotIndex < _currentFrame.numParameters));
- v.index = paramSlotIndex;
- } else {
- v.index = _currentScope.localsUsed++;
- if (v.index >= localVariableIndexLimit) {
- throw new LocalVariableIndexOverflowException();
- }
- }
- _updateFrameSize();
- }
-
- void _ensureVariableAllocated(VariableDeclaration variable) {
- if (variable != null) {
- final VarDesc v = locals._getVarDesc(variable);
- if (!v.isAllocated) {
- _allocateVariable(variable);
- }
- }
- }
-
- void _allocateParameter(VariableDeclaration node, int i) {
- final numParameters = _currentFrame.numParameters;
- assert(0 <= i && i < numParameters);
- int paramSlotIndex = _currentFrame.hasOptionalParameters
- ? i
- : -kParamEndSlotFromFp - numParameters + i;
- _allocateVariable(node, paramSlotIndex: paramSlotIndex);
- }
-
- void _allocateParameters(TreeNode node, FunctionNode function) {
- final bool isFactory = node is Procedure && node.isFactory;
- final bool hasReceiver = _hasReceiverParameter(node);
- final bool hasClosureArg =
- node is FunctionDeclaration || node is FunctionExpression;
-
- _currentFrame.numParameters = function.positionalParameters.length +
- function.namedParameters.length +
- (isFactory ? 1 : 0) +
- (hasReceiver ? 1 : 0) +
- (hasClosureArg ? 1 : 0);
-
- _currentFrame.hasOptionalParameters = function.requiredParameterCount <
- function.positionalParameters.length ||
- function.namedParameters.isNotEmpty;
-
- _currentFrame.hasCapturedParameters =
- (isFactory && locals.isCaptured(_currentFrame.factoryTypeArgsVar)) ||
- (hasReceiver && _currentFrame.capturedReceiverVar != null) ||
- function.positionalParameters.any(locals.isCaptured) ||
- function.namedParameters.any(locals.isCaptured);
-
- int count = 0;
- if (isFactory) {
- _allocateParameter(_currentFrame.factoryTypeArgsVar, count++);
- }
- if (hasReceiver) {
- assert(!locals.isCaptured(_currentFrame.receiverVar));
- _allocateParameter(_currentFrame.receiverVar, count++);
-
- if (_currentFrame.capturedReceiverVar != null) {
- _allocateVariable(_currentFrame.capturedReceiverVar);
- }
- }
- if (hasClosureArg) {
- assert(!locals.isCaptured(_currentFrame.closureVar));
- _allocateParameter(_currentFrame.closureVar, count++);
- }
- for (var param in function.positionalParameters) {
- _allocateParameter(param, count++);
- }
- for (var param in _currentFrame.sortedNamedParameters) {
- _allocateParameter(param, count++);
- }
- assert(count == _currentFrame.numParameters);
-
- if (_currentFrame.hasOptionalParameters) {
- _currentScope.localsUsed = _currentFrame.numParameters;
- _updateFrameSize();
- }
- }
-
- void _allocateSpecialVariables() {
- _ensureVariableAllocated(_currentFrame.functionTypeArgsVar);
- _ensureVariableAllocated(_currentFrame.contextVar);
- _ensureVariableAllocated(_currentFrame.scratchVar);
- _ensureVariableAllocated(_currentFrame.returnVar);
- }
-
- void _visitFunction(TreeNode node) {
- _enterScope(node);
-
- if (node is Field) {
- if (_hasReceiverParameter(node)) {
- _currentFrame.numParameters = 1;
- _allocateParameter(_currentFrame.receiverVar, 0);
- if (_currentFrame.capturedReceiverVar != null) {
- _allocateVariable(_currentFrame.capturedReceiverVar);
- }
- }
- _allocateSpecialVariables();
- node.initializer?.accept(this);
- } else {
- assert(node is Procedure ||
- node is Constructor ||
- node is FunctionDeclaration ||
- node is FunctionExpression);
-
- final FunctionNode function = (node as dynamic).function;
- assert(function != null);
-
- // Specially allocate implicit variables before anything else to ensure
- // reserved spot in context.
-
- // Outer async/async* function.
- if (_currentFrame.dartAsyncMarker == AsyncMarker.Async ||
- _currentFrame.dartAsyncMarker == AsyncMarker.AsyncStar) {
- final awaitJumpVar =
- _currentFrame.getSyntheticVar(ContinuationVariables.awaitJumpVar);
- _allocateVariable(awaitJumpVar);
- assert(
- locals._getVarDesc(awaitJumpVar).index == awaitJumpVarContextIndex);
- }
-
- // :await_jump_var is declared in sync_op_gen, and implicitely used in sync_op.
- if (_currentFrame.parent?.dartAsyncMarker == AsyncMarker.SyncStar) {
- final awaitJumpVar =
- _currentFrame.getSyntheticVar(ContinuationVariables.awaitJumpVar);
- _allocateVariable(awaitJumpVar);
- assert(
- locals._getVarDesc(awaitJumpVar).index == awaitJumpVarContextIndex);
- }
-
- if (_currentFrame.dartAsyncMarker == AsyncMarker.Async) {
- final asyncCompleter =
- _currentFrame.getSyntheticVar(ContinuationVariables.asyncCompleter);
- _allocateVariable(asyncCompleter);
- assert(locals._getVarDesc(asyncCompleter).index ==
- asyncCompleterContextIndex);
- } else if (_currentFrame.dartAsyncMarker == AsyncMarker.AsyncStar) {
- final controller =
- _currentFrame.getSyntheticVar(ContinuationVariables.controller);
- _allocateVariable(controller);
- assert(locals._getVarDesc(controller).index == controllerContextIndex);
- }
-
- _allocateParameters(node, function);
- _allocateSpecialVariables();
-
- if (node is Constructor) {
- for (var field in node.enclosingClass.fields) {
- if (!field.isStatic && field.initializer != null) {
- field.initializer.accept(this);
- }
- }
- visitList(node.initializers, this);
- }
-
- // The visit the function body.
- function.body?.accept(this);
- }
-
- _leaveScope();
- }
-
- void _visit(TreeNode node, {bool scope: false, int temps: 0}) {
- if (scope) {
- _enterScope(node);
- }
- if (temps > 0) {
- _allocateTemp(node, count: temps);
- }
-
- node.visitChildren(this);
-
- if (temps > 0) {
- _freeTemp(node, count: temps);
- }
- if (scope) {
- _leaveScope();
- }
- }
-
- @override
- defaultMember(Member node) {
- _visitFunction(node);
- }
-
- @override
- visitFunctionDeclaration(FunctionDeclaration node) {
- _allocateVariable(node.variable);
- _allocateTemp(node);
- _visitFunction(node);
- _freeTemp(node);
- }
-
- @override
- visitFunctionExpression(FunctionExpression node) {
- _allocateTemp(node);
- _visitFunction(node);
- _freeTemp(node);
- }
-
- @override
- visitVariableDeclaration(VariableDeclaration node) {
- // Since these synthetic vars are specially allocated at a set index,
- // verify these slots, and only allocate normal vars.
- if (node.name == ContinuationVariables.awaitJumpVar) {
- assert(locals._getVarDesc(node).index == awaitJumpVarContextIndex);
- } else if (node.name == ContinuationVariables.asyncCompleter) {
- assert(locals._getVarDesc(node).index == asyncCompleterContextIndex);
- } else if (node.name == ContinuationVariables.controller) {
- assert(locals._getVarDesc(node).index == controllerContextIndex);
- } else {
- _allocateVariable(node);
- }
-
- node.visitChildren(this);
- }
-
- @override
- visitBlock(Block node) {
- _visit(node, scope: true);
- }
-
- @override
- visitBlockExpression(BlockExpression node) {
- // Not using _visit as Block inside BlockExpression does not have a scope.
- _enterScope(node);
- visitList(node.body.statements, this);
- node.value.accept(this);
- _leaveScope();
- }
-
- @override
- visitAssertStatement(AssertStatement node) {
- if (!locals.options.enableAsserts) {
- return;
- }
- super.visitAssertStatement(node);
- }
-
- @override
- visitAssertBlock(AssertBlock node) {
- if (!locals.options.enableAsserts) {
- return;
- }
- _visit(node, scope: true);
- }
-
- @override
- visitForStatement(ForStatement node) {
- _visit(node, scope: true);
- }
-
- @override
- visitForInStatement(ForInStatement node) {
- _allocateTemp(node);
- if (locals._capturedIteratorVars != null) {
- _ensureVariableAllocated(locals._capturedIteratorVars[node]);
- }
-
- node.iterable.accept(this);
-
- _enterScope(node);
- node.variable.accept(this);
- node.body.accept(this);
- _leaveScope();
-
- _freeTemp(node);
- }
-
- @override
- visitCatch(Catch node) {
- _visit(node, scope: true);
- }
-
- @override
- visitLet(Let node) {
- _visit(node, scope: true);
- }
-
- // -------------- Allocation of temporaries --------------
-
- @override
- visitConstructorInvocation(ConstructorInvocation node) {
- if (node.isConst) {
- return;
- }
- _visit(node, temps: 1);
- }
-
- @override
- visitListLiteral(ListLiteral node) {
- if (node.isConst) {
- return;
- }
- _visit(node, temps: 1);
- }
-
- @override
- visitMapLiteral(MapLiteral node) {
- if (node.isConst) {
- return;
- }
- _visit(node, temps: 1);
- }
-
- @override
- visitStringConcatenation(StringConcatenation node) {
- _visit(node, temps: 1);
- }
-
- @override
- visitConditionalExpression(ConditionalExpression node) {
- _visit(node, temps: 1);
- }
-
- @override
- visitLogicalExpression(LogicalExpression node) {
- _visit(node, temps: 1);
- }
-
- @override
- visitMethodInvocation(MethodInvocation node) {
- int numTemps = 0;
- if (isUncheckedClosureCall(
- node, locals.staticTypeContext, locals.options)) {
- numTemps = 1;
- } else if (locals.directCallMetadata != null) {
- final directCall = locals.directCallMetadata[node];
- if (directCall != null && directCall.checkReceiverForNull) {
- numTemps = 1;
- }
- }
- _visit(node, temps: numTemps);
- }
-
- @override
- visitPropertySet(PropertySet node) {
- _visit(node, temps: 1);
- }
-
- @override
- visitPropertyGet(PropertyGet node) {
- int numTemps = 0;
- if (locals.directCallMetadata != null) {
- final directCall = locals.directCallMetadata[node];
- if (directCall != null && directCall.checkReceiverForNull) {
- numTemps = 1;
- }
- }
- _visit(node, temps: numTemps);
- }
-
- @override
- visitSuperMethodInvocation(SuperMethodInvocation node) {
- _visit(node, temps: 1);
- }
-
- @override
- visitSuperPropertyGet(SuperPropertyGet node) {
- _visit(node, temps: 1);
- }
-
- @override
- visitSuperPropertySet(SuperPropertySet node) {
- _visit(node, temps: 1);
- }
-
- @override
- visitSwitchStatement(SwitchStatement node) {
- _visit(node, temps: 1);
- }
-
- @override
- visitVariableGet(VariableGet node) {
- _visit(node, temps: node.variable.isLate ? 1 : 0);
- }
-
- @override
- visitVariableSet(VariableSet node) {
- final v = node.variable;
- final bool needsTemp = locals.isCaptured(v) || v.isLate && v.isFinal;
- _visit(node, temps: needsTemp ? 1 : 0);
- }
-
- @override
- visitStaticSet(StaticSet node) {
- _visit(node, temps: 1);
- }
-
- @override
- visitTryCatch(TryCatch node) {
- _visit(node, temps: 2);
- }
-
- @override
- visitTryFinally(TryFinally node) {
- _visit(node, temps: 2);
- }
-
- @override
- visitInstantiation(Instantiation node) {
- _visit(node, temps: 3);
- }
-
- @override
- visitNullCheck(NullCheck node) {
- _visit(node, temps: 1);
- }
-}
-
-class LocalVariableIndexOverflowException
- extends BytecodeLimitExceededException {}
diff --git a/pkg/vm/lib/bytecode/ngrams.dart b/pkg/vm/lib/bytecode/ngrams.dart
deleted file mode 100644
index 54e028b..0000000
--- a/pkg/vm/lib/bytecode/ngrams.dart
+++ /dev/null
@@ -1,142 +0,0 @@
-// 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.
-
-library vm.bytecode.ngrams;
-
-import 'dart:io';
-import 'dart:typed_data';
-
-import 'package:kernel/ast.dart' show listEquals, listHashCode;
-
-import 'dbc.dart';
-import 'disassembler.dart' show Instruction, BytecodeDisassembler;
-
-bool isControlFlowInstr(Instruction instr) => isControlFlow(instr.opcode);
-
-class NGram {
- List<Instruction> instrs;
- BytecodeDisassembler _disassembler;
-
- NGram(this.instrs, {bool mergePushes = false}) {
- if (mergePushes) {
- _mergePushes(instrs);
- }
- _canonicalize(instrs);
- }
-
- /// Tests if any instructions that are not the last instruction in the window
- /// are a jump, throw, or call.
- bool get controlFlowIsNotLast =>
- instrs.sublist(0, instrs.length - 1).any(isControlFlowInstr);
-
- @override
- int get hashCode => listHashCode(instrs);
-
- @override
- bool operator ==(other) =>
- (other is NGram) && listEquals(instrs, other.instrs);
-
- @override
- String toString() {
- StringBuffer out = new StringBuffer();
- for (var instr in instrs) {
- _disassembler.writeInstruction(out, instr);
- }
- return out.toString();
- }
-
- /// Rewrites all Push-like instructions as 'Push r0'.
- static void _mergePushes(List<Instruction> instrs) {
- for (int i = 0; i < instrs.length; i++) {
- if (isPush(instrs[i].opcode)) {
- instrs[i] = new Instruction(Opcode.kPush, false, <int>[0], 0);
- }
- }
- }
-
- /// Rewrites the operands of instructions so that ngrams that differ only in
- /// operands can be considered the same.
- ///
- /// Each type of operand is considered to come from a different space, and
- /// each operand is re-indexed in that space starting from 0 such that each
- /// distinct operand before canonicalization remains distinct afterwords. E.g.
- ///
- /// Push r3
- /// Push r3
- /// Push r4
- ///
- /// Becomes
- ///
- /// Push r0
- /// Push r0
- /// Push r1
- static void _canonicalize(List<Instruction> instrs) {
- Map<Operand, Map<int, int>> operandMaps = <Operand, Map<int, int>>{
- // No mapping for Operand.none.
- Operand.imm: <int, int>{},
- Operand.lit: <int, int>{},
- Operand.reg: <int, int>{},
- Operand.xeg: <int, int>{},
- Operand.tgt: <int, int>{},
- // No mapping for Operand.spe.
- };
- for (Instruction instr in instrs) {
- Format fmt = BytecodeFormats[instr.opcode];
- for (int i = 0; i < instr.operands.length; i++) {
- Operand op = fmt.operands[i];
- if (!operandMaps.containsKey(op)) {
- continue;
- }
- int newOperand = operandMaps[op]
- .putIfAbsent(instr.operands[i], () => operandMaps[op].length);
- instr.operands[i] = newOperand;
- }
- }
- }
-}
-
-class NGramReader {
- List<Instruction> _instructions;
-
- Map<NGram, int> _ngramCounts = <NGram, int>{};
-
- NGramReader(String traceFilename) {
- File traceFile = File(traceFilename);
- Uint8List bytecode = traceFile.readAsBytesSync();
- final disassembler = new BytecodeDisassembler();
- _instructions = disassembler.decode(bytecode);
- }
-
- Map<NGram, int> get ngramCounts => _ngramCounts;
-
- void readAllNGrams(int windowSize,
- {bool basicBlocks: true, bool mergePushes: false}) {
- int offset = 0;
- while (offset + windowSize < _instructions.length) {
- List<Instruction> window =
- _instructions.sublist(offset, offset + windowSize);
- offset += 1;
- NGram ngram = new NGram(window, mergePushes: mergePushes);
- if (basicBlocks && ngram.controlFlowIsNotLast) {
- continue;
- }
- _ngramCounts.update(ngram, (count) => count + 1, ifAbsent: () => 1);
- }
- }
-
- void writeNGramStats(String outputFilename,
- {bool sort = true, int minCount = 1000}) {
- File outputFile = new File(outputFilename);
- IOSink file = outputFile.openWrite();
- List<MapEntry<NGram, int>> entries =
- _ngramCounts.entries.where((e) => e.value > minCount).toList();
- if (sort) {
- entries.sort((e1, e2) => e2.value - e1.value);
- }
- entries.forEach((e) {
- file.write("count: ${e.value}\n${e.key}\n");
- });
- file.close();
- }
-}
diff --git a/pkg/vm/lib/bytecode/nullability_detector.dart b/pkg/vm/lib/bytecode/nullability_detector.dart
deleted file mode 100644
index 414807b..0000000
--- a/pkg/vm/lib/bytecode/nullability_detector.dart
+++ /dev/null
@@ -1,142 +0,0 @@
-// 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.
-
-library vm.bytecode.nullability_detector;
-
-import 'package:kernel/ast.dart';
-import 'dbc.dart';
-import 'recognized_methods.dart' show RecognizedMethods;
-
-class NullabilityDetector {
- final _IsNullableVisitor _isNullableVisitor;
-
- NullabilityDetector(RecognizedMethods recognizedMethods)
- : _isNullableVisitor = new _IsNullableVisitor(recognizedMethods);
-
- bool isNullable(Expression expr) => expr.accept(_isNullableVisitor);
-}
-
-class _IsNullableVisitor extends ExpressionVisitor<bool> {
- final RecognizedMethods recognizedMethods;
-
- _IsNullableVisitor(this.recognizedMethods);
-
- @override
- bool defaultExpression(Expression node) => true;
-
- @override
- bool visitNullLiteral(NullLiteral node) => true;
-
- // All basic literals except NullLiteral are non-nullable.
- @override
- bool defaultBasicLiteral(BasicLiteral node) => false;
-
- @override
- bool visitVariableGet(VariableGet node) {
- final v = node.variable;
- if ((v.isConst || v.isFinal) && v.initializer != null) {
- return v.initializer.accept(this);
- }
- return true;
- }
-
- @override
- bool visitVariableSet(VariableSet node) => node.value.accept(this);
-
- @override
- bool visitMethodInvocation(MethodInvocation node) {
- final Opcode opcode = recognizedMethods.specializedBytecodeFor(node);
- if (opcode != null) {
- return !_nonNullableBytecodeInstructions.contains(opcode);
- }
- return true;
- }
-
- @override
- bool visitConstructorInvocation(ConstructorInvocation node) => false;
-
- @override
- bool visitNot(Not node) => false;
-
- @override
- bool visitLogicalExpression(LogicalExpression node) => false;
-
- @override
- bool visitConditionalExpression(ConditionalExpression node) =>
- node.then.accept(this) || node.otherwise.accept(this);
-
- @override
- bool visitStringConcatenation(StringConcatenation node) => false;
-
- @override
- bool visitIsExpression(IsExpression node) => false;
-
- @override
- bool visitAsExpression(AsExpression node) => node.operand.accept(this);
-
- @override
- bool visitSymbolLiteral(SymbolLiteral node) => false;
-
- @override
- bool visitTypeLiteral(TypeLiteral node) => false;
-
- @override
- bool visitThisExpression(ThisExpression node) => false;
-
- @override
- bool visitRethrow(Rethrow node) => false;
-
- @override
- bool visitThrow(Throw node) => false;
-
- @override
- bool visitListLiteral(ListLiteral node) => false;
-
- @override
- bool visitMapLiteral(MapLiteral node) => false;
-
- @override
- bool visitFunctionExpression(FunctionExpression node) => false;
-
- @override
- bool visitConstantExpression(ConstantExpression node) =>
- node.constant is NullConstant;
-
- @override
- bool visitLet(Let node) => node.body.accept(this);
-
- @override
- bool visitInstantiation(Instantiation node) => false;
-}
-
-final _nonNullableBytecodeInstructions = new Set<Opcode>.from([
- Opcode.kBooleanNegateTOS,
- Opcode.kEqualsNull,
- Opcode.kNegateInt,
- Opcode.kAddInt,
- Opcode.kSubInt,
- Opcode.kMulInt,
- Opcode.kTruncDivInt,
- Opcode.kModInt,
- Opcode.kBitAndInt,
- Opcode.kBitOrInt,
- Opcode.kBitXorInt,
- Opcode.kShlInt,
- Opcode.kShrInt,
- Opcode.kCompareIntEq,
- Opcode.kCompareIntGt,
- Opcode.kCompareIntLt,
- Opcode.kCompareIntGe,
- Opcode.kCompareIntLe,
- Opcode.kNegateDouble,
- Opcode.kAddDouble,
- Opcode.kSubDouble,
- Opcode.kMulDouble,
- Opcode.kDivDouble,
- Opcode.kCompareDoubleEq,
- Opcode.kCompareDoubleGt,
- Opcode.kCompareDoubleLt,
- Opcode.kCompareDoubleGe,
- Opcode.kCompareDoubleLe,
-]);
diff --git a/pkg/vm/lib/bytecode/object_table.dart b/pkg/vm/lib/bytecode/object_table.dart
deleted file mode 100644
index 8db0792..0000000
--- a/pkg/vm/lib/bytecode/object_table.dart
+++ /dev/null
@@ -1,2376 +0,0 @@
-// 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.
-
-library vm.bytecode.object_table;
-
-import 'package:kernel/ast.dart' hide MapEntry;
-import 'package:kernel/core_types.dart' show CoreTypes;
-
-import 'bytecode_serialization.dart'
- show
- BufferedWriter,
- BufferedReader,
- BytecodeObject,
- BytecodeSizeStatistics,
- ForwardReference,
- NamedEntryStatistics,
- doubleToIntBits,
- intBitsToDouble,
- ObjectReader,
- ObjectWriter,
- StringWriter;
-import 'generics.dart'
- show getInstantiatorTypeArguments, hasInstantiatorTypeArguments;
-import 'declarations.dart' show SourceFile, TypeParametersDeclaration;
-import 'recursive_types_validator.dart' show RecursiveTypesValidator;
-
-/*
-
-Bytecode object table is encoded in the following way
-(using notation from pkg/kernel/binary.md):
-
-type ObjectTable {
- UInt numEntries
-
- // Total size of ‘objects’ in bytes.
- UInt objectsSize
-
- ObjectContents[numEntries] objects
-
- // Offsets relative to ‘objects’.
- UInt[numEntries] objectOffsets
-}
-
-
-// Either reference to an object in object table, or object contents
-// written inline (determined by bit 0).
-PackedObject = ObjectReference | ObjectContents
-
-type ObjectReference {
- // Bit 0 (reference bit): 1
- // Bits 1+: index in object table
- UInt reference
-}
-
-type ObjectContents {
- // Bit 0 (reference bit): 0
- // Bits 1-4: object kind
- // Bits 5+ object flags
- UInt header
-}
-
-// Invalid/null object (always present at index 0).
-type InvalidObject extends ObjectContents {
- kind = 0;
-}
-
-type Library extends ObjectContents {
- kind = 1;
- PackedObject importUri;
-}
-
-type Class extends ObjectContents {
- kind = 2;
- PackedObject library;
- // Empty name is used for artificial class containing top-level
- // members of a library.
- PackedObject name;
-}
-
-type Member extends ObjectContents {
- kind = 3;
- flags = (isField, isConstructor);
- PackedObject class;
- PackedObject name;
-}
-
-type Closure extends ObjectContents {
- kind = 4;
- PackedObject enclosingMember;
- UInt closureIndex;
-}
-
-type Name extends ObjectContents {
- kind = 9;
-
- // Invalid for public names
- PackedObject library;
-
- // Getters are prefixed with 'get:'.
- // Setters are prefixed with 'set:'.
- PackedString string;
-}
-
-// Type arguments vector.
-type TypeArguments extends ObjectContents {
- kind = 10;
- List<PackedObject> args;
-}
-
-abstract type ConstObject extends ObjectContents {
- kind = 12;
- flags = constantTag (4 bits)
-}
-
-type ConstInstance extends ConstObject {
- kind = 12
- constantTag (flags) = 1
- PackedObject type;
- List<Pair<PackedObject, PackedObject>> fieldValues;
-}
-
-type ConstInt extends ConstValue {
- kind = 12
- constantTag (flags) = 2
- SLEB128 value;
-}
-
-type ConstDouble extends ConstValue {
- kind = 12
- constantTag (flags) = 3
- // double bits are reinterpreted as 64-bit int
- SLEB128 value;
-}
-
-type ConstList extends ConstObject {
- kind = 12
- constantTag (flags) = 4
- PackedObject elemType;
- List<PackedObject> entries;
-}
-
-type ConstTearOff extends ConstObject {
- kind = 12
- constantTag (flags) = 5
- PackedObject target;
-}
-
-type ConstBool extends ConstValue {
- kind = 12
- constantTag = 6
- Byte isTrue;
-}
-
-type ConstSymbol extends ConstObject {
- kind = 12
- constantTag (flags) = 7
- PackedObject name;
-}
-
-type ConstTearOffInstantiation extends ConstObject {
- kind = 12
- constantTag (flags) = 8
- PackedObject tearOff;
- PackedObject typeArguments;
-}
-
-type ArgDesc extends ObjectContents {
- kind = 13;
- flags = (hasNamedArgs, hasTypeArgs)
-
- UInt numArguments
-
- if hasTypeArgs
- UInt numTypeArguments
-
- if hasNamedArgs
- List<PackedObject> argNames;
-}
-
-type Script extends ObjectContents {
- kind = 14
- flags = (hasSourceFile)
- PackedObject uri
- if hasSourceFile
- UInt sourceFileOffset
-}
-
-abstract type Type extends ObjectContents {
- kind = 15
- flags = typeTag (4 bits)
-}
-
-type DynamicType extends Type {
- kind = 15
- typeTag (flags) = 1
-}
-
-type VoidType extends Type {
- kind = 15
- typeTag (flags) = 2
-}
-
-type NeverType extends Type {
- kind = 15
- typeTag (flags) = 9
-}
-
-// SimpleType can be used only for types without instantiator type arguments.
-type SimpleType extends Type {
- kind = 15
- typeTag (flags) = 3
- PackedObject class
-}
-
-type TypeParameter extends Type {
- kind = 15
- typeTag (flags) = 4
- // Class, Member or Closure declaring this type parameter.
- // Null (Invalid) if declared by function type.
- PackedObject parent
- UInt indexInParent
-}
-
-// Non-recursive finalized generic type.
-type GenericType extends Type {
- kind = 15
- typeTag (flags) = 5
- PackedObject class
- // Flattened type arguments vector.
- PackedObject typeArgs
-}
-
-// Recursive finalized generic type.
-type RecursiveGenericType extends Type {
- kind = 15
- typeTag (flags) = 6
- // This id is used to reference recursive types using RecursiveTypeRef.
- // Type should be declared using RecursiveGenericType before it can be referenced.
- // The root type should have zero recursiveId.
- UInt recursiveId
- PackedObject class
- // Flattened type arguments vector.
- PackedObject typeArgs
-}
-
-type RecursiveTypeRef extends Type {
- kind = 15
- typeTag (flags) = 7
- UInt recursiveId
-}
-
-type FunctionType extends Type {
- kind = 15
- typeTag (flags) = 8
-
- UInt functionTypeFlags(hasOptionalPositionalParams,
- hasOptionalNamedParams,
- hasTypeParams)
-
- if hasTypeParams
- TypeParametersDeclaration typeParameters
-
- UInt numParameters
-
- if hasOptionalPositionalParams || hasOptionalNamedParams
- UInt numRequiredParameters
-
- Type[] positionalParameters
- NameAndType[] namedParameters
- PackedObject returnType
-}
-
-type TypeParametersDeclaration {
- UInt numTypeParameters
- PackedObject[numTypeParameters] typeParameterNames
- PackedObject[numTypeParameters] typeParameterBounds
-}
-
-type NameAndType {
- PackedObject name;
- PackedObject type;
-}
-
-*/
-
-enum ObjectKind {
- kInvalid,
- kLibrary,
- kClass,
- kMember,
- kClosure,
- kUnused1,
- kUnused2,
- kUnused3,
- kUnused4,
- kName,
- kTypeArguments,
- kUnused5,
- kConstObject,
- kArgDesc,
- kScript,
- kType,
-}
-
-enum ConstTag {
- kInvalid,
- kInstance,
- kInt,
- kDouble,
- kList,
- kTearOff,
- kBool,
- kSymbol,
- kTearOffInstantiation,
- kString,
-}
-
-enum TypeTag {
- kInvalid,
- kDynamic,
- kVoid,
- kSimpleType,
- kTypeParameter,
- kGenericType,
- kRecursiveGenericType,
- kRecursiveTypeRef,
- kFunctionType,
- kNever,
-}
-
-/// Name of artificial class containing top-level members of a library.
-const String topLevelClassName = '';
-
-String objectKindToString(ObjectKind kind) =>
- kind.toString().substring('ObjectKind.k'.length);
-
-String nullabilityToString(Nullability nullability) {
- switch (nullability) {
- case Nullability.legacy:
- return '*';
- case Nullability.nullable:
- return '?';
- case Nullability.undetermined:
- return '%';
- case Nullability.nonNullable:
- return '';
- }
- throw "Unknown Nullability: $nullability";
-}
-
-/// Represents object (library, class, member, closure, type or name) in the
-/// object table.
-abstract class ObjectHandle extends BytecodeObject {
- static const int referenceBit = 1 << 0;
- static const int indexShift = 1;
- static const int inlineObject = -1;
-
- static const int kindShift = 1;
- static const int kindMask = 0x0F;
-
- static const int flagBit0 = 1 << 5;
- static const int flagBit1 = 1 << 6;
- static const int flagBit2 = 1 << 7;
- static const int flagBit3 = 1 << 8;
- static const int flagBit4 = 1 << 9;
- static const int flagBit5 = 1 << 10;
- static const int flagsMask =
- flagBit0 | flagBit1 | flagBit2 | flagBit3 | flagBit4 | flagBit5;
-
- static int _makeReference(int index) => (index << indexShift) | referenceBit;
-
- static int _getIndexFromReference(int reference) {
- assert((reference & referenceBit) != 0);
- return reference >> indexShift;
- }
-
- static int _makeHeader(ObjectKind kind, int flags) {
- assert((kind.index & kindMask) == kind.index);
- assert((flags & flagsMask) == flags);
- return (kind.index << kindShift) | flags;
- }
-
- static ObjectKind _getKindFromHeader(int header) {
- assert((header & referenceBit) == 0);
- return ObjectKind.values[(header >> kindShift) & kindMask];
- }
-
- static int _getFlagsFromHeader(int header) {
- assert((header & referenceBit) == 0);
- return header & flagsMask;
- }
-
- int _useCount = 0;
- int _reference;
-
- ObjectHandle();
-
- ObjectKind get kind;
-
- int get flags => 0;
- set flags(int value) {}
-
- bool get isCacheable => true;
- bool get shouldBeIncludedIntoIndexTable =>
- _useCount >= ObjectTable.indexTableUseCountThreshold && isCacheable;
-
- factory ObjectHandle._empty(ObjectKind kind, int flags) {
- switch (kind) {
- case ObjectKind.kInvalid:
- return new _InvalidHandle();
- case ObjectKind.kLibrary:
- return new _LibraryHandle._empty();
- case ObjectKind.kClass:
- return new _ClassHandle._empty();
- case ObjectKind.kMember:
- return new _MemberHandle._empty();
- case ObjectKind.kClosure:
- return new _ClosureHandle._empty();
- case ObjectKind.kName:
- return ((flags & _NameHandle.flagIsPublic) != 0)
- ? new _PublicNameHandle._empty()
- : _PrivateNameHandle._empty();
- case ObjectKind.kTypeArguments:
- return new _TypeArgumentsHandle._empty();
- case ObjectKind.kConstObject:
- return new _ConstObjectHandle._empty();
- case ObjectKind.kArgDesc:
- return new _ArgDescHandle._empty();
- case ObjectKind.kScript:
- return new _ScriptHandle._empty();
- case ObjectKind.kType:
- Nullability nullability = Nullability
- .values[(flags & _TypeHandle.nullabilityMask) ~/ flagBit4];
- switch (TypeTag.values[(flags & _TypeHandle.tagMask) ~/ flagBit0]) {
- case TypeTag.kInvalid:
- break;
- case TypeTag.kDynamic:
- return new _DynamicTypeHandle();
- case TypeTag.kVoid:
- return new _VoidTypeHandle();
- case TypeTag.kNever:
- return new _NeverTypeHandle(nullability);
- case TypeTag.kSimpleType:
- return new _SimpleTypeHandle._empty(nullability);
- case TypeTag.kTypeParameter:
- return new _TypeParameterHandle._empty(nullability);
- case TypeTag.kGenericType:
- return new _GenericTypeHandle._empty(nullability);
- case TypeTag.kRecursiveGenericType:
- return new _RecursiveGenericTypeHandle._empty(nullability);
- case TypeTag.kRecursiveTypeRef:
- return new _RecursiveTypeRefHandle._empty(nullability);
- case TypeTag.kFunctionType:
- return new _FunctionTypeHandle._empty(nullability);
- }
- throw 'Unexpected type tag $flags';
- case ObjectKind.kUnused1:
- case ObjectKind.kUnused2:
- case ObjectKind.kUnused3:
- case ObjectKind.kUnused4:
- case ObjectKind.kUnused5:
- break;
- }
- throw 'Unexpected object kind $kind';
- }
-
- void _write(BufferedWriter writer) {
- int header = _makeHeader(kind, flags);
- assert((header & referenceBit) == 0);
- writer.writePackedUInt30(header);
- writeContents(writer);
- }
-
- void writeContents(BufferedWriter writer);
-
- factory ObjectHandle._read(BufferedReader reader, int header) {
- assert((header & referenceBit) == 0);
- final ObjectKind kind = _getKindFromHeader(header);
- final int flags = _getFlagsFromHeader(header);
- final obj = new ObjectHandle._empty(kind, flags);
- obj.flags = flags;
- obj.readContents(reader);
- return obj;
- }
-
- void readContents(BufferedReader reader);
-
- void accountUsesForObjectCopies(int numCopies) {}
-
- void indexStrings(StringWriter strings) {}
-}
-
-class _InvalidHandle extends ObjectHandle {
- _InvalidHandle();
-
- @override
- ObjectKind get kind => ObjectKind.kInvalid;
-
- @override
- void writeContents(BufferedWriter writer) {}
-
- @override
- void readContents(BufferedReader reader) {}
-
- @override
- String toString() => 'Invalid';
-}
-
-class _LibraryHandle extends ObjectHandle {
- _ConstObjectHandle uri;
-
- _LibraryHandle._empty();
-
- _LibraryHandle(this.uri);
-
- @override
- ObjectKind get kind => ObjectKind.kLibrary;
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedObject(uri);
- }
-
- @override
- void readContents(BufferedReader reader) {
- uri = reader.readPackedObject();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- uri._useCount += numCopies;
- }
-
- @override
- int get hashCode => uri.hashCode + 11;
-
- @override
- bool operator ==(other) => other is _LibraryHandle && this.uri == other.uri;
-
- @override
- String toString() => uri.value;
-}
-
-class _ClassHandle extends ObjectHandle {
- _LibraryHandle library;
- _NameHandle name;
-
- _ClassHandle._empty();
-
- _ClassHandle(this.library, this.name);
-
- @override
- ObjectKind get kind => ObjectKind.kClass;
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedObject(library);
- writer.writePackedObject(name);
- }
-
- @override
- void readContents(BufferedReader reader) {
- library = reader.readPackedObject();
- name = reader.readPackedObject();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- library._useCount += numCopies;
- name._useCount += numCopies;
- }
-
- @override
- int get hashCode => _combineHashes(library.hashCode, name.hashCode);
-
- @override
- bool operator ==(other) =>
- other is _ClassHandle &&
- this.library == other.library &&
- this.name == other.name;
-
- @override
- String toString() =>
- name.name == topLevelClassName ? '$library' : '$library::${name.name}';
-}
-
-class _MemberHandle extends ObjectHandle {
- static const int flagIsField = ObjectHandle.flagBit0;
- static const int flagIsConstructor = ObjectHandle.flagBit1;
-
- int _flags = 0;
- _ClassHandle parent;
- _NameHandle name;
-
- _MemberHandle._empty();
- _MemberHandle(this.parent, this.name, bool isField, bool isConstructor) {
- if (isField) {
- _flags |= flagIsField;
- }
- if (isConstructor) {
- _flags |= flagIsConstructor;
- }
- }
-
- @override
- ObjectKind get kind => ObjectKind.kMember;
-
- @override
- int get flags => _flags;
-
- @override
- set flags(int value) {
- _flags = value;
- }
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedObject(parent);
- writer.writePackedObject(name);
- }
-
- @override
- void readContents(BufferedReader reader) {
- parent = reader.readPackedObject();
- name = reader.readPackedObject();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- parent._useCount += numCopies;
- name._useCount += numCopies;
- }
-
- @override
- int get hashCode => _combineHashes(parent.hashCode, name.hashCode);
-
- @override
- bool operator ==(other) =>
- other is _MemberHandle &&
- this.parent == other.parent &&
- this.name == other.name &&
- this.flags == other.flags;
-
- @override
- String toString() =>
- '$parent::${name.name}' +
- (flags & flagIsField != 0 ? ' (field)' : '') +
- (flags & flagIsConstructor != 0 ? ' (constructor)' : '');
-}
-
-class _ClosureHandle extends ObjectHandle {
- _MemberHandle enclosingMember;
- int closureIndex;
-
- _ClosureHandle._empty();
-
- _ClosureHandle(this.enclosingMember, this.closureIndex) {
- assert(closureIndex >= 0);
- }
-
- @override
- ObjectKind get kind => ObjectKind.kClosure;
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedObject(enclosingMember);
- writer.writePackedUInt30(closureIndex);
- }
-
- @override
- void readContents(BufferedReader reader) {
- enclosingMember = reader.readPackedObject();
- closureIndex = reader.readPackedUInt30();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- enclosingMember._useCount += numCopies;
- }
-
- @override
- int get hashCode => _combineHashes(enclosingMember.hashCode, closureIndex);
-
- @override
- bool operator ==(other) =>
- other is _ClosureHandle &&
- this.enclosingMember == other.enclosingMember &&
- this.closureIndex == other.closureIndex;
-
- @override
- String toString() => '$enclosingMember::Closure/$closureIndex';
-}
-
-abstract class _TypeHandle extends ObjectHandle {
- static const int tagMask = ObjectHandle.flagBit0 |
- ObjectHandle.flagBit1 |
- ObjectHandle.flagBit2 |
- ObjectHandle.flagBit3;
- static const int nullabilityMask =
- ObjectHandle.flagBit4 | ObjectHandle.flagBit5;
-
- final TypeTag tag;
- Nullability nullability;
-
- _TypeHandle(this.tag, this.nullability);
-
- @override
- ObjectKind get kind => ObjectKind.kType;
-
- @override
- int get flags =>
- (tag.index * ObjectHandle.flagBit0) |
- (nullability.index * ObjectHandle.flagBit4);
-
- @override
- set flags(int value) {
- if (value != flags) {
- throw 'Unable to set flags for _TypeHandle (they are occupied by type tag and nnbd)';
- }
- }
-}
-
-class _DynamicTypeHandle extends _TypeHandle {
- _DynamicTypeHandle() : super(TypeTag.kDynamic, Nullability.nullable);
-
- @override
- void writeContents(BufferedWriter writer) {}
-
- @override
- void readContents(BufferedReader reader) {}
-
- @override
- int get hashCode => 2029;
-
- @override
- bool operator ==(other) => other is _DynamicTypeHandle;
-
- @override
- String toString() => 'dynamic';
-}
-
-class _VoidTypeHandle extends _TypeHandle {
- _VoidTypeHandle() : super(TypeTag.kVoid, Nullability.nullable);
-
- @override
- void writeContents(BufferedWriter writer) {}
-
- @override
- void readContents(BufferedReader reader) {}
-
- @override
- int get hashCode => 2039;
-
- @override
- bool operator ==(other) => other is _VoidTypeHandle;
-
- @override
- String toString() => 'void';
-}
-
-class _NeverTypeHandle extends _TypeHandle {
- _NeverTypeHandle(Nullability nullability)
- : super(TypeTag.kNever, nullability);
-
- @override
- void writeContents(BufferedWriter writer) {}
-
- @override
- void readContents(BufferedReader reader) {}
-
- @override
- int get hashCode => _combineHashes(2049, nullability.index);
-
- @override
- bool operator ==(other) =>
- other is _NeverTypeHandle && this.nullability == other.nullability;
-
- @override
- String toString() => 'Never${nullabilityToString(nullability)}';
-}
-
-class _SimpleTypeHandle extends _TypeHandle {
- _ClassHandle class_;
-
- _SimpleTypeHandle._empty(Nullability nullability)
- : super(TypeTag.kSimpleType, nullability);
-
- _SimpleTypeHandle(this.class_, Nullability nullability)
- : super(TypeTag.kSimpleType, nullability);
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedObject(class_);
- }
-
- @override
- void readContents(BufferedReader reader) {
- class_ = reader.readPackedObject();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- if (class_ != null) {
- class_._useCount += numCopies;
- }
- }
-
- @override
- int get hashCode => _combineHashes(class_.hashCode, nullability.index);
-
- @override
- bool operator ==(other) =>
- other is _SimpleTypeHandle &&
- this.class_ == other.class_ &&
- this.nullability == other.nullability;
-
- @override
- String toString() => '$class_${nullabilityToString(nullability)}';
-}
-
-class _TypeParameterHandle extends _TypeHandle {
- ObjectHandle parent;
- int indexInParent;
-
- _TypeParameterHandle._empty(Nullability nullability)
- : super(TypeTag.kTypeParameter, nullability);
-
- _TypeParameterHandle(this.parent, this.indexInParent, Nullability nullability)
- : super(TypeTag.kTypeParameter, nullability) {
- assert(parent is _ClassHandle ||
- parent is _MemberHandle ||
- parent is _ClosureHandle ||
- parent == null);
- assert(indexInParent >= 0);
- }
-
- @override
- bool get isCacheable => (parent != null);
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedObject(parent);
- writer.writePackedUInt30(indexInParent);
- }
-
- @override
- void readContents(BufferedReader reader) {
- parent = reader.readPackedObject();
- indexInParent = reader.readPackedUInt30();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- if (parent != null) {
- parent._useCount += numCopies;
- }
- }
-
- @override
- int get hashCode => _combineHashes(
- parent.hashCode, _combineHashes(indexInParent, nullability.index));
-
- @override
- bool operator ==(other) =>
- other is _TypeParameterHandle &&
- this.parent == other.parent &&
- this.indexInParent == other.indexInParent &&
- this.nullability == other.nullability;
-
- @override
- String toString() =>
- '$parent::TypeParam/$indexInParent${nullabilityToString(nullability)}';
-}
-
-class _GenericTypeHandle extends _TypeHandle {
- _ClassHandle class_;
- _TypeArgumentsHandle typeArgs;
-
- _GenericTypeHandle._empty(Nullability nullability)
- : super(TypeTag.kGenericType, nullability);
-
- _GenericTypeHandle(this.class_, this.typeArgs, Nullability nullability)
- : super(TypeTag.kGenericType, nullability);
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedObject(class_);
- writer.writePackedObject(typeArgs);
- }
-
- @override
- void readContents(BufferedReader reader) {
- class_ = reader.readPackedObject();
- typeArgs = reader.readPackedObject();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- class_._useCount += numCopies;
- if (typeArgs != null) {
- typeArgs._useCount += numCopies;
- }
- }
-
- @override
- int get hashCode => _combineHashes(
- class_.hashCode, _combineHashes(typeArgs.hashCode, nullability.index));
-
- @override
- bool operator ==(other) =>
- other is _GenericTypeHandle &&
- this.class_ == other.class_ &&
- this.typeArgs == other.typeArgs &&
- this.nullability == other.nullability;
-
- @override
- String toString() => '$class_ $typeArgs${nullabilityToString(nullability)}';
-}
-
-class _RecursiveGenericTypeHandle extends _TypeHandle {
- int id;
- _ClassHandle class_;
- _TypeArgumentsHandle typeArgs;
-
- _RecursiveGenericTypeHandle._empty(Nullability nullability)
- : super(TypeTag.kRecursiveGenericType, nullability);
-
- _RecursiveGenericTypeHandle(
- this.id, this.class_, this.typeArgs, Nullability nullability)
- : super(TypeTag.kRecursiveGenericType, nullability);
-
- @override
- bool get isCacheable => (id == 0);
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedUInt30(id);
- writer.writePackedObject(class_);
- writer.writePackedObject(typeArgs);
- }
-
- @override
- void readContents(BufferedReader reader) {
- id = reader.readPackedUInt30();
- class_ = reader.readPackedObject();
- typeArgs = reader.readPackedObject();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- class_._useCount += numCopies;
- if (typeArgs != null) {
- typeArgs._useCount += numCopies;
- }
- }
-
- @override
- int get hashCode => _combineHashes(
- class_.hashCode, _combineHashes(typeArgs.hashCode, nullability.index));
-
- @override
- bool operator ==(other) =>
- other is _RecursiveGenericTypeHandle &&
- this.class_ == other.class_ &&
- this.typeArgs == other.typeArgs &&
- this.nullability == other.nullability;
-
- @override
- String toString() =>
- '(recursive #$id) $class_ $typeArgs${nullabilityToString(nullability)}';
-}
-
-class _RecursiveTypeRefHandle extends _TypeHandle {
- int id;
-
- _RecursiveTypeRefHandle._empty(Nullability nullability)
- : super(TypeTag.kRecursiveTypeRef, nullability);
-
- _RecursiveTypeRefHandle(this.id)
- : super(TypeTag.kRecursiveTypeRef, Nullability.legacy);
-
- @override
- bool get isCacheable => false;
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedUInt30(id);
- }
-
- @override
- void readContents(BufferedReader reader) {
- id = reader.readPackedUInt30();
- }
-
- @override
- int get hashCode => id;
-
- @override
- bool operator ==(other) =>
- other is _RecursiveTypeRefHandle && this.id == other.id;
-
- @override
- String toString() => 'recursive-ref #$id';
-}
-
-class NameAndType {
- _NameHandle name;
- _TypeHandle type;
-
- NameAndType(this.name, this.type);
-
- @override
- int get hashCode => _combineHashes(name.hashCode, type.hashCode);
-
- @override
- bool operator ==(other) =>
- other is NameAndType &&
- this.name == other.name &&
- this.type == other.type;
-
- @override
- String toString() => '$type ${name.name}';
-}
-
-class _FunctionTypeHandle extends _TypeHandle {
- static const int flagHasOptionalPositionalParams = 1 << 0;
- static const int flagHasOptionalNamedParams = 1 << 1;
- static const int flagHasTypeParams = 1 << 2;
-
- int functionTypeFlags = 0;
- List<NameAndType> typeParams;
- int numRequiredParams;
- List<_TypeHandle> positionalParams;
- List<NameAndType> namedParams;
- _TypeHandle returnType;
-
- _FunctionTypeHandle._empty(Nullability nullability)
- : super(TypeTag.kFunctionType, nullability);
-
- _FunctionTypeHandle(
- this.typeParams,
- this.numRequiredParams,
- this.positionalParams,
- this.namedParams,
- this.returnType,
- Nullability nullability)
- : super(TypeTag.kFunctionType, nullability) {
- assert(numRequiredParams <= positionalParams.length + namedParams.length);
- if (numRequiredParams < positionalParams.length) {
- assert(namedParams.isEmpty);
- functionTypeFlags |= flagHasOptionalPositionalParams;
- }
- if (namedParams.isNotEmpty) {
- assert(numRequiredParams == positionalParams.length);
- functionTypeFlags |= flagHasOptionalNamedParams;
- }
- if (typeParams.isNotEmpty) {
- functionTypeFlags |= flagHasTypeParams;
- }
- }
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedUInt30(functionTypeFlags);
- if ((functionTypeFlags & flagHasTypeParams) != 0) {
- new TypeParametersDeclaration(typeParams).write(writer);
- }
- writer.writePackedUInt30(positionalParams.length + namedParams.length);
- if (functionTypeFlags &
- (flagHasOptionalPositionalParams | flagHasOptionalNamedParams) !=
- 0) {
- writer.writePackedUInt30(numRequiredParams);
- }
- for (var param in positionalParams) {
- writer.writePackedObject(param);
- }
- for (var param in namedParams) {
- writer.writePackedObject(param.name);
- writer.writePackedObject(param.type);
- }
- writer.writePackedObject(returnType);
- }
-
- @override
- void readContents(BufferedReader reader) {
- functionTypeFlags = reader.readPackedUInt30();
- if ((functionTypeFlags & flagHasTypeParams) != 0) {
- typeParams = new TypeParametersDeclaration.read(reader).typeParams;
- } else {
- typeParams = const <NameAndType>[];
- }
- final int numParams = reader.readPackedUInt30();
- numRequiredParams = numParams;
- if ((functionTypeFlags &
- (flagHasOptionalPositionalParams | flagHasOptionalNamedParams)) !=
- 0) {
- numRequiredParams = reader.readPackedUInt30();
- }
- final bool hasNamedParams =
- (functionTypeFlags & flagHasOptionalNamedParams) != 0;
- positionalParams = new List<_TypeHandle>.generate(
- hasNamedParams ? numRequiredParams : numParams,
- (_) => reader.readPackedObject());
- if (hasNamedParams) {
- namedParams = new List<NameAndType>.generate(
- numParams - numRequiredParams,
- (_) => new NameAndType(
- reader.readPackedObject(), reader.readPackedObject()));
- } else {
- namedParams = const <NameAndType>[];
- }
- returnType = reader.readPackedObject();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- positionalParams.forEach((p) {
- p._useCount += numCopies;
- });
- namedParams.forEach((p) {
- p.name._useCount += numCopies;
- p.type._useCount += numCopies;
- });
- }
-
- @override
- bool get isCacheable {
- for (var param in positionalParams) {
- if (!param.isCacheable) {
- return false;
- }
- }
- for (var param in namedParams) {
- if (!param.type.isCacheable) {
- return false;
- }
- }
- if (!returnType.isCacheable) {
- return false;
- }
- return true;
- }
-
- @override
- int get hashCode {
- int hash = listHashCode(typeParams);
- hash = _combineHashes(hash, numRequiredParams);
- hash = _combineHashes(hash, listHashCode(positionalParams));
- hash = _combineHashes(hash, listHashCode(namedParams));
- hash = _combineHashes(hash, returnType.hashCode);
- hash = _combineHashes(hash, nullability.index);
- return hash;
- }
-
- @override
- bool operator ==(other) =>
- other is _FunctionTypeHandle &&
- listEquals(this.typeParams, other.typeParams) &&
- this.numRequiredParams == other.numRequiredParams &&
- listEquals(this.positionalParams, other.positionalParams) &&
- listEquals(this.namedParams, other.namedParams) &&
- this.returnType == other.returnType &&
- this.nullability == other.nullability;
-
- @override
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.write('FunctionType');
- if (typeParams.isNotEmpty) {
- sb.write(' <${typeParams.join(', ')}>');
- }
- sb.write(' (');
- sb.write(positionalParams.sublist(0, numRequiredParams).join(', '));
- if (numRequiredParams != positionalParams.length) {
- if (numRequiredParams > 0) {
- sb.write(', ');
- }
- sb.write('[ ${positionalParams.sublist(numRequiredParams).join(', ')} ]');
- }
- if (namedParams.isNotEmpty) {
- if (numRequiredParams > 0) {
- sb.write(', ');
- }
- sb.write('{ ${namedParams.join(', ')} }');
- }
- sb.write(')${nullabilityToString(nullability)} -> ');
- sb.write(returnType);
- return sb.toString();
- }
-}
-
-abstract class _NameHandle extends ObjectHandle {
- static const int flagIsPublic = ObjectHandle.flagBit0;
-
- String get name;
-
- @override
- ObjectKind get kind => ObjectKind.kName;
-
- @override
- void indexStrings(StringWriter strings) {
- strings.put(name);
- }
-
- @override
- String toString() => "'$name'";
-}
-
-class _PublicNameHandle extends _NameHandle {
- String name;
-
- _PublicNameHandle._empty();
-
- _PublicNameHandle(this.name);
-
- @override
- int get flags => _NameHandle.flagIsPublic;
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedStringReference(name);
- }
-
- @override
- void readContents(BufferedReader reader) {
- name = reader.readPackedStringReference();
- }
-
- @override
- int get hashCode => name.hashCode;
-
- @override
- bool operator ==(other) =>
- other is _PublicNameHandle && this.name == other.name;
-
- @override
- String toString() => "'$name'";
-}
-
-class _PrivateNameHandle extends _NameHandle {
- _LibraryHandle library;
- String name;
-
- _PrivateNameHandle._empty();
-
- _PrivateNameHandle(this.library, this.name) {
- assert(library != null);
- }
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedObject(library);
- writer.writePackedStringReference(name);
- }
-
- @override
- void readContents(BufferedReader reader) {
- library = reader.readPackedObject();
- name = reader.readPackedStringReference();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- library._useCount += numCopies;
- }
-
- @override
- int get hashCode => _combineHashes(name.hashCode, library.hashCode);
-
- @override
- bool operator ==(other) =>
- other is _PrivateNameHandle &&
- this.name == other.name &&
- this.library == other.library;
-
- @override
- String toString() => "'$name'";
-}
-
-class _TypeArgumentsHandle extends ObjectHandle {
- List<_TypeHandle> args;
-
- _TypeArgumentsHandle._empty();
-
- _TypeArgumentsHandle(this.args);
-
- @override
- ObjectKind get kind => ObjectKind.kTypeArguments;
-
- @override
- bool get isCacheable {
- for (var arg in args) {
- if (!arg.isCacheable) {
- return false;
- }
- }
- return true;
- }
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedList(args);
- }
-
- @override
- void readContents(BufferedReader reader) {
- args = reader.readPackedList<_TypeHandle>();
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- args.forEach((t) {
- t._useCount += numCopies;
- });
- }
-
- @override
- int get hashCode => listHashCode(args);
-
- @override
- bool operator ==(other) =>
- other is _TypeArgumentsHandle && listEquals(this.args, other.args);
-
- @override
- String toString() => '< ${args.join(', ')} >';
-}
-
-class _ConstObjectHandle extends ObjectHandle {
- ConstTag tag;
- dynamic value;
- ObjectHandle type;
- int _hashCode = 0;
-
- _ConstObjectHandle._empty();
-
- _ConstObjectHandle(this.tag, this.value, [this.type]);
-
- @override
- ObjectKind get kind => ObjectKind.kConstObject;
-
- @override
- int get flags => tag.index * ObjectHandle.flagBit0;
-
- @override
- set flags(int value) {
- tag = ConstTag.values[value ~/ ObjectHandle.flagBit0];
- assert(tag != ConstTag.kInvalid);
- }
-
- bool get isCacheable => (tag != ConstTag.kInt) && (tag != ConstTag.kBool);
-
- @override
- void writeContents(BufferedWriter writer) {
- switch (tag) {
- case ConstTag.kInt:
- writer.writeSLEB128(value as int);
- break;
- case ConstTag.kDouble:
- writer.writeSLEB128(doubleToIntBits(value as double));
- break;
- case ConstTag.kBool:
- writer.writeByte((value as bool) ? 1 : 0);
- break;
- case ConstTag.kInstance:
- {
- final fieldValues = value as Map<ObjectHandle, ObjectHandle>;
- writer.writePackedObject(type);
- writer.writePackedUInt30(fieldValues.length);
- fieldValues.forEach((ObjectHandle field, ObjectHandle value) {
- writer.writePackedObject(field);
- writer.writePackedObject(value);
- });
- }
- break;
- case ConstTag.kList:
- {
- final elems = value as List<ObjectHandle>;
- writer.writePackedObject(type);
- writer.writePackedList(elems);
- }
- break;
- case ConstTag.kTearOff:
- {
- final target = value as ObjectHandle;
- writer.writePackedObject(target);
- }
- break;
- case ConstTag.kSymbol:
- {
- final name = value as ObjectHandle;
- writer.writePackedObject(name);
- }
- break;
- case ConstTag.kTearOffInstantiation:
- {
- final tearOff = value as ObjectHandle;
- writer.writePackedObject(tearOff);
- writer.writePackedObject(type as _TypeArgumentsHandle);
- }
- break;
- case ConstTag.kString:
- writer.writePackedStringReference(value as String);
- break;
- default:
- throw 'Unexpected constant tag: $tag';
- }
- }
-
- @override
- void readContents(BufferedReader reader) {
- switch (tag) {
- case ConstTag.kInt:
- value = reader.readSLEB128();
- break;
- case ConstTag.kDouble:
- value = intBitsToDouble(reader.readSLEB128());
- break;
- case ConstTag.kBool:
- value = reader.readByte() != 0;
- break;
- case ConstTag.kInstance:
- type = reader.readPackedObject();
- value = Map<ObjectHandle, ObjectHandle>.fromEntries(
- new List<MapEntry<ObjectHandle, ObjectHandle>>.generate(
- reader.readPackedUInt30(),
- (_) => new MapEntry<ObjectHandle, ObjectHandle>(
- reader.readPackedObject(), reader.readPackedObject())));
- break;
- case ConstTag.kList:
- type = reader.readPackedObject();
- value = reader.readPackedList<ObjectHandle>();
- break;
- case ConstTag.kTearOff:
- value = reader.readPackedObject();
- break;
- case ConstTag.kSymbol:
- value = reader.readPackedObject();
- break;
- case ConstTag.kTearOffInstantiation:
- value = reader.readPackedObject();
- type = reader.readPackedObject();
- break;
- case ConstTag.kString:
- value = reader.readPackedStringReference();
- break;
- default:
- throw 'Unexpected constant tag: $tag';
- }
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- switch (tag) {
- case ConstTag.kInt:
- case ConstTag.kDouble:
- case ConstTag.kBool:
- case ConstTag.kString:
- break;
- case ConstTag.kInstance:
- {
- type._useCount += numCopies;
- final fieldValues = value as Map<ObjectHandle, ObjectHandle>;
- fieldValues.forEach((ObjectHandle field, ObjectHandle value) {
- field._useCount += numCopies;
- value?._useCount += numCopies;
- });
- }
- break;
- case ConstTag.kList:
- {
- final elems = value as List<ObjectHandle>;
- for (var elem in elems) {
- elem?._useCount += numCopies;
- }
- type._useCount += numCopies;
- }
- break;
- case ConstTag.kTearOff:
- {
- final target = value as ObjectHandle;
- target._useCount += numCopies;
- }
- break;
- case ConstTag.kSymbol:
- {
- final name = value as ObjectHandle;
- name._useCount += numCopies;
- }
- break;
- case ConstTag.kTearOffInstantiation:
- {
- final tearOff = value as ObjectHandle;
- tearOff._useCount += numCopies;
- if (type != null) {
- type._useCount += numCopies;
- }
- }
- break;
- default:
- throw 'Unexpected constant tag: $tag';
- }
- }
-
- @override
- int get hashCode {
- if (_hashCode != 0) {
- return _hashCode;
- }
- switch (tag) {
- case ConstTag.kInt:
- case ConstTag.kDouble:
- case ConstTag.kBool:
- case ConstTag.kTearOff:
- case ConstTag.kSymbol:
- case ConstTag.kString:
- return _hashCode = value.hashCode;
- case ConstTag.kInstance:
- {
- final fieldValues = value as Map<ObjectHandle, ObjectHandle>;
- return _hashCode =
- _combineHashes(type.hashCode, mapHashCode(fieldValues));
- }
- break;
- case ConstTag.kList:
- {
- final elems = value as List<ObjectHandle>;
- return _hashCode = _combineHashes(type.hashCode, listHashCode(elems));
- }
- break;
- case ConstTag.kTearOffInstantiation:
- return _hashCode = _combineHashes(value.hashCode, type.hashCode);
- default:
- throw 'Unexpected constant tag: $tag';
- }
- }
-
- @override
- bool operator ==(other) {
- if (identical(this, other)) {
- return true;
- }
- if (other is _ConstObjectHandle && this.tag == other.tag) {
- switch (tag) {
- case ConstTag.kInt:
- case ConstTag.kBool:
- case ConstTag.kTearOff:
- case ConstTag.kSymbol:
- case ConstTag.kString:
- return this.value == other.value;
- case ConstTag.kDouble:
- return this.value.compareTo(other.value) == 0;
- case ConstTag.kInstance:
- return this.type == other.type && mapEquals(this.value, other.value);
- case ConstTag.kList:
- return this.type == other.type && listEquals(this.value, other.value);
- case ConstTag.kTearOffInstantiation:
- return this.type == other.type && this.value == other.value;
- default:
- throw 'Unexpected constant tag: $tag';
- }
- }
- return false;
- }
-
- @override
- String toString() {
- switch (tag) {
- case ConstTag.kInt:
- case ConstTag.kDouble:
- case ConstTag.kBool:
- case ConstTag.kSymbol:
- return 'const $value';
- case ConstTag.kInstance:
- return 'const $type $value';
- case ConstTag.kList:
- return 'const <$type> $value';
- case ConstTag.kTearOff:
- return 'const tear-off $value';
- case ConstTag.kTearOffInstantiation:
- return 'const $type $value';
- case ConstTag.kString:
- return "'$value'";
- default:
- throw 'Unexpected constant tag: $tag';
- }
- }
-}
-
-class _ArgDescHandle extends ObjectHandle {
- static const int flagHasNamedArgs = ObjectHandle.flagBit0;
- static const int flagHasTypeArgs = ObjectHandle.flagBit1;
-
- int _flags = 0;
- int numArguments;
- int numTypeArguments;
- List<_PublicNameHandle> argNames;
-
- _ArgDescHandle._empty();
-
- _ArgDescHandle(this.numArguments, this.numTypeArguments, this.argNames) {
- if (argNames.isNotEmpty) {
- _flags |= flagHasNamedArgs;
- }
- if (numTypeArguments > 0) {
- _flags |= flagHasTypeArgs;
- }
- }
-
- @override
- ObjectKind get kind => ObjectKind.kArgDesc;
-
- @override
- int get flags => _flags;
-
- @override
- set flags(int value) {
- _flags = value;
- }
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedUInt30(numArguments);
- if ((_flags & flagHasTypeArgs) != 0) {
- writer.writePackedUInt30(numTypeArguments);
- }
- if ((_flags & flagHasNamedArgs) != 0) {
- writer.writePackedList(argNames);
- }
- }
-
- @override
- void readContents(BufferedReader reader) {
- numArguments = reader.readPackedUInt30();
- numTypeArguments =
- ((_flags & flagHasTypeArgs) != 0) ? reader.readPackedUInt30() : 0;
- argNames = ((_flags & flagHasNamedArgs) != 0)
- ? reader.readPackedList<_PublicNameHandle>()
- : null;
- }
-
- @override
- void accountUsesForObjectCopies(int numCopies) {
- if (argNames != null) {
- for (var name in argNames) {
- name._useCount += numCopies;
- }
- }
- }
-
- @override
- int get hashCode => _combineHashes(
- numArguments, _combineHashes(numTypeArguments, listHashCode(argNames)));
-
- @override
- bool operator ==(other) =>
- other is _ArgDescHandle &&
- this.numArguments == other.numArguments &&
- this.numTypeArguments == other.numTypeArguments &&
- listEquals(this.argNames, other.argNames);
-
- @override
- String toString() =>
- 'ArgDesc num-args $numArguments, num-type-args $numTypeArguments, names $argNames';
-}
-
-class _ScriptHandle extends ObjectHandle {
- static const int flagHasSourceFile = ObjectHandle.flagBit0;
-
- int _flags = 0;
- ObjectHandle uri;
- SourceFile _source;
- ForwardReference<SourceFile> _sourceForwardReference;
-
- _ScriptHandle._empty();
-
- _ScriptHandle(this.uri, this._source) {
- if (_source != null) {
- _flags |= flagHasSourceFile;
- }
- }
-
- @override
- ObjectKind get kind => ObjectKind.kScript;
-
- // Include scripts into index table if there are more than 1 reference
- // in order to make sure there are no duplicated script objects within the
- // same bytecode component.
- @override
- bool get shouldBeIncludedIntoIndexTable => _useCount > 1;
-
- @override
- int get flags => _flags;
-
- @override
- set flags(int value) {
- _flags = value;
- }
-
- SourceFile get source {
- // Unwrap forward reference on the first access.
- if (_sourceForwardReference != null) {
- _source = _sourceForwardReference.get();
- _sourceForwardReference = null;
- }
- return _source;
- }
-
- set source(SourceFile sourceFile) {
- _source = sourceFile;
- if (_source != null) {
- _flags |= flagHasSourceFile;
- } else {
- _flags &= ~flagHasSourceFile;
- }
- }
-
- @override
- void writeContents(BufferedWriter writer) {
- writer.writePackedObject(uri);
- if ((_flags & flagHasSourceFile) != 0) {
- writer.writeLinkOffset(source);
- }
- }
-
- @override
- void readContents(BufferedReader reader) {
- uri = reader.readPackedObject();
- if ((_flags & flagHasSourceFile) != 0) {
- // Script handles in the object table may be read before source files,
- // so use forwarding reference here.
- _sourceForwardReference =
- reader.readLinkOffsetAsForwardReference<SourceFile>();
- }
- }
-
- @override
- int get hashCode => uri.hashCode;
-
- @override
- bool operator ==(other) => other is _ScriptHandle && this.uri == other.uri;
-
- @override
- String toString() => "$uri${source != null ? '($source)' : ''}";
-}
-
-class ObjectTable implements ObjectWriter, ObjectReader {
- /// Object is added to an index table if it is used more than this
- /// number of times.
- static const int indexTableUseCountThreshold = 3;
-
- final List<ObjectHandle> _objects = new List<ObjectHandle>();
- final Map<ObjectHandle, ObjectHandle> _canonicalizationCache =
- <ObjectHandle, ObjectHandle>{};
- final Map<Node, ObjectHandle> _nodeCache = <Node, ObjectHandle>{};
- final Map<String, _PublicNameHandle> _publicNames =
- <String, _PublicNameHandle>{};
- List<ObjectHandle> _indexTable;
- _TypeHandle _dynamicType;
- _TypeHandle _voidType;
- _NodeVisitor _nodeVisitor;
-
- ObjectTable(CoreTypes coreTypes) {
- _dynamicType = getOrAddObject(new _DynamicTypeHandle());
- _voidType = getOrAddObject(new _VoidTypeHandle());
- _nodeVisitor = new _NodeVisitor(this, coreTypes);
- }
-
- ObjectHandle getHandle(Node node) {
- if (node == null) {
- return null;
- }
- ObjectHandle handle = _nodeCache[node];
- if (handle == null) {
- handle = node.accept(_nodeVisitor);
- if (handle != null && handle.isCacheable) {
- _nodeCache[node] = handle;
- }
- } else {
- ++handle._useCount;
- }
- return handle;
- }
-
- List<ObjectHandle> getHandles(List<Node> nodes) {
- final handles = new List<ObjectHandle>(nodes.length);
- for (int i = 0; i < nodes.length; ++i) {
- handles[i] = getHandle(nodes[i]);
- }
- return handles;
- }
-
- String mangleGetterName(String name) => 'get:$name';
-
- String mangleSetterName(String name) => 'set:$name';
-
- String mangleSelectorName(String name, bool isGetter, bool isSetter) {
- if (isGetter) {
- return mangleGetterName(name);
- } else if (isSetter) {
- return mangleSetterName(name);
- } else {
- return name;
- }
- }
-
- String mangleMemberName(Member member, bool isGetter, bool isSetter) {
- final name = member.name.text;
- if (isGetter || (member is Procedure && member.isGetter)) {
- return mangleGetterName(name);
- }
- if (isSetter || (member is Procedure && member.isSetter)) {
- return mangleSetterName(name);
- }
- return name;
- }
-
- ObjectHandle getPublicNameHandle(String name) {
- assert(name != null);
- _PublicNameHandle handle = _publicNames[name];
- if (handle == null) {
- handle = getOrAddObject(new _PublicNameHandle(name));
- _publicNames[name] = handle;
- }
- return handle;
- }
-
- ObjectHandle getNameHandle(Library library, String name) {
- if (library == null) {
- return getPublicNameHandle(name);
- }
- assert(name != null);
- final libraryHandle = library != null ? getHandle(library) : null;
- return getOrAddObject(new _PrivateNameHandle(libraryHandle, name));
- }
-
- List<_PublicNameHandle> getPublicNameHandles(List<String> names) {
- if (names.isEmpty) {
- return const <_PublicNameHandle>[];
- }
- final handles = new List<_PublicNameHandle>(names.length);
- for (int i = 0; i < names.length; ++i) {
- handles[i] = getPublicNameHandle(names[i]);
- }
- return handles;
- }
-
- ObjectHandle getConstStringHandle(String value) =>
- getOrAddObject(new _ConstObjectHandle(ConstTag.kString, value));
-
- List<ObjectHandle> getConstStringHandles(List<String> values) {
- if (values.isEmpty) {
- return const <ObjectHandle>[];
- }
- final handles = new List<ObjectHandle>(values.length);
- for (int i = 0; i < values.length; ++i) {
- handles[i] = getConstStringHandle(values[i]);
- }
- return handles;
- }
-
- ObjectHandle getSelectorNameHandle(Name name,
- {bool isGetter: false, bool isSetter: false}) {
- return getNameHandle(
- name.library, mangleSelectorName(name.text, isGetter, isSetter));
- }
-
- ObjectHandle getTopLevelClassHandle(Library library) {
- final libraryHandle = getHandle(library);
- final name = getPublicNameHandle(topLevelClassName);
- return getOrAddObject(new _ClassHandle(libraryHandle, name));
- }
-
- ObjectHandle getMemberHandle(Member member,
- {bool isGetter: false, bool isSetter: false}) {
- final parent = member.parent;
- ObjectHandle classHandle;
- if (parent is Class) {
- classHandle = getHandle(parent);
- } else if (parent is Library) {
- classHandle = getTopLevelClassHandle(parent);
- } else {
- throw "Unexpected Member's parent ${parent.runtimeType} $parent";
- }
- final nameHandle = getNameHandle(
- member.name.library, mangleMemberName(member, isGetter, isSetter));
- bool isField = member is Field && !isGetter && !isSetter;
- bool isConstructor =
- member is Constructor || (member is Procedure && member.isFactory);
- return getOrAddObject(
- new _MemberHandle(classHandle, nameHandle, isField, isConstructor));
- }
-
- ObjectHandle getTypeArgumentsHandle(List<DartType> typeArgs) {
- if (typeArgs == null) {
- return null;
- }
- final handles = new List<_TypeHandle>(typeArgs.length);
- for (int i = 0; i < typeArgs.length; ++i) {
- handles[i] = getHandle(typeArgs[i]) as _TypeHandle;
- }
- return getOrAddObject(new _TypeArgumentsHandle(handles));
- }
-
- ObjectHandle getArgDescHandle(int numArguments,
- [int numTypeArguments = 0, List<String> argNames = const <String>[]]) {
- return getOrAddObject(new _ArgDescHandle(
- numArguments, numTypeArguments, getPublicNameHandles(argNames)));
- }
-
- ObjectHandle getArgDescHandleByArguments(Arguments args,
- {bool hasReceiver: false, bool isFactory: false}) {
- List<_PublicNameHandle> argNames = const <_PublicNameHandle>[];
- final namedArguments = args.named;
- if (namedArguments.isNotEmpty) {
- argNames = new List<_PublicNameHandle>(namedArguments.length);
- for (int i = 0; i < namedArguments.length; ++i) {
- argNames[i] = getPublicNameHandle(namedArguments[i].name);
- }
- }
- final int numArguments = args.positional.length +
- args.named.length +
- (hasReceiver ? 1 : 0) +
- // VM expects that type arguments vector passed to a factory
- // constructor is counted in numArguments, and not counted in
- // numTypeArgs.
- // TODO(alexmarkov): Clean this up.
- (isFactory ? 1 : 0);
- final int numTypeArguments = isFactory ? 0 : args.types.length;
- return getOrAddObject(
- new _ArgDescHandle(numArguments, numTypeArguments, argNames));
- }
-
- ObjectHandle getScriptHandle(Uri uri, SourceFile source) {
- ObjectHandle uriHandle = getPublicNameHandle(uri.toString());
- _ScriptHandle handle = getOrAddObject(new _ScriptHandle(uriHandle, source));
- if (handle.source == null && source != null) {
- handle.source = source;
- }
- return handle;
- }
-
- List<NameAndType> getTypeParameterHandles(List<TypeParameter> typeParams) {
- if (typeParams.isEmpty) {
- return const <NameAndType>[];
- }
- final namesAndBounds = new List<NameAndType>();
- for (TypeParameter tp in typeParams) {
- namesAndBounds.add(
- new NameAndType(getPublicNameHandle(tp.name), getHandle(tp.bound)));
- }
- return namesAndBounds;
- }
-
- void declareClosure(
- FunctionNode function, Member enclosingMember, int closureIndex) {
- final handle = getOrAddObject(
- new _ClosureHandle(getHandle(enclosingMember), closureIndex));
- _nodeCache[function] = handle;
- }
-
- ObjectHandle getOrAddObject(ObjectHandle obj) {
- assert(obj._useCount == 0);
- ObjectHandle canonical = _canonicalizationCache[obj];
- if (canonical == null) {
- assert(_indexTable == null);
- _objects.add(obj);
- _canonicalizationCache[obj] = obj;
- canonical = obj;
- }
- ++canonical._useCount;
- return canonical;
- }
-
- void allocateIndexTable() {
- int tableSize = 1; // Reserve invalid entry.
- for (var obj in _objects.reversed) {
- assert(obj._reference == null);
- if (obj.shouldBeIncludedIntoIndexTable) {
- // This object will be included into index table.
- ++tableSize;
- } else {
- // This object will be copied and written inline. Bump use count for
- // objects referenced from this one for each copy after the first.
- obj._reference = ObjectHandle.inlineObject;
- obj.accountUsesForObjectCopies(obj._useCount - 1);
- }
- }
- _indexTable = new List<ObjectHandle>(tableSize);
- int count = 0;
- _indexTable[count++] = new _InvalidHandle()
- .._reference = ObjectHandle._makeReference(0);
- for (var obj in _objects) {
- if (obj._reference == null) {
- obj._reference = ObjectHandle._makeReference(count);
- _indexTable[count++] = obj;
- } else {
- assert(obj._reference == ObjectHandle.inlineObject);
- }
- }
- assert(count == tableSize);
- }
-
- @override
- void writeObject(BytecodeObject object, BufferedWriter writer) {
- ObjectHandle handle = object as ObjectHandle;
- if (handle == null) {
- writer.writePackedUInt30(ObjectHandle._makeReference(0));
- return;
- }
- if (handle._reference == ObjectHandle.inlineObject) {
- handle._write(writer);
- } else {
- assert(handle._reference >= 0);
- assert((handle._reference & ObjectHandle.referenceBit) != 0);
- writer.writePackedUInt30(handle._reference);
- }
- }
-
- @override
- BytecodeObject readObject(BufferedReader reader) {
- final int header = reader.readPackedUInt30();
- if ((header & ObjectHandle.referenceBit) == 0) {
- return new ObjectHandle._read(reader, header);
- } else {
- final int index = ObjectHandle._getIndexFromReference(header);
- return (index == 0) ? null : _indexTable[index];
- }
- }
-
- void write(BufferedWriter writer) {
- assert(writer.objectWriter == this);
- assert(_indexTable != null);
- final start = writer.offset;
- if (BytecodeSizeStatistics.objectTableStats.isEmpty) {
- for (var kind in ObjectKind.values) {
- BytecodeSizeStatistics.objectTableStats
- .add(new NamedEntryStatistics(objectKindToString(kind)));
- }
- }
-
- BufferedWriter contentsWriter = new BufferedWriter.fromWriter(writer);
- List<int> offsets = new List<int>(_indexTable.length);
-
- for (int i = 0; i < _indexTable.length; ++i) {
- offsets[i] = contentsWriter.offset;
- _indexTable[i]._write(contentsWriter);
-
- final entryStat =
- BytecodeSizeStatistics.objectTableStats[_indexTable[i].kind.index];
- entryStat.size += (contentsWriter.offset - offsets[i]);
- ++entryStat.count;
- }
-
- writer.writePackedUInt30(_indexTable.length);
- writer.writePackedUInt30(contentsWriter.offset);
- writer.appendWriter(contentsWriter);
- for (var offs in offsets) {
- writer.writePackedUInt30(offs);
- }
-
- // Index strings in objects which will be written inline
- // in constant pool entries.
- for (var obj in _objects) {
- if (obj._reference == ObjectHandle.inlineObject) {
- obj.indexStrings(writer.stringWriter);
- }
- }
-
- BytecodeSizeStatistics.objectTableSize += (writer.offset - start);
- BytecodeSizeStatistics.objectTableEntriesCount += _indexTable.length;
- }
-
- ObjectTable.read(BufferedReader reader) {
- reader.objectReader = this;
-
- final int numEntries = reader.readPackedUInt30();
- reader.readPackedUInt30(); // Contents length
-
- _indexTable = new List<ObjectHandle>(numEntries);
- for (int i = 0; i < numEntries; ++i) {
- final int header = reader.readPackedUInt30();
- _indexTable[i] = new ObjectHandle._read(reader, header)
- .._reference = ObjectHandle._makeReference(i);
- }
- // Skip index table.
- for (int i = 0; i < numEntries; ++i) {
- reader.readPackedUInt30();
- }
- }
-
- @override
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.writeln('ObjectTable {');
- for (int i = 0; i < _indexTable.length; ++i) {
- final obj = _indexTable[i];
- sb.writeln(' [$i] = ${objectKindToString(obj.kind)} $obj');
- }
- sb.writeln('}');
- return sb.toString();
- }
-}
-
-class _NodeVisitor extends Visitor<ObjectHandle> {
- final ObjectTable objectTable;
- final CoreTypes coreTypes;
- final _typeParameters = <TypeParameter, ObjectHandle>{};
- final Map<DartType, int> _recursiveTypeIds = <DartType, int>{};
- final recursiveTypesValidator;
-
- _NodeVisitor(this.objectTable, this.coreTypes)
- : recursiveTypesValidator = new RecursiveTypesValidator(coreTypes);
-
- @override
- ObjectHandle defaultNode(Node node) =>
- throw 'Unexpected node ${node.runtimeType} $node';
-
- @override
- ObjectHandle visitLibrary(Library node) {
- final uri = objectTable.getConstStringHandle(node.importUri.toString());
- return objectTable.getOrAddObject(new _LibraryHandle(uri));
- }
-
- @override
- ObjectHandle visitClass(Class node) {
- final ObjectHandle library = objectTable.getHandle(node.enclosingLibrary);
- final name = node.name.startsWith('_')
- ? objectTable.getOrAddObject(new _PrivateNameHandle(library, node.name))
- : objectTable.getPublicNameHandle(node.name);
- return objectTable.getOrAddObject(new _ClassHandle(library, name));
- }
-
- @override
- ObjectHandle defaultMember(Member node) => objectTable.getMemberHandle(node);
-
- @override
- ObjectHandle visitDynamicType(DynamicType node) => objectTable._dynamicType;
-
- @override
- ObjectHandle visitVoidType(VoidType node) => objectTable._voidType;
-
- @override
- ObjectHandle visitNeverType(NeverType node) =>
- objectTable.getOrAddObject(new _NeverTypeHandle(node.nullability));
-
- @override
- ObjectHandle visitBottomType(BottomType node) =>
- // Map Bottom type to Null type until not emitted by CFE anymore.
- objectTable.getHandle(coreTypes.nullType);
-
- @override
- ObjectHandle visitInterfaceType(InterfaceType node) {
- final classHandle = objectTable.getHandle(node.classNode);
- if (!hasInstantiatorTypeArguments(node.classNode)) {
- return objectTable
- .getOrAddObject(new _SimpleTypeHandle(classHandle, node.nullability));
- }
-
- // Non-finalized types are not recursive, but finalization of
- // generic types includes flattening of type arguments and types could
- // become recursive. Consider the following example:
- //
- // class Base<T> {}
- // class Foo<T> extends Base<Foo<T>> {}
- //
- // Foo<int> is not recursive, but finalized type is recursive:
- // Foo<int>* = Foo [ Base [ Foo<int>* ], int ]
- //
- // Object table serialization/deserialization cannot handle cycles between
- // objects, so recursive types require extra care when serializing.
- // Back references to the already serialized types are represented as
- // _RecursiveTypeRefHandle objects, which are only valid in the context
- // of enclosing top-level _RecursiveGenericType.
- //
- int recursiveId = _recursiveTypeIds[node];
- if (recursiveId != null) {
- return objectTable
- .getOrAddObject(new _RecursiveTypeRefHandle(recursiveId));
- }
-
- recursiveTypesValidator.validateType(node);
-
- final isRecursive = recursiveTypesValidator.isRecursive(node);
- if (isRecursive) {
- recursiveId = _recursiveTypeIds.length;
- _recursiveTypeIds[node] = recursiveId;
- }
-
- List<DartType> instantiatorArgs =
- getInstantiatorTypeArguments(node.classNode, node.typeArguments);
- ObjectHandle typeArgsHandle =
- objectTable.getTypeArgumentsHandle(instantiatorArgs);
-
- final result = objectTable.getOrAddObject(isRecursive
- ? new _RecursiveGenericTypeHandle(
- recursiveId, classHandle, typeArgsHandle, node.nullability)
- : new _GenericTypeHandle(
- classHandle, typeArgsHandle, node.nullability));
-
- if (isRecursive) {
- _recursiveTypeIds.remove(node);
- }
-
- return result;
- }
-
- @override
- ObjectHandle visitFutureOrType(FutureOrType node) {
- final classNode = coreTypes.deprecatedFutureOrClass;
- final classHandle = objectTable.getHandle(classNode);
- List<DartType> instantiatorArgs =
- getInstantiatorTypeArguments(classNode, [node.typeArgument]);
- ObjectHandle typeArgsHandle =
- objectTable.getTypeArgumentsHandle(instantiatorArgs);
- final result = objectTable.getOrAddObject(
- new _GenericTypeHandle(classHandle, typeArgsHandle, node.nullability));
- return result;
- }
-
- @override
- ObjectHandle visitTypeParameterType(TypeParameterType node) {
- final param = node.parameter;
- final handle = _typeParameters[param];
- if (handle != null) {
- final typeParameterHandle = handle as _TypeParameterHandle;
- if (typeParameterHandle.nullability == node.nullability) {
- return handle;
- }
- return objectTable.getOrAddObject(new _TypeParameterHandle(
- typeParameterHandle.parent,
- typeParameterHandle.indexInParent,
- node.nullability));
- }
-
- final parent = param.parent;
- if (parent == null) {
- throw 'Type parameter $param without parent, but not declared by function type';
- }
-
- ObjectHandle parentHandle;
- int indexInParent;
- if (parent is Class) {
- parentHandle = objectTable.getHandle(parent);
- indexInParent = parent.typeParameters.indexOf(param);
- if (indexInParent < 0) {
- throw 'Type parameter $param is not found in its parent class $parent';
- }
- } else if (parent is FunctionNode) {
- final funcParent = parent.parent;
- if (funcParent is Member) {
- parentHandle = objectTable.getHandle(funcParent);
- } else if (funcParent is FunctionExpression ||
- funcParent is FunctionDeclaration) {
- parentHandle = objectTable.getHandle(parent);
- } else {
- throw 'Unexpected parent of FunctionNode: ${funcParent.runtimeType} $funcParent';
- }
- indexInParent = parent.typeParameters.indexOf(node.parameter);
- if (indexInParent < 0) {
- throw 'Type parameter $param is not found in its parent function $parent';
- }
- } else {
- throw 'Unexpected parent of TypeParameter: ${parent.runtimeType} $parent';
- }
- return objectTable.getOrAddObject(new _TypeParameterHandle(
- parentHandle, indexInParent, node.nullability));
- }
-
- @override
- ObjectHandle visitFunctionType(FunctionType node) {
- final int numEnclosingTypeParameters = _typeParameters.length;
- for (int i = 0; i < node.typeParameters.length; ++i) {
- _typeParameters[node.typeParameters[i]] = objectTable.getOrAddObject(
- new _TypeParameterHandle(
- null, numEnclosingTypeParameters + i, Nullability.legacy));
- // Nullability.legacy is a dummy value, since TypeParameter does not
- // specify nullability, only the reference to a TypeParameter does, i.e.
- // TypeParameterType.
- }
-
- final positionalParams = new List<_TypeHandle>();
- for (var param in node.positionalParameters) {
- positionalParams.add(objectTable.getHandle(param));
- }
- final namedParams = new List<NameAndType>();
- for (var param in node.namedParameters) {
- namedParams.add(new NameAndType(
- objectTable.getPublicNameHandle(param.name),
- objectTable.getHandle(param.type)));
- }
- final returnType = objectTable.getHandle(node.returnType);
-
- final result = objectTable.getOrAddObject(new _FunctionTypeHandle(
- objectTable.getTypeParameterHandles(node.typeParameters),
- node.requiredParameterCount,
- positionalParams,
- namedParams,
- returnType,
- node.nullability));
-
- for (int i = 0; i < node.typeParameters.length; ++i) {
- _typeParameters.remove(node.typeParameters[i]);
- }
-
- return result;
- }
-
- @override
- ObjectHandle visitTypedefType(TypedefType node) =>
- objectTable.getHandle(node.unalias);
-
- @override
- ObjectHandle visitNullConstant(NullConstant node) => null;
-
- @override
- ObjectHandle visitBoolConstant(BoolConstant node) => objectTable
- .getOrAddObject(new _ConstObjectHandle(ConstTag.kBool, node.value));
-
- @override
- ObjectHandle visitIntConstant(IntConstant node) => objectTable
- .getOrAddObject(new _ConstObjectHandle(ConstTag.kInt, node.value));
-
- @override
- ObjectHandle visitDoubleConstant(DoubleConstant node) => objectTable
- .getOrAddObject(new _ConstObjectHandle(ConstTag.kDouble, node.value));
-
- @override
- ObjectHandle visitStringConstant(StringConstant node) =>
- objectTable.getConstStringHandle(node.value);
-
- @override
- ObjectHandle visitSymbolConstant(SymbolConstant node) =>
- objectTable.getOrAddObject(new _ConstObjectHandle(
- ConstTag.kSymbol,
- objectTable.getNameHandle(
- node.libraryReference?.asLibrary, node.name)));
-
- @override
- ObjectHandle visitListConstant(ListConstant node) =>
- objectTable.getOrAddObject(new _ConstObjectHandle(
- ConstTag.kList,
- objectTable.getHandles(node.entries),
- objectTable.getHandle(node.typeArgument)));
-
- @override
- ObjectHandle visitInstanceConstant(InstanceConstant node) =>
- objectTable.getOrAddObject(new _ConstObjectHandle(
- ConstTag.kInstance,
- node.fieldValues.map<ObjectHandle, ObjectHandle>(
- (Reference fieldRef, Constant value) => new MapEntry(
- objectTable.getHandle(fieldRef.asField),
- objectTable.getHandle(value))),
- objectTable.getHandle(new InterfaceType(
- node.classNode, Nullability.legacy, node.typeArguments))));
-
- @override
- ObjectHandle visitTearOffConstant(TearOffConstant node) =>
- objectTable.getOrAddObject(new _ConstObjectHandle(
- ConstTag.kTearOff, objectTable.getHandle(node.procedure)));
-
- @override
- ObjectHandle visitTypeLiteralConstant(TypeLiteralConstant node) =>
- objectTable.getHandle(node.type);
-
- @override
- ObjectHandle visitPartialInstantiationConstant(
- PartialInstantiationConstant node) =>
- objectTable.getOrAddObject(new _ConstObjectHandle(
- ConstTag.kTearOffInstantiation,
- objectTable.getHandle(node.tearOffConstant),
- objectTable.getTypeArgumentsHandle(node.types)));
-}
-
-int _combineHashes(int hash1, int hash2) =>
- (((hash1 * 31) & 0x3fffffff) + hash2) & 0x3fffffff;
diff --git a/pkg/vm/lib/bytecode/options.dart b/pkg/vm/lib/bytecode/options.dart
deleted file mode 100644
index 1eedd8d..0000000
--- a/pkg/vm/lib/bytecode/options.dart
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2019, 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 vm.bytecode.options;
-
-/// Collection of options for bytecode generator.
-class BytecodeOptions {
- static Map<String, String> commandLineFlags = {
- 'annotations': 'Emit Dart annotations',
- 'local-var-info': 'Emit debug information about local variables',
- 'debugger-stops': 'Emit bytecode instructions for stopping in the debugger',
- 'show-bytecode-size-stat': 'Show bytecode size breakdown',
- 'source-positions': 'Emit source positions',
- 'instance-field-initializers': 'Emit separate instance field initializers',
- 'keep-unreachable-code':
- 'Do not remove unreachable code (useful if collecting code coverage)',
- 'avoid-closure-call-instructions':
- 'Do not emit closure call instructions (useful if collecting code '
- 'coverage, as closure call instructions are not tracked by code '
- 'coverage)',
- };
-
- bool enableAsserts;
- bool causalAsyncStacks;
- bool emitSourcePositions;
- bool emitSourceFiles;
- bool emitLocalVarInfo;
- bool emitDebuggerStops;
- bool emitAnnotations;
- bool emitInstanceFieldInitializers;
- bool omitAssertSourcePositions;
- bool keepUnreachableCode;
- bool avoidClosureCallInstructions;
- bool showBytecodeSizeStatistics;
- Map<String, String> environmentDefines;
-
- BytecodeOptions(
- {this.enableAsserts = false,
- this.causalAsyncStacks,
- this.emitSourcePositions = false,
- this.emitSourceFiles = false,
- this.emitLocalVarInfo = false,
- this.emitDebuggerStops = false,
- this.emitAnnotations = false,
- this.emitInstanceFieldInitializers = false,
- this.omitAssertSourcePositions = false,
- this.keepUnreachableCode = false,
- this.avoidClosureCallInstructions = false,
- this.showBytecodeSizeStatistics = false,
- bool aot = false,
- this.environmentDefines = const <String, String>{}}) {
- causalAsyncStacks ??=
- environmentDefines['dart.developer.causal_async_stacks'] == 'true';
- if (aot) {
- emitSourcePositions = true;
- emitLocalVarInfo = true;
- causalAsyncStacks = true;
- }
- }
-
- void parseCommandLineFlags(List<String> flags) {
- if (flags == null) {
- return;
- }
- for (String flag in flags) {
- switch (flag) {
- case 'source-positions':
- emitSourcePositions = true;
- break;
- case 'local-var-info':
- emitLocalVarInfo = true;
- break;
- case 'debugger-stops':
- emitDebuggerStops = true;
- break;
- case 'annotations':
- emitAnnotations = true;
- break;
- case 'instance-field-initializers':
- emitInstanceFieldInitializers = true;
- break;
- case 'keep-unreachable-code':
- keepUnreachableCode = true;
- break;
- case 'avoid-closure-call-instructions':
- avoidClosureCallInstructions = true;
- break;
- case 'show-bytecode-size-stat':
- showBytecodeSizeStatistics = true;
- break;
- default:
- throw 'Unexpected bytecode flag $flag';
- }
- }
- }
-}
diff --git a/pkg/vm/lib/bytecode/recognized_methods.dart b/pkg/vm/lib/bytecode/recognized_methods.dart
deleted file mode 100644
index f73ce50..0000000
--- a/pkg/vm/lib/bytecode/recognized_methods.dart
+++ /dev/null
@@ -1,107 +0,0 @@
-// 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.
-
-library vm.bytecode.recognized_methods;
-
-import 'package:kernel/ast.dart';
-import 'package:kernel/type_environment.dart' show StaticTypeContext;
-
-import 'dbc.dart';
-import 'generics.dart' show getStaticType;
-
-class RecognizedMethods {
- static const binaryIntOps = <String, Opcode>{
- '+': Opcode.kAddInt,
- '-': Opcode.kSubInt,
- '*': Opcode.kMulInt,
- '~/': Opcode.kTruncDivInt,
- '%': Opcode.kModInt,
- '&': Opcode.kBitAndInt,
- '|': Opcode.kBitOrInt,
- '^': Opcode.kBitXorInt,
- '<<': Opcode.kShlInt,
- '>>': Opcode.kShrInt,
- '==': Opcode.kCompareIntEq,
- '>': Opcode.kCompareIntGt,
- '<': Opcode.kCompareIntLt,
- '>=': Opcode.kCompareIntGe,
- '<=': Opcode.kCompareIntLe,
- };
-
- static const binaryDoubleOps = <String, Opcode>{
- '+': Opcode.kAddDouble,
- '-': Opcode.kSubDouble,
- '*': Opcode.kMulDouble,
- '/': Opcode.kDivDouble,
- '==': Opcode.kCompareDoubleEq,
- '>': Opcode.kCompareDoubleGt,
- '<': Opcode.kCompareDoubleLt,
- '>=': Opcode.kCompareDoubleGe,
- '<=': Opcode.kCompareDoubleLe,
- };
-
- final StaticTypeContext staticTypeContext;
-
- RecognizedMethods(this.staticTypeContext);
-
- DartType staticType(Expression expr) =>
- getStaticType(expr, staticTypeContext);
-
- bool isInt(DartType type) =>
- type == staticTypeContext.typeEnvironment.coreTypes.intLegacyRawType;
-
- bool isDouble(DartType type) =>
- type == staticTypeContext.typeEnvironment.coreTypes.doubleLegacyRawType;
-
- Opcode specializedBytecodeFor(MethodInvocation node) {
- final args = node.arguments;
- if (!args.named.isEmpty) {
- return null;
- }
-
- final Expression receiver = node.receiver;
- final String selector = node.name.text;
-
- switch (args.positional.length) {
- case 0:
- return specializedBytecodeForUnaryOp(selector, receiver);
- case 1:
- return specializedBytecodeForBinaryOp(
- selector, receiver, args.positional.single);
- default:
- return null;
- }
- }
-
- Opcode specializedBytecodeForUnaryOp(String selector, Expression arg) {
- if (selector == 'unary-') {
- final argType = staticType(arg);
- if (isInt(argType)) {
- return Opcode.kNegateInt;
- } else if (isDouble(argType)) {
- return Opcode.kNegateDouble;
- }
- }
-
- return null;
- }
-
- Opcode specializedBytecodeForBinaryOp(
- String selector, Expression a, Expression b) {
- if (selector == '==' && (a is NullLiteral || b is NullLiteral)) {
- return Opcode.kEqualsNull;
- }
-
- final aType = staticType(a);
- final bType = staticType(b);
-
- if (isInt(aType) && isInt(bType)) {
- return binaryIntOps[selector];
- }
- if (isDouble(aType) && isDouble(bType)) {
- return binaryDoubleOps[selector];
- }
- return null;
- }
-}
diff --git a/pkg/vm/lib/bytecode/recursive_types_validator.dart b/pkg/vm/lib/bytecode/recursive_types_validator.dart
deleted file mode 100644
index 66512be..0000000
--- a/pkg/vm/lib/bytecode/recursive_types_validator.dart
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright (c) 2019, 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 vm.bytecode.recursive_types_validator;
-
-import 'package:kernel/ast.dart' hide MapEntry;
-import 'package:kernel/core_types.dart' show CoreTypes;
-import 'package:kernel/type_algebra.dart' show Substitution;
-
-import 'generics.dart'
- show flattenInstantiatorTypeArguments, hasFreeTypeParameters;
-
-/// Detect recursive types and validates that finalized (flattened)
-/// representation of generic types is valid (finite).
-class RecursiveTypesValidator {
- final CoreTypes coreTypes;
- final Set<DartType> _validatedTypes = <DartType>{};
- final Set<DartType> _recursiveTypes = <DartType>{};
- final Set<Class> _validatedClases = <Class>{};
-
- RecursiveTypesValidator(this.coreTypes);
-
- /// Validates [type].
- void validateType(DartType type) {
- if (!isValidated(type)) {
- final visitor = new _RecursiveTypesVisitor(this);
- visitor.visit(type);
- _validatedTypes.addAll(visitor.validated);
- _recursiveTypes.addAll(visitor.recursive);
- }
- }
-
- bool isValidated(DartType type) => _validatedTypes.contains(type);
-
- /// Returns true if [type] is recursive.
- /// Should be called only after validating [type].
- bool isRecursive(DartType type) {
- assert(isValidated(type));
- return _recursiveTypes.contains(type);
- }
-
- void validateClass(Class cls) {
- if (_validatedClases.add(cls)) {
- try {
- validateType(
- cls.getThisType(coreTypes, cls.enclosingLibrary.nonNullable));
- } on IllegalRecursiveTypeException catch (e) {
- _validatedClases.remove(cls);
- throw e;
- }
- }
- }
-}
-
-class IllegalRecursiveTypeException {
- final DartType type;
- IllegalRecursiveTypeException(this.type);
-}
-
-class _RecursiveTypesVisitor extends DartTypeVisitor<void> {
- final RecursiveTypesValidator validator;
- final Set<DartType> validated = <DartType>{};
- final Set<DartType> recursive = <DartType>{};
- final Set<DartType> _visited = new Set<DartType>();
- final List<DartType> _stack = <DartType>[];
-
- _RecursiveTypesVisitor(this.validator);
-
- void visit(DartType type) {
- if (validator.isValidated(type)) {
- return;
- }
-
- if (!_visited.add(type)) {
- final int start = _stack.lastIndexOf(type);
- _verifyRecursiveType(start, type);
- for (int i = start; i < _stack.length; ++i) {
- recursive.add(_stack[i]);
- }
- return;
- }
-
- _stack.add(type);
-
- type.accept(this);
-
- _stack.removeLast();
- _visited.remove(type);
-
- validated.add(type);
- }
-
- @override
- void defaultDartType(DartType node) =>
- throw 'Unexpected type ${node.runtimeType} $node';
-
- @override
- void visitInvalidType(InvalidType node) {}
-
- @override
- void visitDynamicType(DynamicType node) {}
-
- @override
- void visitVoidType(VoidType node) {}
-
- @override
- void visitBottomType(BottomType node) {}
-
- @override
- void visitNeverType(NeverType node) {}
-
- @override
- void visitTypeParameterType(TypeParameterType node) {}
-
- @override
- void visitInterfaceType(InterfaceType node) {
- // Validate class declaration type separately
- // to avoid failures due to types in the current _stack.
- validator.validateClass(node.classNode);
-
- for (var typeArg in node.typeArguments) {
- visit(typeArg);
- }
- final flatTypeArgs =
- flattenInstantiatorTypeArguments(node.classNode, node.typeArguments);
- for (var typeArg in flatTypeArgs.getRange(
- 0, flatTypeArgs.length - node.typeArguments.length)) {
- visit(typeArg);
- }
- }
-
- @override
- void visitFutureOrType(FutureOrType node) {
- visit(node.typeArgument);
- }
-
- @override
- void visitTypedefType(TypedefType node) => visit(node.unalias);
-
- @override
- void visitFunctionType(FunctionType node) {
- for (var p in node.positionalParameters) {
- visit(p);
- }
- for (var p in node.namedParameters) {
- visit(p.type);
- }
- visit(node.returnType);
- }
-
- void _verifyRecursiveType(int start, DartType type) {
- if (type is InterfaceType) {
- if (!hasFreeTypeParameters(type.typeArguments)) {
- return;
- }
-
- for (int i = start + 1; i < _stack.length; ++i) {
- final other = _stack[i];
- if (other is InterfaceType &&
- other.classNode == type.classNode &&
- hasFreeTypeParameters(other.typeArguments)) {
- if (!listEquals(_eraseTypeParameters(type.typeArguments),
- _eraseTypeParameters(other.typeArguments))) {
- throw IllegalRecursiveTypeException(type);
- }
- }
- }
- } else {
- throw 'Unexpected recursive type ${type.runtimeType} $type';
- }
- }
-
- List<DartType> _eraseTypeParameters(List<DartType> typeArgs) {
- return typeArgs
- .map((DartType t) =>
- const _EraseTypeParametersToDynamic().substituteType(t))
- .toList();
- }
-}
-
-class _EraseTypeParametersToDynamic extends Substitution {
- const _EraseTypeParametersToDynamic();
-
- DartType getSubstitute(TypeParameter parameter, bool upperBound) {
- return const DynamicType();
- }
-}
diff --git a/pkg/vm/lib/bytecode/source_positions.dart b/pkg/vm/lib/bytecode/source_positions.dart
deleted file mode 100644
index 9cf138c..0000000
--- a/pkg/vm/lib/bytecode/source_positions.dart
+++ /dev/null
@@ -1,125 +0,0 @@
-// 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.
-
-library vm.bytecode.source_positions;
-
-import 'bytecode_serialization.dart'
- show
- BufferedWriter,
- BufferedReader,
- BytecodeDeclaration,
- PackedUInt30DeltaEncoder,
- PackedUInt30DeltaDecoder,
- SLEB128DeltaEncoder,
- SLEB128DeltaDecoder;
-
-/// Maintains mapping between bytecode instructions and source positions.
-class SourcePositions extends BytecodeDeclaration {
- // Special value of fileOffset which marks synthetic code without source
- // position.
- static const syntheticCodeMarker = -1;
- // Special value of fileOffset which marks yield point.
- static const yieldPointMarker = -2;
-
- final List<int> _positions = <int>[]; // Pairs (PC, fileOffset).
- int _lastPc = 0;
- int _lastOffset = 0;
-
- SourcePositions();
-
- void add(int pc, int fileOffset) {
- assert(pc > _lastPc);
- assert((fileOffset >= 0) || (fileOffset == syntheticCodeMarker));
- if (fileOffset != _lastOffset) {
- _positions.add(pc);
- _positions.add(fileOffset);
- _lastPc = pc;
- _lastOffset = fileOffset;
- }
- }
-
- void addYieldPoint(int pc, int fileOffset) {
- assert(pc > _lastPc);
- assert((fileOffset >= 0) || (fileOffset == syntheticCodeMarker));
- _positions.add(pc);
- _positions.add(yieldPointMarker);
- _positions.add(pc);
- _positions.add(fileOffset);
- _lastPc = pc;
- _lastOffset = fileOffset;
- }
-
- bool get isEmpty => _positions.isEmpty;
- bool get isNotEmpty => !isEmpty;
-
- void write(BufferedWriter writer) {
- writer.writePackedUInt30(_positions.length ~/ 2);
- final encodePC = new PackedUInt30DeltaEncoder();
- final encodeOffset = new SLEB128DeltaEncoder();
- for (int i = 0; i < _positions.length; i += 2) {
- final int pc = _positions[i];
- final int fileOffset = _positions[i + 1];
- encodePC.write(writer, pc);
- encodeOffset.write(writer, fileOffset);
- }
- }
-
- SourcePositions.read(BufferedReader reader) {
- final int length = reader.readPackedUInt30();
- final decodePC = new PackedUInt30DeltaDecoder();
- final decodeOffset = new SLEB128DeltaDecoder();
- for (int i = 0; i < length; ++i) {
- int pc = decodePC.read(reader);
- int fileOffset = decodeOffset.read(reader);
- _positions.add(pc);
- _positions.add(fileOffset);
- }
- }
-
- @override
- String toString() => _positions.toString();
-
- Map<int, String> getBytecodeAnnotations() {
- final map = <int, String>{};
- for (int i = 0; i < _positions.length; i += 2) {
- final int pc = _positions[i];
- final int fileOffset = _positions[i + 1];
- final entry = (fileOffset == yieldPointMarker)
- ? 'yield point'
- : 'source position $fileOffset';
- if (map[pc] == null) {
- map[pc] = entry;
- } else {
- map[pc] = "${map[pc]}; $entry";
- }
- }
- return map;
- }
-}
-
-/// Keeps file offsets of line starts. This information is used to
-/// decode source positions to line/column.
-class LineStarts extends BytecodeDeclaration {
- final List<int> lineStarts;
-
- LineStarts(this.lineStarts);
-
- void write(BufferedWriter writer) {
- writer.writePackedUInt30(lineStarts.length);
- final encodeLineStarts = new PackedUInt30DeltaEncoder();
- for (int lineStart in lineStarts) {
- encodeLineStarts.write(writer, lineStart);
- }
- }
-
- factory LineStarts.read(BufferedReader reader) {
- final decodeLineStarts = new PackedUInt30DeltaDecoder();
- final lineStarts = new List<int>.generate(
- reader.readPackedUInt30(), (_) => decodeLineStarts.read(reader));
- return new LineStarts(lineStarts);
- }
-
- @override
- String toString() => 'Line starts: $lineStarts';
-}
diff --git a/pkg/vm/lib/kernel_front_end.dart b/pkg/vm/lib/kernel_front_end.dart
index a3e2edd..c123f75 100644
--- a/pkg/vm/lib/kernel_front_end.dart
+++ b/pkg/vm/lib/kernel_front_end.dart
@@ -47,10 +47,6 @@
import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget;
import 'package:package_config/package_config.dart' show loadPackageConfigUri;
-import 'bytecode/bytecode_serialization.dart' show BytecodeSizeStatistics;
-import 'bytecode/gen_bytecode.dart'
- show generateBytecode, createFreshComponentWithBytecode;
-import 'bytecode/options.dart' show BytecodeOptions;
import 'http_filesystem.dart' show HttpAwareFileSystem;
import 'target/install.dart' show installAdditionalTargets;
import 'transformations/devirtualization.dart' as devirtualization
@@ -129,14 +125,6 @@
args.addOption('data-dir',
help: 'Name of the subdirectory of //data for output files');
args.addOption('manifest', help: 'Path to output Fuchsia package manifest');
- args.addFlag('gen-bytecode', help: 'Generate bytecode', defaultsTo: false);
- args.addMultiOption('bytecode-options',
- help: 'Specify options for bytecode generation:',
- valueHelp: 'opt1,opt2,...',
- allowed: BytecodeOptions.commandLineFlags.keys,
- allowedHelp: BytecodeOptions.commandLineFlags);
- args.addFlag('drop-ast',
- help: 'Include only bytecode into the output file', defaultsTo: true);
args.addMultiOption('enable-experiment',
help: 'Comma separated list of experimental features to enable.');
args.addFlag('help',
@@ -184,8 +172,6 @@
final bool tfa = options['tfa'];
final bool linkPlatform = options['link-platform'];
final bool embedSources = options['embed-sources'];
- final bool genBytecode = options['gen-bytecode'];
- final bool dropAST = options['drop-ast'];
final bool enableAsserts = options['enable-asserts'];
final bool nullSafety = options['sound-null-safety'];
final bool useProtobufTreeShaker = options['protobuf-tree-shaker'];
@@ -215,13 +201,6 @@
}
}
- final BytecodeOptions bytecodeOptions = new BytecodeOptions(
- enableAsserts: enableAsserts,
- emitSourceFiles: embedSources,
- environmentDefines: environmentDefines,
- aot: aot,
- )..parseCommandLineFlags(options['bytecode-options']);
-
final fileSystem =
createFrontEndFileSystem(fileSystemScheme, fileSystemRoots);
@@ -276,9 +255,6 @@
useGlobalTypeFlowAnalysis: tfa,
environmentDefines: environmentDefines,
enableAsserts: enableAsserts,
- genBytecode: genBytecode,
- bytecodeOptions: bytecodeOptions,
- dropAST: dropAST && !splitOutputByPackages,
useProtobufTreeShaker: useProtobufTreeShaker,
useProtobufTreeShakerV2: useProtobufTreeShakerV2,
minimalKernel: minimalKernel,
@@ -291,20 +267,12 @@
return compileTimeErrorExitCode;
}
- if (bytecodeOptions.showBytecodeSizeStatistics && !splitOutputByPackages) {
- BytecodeSizeStatistics.reset();
- }
-
final IOSink sink = new File(outputFileName).openWrite();
final BinaryPrinter printer = new BinaryPrinter(sink,
libraryFilter: (lib) => !results.loadedLibraries.contains(lib));
printer.writeComponentFile(results.component);
await sink.close();
- if (bytecodeOptions.showBytecodeSizeStatistics && !splitOutputByPackages) {
- BytecodeSizeStatistics.dump();
- }
-
if (depfile != null) {
await writeDepfile(
fileSystem, results.compiledSources, outputFileName, depfile);
@@ -316,9 +284,6 @@
compilerOptions,
results,
outputFileName,
- genBytecode: genBytecode,
- bytecodeOptions: bytecodeOptions,
- dropAST: dropAST,
);
}
@@ -357,9 +322,6 @@
bool useGlobalTypeFlowAnalysis: false,
Map<String, String> environmentDefines,
bool enableAsserts: true,
- bool genBytecode: false,
- BytecodeOptions bytecodeOptions,
- bool dropAST: false,
bool useProtobufTreeShaker: false,
bool useProtobufTreeShakerV2: false,
bool minimalKernel: false,
@@ -411,26 +373,6 @@
}
}
- if (genBytecode && !errorDetector.hasCompilationErrors && component != null) {
- List<Library> libraries = new List<Library>();
- for (Library library in component.libraries) {
- if (loadedLibraries.contains(library)) continue;
- libraries.add(library);
- }
-
- await runWithFrontEndCompilerContext(source, options, component, () {
- generateBytecode(component,
- libraries: libraries,
- hierarchy: compilerResult.classHierarchy,
- coreTypes: compilerResult.coreTypes,
- options: bytecodeOptions);
- });
-
- if (dropAST) {
- component = createFreshComponentWithBytecode(component);
- }
- }
-
// Restore error handler (in case 'options' are reused).
options.onDiagnostic = errorDetector.previousErrorHandler;
@@ -683,21 +625,8 @@
/// Write a separate kernel binary for each package. The name of the
/// output kernel binary is '[outputFileName]-$package.dilp'.
/// The list of package names is written into a file '[outputFileName]-packages'.
-///
-/// Generates bytecode for each package if requested.
-Future writeOutputSplitByPackages(
- Uri source,
- CompilerOptions compilerOptions,
- KernelCompilationResults compilationResults,
- String outputFileName, {
- bool genBytecode: false,
- BytecodeOptions bytecodeOptions,
- bool dropAST: false,
-}) async {
- if (bytecodeOptions.showBytecodeSizeStatistics) {
- BytecodeSizeStatistics.reset();
- }
-
+Future writeOutputSplitByPackages(Uri source, CompilerOptions compilerOptions,
+ KernelCompilationResults compilationResults, String outputFileName) async {
final packages = new List<String>();
await runWithFrontEndCompilerContext(
source, compilerOptions, compilationResults.component, () async {
@@ -710,17 +639,6 @@
final IOSink sink = new File(filename).openWrite();
Component partComponent = compilationResults.component;
- if (genBytecode) {
- generateBytecode(partComponent,
- options: bytecodeOptions,
- libraries: libraries,
- hierarchy: compilationResults.classHierarchy,
- coreTypes: compilationResults.coreTypes);
-
- if (dropAST) {
- partComponent = createFreshComponentWithBytecode(partComponent);
- }
- }
final BinaryPrinter printer = new BinaryPrinter(sink,
libraryFilter: (lib) =>
@@ -731,10 +649,6 @@
}, mainFirst: false);
});
- if (bytecodeOptions.showBytecodeSizeStatistics) {
- BytecodeSizeStatistics.dump();
- }
-
final IOSink packagesList = new File('$outputFileName-packages').openWrite();
for (String package in packages) {
packagesList.writeln(package);
diff --git a/pkg/vm/lib/metadata/binary_cache.dart b/pkg/vm/lib/metadata/binary_cache.dart
deleted file mode 100644
index e2151ef..0000000
--- a/pkg/vm/lib/metadata/binary_cache.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2019, 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 vm.metadata.binary_cache;
-
-import 'package:kernel/ast.dart'
- show BinarySink, BinarySource, MetadataRepository, Node, TreeNode;
-
-class BinaryCacheMetadataRepository extends MetadataRepository<List<int>> {
- static const repositoryTag = 'vm.binary_cache';
-
- @override
- String get tag => repositoryTag;
-
- @override
- final Map<TreeNode, List<int>> mapping = <TreeNode, List<int>>{};
-
- @override
- void writeToBinary(List<int> metadata, Node node, BinarySink sink) {
- sink.writeByteList(metadata);
- }
-
- @override
- List<int> readFromBinary(Node node, BinarySource source) {
- List<int> result = source.readByteList();
- _weakMap[node] = result;
- return result;
- }
-
- static List<int> lookup(Node node) => _weakMap[node];
- static void insert(Node node, List<int> metadata) {
- _weakMap[node] = metadata;
- }
-
- static final _weakMap = new Expando<List<int>>();
-}
diff --git a/pkg/vm/lib/metadata/bytecode.dart b/pkg/vm/lib/metadata/bytecode.dart
deleted file mode 100644
index fc91879..0000000
--- a/pkg/vm/lib/metadata/bytecode.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-// 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.
-
-library vm.metadata.bytecode;
-
-import 'package:kernel/ast.dart'
- show BinarySink, BinarySource, MetadataRepository, Node, TreeNode;
-import '../bytecode/bytecode_serialization.dart'
- show BufferedWriter, BufferedReader, LinkWriter, LinkReader;
-import '../bytecode/declarations.dart' show Component;
-
-import 'dart:developer';
-
-class BytecodeMetadata {
- final Component component;
-
- BytecodeMetadata(this.component);
-
- void write(BufferedWriter writer) {
- Timeline.timeSync("BytecodeMetadata.write", () {
- component.write(writer);
- });
- }
-
- factory BytecodeMetadata.read(BufferedReader reader) {
- return Timeline.timeSync("BytecodeMetadata.read", () {
- return new BytecodeMetadata(new Component.read(reader));
- });
- }
-
- @override
- String toString() => "\n"
- "BytecodeMetadata {\n"
- "$component\n"
- "}\n";
-}
-
-/// Repository for [BytecodeMetadata].
-class BytecodeMetadataRepository extends MetadataRepository<BytecodeMetadata> {
- @override
- final String tag = 'vm.bytecode';
-
- @override
- final Map<TreeNode, BytecodeMetadata> mapping =
- <TreeNode, BytecodeMetadata>{};
-
- @override
- void writeToBinary(BytecodeMetadata metadata, Node node, BinarySink sink) {
- final bytecodeComponent = metadata.component;
- final linkWriter = new LinkWriter();
- final writer = new BufferedWriter(
- bytecodeComponent.version,
- bytecodeComponent.stringTable,
- bytecodeComponent.objectTable,
- linkWriter);
- metadata.write(writer);
- writer.writeContentsToBinarySink(sink);
- }
-
- @override
- BytecodeMetadata readFromBinary(Node node, BinarySource source) {
- final linkReader = new LinkReader();
- final reader = new BufferedReader(-1, null, null, linkReader, source.bytes,
- baseOffset: source.currentOffset);
- final bytecodeComponent = new Component.read(reader);
- return new BytecodeMetadata(bytecodeComponent);
- }
-}
diff --git a/pkg/vm/lib/target/vm.dart b/pkg/vm/lib/target/vm.dart
index 59a24ab..174a310 100644
--- a/pkg/vm/lib/target/vm.dart
+++ b/pkg/vm/lib/target/vm.dart
@@ -20,7 +20,6 @@
import 'package:kernel/vm/constants_native_effects.dart'
show VmConstantsBackend;
-import '../metadata/binary_cache.dart' show BinaryCacheMetadataRepository;
import '../transformations/call_site_annotator.dart' as callSiteAnnotator;
import '../transformations/lowering.dart' as lowering show transformLibraries;
import '../transformations/ffi.dart' as transformFfi show ReplacedMembers;
@@ -400,7 +399,6 @@
@override
Component configureComponent(Component component) {
callSiteAnnotator.addRepositoryTo(component);
- component.addMetadataRepository(new BinaryCacheMetadataRepository());
return super.configureComponent(component);
}
diff --git a/pkg/vm/test/bytecode/gen_bytecode_test.dart b/pkg/vm/test/bytecode/gen_bytecode_test.dart
deleted file mode 100644
index 673a16e..0000000
--- a/pkg/vm/test/bytecode/gen_bytecode_test.dart
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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.
-
-import 'dart:io';
-
-import 'package:front_end/src/api_unstable/vm.dart'
- show CompilerOptions, DiagnosticMessage;
-import 'package:kernel/ast.dart';
-import 'package:kernel/kernel.dart';
-import 'package:test/test.dart';
-import 'package:vm/bytecode/gen_bytecode.dart' show generateBytecode;
-import 'package:vm/bytecode/options.dart' show BytecodeOptions;
-import 'package:vm/kernel_front_end.dart' show runWithFrontEndCompilerContext;
-
-import '../common_test_utils.dart';
-
-final String pkgVmDir = Platform.script.resolve('../..').toFilePath();
-
-runTestCase(Uri source) async {
- // Certain tests require super-mixin semantics which is used in Flutter.
- bool enableSuperMixins = source.pathSegments.last == 'super_calls.dart';
-
- Component component = await compileTestCaseToKernelProgram(source,
- enableSuperMixins: enableSuperMixins);
-
- final options = new CompilerOptions()
- ..onDiagnostic = (DiagnosticMessage message) {
- fail("Compilation error: ${message.plainTextFormatted.join('\n')}");
- };
-
- final mainLibrary = component.mainMethod.enclosingLibrary;
-
- await runWithFrontEndCompilerContext(source, options, component, () {
- // Need to omit source positions from bytecode as they are different on
- // Linux and Windows (due to differences in newline characters).
- generateBytecode(component,
- options: new BytecodeOptions(
- enableAsserts: true, omitAssertSourcePositions: true),
- libraries: [mainLibrary]);
- });
-
- component.libraries.removeWhere((lib) => lib != mainLibrary);
- String actual = kernelComponentToString(component);
-
- // Remove absolute library URIs.
- actual = actual.replaceAll(new Uri.file(pkgVmDir).toString(), '#pkg/vm');
-
- compareResultWithExpectationsFile(source, actual);
-}
-
-main() {
- group('gen-bytecode', () {
- final testCasesDir = new Directory(pkgVmDir + '/testcases/bytecode');
-
- for (var entry
- in testCasesDir.listSync(recursive: true, followLinks: false)) {
- if (entry.path.endsWith(".dart")) {
- test(entry.path, () => runTestCase(entry.uri));
- }
- }
- });
-}
diff --git a/pkg/vm/test/bytecode/object_table_test.dart b/pkg/vm/test/bytecode/object_table_test.dart
deleted file mode 100644
index 84f1001..0000000
--- a/pkg/vm/test/bytecode/object_table_test.dart
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (c) 2019, 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 'package:kernel/ast.dart';
-import 'package:kernel/core_types.dart' show CoreTypes;
-import 'package:kernel/testing/mock_sdk_component.dart';
-import 'package:test/test.dart';
-import 'package:expect/expect.dart';
-import 'package:vm/bytecode/object_table.dart';
-
-main() {
- Library lib1;
- Library lib2;
- CoreTypes coreTypes;
- Supertype objectSupertype;
- ObjectTable objectTable;
-
- Class addClass(Library lib, String name,
- [List<TypeParameter> typeParameters = const []]) {
- Class cls = new Class(
- name: name, supertype: objectSupertype, typeParameters: typeParameters);
- cls.parent = lib;
- lib.addClass(cls);
- return cls;
- }
-
- setUp(() {
- // Start with mock SDK libraries.
- Component component = createMockSdkComponent();
- coreTypes = new CoreTypes(component);
- objectSupertype = coreTypes.objectClass.asThisSupertype;
-
- // Add test libraries.
- lib1 = new Library(Uri.parse('org-dartlang:///test1.dart'), name: 'lib1');
- lib1.parent = component;
- component.libraries.add(lib1);
-
- lib2 = new Library(Uri.parse('org-dartlang:///test2.dart'), name: 'lib2');
- lib2.parent = component;
- component.libraries.add(lib2);
-
- objectTable = new ObjectTable(coreTypes);
- });
-
- tearDown(() {});
-
- test('libraries', () {
- final h1 = objectTable.getHandle(lib1);
- final h2 = objectTable.getHandle(lib2);
- Expect.notEquals(h1, h2);
- Expect.identical(h1, objectTable.getHandle(lib1));
- Expect.identical(h2, objectTable.getHandle(lib2));
- Expect.equals(true, h1.isCacheable);
- Expect.equals(true, h2.isCacheable);
- Expect.equals(false, h1.shouldBeIncludedIntoIndexTable); // 2 uses
- Expect.identical(h1, objectTable.getHandle(lib1));
- Expect.equals(true, h1.shouldBeIncludedIntoIndexTable); // 3 uses
- });
-
- test('classes', () {
- final Class c1 = addClass(lib1, 'A');
- final Class c2 = addClass(lib1, 'B');
- final Class c3 = addClass(lib2, 'A');
- final h1 = objectTable.getHandle(c1);
- final h2 = objectTable.getHandle(c2);
- final h3 = objectTable.getHandle(c3);
- Expect.notEquals(h1, h2);
- Expect.notEquals(h1, h3);
- Expect.notEquals(h2, h3);
- Expect.identical(h1, objectTable.getHandle(c1));
- Expect.identical(h2, objectTable.getHandle(c2));
- Expect.identical(h3, objectTable.getHandle(c3));
- Expect.equals(true, h1.isCacheable);
- Expect.equals(true, h2.isCacheable);
- Expect.equals(true, h3.isCacheable);
- final lib1h = objectTable.getHandle(lib1);
- final lib2h = objectTable.getHandle(lib2);
- Expect.equals(true, lib1h.shouldBeIncludedIntoIndexTable); // 3 uses
- Expect.equals(false, lib2h.shouldBeIncludedIntoIndexTable); // 2 uses
- });
-
- test('simple-types', () {
- final h1a = objectTable
- .getHandle(new InterfaceType(coreTypes.intClass, Nullability.legacy));
- final h1b = objectTable
- .getHandle(new InterfaceType(coreTypes.intClass, Nullability.legacy));
- final h2a = objectTable.getHandle(const DynamicType());
- final h2b = objectTable.getHandle(new DynamicType());
- Expect.identical(h1a, h1b);
- Expect.identical(h2a, h2b);
- Expect.notEquals(h1a, h2a);
- Expect.equals(true, h1a.isCacheable);
- Expect.equals(true, h2a.isCacheable);
- Expect.equals(false, h1a.shouldBeIncludedIntoIndexTable); // 2 uses
- objectTable.getHandle(new InterfaceType(
- coreTypes.listClass,
- Nullability.legacy,
- [new InterfaceType(coreTypes.intClass, Nullability.legacy)]));
- Expect.equals(true, h1a.shouldBeIncludedIntoIndexTable); // 3 uses
- });
-
- test('recursive-types', () {
- final base = addClass(lib1, "Base", [new TypeParameter("T")]);
- final derived1 = addClass(lib1, "Derived");
- derived1.supertype =
- new Supertype(base, [new InterfaceType(derived1, Nullability.legacy)]);
- final derived2 = addClass(lib2, "Derived");
- derived2.supertype =
- new Supertype(base, [new InterfaceType(derived2, Nullability.legacy)]);
- final h1a =
- objectTable.getHandle(new InterfaceType(derived1, Nullability.legacy));
- final h1b =
- objectTable.getHandle(new InterfaceType(derived1, Nullability.legacy));
- final h2a =
- objectTable.getHandle(new InterfaceType(derived2, Nullability.legacy));
- final h2b =
- objectTable.getHandle(new InterfaceType(derived2, Nullability.legacy));
- Expect.identical(h1a, h1b);
- Expect.identical(h2a, h2b);
- Expect.notEquals(h1a, h2a);
- Expect.equals(true, h1a.isCacheable);
- Expect.equals(true, h2a.isCacheable);
- final typeArgs1 = (h1a as dynamic).typeArgs;
- final typeArgs2 = (h2a as dynamic).typeArgs;
- Expect.equals(false, typeArgs1.isCacheable);
- Expect.equals(false, typeArgs2.isCacheable);
- });
-}
diff --git a/pkg/vm/test/bytecode/recursive_types_validator_test.dart b/pkg/vm/test/bytecode/recursive_types_validator_test.dart
deleted file mode 100644
index 6927492..0000000
--- a/pkg/vm/test/bytecode/recursive_types_validator_test.dart
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright (c) 2019, 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 'package:kernel/ast.dart';
-import 'package:kernel/core_types.dart' show CoreTypes;
-import 'package:kernel/testing/mock_sdk_component.dart';
-import 'package:test/test.dart';
-import 'package:expect/expect.dart';
-import 'package:vm/bytecode/recursive_types_validator.dart';
-
-main() {
- CoreTypes coreTypes;
- Library lib;
- Supertype objectSuper;
- DartType intType;
- DartType doubleType;
- Class base;
- RecursiveTypesValidator validator;
-
- Class addClass(String name, List<TypeParameter> typeParameters) {
- Class cls = new Class(
- name: name, supertype: objectSuper, typeParameters: typeParameters);
- lib.addClass(cls);
- return cls;
- }
-
- setUp(() {
- // Start with mock SDK libraries.
- Component component = createMockSdkComponent();
- coreTypes = new CoreTypes(component);
- objectSuper = coreTypes.objectClass.asThisSupertype;
- intType = new InterfaceType(coreTypes.intClass, Nullability.legacy);
- doubleType = new InterfaceType(coreTypes.doubleClass, Nullability.legacy);
-
- // Add the test library.
- lib = new Library(Uri.parse('org-dartlang:///test.dart'), name: 'lib');
- lib.parent = component;
- component.libraries.add(lib);
-
- // class Base<T>
- base = addClass('Base', [new TypeParameter('T')]);
-
- validator = new RecursiveTypesValidator(coreTypes);
- });
-
- tearDown(() {});
-
- test('simple-recursive-type', () async {
- // class Derived<T> extends Base<Derived<T>>
- TypeParameter t = new TypeParameter('T');
- Class derived = addClass('Derived', [t]);
- DartType derivedOfT = new InterfaceType(derived, Nullability.legacy,
- [new TypeParameterType(t, Nullability.legacy)]);
- DartType derivedOfInt =
- new InterfaceType(derived, Nullability.legacy, [intType]);
- derived.supertype = new Supertype(base, [derivedOfT]);
-
- validator.validateType(derivedOfT);
- Expect.isTrue(validator.isRecursive(derivedOfT));
-
- validator.validateType(derivedOfInt);
- Expect.isTrue(validator.isRecursive(derivedOfInt));
- });
-
- test('recursive-type-extends-instantiated', () async {
- // class Derived<T> extends Base<Derived<Derived<int>>>
- TypeParameter t = new TypeParameter('T');
- Class derived = addClass('Derived', [t]);
- DartType derivedOfT = new InterfaceType(derived, Nullability.legacy,
- [new TypeParameterType(t, Nullability.legacy)]);
- DartType derivedOfInt =
- new InterfaceType(derived, Nullability.legacy, [intType]);
- DartType derivedOfDerivedOfInt =
- new InterfaceType(derived, Nullability.legacy, [derivedOfInt]);
- derived.supertype = new Supertype(base, [derivedOfDerivedOfInt]);
-
- validator.validateType(derivedOfT);
- validator.validateType(derivedOfInt);
-
- Expect.isFalse(validator.isRecursive(derivedOfT));
- Expect.isTrue(validator.isRecursive(derivedOfInt));
- Expect.isTrue(validator.isRecursive(derivedOfDerivedOfInt));
- });
-
- test('recursive-non-contractive-type', () async {
- // class Derived<T> extends Base<Derived<Derived<T>>>
- TypeParameter t = new TypeParameter('T');
- Class derived = addClass('Derived', [t]);
- DartType derivedOfT = new InterfaceType(derived, Nullability.legacy,
- [new TypeParameterType(t, Nullability.legacy)]);
- DartType derivedOfInt =
- new InterfaceType(derived, Nullability.legacy, [intType]);
- DartType derivedOfDerivedOfT =
- new InterfaceType(derived, Nullability.legacy, [derivedOfT]);
- derived.supertype = new Supertype(base, [derivedOfDerivedOfT]);
-
- Expect.throws(() {
- validator.validateType(derivedOfT);
- });
- Expect.throws(() {
- validator.validateType(derivedOfDerivedOfT);
- });
- Expect.throws(() {
- validator.validateType(derivedOfInt);
- });
- });
-
- test('mutually-recursive-types', () async {
- // class Derived1<U> extends Base<Derived2<U>>
- // class Derived2<V> extends Base<Derived1<V>>
- TypeParameter u = new TypeParameter('U');
- Class derived1 = addClass('Derived1', [u]);
-
- TypeParameter v = new TypeParameter('V');
- Class derived2 = addClass('Derived2', [v]);
-
- DartType derived2OfU = new InterfaceType(derived2, Nullability.legacy,
- [new TypeParameterType(u, Nullability.legacy)]);
- derived1.supertype = new Supertype(base, [derived2OfU]);
-
- DartType derived1OfV = new InterfaceType(derived1, Nullability.legacy,
- [new TypeParameterType(v, Nullability.legacy)]);
- derived2.supertype = new Supertype(base, [derived1OfV]);
-
- DartType derived1OfU = new InterfaceType(derived1, Nullability.legacy,
- [new TypeParameterType(u, Nullability.legacy)]);
- DartType derived1OfInt =
- new InterfaceType(derived1, Nullability.legacy, [intType]);
-
- DartType derived2OfV = new InterfaceType(derived2, Nullability.legacy,
- [new TypeParameterType(v, Nullability.legacy)]);
- DartType derived2OfInt =
- new InterfaceType(derived2, Nullability.legacy, [intType]);
-
- validator.validateType(derived1OfU);
- Expect.isTrue(validator.isRecursive(derived1OfU));
-
- validator.validateType(derived1OfInt);
- Expect.isTrue(validator.isRecursive(derived1OfInt));
-
- validator.validateType(derived2OfV);
- Expect.isTrue(validator.isRecursive(derived2OfV));
-
- validator.validateType(derived2OfInt);
- Expect.isTrue(validator.isRecursive(derived2OfInt));
- });
-
- test('recursive-two-type-params', () async {
- // class F<P1, P2> {}
- // class E<Q1, Q2> extends F<E<Q1, int>, Q2> {}
- TypeParameter p1 = new TypeParameter('P1');
- TypeParameter p2 = new TypeParameter('P2');
- Class f = addClass('F', [p1, p2]);
-
- TypeParameter q1 = new TypeParameter('Q1');
- TypeParameter q2 = new TypeParameter('Q2');
- Class e = addClass('E', [q1, q2]);
-
- DartType eOfQ1Int = new InterfaceType(e, Nullability.legacy,
- [new TypeParameterType(q1, Nullability.legacy), intType]);
- e.supertype = new Supertype(
- f, [eOfQ1Int, new TypeParameterType(q2, Nullability.legacy)]);
-
- DartType eOfIntDouble =
- new InterfaceType(e, Nullability.legacy, [intType, doubleType]);
-
- validator.validateType(eOfIntDouble);
- validator.validateType(e.getThisType(coreTypes, lib.nonNullable));
-
- Expect.isFalse(validator.isRecursive(eOfIntDouble));
- Expect.isFalse(
- validator.isRecursive(e.getThisType(coreTypes, lib.nonNullable)));
- });
-}
diff --git a/pkg/vm/test/kernel_front_end_test.dart b/pkg/vm/test/kernel_front_end_test.dart
index 2bc2815..711b616 100644
--- a/pkg/vm/test/kernel_front_end_test.dart
+++ b/pkg/vm/test/kernel_front_end_test.dart
@@ -101,39 +101,6 @@
]);
}, timeout: Timeout.none);
- test('compile-bytecode', () async {
- await testCompile([
- '--platform',
- platformPath(),
- '--packages',
- '$sdkDir/$packagesFile',
- '--output',
- outputDill(),
- '--gen-bytecode',
- '--drop-ast',
- '$sdkDir/$mainScript',
- ]);
- }, timeout: Timeout.none);
-
- test('compile-bytecode-package-split', () async {
- await testCompile([
- '--platform',
- platformPath(),
- '--packages',
- '$sdkDir/$packagesFile',
- '--output',
- outputDill(),
- '--gen-bytecode',
- '--drop-ast',
- '--split-output-by-packages',
- '--manifest',
- outputManifest(),
- '--component-name',
- 'foo_component',
- '$sdkDir/$mainScript',
- ]);
- }, timeout: Timeout.none);
-
test('compile-package-config', () async {
await testCompile([
'--platform',
diff --git a/pkg/vm/testcases/bytecode/asserts.dart b/pkg/vm/testcases/bytecode/asserts.dart
deleted file mode 100644
index 2778c8d..0000000
--- a/pkg/vm/testcases/bytecode/asserts.dart
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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.
-
-void test1(bool condition) {
- assert(condition);
-}
-
-void test2(bool condition(), String message()) {
- assert(condition(), message());
-}
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/asserts.dart.expect b/pkg/vm/testcases/bytecode/asserts.dart.expect
deleted file mode 100644
index 39a0d1e..0000000
--- a/pkg/vm/testcases/bytecode/asserts.dart.expect
+++ /dev/null
@@ -1,96 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'test1', static, reflectable, debuggable
- parameters [dart:core::bool* 'condition'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 0
- CheckStack 0
- JumpIfNoAsserts L1
- Push FP[-5]
- AssertBoolean 0
- JumpIfTrue L1
- PushInt 0
- PushInt 0
- PushNull
- DirectCall CP#0, 3
- Drop1
-L1:
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::_AssertionError::_throwNew', ArgDesc num-args 3, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'test2', static, reflectable, debuggable
- parameters [FunctionType ()* -> dart:core::bool* 'condition', FunctionType ()* -> dart:core::String* 'message'] (required: 2)
- return-type void
-
-Bytecode {
- Entry 1
- CheckStack 0
- JumpIfNoAsserts L1
- Push FP[-6]
- StoreLocal r0
- Push r0
- UncheckedClosureCall CP#0, 1
- AssertBoolean 0
- JumpIfTrue L1
- PushInt 0
- PushInt 0
- Push FP[-5]
- StoreLocal r0
- Push r0
- UncheckedClosureCall CP#0, 1
- DirectCall CP#1, 3
- Drop1
-L1:
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
- [1] = DirectCall 'dart:core::_AssertionError::_throwNew', ArgDesc num-args 3, num-type-args 0, names []
- [2] = Reserved
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- static method test1(dart.core::bool* condition) → void {
- assert(condition);
- }
- static method test2(() →* dart.core::bool* condition, () →* dart.core::String* message) → void {
- assert([@vm.call-site-attributes.metadata=receiverType:dart.core::bool* Function()*] condition.call(), [@vm.call-site-attributes.metadata=receiverType:dart.core::String* Function()*] message.call());
- }
- static method main() → dynamic {}
-}
diff --git a/pkg/vm/testcases/bytecode/async.dart b/pkg/vm/testcases/bytecode/async.dart
deleted file mode 100644
index 6ccf357..0000000
--- a/pkg/vm/testcases/bytecode/async.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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.
-
-import 'dart:async';
-
-Future<int> foo() async => 42;
-
-Future<int> simpleAsyncAwait(Future<int> a, Future<int> b) async {
- return (await a) + (await b);
-}
-
-Future<int> loops(List<int> list) async {
- int sum = 0;
- for (int i = 0; i < 10; ++i) {
- for (var j in list) {
- sum += i + j + await foo();
- }
- }
- for (int k = 0; k < 10; ++k) {
- sum += k;
- }
- return sum;
-}
-
-Future<int> tryCatchRethrow(Future<int> a, Future<int> b, Future<int> c) async {
- int x = 1;
- try {
- x = x + await a;
- } catch (e) {
- if (e is Error) {
- return 42;
- }
- x = x + await b;
- rethrow;
- } finally {
- print('fin');
- x = x + await c;
- return x;
- }
-}
-
-closure(Future<int> a) {
- int x = 3;
- Future<int> nested() async {
- int y = 4;
- try {
- x = 5;
- y = await a;
- return x + y;
- } finally {
- print('fin');
- }
- }
-
- return nested;
-}
-
-Future<int> testAssert(Future<int> a) async {
- assert((await a) == 42);
- return 7;
-}
-
-var asyncInFieldInitializer = (Future<int> x) async {
- await x;
-};
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/async.dart.expect b/pkg/vm/testcases/bytecode/async.dart.expect
deleted file mode 100644
index 54765bc..0000000
--- a/pkg/vm/testcases/bytecode/async.dart.expect
+++ /dev/null
@@ -1,2265 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-Field 'asyncInFieldInitializer', type = FunctionType (dart:async::Future < dart:core::int* >*)* -> dart:async::Future < dart:core::Null? >*, getter = 'get:asyncInFieldInitializer', reflectable, static, has-initializer
- initializer
-Bytecode {
- Entry 3
- CheckStack 0
- AllocateClosure CP#0
- StoreLocal r2
- Push r2
- PushNull
- StoreFieldTOS CP#20
- Push r2
- PushNull
- StoreFieldTOS CP#22
- Push r2
- PushConstant CP#0
- StoreFieldTOS CP#24
- Push r2
- Push r0
- StoreFieldTOS CP#1
- ReturnTOS
-}
-ConstantPool {
- [0] = ClosureFunction 0
- [1] = InstanceField dart:core::_Closure::_context (field)
- [2] = Reserved
- [3] = Type dart:async::Future < dart:core::int* >*
- [4] = ObjectRef 'x'
- [5] = SubtypeTestCache
- [6] = Class dart:async::_AsyncAwaitCompleter
- [7] = ObjectRef < dart:core::Null? >
- [8] = DirectCall 'dart:async::_AsyncAwaitCompleter:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [9] = Reserved
- [10] = ClosureFunction 1
- [11] = ObjectRef null
- [12] = DirectCall 'dart:async::_awaitHelper', ArgDesc num-args 4, num-type-args 0, names []
- [13] = Reserved
- [14] = DirectCall 'dart:async::_completeOnAsyncReturn', ArgDesc num-args 2, num-type-args 0, names []
- [15] = Reserved
- [16] = Type dynamic
- [17] = InterfaceCall 'dart:async::Completer::completeError', ArgDesc num-args 3, num-type-args 0, names []
- [18] = Reserved
- [19] = EndClosureFunctionScope
- [20] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [21] = Reserved
- [22] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [23] = Reserved
- [24] = InstanceField dart:core::_Closure::_function (field)
- [25] = Reserved
- [26] = DirectCall 'dart:async::_asyncThenWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [27] = Reserved
- [28] = DirectCall 'dart:async::_asyncErrorWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [29] = Reserved
- [30] = InterfaceCall 'dart:async::_AsyncAwaitCompleter::start', ArgDesc num-args 2, num-type-args 0, names []
- [31] = Reserved
- [32] = InterfaceCall 'dart:async::Completer::get:future', ArgDesc num-args 1, num-type-args 0, names []
- [33] = Reserved
- [34] = EndClosureFunctionScope
-}
-Closure #lib::asyncInFieldInitializer (field)::'<anonymous closure>' async (dart:async::Future < dart:core::int* >* x) -> dart:async::Future < dart:core::Null? >*
-ClosureCode {
- Entry 4
- Push FP[-6]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- AllocateContext 0, 9
- PopLocal r0
- Push r0
- Push FP[-5]
- StoreContextVar 0, 2
- JumpIfUnchecked L1
- Push FP[-5]
- PushConstant CP#3
- PushNull
- PushNull
- PushConstant CP#4
- AssertAssignable 0, CP#5
- Drop1
-L1:
- Push r0
- PushConstant CP#7
- PushConstant CP#6
- AllocateT
- StoreLocal r2
- Push r2
- DirectCall CP#8, 1
- Drop1
- StoreContextVar 0, 1
- PushNull
- PopLocal r3
- Push r0
- PushInt 0
- StoreContextVar 0, 0
- Push r0
- AllocateClosure CP#10
- StoreLocal r2
- Push r2
- PushNull
- StoreFieldTOS CP#20
- Push r2
- PushNull
- StoreFieldTOS CP#22
- Push r2
- PushConstant CP#10
- StoreFieldTOS CP#24
- Push r2
- Push r0
- StoreFieldTOS CP#1
- StoreContextVar 0, 8
- PushNull
- PopLocal r3
- Push r0
- Push r0
- LoadContextVar 0, 8
- DirectCall CP#26, 1
- StoreContextVar 0, 4
- Push r0
- Push r0
- LoadContextVar 0, 8
- DirectCall CP#28, 1
- StoreContextVar 0, 5
- Push r0
- LoadContextVar 0, 1
- Push r0
- LoadContextVar 0, 8
- InterfaceCall CP#30, 2
- Drop1
- Push r0
- LoadContextVar 0, 1
- InterfaceCall CP#32, 1
- ReturnTOS
-}
-
-Closure #lib::asyncInFieldInitializer (field)::Closure/0::':async_op' ([ dynamic :result, dynamic :exception, dynamic :stack_trace ]) -> dynamic
-ClosureCode {
- EntryOptional 1, 3, 0
- LoadConstant r1, CP#11
- LoadConstant r2, CP#11
- LoadConstant r3, CP#11
- Frame 6
- Push r0
- LoadFieldTOS CP#1
- PopLocal r4
- CheckStack 0
- Push r4
- LoadContextVar 0, 0
- StoreLocal r5
- PushInt 0
- JumpIfNeStrict L1
- Push r4
- Push r4
- StoreContextVar 0, 7
-Try #0 start:
- Push r4
- PushInt 1
- StoreContextVar 0, 0
- Push r4
- Push r4
- StoreContextVar 0, 6
- Push r4
- LoadContextVar 0, 2
- Push r4
- LoadContextVar 0, 4
- Push r4
- LoadContextVar 0, 5
- Push r4
- LoadContextVar 0, 8
- DirectCall CP#12, 4
- PopLocal r8
- PushNull
- ReturnTOS
-L4:
- Push r2
- JumpIfNull L2
- Push r2
- Push r3
- Throw 1
-L2:
- Push r1
- Drop1
- Push r4
- LoadContextVar 0, 1
- Push r4
- LoadContextVar 0, 3
- DirectCall CP#14, 2
- Drop1
- PushNull
- ReturnTOS
-Try #0 end:
-Try #0 handler:
- SetFrame 10
- Push r0
- LoadFieldTOS CP#1
- PopLocal r4
- Push r4
- LoadContextVar 0, 7
- PopLocal r4
- MoveSpecial exception, r6
- MoveSpecial stackTrace, r7
- Push r6
- PopLocal r8
- Push r7
- PopLocal r9
- Push r4
- LoadContextVar 0, 1
- Push r8
- Push r9
- InterfaceCall CP#17, 3
- Drop1
- Jump L3
-L3:
- PushNull
- ReturnTOS
-L1:
- Push r4
- LoadContextVar 0, 6
- PopLocal r4
- Jump L4
-}
-
-
-Function 'foo', static, reflectable, async
- parameters [] (required: 0)
- return-type dart:async::Future < dart:core::int* >*
-
-Bytecode {
- Entry 7
- CheckStack 0
- AllocateContext 0, 4
- PopLocal r0
- Push r0
- PushConstant CP#1
- PushConstant CP#0
- AllocateT
- StoreLocal r2
- Push r2
- DirectCall CP#2, 1
- Drop1
- StoreContextVar 0, 1
- PushNull
- PopLocal r3
- PushNull
- PopLocal r4
- PushNull
- PopLocal r5
- Push r0
- PushInt 0
- StoreContextVar 0, 0
- AllocateClosure CP#4
- StoreLocal r2
- Push r2
- PushNull
- StoreFieldTOS CP#14
- Push r2
- PushNull
- StoreFieldTOS CP#16
- Push r2
- PushConstant CP#4
- StoreFieldTOS CP#18
- Push r2
- Push r0
- StoreFieldTOS CP#6
- PopLocal r6
- PushNull
- PopLocal r3
- Push r6
- DirectCall CP#20, 1
- PopLocal r4
- Push r6
- DirectCall CP#22, 1
- PopLocal r5
- Push r0
- LoadContextVar 0, 1
- Push r6
- InterfaceCall CP#24, 2
- Drop1
- Push r0
- LoadContextVar 0, 1
- InterfaceCall CP#26, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = Class dart:async::_AsyncAwaitCompleter
- [1] = ObjectRef < dart:core::int* >
- [2] = DirectCall 'dart:async::_AsyncAwaitCompleter:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = ClosureFunction 0
- [5] = ObjectRef null
- [6] = InstanceField dart:core::_Closure::_context (field)
- [7] = Reserved
- [8] = DirectCall 'dart:async::_completeOnAsyncReturn', ArgDesc num-args 2, num-type-args 0, names []
- [9] = Reserved
- [10] = Type dynamic
- [11] = InterfaceCall 'dart:async::Completer::completeError', ArgDesc num-args 3, num-type-args 0, names []
- [12] = Reserved
- [13] = EndClosureFunctionScope
- [14] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [15] = Reserved
- [16] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [17] = Reserved
- [18] = InstanceField dart:core::_Closure::_function (field)
- [19] = Reserved
- [20] = DirectCall 'dart:async::_asyncThenWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [21] = Reserved
- [22] = DirectCall 'dart:async::_asyncErrorWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [23] = Reserved
- [24] = InterfaceCall 'dart:async::_AsyncAwaitCompleter::start', ArgDesc num-args 2, num-type-args 0, names []
- [25] = Reserved
- [26] = InterfaceCall 'dart:async::Completer::get:future', ArgDesc num-args 1, num-type-args 0, names []
- [27] = Reserved
-}
-Closure #lib::foo::':async_op' ([ dynamic :result, dynamic :exception, dynamic :stack_trace ]) -> dynamic
-ClosureCode {
- EntryOptional 1, 3, 0
- LoadConstant r1, CP#5
- LoadConstant r2, CP#5
- LoadConstant r3, CP#5
- Frame 6
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- CheckStack 0
- Push r4
- LoadContextVar 0, 0
- StoreLocal r5
- PushInt 0
- JumpIfNeStrict L1
- Push r4
- PopLocal r6
-Try #0 start:
- Push r4
- PushInt 42
- StoreContextVar 0, 2
- Jump L2
-L2:
- Push r4
- LoadContextVar 0, 1
- Push r4
- LoadContextVar 0, 2
- DirectCall CP#8, 2
- Drop1
- PushNull
- ReturnTOS
-Try #0 end:
-Try #0 handler:
- SetFrame 10
- Push r6
- PopLocal r4
- MoveSpecial exception, r6
- MoveSpecial stackTrace, r7
- Push r6
- PopLocal r8
- Push r7
- PopLocal r9
- Push r4
- LoadContextVar 0, 1
- Push r8
- Push r9
- InterfaceCall CP#11, 3
- Drop1
- Jump L3
-L3:
- PushNull
- ReturnTOS
-L1:
- Trap
-}
-
-
-Function 'simpleAsyncAwait', static, reflectable, async
- parameters [dart:async::Future < dart:core::int* >* 'a', dart:async::Future < dart:core::int* >* 'b'] (required: 2)
- return-type dart:async::Future < dart:core::int* >*
-
-Bytecode {
- Entry 4
- CheckStack 0
- AllocateContext 0, 11
- PopLocal r0
- Push r0
- Push FP[-6]
- StoreContextVar 0, 2
- Push r0
- Push FP[-5]
- StoreContextVar 0, 3
- Push r0
- PushConstant CP#1
- PushConstant CP#0
- AllocateT
- StoreLocal r2
- Push r2
- DirectCall CP#2, 1
- Drop1
- StoreContextVar 0, 1
- PushNull
- PopLocal r3
- Push r0
- PushInt 0
- StoreContextVar 0, 0
- Push r0
- AllocateClosure CP#4
- StoreLocal r2
- Push r2
- PushNull
- StoreFieldTOS CP#16
- Push r2
- PushNull
- StoreFieldTOS CP#18
- Push r2
- PushConstant CP#4
- StoreFieldTOS CP#20
- Push r2
- Push r0
- StoreFieldTOS CP#6
- StoreContextVar 0, 10
- PushNull
- PopLocal r3
- Push r0
- Push r0
- LoadContextVar 0, 10
- DirectCall CP#22, 1
- StoreContextVar 0, 5
- Push r0
- Push r0
- LoadContextVar 0, 10
- DirectCall CP#24, 1
- StoreContextVar 0, 6
- Push r0
- LoadContextVar 0, 1
- Push r0
- LoadContextVar 0, 10
- InterfaceCall CP#26, 2
- Drop1
- Push r0
- LoadContextVar 0, 1
- InterfaceCall CP#28, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = Class dart:async::_AsyncAwaitCompleter
- [1] = ObjectRef < dart:core::int* >
- [2] = DirectCall 'dart:async::_AsyncAwaitCompleter:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = ClosureFunction 0
- [5] = ObjectRef null
- [6] = InstanceField dart:core::_Closure::_context (field)
- [7] = Reserved
- [8] = DirectCall 'dart:async::_awaitHelper', ArgDesc num-args 4, num-type-args 0, names []
- [9] = Reserved
- [10] = DirectCall 'dart:async::_completeOnAsyncReturn', ArgDesc num-args 2, num-type-args 0, names []
- [11] = Reserved
- [12] = Type dynamic
- [13] = InterfaceCall 'dart:async::Completer::completeError', ArgDesc num-args 3, num-type-args 0, names []
- [14] = Reserved
- [15] = EndClosureFunctionScope
- [16] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [17] = Reserved
- [18] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [19] = Reserved
- [20] = InstanceField dart:core::_Closure::_function (field)
- [21] = Reserved
- [22] = DirectCall 'dart:async::_asyncThenWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [23] = Reserved
- [24] = DirectCall 'dart:async::_asyncErrorWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [25] = Reserved
- [26] = InterfaceCall 'dart:async::_AsyncAwaitCompleter::start', ArgDesc num-args 2, num-type-args 0, names []
- [27] = Reserved
- [28] = InterfaceCall 'dart:async::Completer::get:future', ArgDesc num-args 1, num-type-args 0, names []
- [29] = Reserved
-}
-Closure #lib::simpleAsyncAwait::':async_op' ([ dynamic :result, dynamic :exception, dynamic :stack_trace ]) -> dynamic
-ClosureCode {
- EntryOptional 1, 3, 0
- LoadConstant r1, CP#5
- LoadConstant r2, CP#5
- LoadConstant r3, CP#5
- Frame 6
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- CheckStack 0
- Push r4
- LoadContextVar 0, 0
- StoreLocal r5
- PushInt 0
- JumpIfNeStrict L1
- Push r4
- Push r4
- StoreContextVar 0, 8
-Try #0 start:
- Push r4
- PushInt 1
- StoreContextVar 0, 0
- Push r4
- Push r4
- StoreContextVar 0, 7
- Push r4
- LoadContextVar 0, 2
- Push r4
- LoadContextVar 0, 5
- Push r4
- LoadContextVar 0, 6
- Push r4
- LoadContextVar 0, 10
- DirectCall CP#8, 4
- PopLocal r8
- PushNull
- ReturnTOS
-L6:
- Push r2
- JumpIfNull L2
- Push r2
- Push r3
- Throw 1
-L2:
- Push r4
- Push r1
- StoreContextVar 0, 9
- Push r4
- PushInt 2
- StoreContextVar 0, 0
- Push r4
- Push r4
- StoreContextVar 0, 7
- Push r4
- LoadContextVar 0, 3
- Push r4
- LoadContextVar 0, 5
- Push r4
- LoadContextVar 0, 6
- Push r4
- LoadContextVar 0, 10
- DirectCall CP#8, 4
- PopLocal r9
- PushNull
- ReturnTOS
-L7:
- Push r2
- JumpIfNull L3
- Push r2
- Push r3
- Throw 1
-L3:
- Push r4
- Push r4
- LoadContextVar 0, 9
- Push r1
- AddInt
- StoreContextVar 0, 4
- Jump L4
-L4:
- Push r4
- LoadContextVar 0, 1
- Push r4
- LoadContextVar 0, 4
- DirectCall CP#10, 2
- Drop1
- PushNull
- ReturnTOS
-Try #0 end:
-Try #0 handler:
- SetFrame 10
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- Push r4
- LoadContextVar 0, 8
- PopLocal r4
- MoveSpecial exception, r6
- MoveSpecial stackTrace, r7
- Push r6
- PopLocal r8
- Push r7
- PopLocal r9
- Push r4
- LoadContextVar 0, 1
- Push r8
- Push r9
- InterfaceCall CP#13, 3
- Drop1
- Jump L5
-L5:
- PushNull
- ReturnTOS
-L1:
- Push r4
- LoadContextVar 0, 7
- PopLocal r4
- Push r5
- PushInt 1
- JumpIfEqStrict L6
- Jump L7
-}
-
-
-Function 'loops', static, reflectable, async
- parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
- return-type dart:async::Future < dart:core::int* >*
-
-Bytecode {
- Entry 4
- CheckStack 0
- AllocateContext 0, 11
- PopLocal r0
- Push r0
- Push FP[-5]
- StoreContextVar 0, 2
- Push r0
- PushConstant CP#1
- PushConstant CP#0
- AllocateT
- StoreLocal r2
- Push r2
- DirectCall CP#2, 1
- Drop1
- StoreContextVar 0, 1
- PushNull
- PopLocal r3
- Push r0
- PushInt 0
- StoreContextVar 0, 0
- Push r0
- AllocateClosure CP#4
- StoreLocal r2
- Push r2
- PushNull
- StoreFieldTOS CP#24
- Push r2
- PushNull
- StoreFieldTOS CP#26
- Push r2
- PushConstant CP#4
- StoreFieldTOS CP#28
- Push r2
- Push r0
- StoreFieldTOS CP#6
- StoreContextVar 0, 10
- PushNull
- PopLocal r3
- Push r0
- Push r0
- LoadContextVar 0, 10
- DirectCall CP#30, 1
- StoreContextVar 0, 4
- Push r0
- Push r0
- LoadContextVar 0, 10
- DirectCall CP#32, 1
- StoreContextVar 0, 5
- Push r0
- LoadContextVar 0, 1
- Push r0
- LoadContextVar 0, 10
- InterfaceCall CP#34, 2
- Drop1
- Push r0
- LoadContextVar 0, 1
- InterfaceCall CP#36, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = Class dart:async::_AsyncAwaitCompleter
- [1] = ObjectRef < dart:core::int* >
- [2] = DirectCall 'dart:async::_AsyncAwaitCompleter:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = ClosureFunction 0
- [5] = ObjectRef null
- [6] = InstanceField dart:core::_Closure::_context (field)
- [7] = Reserved
- [8] = InterfaceCall 'dart:core::Iterable::get:iterator', ArgDesc num-args 1, num-type-args 0, names []
- [9] = Reserved
- [10] = InterfaceCall 'dart:core::Iterator::moveNext', ArgDesc num-args 1, num-type-args 0, names []
- [11] = Reserved
- [12] = InterfaceCall 'dart:core::Iterator::get:current', ArgDesc num-args 1, num-type-args 0, names []
- [13] = Reserved
- [14] = DirectCall '#lib::foo', ArgDesc num-args 0, num-type-args 0, names []
- [15] = Reserved
- [16] = DirectCall 'dart:async::_awaitHelper', ArgDesc num-args 4, num-type-args 0, names []
- [17] = Reserved
- [18] = DirectCall 'dart:async::_completeOnAsyncReturn', ArgDesc num-args 2, num-type-args 0, names []
- [19] = Reserved
- [20] = Type dynamic
- [21] = InterfaceCall 'dart:async::Completer::completeError', ArgDesc num-args 3, num-type-args 0, names []
- [22] = Reserved
- [23] = EndClosureFunctionScope
- [24] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [25] = Reserved
- [26] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [27] = Reserved
- [28] = InstanceField dart:core::_Closure::_function (field)
- [29] = Reserved
- [30] = DirectCall 'dart:async::_asyncThenWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [31] = Reserved
- [32] = DirectCall 'dart:async::_asyncErrorWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [33] = Reserved
- [34] = InterfaceCall 'dart:async::_AsyncAwaitCompleter::start', ArgDesc num-args 2, num-type-args 0, names []
- [35] = Reserved
- [36] = InterfaceCall 'dart:async::Completer::get:future', ArgDesc num-args 1, num-type-args 0, names []
- [37] = Reserved
-}
-Closure #lib::loops::':async_op' ([ dynamic :result, dynamic :exception, dynamic :stack_trace ]) -> dynamic
-ClosureCode {
- EntryOptional 1, 3, 0
- LoadConstant r1, CP#5
- LoadConstant r2, CP#5
- LoadConstant r3, CP#5
- Frame 6
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- CheckStack 0
- Push r4
- LoadContextVar 0, 0
- StoreLocal r5
- PushInt 0
- JumpIfNeStrict L1
- Push r4
- Push r4
- StoreContextVar 0, 7
-Try #0 start:
- AllocateContext 1, 1
- StoreLocal r5
- Push r5
- Push r4
- StoreContextParent
- PopLocal r4
- Push r4
- PushInt 0
- StoreContextVar 1, 0
- AllocateContext 2, 2
- StoreLocal r5
- Push r5
- Push r4
- StoreContextParent
- PopLocal r4
- Push r4
- PushInt 0
- StoreContextVar 2, 0
-L6:
- CheckStack 1
- Push r4
- LoadContextVar 2, 0
- PushInt 10
- CompareIntLt
- JumpIfFalse L2
- Push r4
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextVar 0, 2
- InterfaceCall CP#8, 1
- StoreContextVar 2, 1
-L5:
- CheckStack 2
- Push r4
- LoadContextVar 2, 1
- InterfaceCall CP#10, 1
- AssertBoolean 0
- JumpIfFalse L3
- AllocateContext 3, 1
- StoreLocal r5
- Push r5
- Push r4
- StoreContextParent
- PopLocal r4
- Push r4
- Push r4
- LoadContextParent
- LoadContextVar 2, 1
- InterfaceCall CP#12, 1
- StoreContextVar 3, 0
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextParent
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextVar 1, 0
- StoreContextVar 0, 9
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextParent
- Push r4
- LoadContextParent
- LoadContextVar 2, 0
- Push r4
- LoadContextVar 3, 0
- AddInt
- StoreContextVar 0, 8
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextParent
- PushInt 1
- StoreContextVar 0, 0
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextParent
- Push r4
- StoreContextVar 0, 6
- DirectCall CP#14, 0
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextParent
- LoadContextVar 0, 4
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextParent
- LoadContextVar 0, 5
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextParent
- LoadContextVar 0, 10
- DirectCall CP#16, 4
- PopLocal r9
- PushNull
- ReturnTOS
-L11:
- Push r2
- JumpIfNull L4
- Push r2
- Push r3
- Throw 1
-L4:
- Push r4
- LoadContextParent
- LoadContextParent
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextParent
- LoadContextVar 0, 9
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextParent
- LoadContextVar 0, 8
- Push r1
- AddInt
- AddInt
- StoreContextVar 1, 0
- Push r4
- LoadContextParent
- PopLocal r4
- Jump L5
-L3:
- Push r4
- CloneContext 2, 2
- PopLocal r4
- Push r4
- Push r4
- LoadContextVar 2, 0
- PushInt 1
- AddInt
- StoreLocal r8
- StoreContextVar 2, 0
- Push r8
- Drop1
- Jump L6
-L2:
- Push r4
- LoadContextParent
- PopLocal r4
- PushInt 0
- PopLocal r8
-L8:
- CheckStack 1
- Push r8
- PushInt 10
- CompareIntLt
- JumpIfFalse L7
- Push r4
- Push r4
- LoadContextVar 1, 0
- Push r8
- AddInt
- StoreContextVar 1, 0
- Push r8
- PushInt 1
- AddInt
- StoreLocal r8
- Drop1
- Jump L8
-L7:
- Push r4
- LoadContextParent
- Push r4
- LoadContextVar 1, 0
- StoreContextVar 0, 3
- Push r4
- LoadContextParent
- PopLocal r4
- Jump L9
-L9:
- Push r4
- LoadContextVar 0, 1
- Push r4
- LoadContextVar 0, 3
- DirectCall CP#18, 2
- Drop1
- PushNull
- ReturnTOS
-Try #0 end:
-Try #0 handler:
- SetFrame 10
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- Push r4
- LoadContextVar 0, 7
- PopLocal r4
- MoveSpecial exception, r6
- MoveSpecial stackTrace, r7
- Push r6
- PopLocal r8
- Push r7
- PopLocal r9
- Push r4
- LoadContextVar 0, 1
- Push r8
- Push r9
- InterfaceCall CP#21, 3
- Drop1
- Jump L10
-L10:
- PushNull
- ReturnTOS
-L1:
- Push r4
- LoadContextVar 0, 6
- PopLocal r4
- Jump L11
-}
-
-
-Function 'tryCatchRethrow', static, reflectable, async
- parameters [dart:async::Future < dart:core::int* >* 'a', dart:async::Future < dart:core::int* >* 'b', dart:async::Future < dart:core::int* >* 'c'] (required: 3)
- return-type dart:async::Future < dart:core::int* >*
-
-Bytecode {
- Entry 4
- CheckStack 0
- AllocateContext 0, 18
- PopLocal r0
- Push r0
- Push FP[-7]
- StoreContextVar 0, 2
- Push r0
- Push FP[-6]
- StoreContextVar 0, 3
- Push r0
- Push FP[-5]
- StoreContextVar 0, 4
- Push r0
- PushConstant CP#1
- PushConstant CP#0
- AllocateT
- StoreLocal r2
- Push r2
- DirectCall CP#2, 1
- Drop1
- StoreContextVar 0, 1
- PushNull
- PopLocal r3
- Push r0
- PushInt 0
- StoreContextVar 0, 0
- Push r0
- AllocateClosure CP#4
- StoreLocal r2
- Push r2
- PushNull
- StoreFieldTOS CP#22
- Push r2
- PushNull
- StoreFieldTOS CP#24
- Push r2
- PushConstant CP#4
- StoreFieldTOS CP#26
- Push r2
- Push r0
- StoreFieldTOS CP#6
- StoreContextVar 0, 17
- PushNull
- PopLocal r3
- Push r0
- Push r0
- LoadContextVar 0, 17
- DirectCall CP#28, 1
- StoreContextVar 0, 6
- Push r0
- Push r0
- LoadContextVar 0, 17
- DirectCall CP#30, 1
- StoreContextVar 0, 7
- Push r0
- LoadContextVar 0, 1
- Push r0
- LoadContextVar 0, 17
- InterfaceCall CP#32, 2
- Drop1
- Push r0
- LoadContextVar 0, 1
- InterfaceCall CP#34, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = Class dart:async::_AsyncAwaitCompleter
- [1] = ObjectRef < dart:core::int* >
- [2] = DirectCall 'dart:async::_AsyncAwaitCompleter:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = ClosureFunction 0
- [5] = ObjectRef null
- [6] = InstanceField dart:core::_Closure::_context (field)
- [7] = Reserved
- [8] = DirectCall 'dart:async::_awaitHelper', ArgDesc num-args 4, num-type-args 0, names []
- [9] = Reserved
- [10] = Type dynamic
- [11] = Type dart:core::Error*
- [12] = InterfaceCall 'dart:core::Object::_simpleInstanceOf', ArgDesc num-args 2, num-type-args 0, names []
- [13] = Reserved
- [14] = ObjectRef 'fin'
- [15] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [16] = Reserved
- [17] = DirectCall 'dart:async::_completeOnAsyncReturn', ArgDesc num-args 2, num-type-args 0, names []
- [18] = Reserved
- [19] = InterfaceCall 'dart:async::Completer::completeError', ArgDesc num-args 3, num-type-args 0, names []
- [20] = Reserved
- [21] = EndClosureFunctionScope
- [22] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [23] = Reserved
- [24] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [25] = Reserved
- [26] = InstanceField dart:core::_Closure::_function (field)
- [27] = Reserved
- [28] = DirectCall 'dart:async::_asyncThenWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [29] = Reserved
- [30] = DirectCall 'dart:async::_asyncErrorWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [31] = Reserved
- [32] = InterfaceCall 'dart:async::_AsyncAwaitCompleter::start', ArgDesc num-args 2, num-type-args 0, names []
- [33] = Reserved
- [34] = InterfaceCall 'dart:async::Completer::get:future', ArgDesc num-args 1, num-type-args 0, names []
- [35] = Reserved
-}
-Closure #lib::tryCatchRethrow::':async_op' ([ dynamic :result, dynamic :exception, dynamic :stack_trace ]) -> dynamic
-ClosureCode {
- EntryOptional 1, 3, 0
- LoadConstant r1, CP#5
- LoadConstant r2, CP#5
- LoadConstant r3, CP#5
- Frame 10
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- CheckStack 0
- Push r4
- LoadContextVar 0, 0
- StoreLocal r5
- PushInt 0
- JumpIfNeStrict L1
- Push r4
- Push r4
- StoreContextVar 0, 9
-Try #0 start:
- AllocateContext 1, 2
- StoreLocal r5
- Push r5
- Push r4
- StoreContextParent
- PopLocal r4
- Push r4
- PushInt 1
- StoreContextVar 1, 0
- Push r4
- LoadContextParent
- Push r4
- StoreContextVar 0, 10
-Try #1 start:
- Push r4
- LoadContextParent
- Push r4
- StoreContextVar 0, 11
-Try #2 start:
- Push r4
- LoadContextParent
- Push r4
- LoadContextVar 1, 0
- StoreContextVar 0, 14
- Push r4
- LoadContextParent
- PushInt 1
- StoreContextVar 0, 0
- Push r4
- LoadContextParent
- Push r4
- StoreContextVar 0, 8
- Push r4
- LoadContextParent
- LoadContextVar 0, 2
- Push r4
- LoadContextParent
- LoadContextVar 0, 6
- Push r4
- LoadContextParent
- LoadContextVar 0, 7
- Push r4
- LoadContextParent
- LoadContextVar 0, 17
- DirectCall CP#8, 4
- PopLocal r13
- PushNull
- ReturnTOS
-L13:
- Push r2
- JumpIfNull L2
- Push r2
- Push r3
- Throw 1
-L2:
- Push r4
- Push r4
- LoadContextParent
- LoadContextVar 0, 14
- Push r1
- AddInt
- StoreContextVar 1, 0
- Jump L3
-Try #2 end:
-Try #2 handler:
- SetFrame 14
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- Push r4
- LoadContextVar 0, 11
- PopLocal r4
- MoveSpecial exception, r10
- MoveSpecial stackTrace, r11
- Push r4
- LoadContextParent
- Push r10
- StoreContextVar 0, 12
- Push r4
- LoadContextParent
- Push r11
- StoreContextVar 0, 13
- Push r4
- Push r10
- StoreContextVar 1, 1
- Push r4
- LoadContextVar 1, 1
- PushConstant CP#11
- InterfaceCall CP#12, 2
- JumpIfFalse L4
- Push r4
- LoadContextParent
- PushInt 42
- StoreContextVar 0, 5
- Jump L5
-L4:
- Push r4
- LoadContextParent
- Push r4
- LoadContextVar 1, 0
- StoreContextVar 0, 15
- Push r4
- LoadContextParent
- PushInt 2
- StoreContextVar 0, 0
- Push r4
- LoadContextParent
- Push r4
- StoreContextVar 0, 8
- Push r4
- LoadContextParent
- LoadContextVar 0, 3
- Push r4
- LoadContextParent
- LoadContextVar 0, 6
- Push r4
- LoadContextParent
- LoadContextVar 0, 7
- Push r4
- LoadContextParent
- LoadContextVar 0, 17
- DirectCall CP#8, 4
- PopLocal r13
- PushNull
- ReturnTOS
-L14:
- Push r2
- JumpIfNull L6
- Push r2
- Push r3
- Throw 1
-L6:
- Push r4
- Push r4
- LoadContextParent
- LoadContextVar 0, 15
- Push r1
- AddInt
- StoreContextVar 1, 0
- Push r4
- LoadContextParent
- LoadContextVar 0, 12
- Push r4
- LoadContextParent
- LoadContextVar 0, 13
- Throw 1
-L3:
- Jump L7
-Try #1 end:
-Try #1 handler:
- SetFrame 14
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- Push r4
- LoadContextVar 0, 10
- PopLocal r4
- MoveSpecial exception, r8
- MoveSpecial stackTrace, r9
- Push r4
- LoadContextParent
- Push r8
- StoreContextVar 0, 12
- Push r4
- LoadContextParent
- Push r9
- StoreContextVar 0, 13
- PushConstant CP#14
- DirectCall CP#15, 1
- Drop1
- Push r4
- LoadContextParent
- Push r4
- LoadContextVar 1, 0
- StoreContextVar 0, 16
- Push r4
- LoadContextParent
- PushInt 3
- StoreContextVar 0, 0
- Push r4
- LoadContextParent
- Push r4
- StoreContextVar 0, 8
- Push r4
- LoadContextParent
- LoadContextVar 0, 4
- Push r4
- LoadContextParent
- LoadContextVar 0, 6
- Push r4
- LoadContextParent
- LoadContextVar 0, 7
- Push r4
- LoadContextParent
- LoadContextVar 0, 17
- DirectCall CP#8, 4
- PopLocal r12
- PushNull
- ReturnTOS
-L15:
- Push r2
- JumpIfNull L8
- Push r2
- Push r3
- Throw 1
-L8:
- Push r4
- Push r4
- LoadContextParent
- LoadContextVar 0, 16
- Push r1
- AddInt
- StoreContextVar 1, 0
- Push r4
- LoadContextParent
- Push r4
- LoadContextVar 1, 0
- StoreContextVar 0, 5
- Push r4
- LoadContextParent
- PopLocal r4
- Jump L9
-L5:
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- Push r4
- LoadContextVar 0, 10
- PopLocal r4
- PushConstant CP#14
- DirectCall CP#15, 1
- Drop1
- Push r4
- LoadContextParent
- Push r4
- LoadContextVar 1, 0
- StoreContextVar 0, 16
- Push r4
- LoadContextParent
- PushInt 4
- StoreContextVar 0, 0
- Push r4
- LoadContextParent
- Push r4
- StoreContextVar 0, 8
- Push r4
- LoadContextParent
- LoadContextVar 0, 4
- Push r4
- LoadContextParent
- LoadContextVar 0, 6
- Push r4
- LoadContextParent
- LoadContextVar 0, 7
- Push r4
- LoadContextParent
- LoadContextVar 0, 17
- DirectCall CP#8, 4
- PopLocal r12
- PushNull
- ReturnTOS
-L16:
- Push r2
- JumpIfNull L10
- Push r2
- Push r3
- Throw 1
-L10:
- Push r4
- Push r4
- LoadContextParent
- LoadContextVar 0, 16
- Push r1
- AddInt
- StoreContextVar 1, 0
- Push r4
- LoadContextParent
- Push r4
- LoadContextVar 1, 0
- StoreContextVar 0, 5
- Push r4
- LoadContextParent
- PopLocal r4
- Jump L9
-L7:
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- Push r4
- LoadContextVar 0, 10
- PopLocal r4
- PushConstant CP#14
- DirectCall CP#15, 1
- Drop1
- Push r4
- LoadContextParent
- Push r4
- LoadContextVar 1, 0
- StoreContextVar 0, 16
- Push r4
- LoadContextParent
- PushInt 5
- StoreContextVar 0, 0
- Push r4
- LoadContextParent
- Push r4
- StoreContextVar 0, 8
- Push r4
- LoadContextParent
- LoadContextVar 0, 4
- Push r4
- LoadContextParent
- LoadContextVar 0, 6
- Push r4
- LoadContextParent
- LoadContextVar 0, 7
- Push r4
- LoadContextParent
- LoadContextVar 0, 17
- DirectCall CP#8, 4
- PopLocal r12
- PushNull
- ReturnTOS
-L17:
- Push r2
- JumpIfNull L11
- Push r2
- Push r3
- Throw 1
-L11:
- Push r4
- Push r4
- LoadContextParent
- LoadContextVar 0, 16
- Push r1
- AddInt
- StoreContextVar 1, 0
- Push r4
- LoadContextParent
- Push r4
- LoadContextVar 1, 0
- StoreContextVar 0, 5
- Push r4
- LoadContextParent
- PopLocal r4
- Jump L9
-L9:
- Push r4
- LoadContextVar 0, 1
- Push r4
- LoadContextVar 0, 5
- DirectCall CP#17, 2
- Drop1
- PushNull
- ReturnTOS
-Try #0 end:
-Try #0 handler:
- SetFrame 14
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- Push r4
- LoadContextVar 0, 9
- PopLocal r4
- MoveSpecial exception, r6
- MoveSpecial stackTrace, r7
- Push r6
- PopLocal r8
- Push r7
- PopLocal r9
- Push r4
- LoadContextVar 0, 1
- Push r8
- Push r9
- InterfaceCall CP#19, 3
- Drop1
- Jump L12
-L12:
- PushNull
- ReturnTOS
-L1:
- Push r4
- LoadContextVar 0, 8
- PopLocal r4
- Push r5
- PushInt 1
- JumpIfEqStrict L13
- Push r5
- PushInt 2
- JumpIfEqStrict L14
- Push r5
- PushInt 3
- JumpIfEqStrict L15
- Push r5
- PushInt 4
- JumpIfEqStrict L16
- Jump L17
-}
-
-
-Function 'closure', static, reflectable, debuggable
- parameters [dart:async::Future < dart:core::int* >* 'a'] (required: 1)
- return-type dynamic
-
-Bytecode {
- Entry 4
- CheckStack 0
- AllocateContext 0, 2
- PopLocal r0
- Push r0
- Push FP[-5]
- StoreContextVar 0, 0
- Push r0
- PushInt 3
- StoreContextVar 0, 1
- AllocateClosure CP#0
- StoreLocal r3
- Push r3
- PushNull
- StoreFieldTOS CP#20
- Push r3
- PushNull
- StoreFieldTOS CP#22
- Push r3
- PushConstant CP#0
- StoreFieldTOS CP#24
- Push r3
- Push r0
- StoreFieldTOS CP#1
- PopLocal r2
- Push r2
- ReturnTOS
-}
-ConstantPool {
- [0] = ClosureFunction 0
- [1] = InstanceField dart:core::_Closure::_context (field)
- [2] = Reserved
- [3] = Class dart:async::_AsyncAwaitCompleter
- [4] = ObjectRef < dart:core::int* >
- [5] = DirectCall 'dart:async::_AsyncAwaitCompleter:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [6] = Reserved
- [7] = ClosureFunction 1
- [8] = ObjectRef null
- [9] = DirectCall 'dart:async::_awaitHelper', ArgDesc num-args 4, num-type-args 0, names []
- [10] = Reserved
- [11] = Type dynamic
- [12] = ObjectRef 'fin'
- [13] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [14] = Reserved
- [15] = DirectCall 'dart:async::_completeOnAsyncReturn', ArgDesc num-args 2, num-type-args 0, names []
- [16] = Reserved
- [17] = InterfaceCall 'dart:async::Completer::completeError', ArgDesc num-args 3, num-type-args 0, names []
- [18] = Reserved
- [19] = EndClosureFunctionScope
- [20] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [21] = Reserved
- [22] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [23] = Reserved
- [24] = InstanceField dart:core::_Closure::_function (field)
- [25] = Reserved
- [26] = DirectCall 'dart:async::_asyncThenWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [27] = Reserved
- [28] = DirectCall 'dart:async::_asyncErrorWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [29] = Reserved
- [30] = InterfaceCall 'dart:async::_AsyncAwaitCompleter::start', ArgDesc num-args 2, num-type-args 0, names []
- [31] = Reserved
- [32] = InterfaceCall 'dart:async::Completer::get:future', ArgDesc num-args 1, num-type-args 0, names []
- [33] = Reserved
- [34] = EndClosureFunctionScope
-}
-Closure #lib::closure::'nested' async () -> dart:async::Future < dart:core::int* >*
-ClosureCode {
- Entry 4
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- AllocateContext 1, 9
- StoreLocal r1
- Push r1
- Push r0
- StoreContextParent
- PopLocal r0
- Push r0
- PushConstant CP#4
- PushConstant CP#3
- AllocateT
- StoreLocal r2
- Push r2
- DirectCall CP#5, 1
- Drop1
- StoreContextVar 1, 1
- PushNull
- PopLocal r3
- Push r0
- PushInt 0
- StoreContextVar 1, 0
- Push r0
- AllocateClosure CP#7
- StoreLocal r2
- Push r2
- PushNull
- StoreFieldTOS CP#20
- Push r2
- PushNull
- StoreFieldTOS CP#22
- Push r2
- PushConstant CP#7
- StoreFieldTOS CP#24
- Push r2
- Push r0
- StoreFieldTOS CP#1
- StoreContextVar 1, 8
- PushNull
- PopLocal r3
- Push r0
- Push r0
- LoadContextVar 1, 8
- DirectCall CP#26, 1
- StoreContextVar 1, 3
- Push r0
- Push r0
- LoadContextVar 1, 8
- DirectCall CP#28, 1
- StoreContextVar 1, 4
- Push r0
- LoadContextVar 1, 1
- Push r0
- LoadContextVar 1, 8
- InterfaceCall CP#30, 2
- Drop1
- Push r0
- LoadContextVar 1, 1
- InterfaceCall CP#32, 1
- ReturnTOS
-}
-
-Closure #lib::closure::Closure/0::':async_op' ([ dynamic :result, dynamic :exception, dynamic :stack_trace ]) -> dynamic
-ClosureCode {
- EntryOptional 1, 3, 0
- LoadConstant r1, CP#8
- LoadConstant r2, CP#8
- LoadConstant r3, CP#8
- Frame 8
- Push r0
- LoadFieldTOS CP#1
- PopLocal r4
- CheckStack 0
- Push r4
- LoadContextVar 1, 0
- StoreLocal r5
- PushInt 0
- JumpIfNeStrict L1
- Push r4
- Push r4
- StoreContextVar 1, 6
-Try #0 start:
- AllocateContext 2, 1
- StoreLocal r5
- Push r5
- Push r4
- StoreContextParent
- PopLocal r4
- Push r4
- PushInt 4
- StoreContextVar 2, 0
- Push r4
- LoadContextParent
- Push r4
- StoreContextVar 1, 7
-Try #1 start:
- Push r4
- LoadContextParent
- LoadContextParent
- PushInt 5
- StoreContextVar 0, 1
- Push r4
- LoadContextParent
- PushInt 1
- StoreContextVar 1, 0
- Push r4
- LoadContextParent
- Push r4
- StoreContextVar 1, 5
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextVar 0, 0
- Push r4
- LoadContextParent
- LoadContextVar 1, 3
- Push r4
- LoadContextParent
- LoadContextVar 1, 4
- Push r4
- LoadContextParent
- LoadContextVar 1, 8
- DirectCall CP#9, 4
- PopLocal r11
- PushNull
- ReturnTOS
-L6:
- Push r2
- JumpIfNull L2
- Push r2
- Push r3
- Throw 1
-L2:
- Push r4
- Push r1
- StoreContextVar 2, 0
- Push r4
- LoadContextParent
- Push r4
- LoadContextParent
- LoadContextParent
- LoadContextVar 0, 1
- Push r4
- LoadContextVar 2, 0
- AddInt
- StoreContextVar 1, 2
- Jump L3
-Try #1 end:
-Try #1 handler:
- SetFrame 12
- Push r0
- LoadFieldTOS CP#1
- PopLocal r4
- Push r4
- LoadContextVar 1, 7
- PopLocal r4
- MoveSpecial exception, r8
- MoveSpecial stackTrace, r9
- PushConstant CP#12
- DirectCall CP#13, 1
- Drop1
- Push r8
- Push r9
- Throw 1
-L3:
- Push r0
- LoadFieldTOS CP#1
- PopLocal r4
- Push r4
- LoadContextVar 1, 7
- PopLocal r4
- PushConstant CP#12
- DirectCall CP#13, 1
- Drop1
- Push r4
- LoadContextParent
- PopLocal r4
- Jump L4
-L4:
- Push r4
- LoadContextVar 1, 1
- Push r4
- LoadContextVar 1, 2
- DirectCall CP#15, 2
- Drop1
- PushNull
- ReturnTOS
-Try #0 end:
-Try #0 handler:
- SetFrame 12
- Push r0
- LoadFieldTOS CP#1
- PopLocal r4
- Push r4
- LoadContextVar 1, 6
- PopLocal r4
- MoveSpecial exception, r6
- MoveSpecial stackTrace, r7
- Push r6
- PopLocal r8
- Push r7
- PopLocal r9
- Push r4
- LoadContextVar 1, 1
- Push r8
- Push r9
- InterfaceCall CP#17, 3
- Drop1
- Jump L5
-L5:
- PushNull
- ReturnTOS
-L1:
- Push r4
- LoadContextVar 1, 5
- PopLocal r4
- Jump L6
-}
-
-
-Function 'testAssert', static, reflectable, async
- parameters [dart:async::Future < dart:core::int* >* 'a'] (required: 1)
- return-type dart:async::Future < dart:core::int* >*
-
-Bytecode {
- Entry 4
- CheckStack 0
- AllocateContext 0, 9
- PopLocal r0
- Push r0
- Push FP[-5]
- StoreContextVar 0, 2
- Push r0
- PushConstant CP#1
- PushConstant CP#0
- AllocateT
- StoreLocal r2
- Push r2
- DirectCall CP#2, 1
- Drop1
- StoreContextVar 0, 1
- PushNull
- PopLocal r3
- Push r0
- PushInt 0
- StoreContextVar 0, 0
- Push r0
- AllocateClosure CP#4
- StoreLocal r2
- Push r2
- PushNull
- StoreFieldTOS CP#18
- Push r2
- PushNull
- StoreFieldTOS CP#20
- Push r2
- PushConstant CP#4
- StoreFieldTOS CP#22
- Push r2
- Push r0
- StoreFieldTOS CP#6
- StoreContextVar 0, 8
- PushNull
- PopLocal r3
- Push r0
- Push r0
- LoadContextVar 0, 8
- DirectCall CP#24, 1
- StoreContextVar 0, 4
- Push r0
- Push r0
- LoadContextVar 0, 8
- DirectCall CP#26, 1
- StoreContextVar 0, 5
- Push r0
- LoadContextVar 0, 1
- Push r0
- LoadContextVar 0, 8
- InterfaceCall CP#28, 2
- Drop1
- Push r0
- LoadContextVar 0, 1
- InterfaceCall CP#30, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = Class dart:async::_AsyncAwaitCompleter
- [1] = ObjectRef < dart:core::int* >
- [2] = DirectCall 'dart:async::_AsyncAwaitCompleter:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = ClosureFunction 0
- [5] = ObjectRef null
- [6] = InstanceField dart:core::_Closure::_context (field)
- [7] = Reserved
- [8] = DirectCall 'dart:async::_awaitHelper', ArgDesc num-args 4, num-type-args 0, names []
- [9] = Reserved
- [10] = DirectCall 'dart:core::_AssertionError::_throwNew', ArgDesc num-args 3, num-type-args 0, names []
- [11] = Reserved
- [12] = DirectCall 'dart:async::_completeOnAsyncReturn', ArgDesc num-args 2, num-type-args 0, names []
- [13] = Reserved
- [14] = Type dynamic
- [15] = InterfaceCall 'dart:async::Completer::completeError', ArgDesc num-args 3, num-type-args 0, names []
- [16] = Reserved
- [17] = EndClosureFunctionScope
- [18] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [19] = Reserved
- [20] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [21] = Reserved
- [22] = InstanceField dart:core::_Closure::_function (field)
- [23] = Reserved
- [24] = DirectCall 'dart:async::_asyncThenWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [25] = Reserved
- [26] = DirectCall 'dart:async::_asyncErrorWrapperHelper', ArgDesc num-args 1, num-type-args 0, names []
- [27] = Reserved
- [28] = InterfaceCall 'dart:async::_AsyncAwaitCompleter::start', ArgDesc num-args 2, num-type-args 0, names []
- [29] = Reserved
- [30] = InterfaceCall 'dart:async::Completer::get:future', ArgDesc num-args 1, num-type-args 0, names []
- [31] = Reserved
-}
-Closure #lib::testAssert::':async_op' ([ dynamic :result, dynamic :exception, dynamic :stack_trace ]) -> dynamic
-ClosureCode {
- EntryOptional 1, 3, 0
- LoadConstant r1, CP#5
- LoadConstant r2, CP#5
- LoadConstant r3, CP#5
- Frame 6
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- CheckStack 0
- Push r4
- LoadContextVar 0, 0
- StoreLocal r5
- PushInt 0
- JumpIfNeStrict L1
- Push r4
- Push r4
- StoreContextVar 0, 7
-Try #0 start:
- JumpIfNoAsserts L2
- Push r4
- PushInt 1
- StoreContextVar 0, 0
- Push r4
- Push r4
- StoreContextVar 0, 6
- Push r4
- LoadContextVar 0, 2
- Push r4
- LoadContextVar 0, 4
- Push r4
- LoadContextVar 0, 5
- Push r4
- LoadContextVar 0, 8
- DirectCall CP#8, 4
- PopLocal r8
- PushNull
- ReturnTOS
-L6:
- Push r2
- JumpIfNull L3
- Push r2
- Push r3
- Throw 1
-L3:
- JumpIfNoAsserts L2
- Push r1
- PushInt 42
- CompareIntEq
- JumpIfTrue L2
- PushInt 0
- PushInt 0
- PushNull
- DirectCall CP#10, 3
- Drop1
-L2:
- Push r4
- PushInt 7
- StoreContextVar 0, 3
- Jump L4
-L4:
- Push r4
- LoadContextVar 0, 1
- Push r4
- LoadContextVar 0, 3
- DirectCall CP#12, 2
- Drop1
- PushNull
- ReturnTOS
-Try #0 end:
-Try #0 handler:
- SetFrame 10
- Push r0
- LoadFieldTOS CP#6
- PopLocal r4
- Push r4
- LoadContextVar 0, 7
- PopLocal r4
- MoveSpecial exception, r6
- MoveSpecial stackTrace, r7
- Push r6
- PopLocal r8
- Push r7
- PopLocal r9
- Push r4
- LoadContextVar 0, 1
- Push r8
- Push r9
- InterfaceCall CP#15, 3
- Drop1
- Jump L5
-L5:
- PushNull
- ReturnTOS
-L1:
- Push r4
- LoadContextVar 0, 6
- PopLocal r4
- Jump L6
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- import "dart:async";
-
- static field (dart.async::Future<dart.core::int*>*) →* dart.async::Future<dart.core::Null?>* asyncInFieldInitializer = (dart.async::Future<dart.core::int*>* x) → dart.async::Future<dart.core::Null?>* /* originally async */ {
- final dart.async::_AsyncAwaitCompleter<dart.core::Null?>* :async_completer = new dart.async::_AsyncAwaitCompleter::•<dart.core::Null?>();
- FutureOr<dart.core::Null?>* :return_value;
- dynamic :async_stack_trace;
- (dynamic) →* dynamic :async_op_then;
- (dart.core::Object*, dart.core::StackTrace*) →* dynamic :async_op_error;
- dart.core::int* :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L1:
- {
- [yield] let dynamic #t1 = dart.async::_awaitHelper(x, :async_op_then, :async_op_error, :async_op) in null;
- dart._internal::unsafeCast<dart.core::int*>(:result);
- }
- dart.async::_completeOnAsyncReturn(:async_completer, :return_value);
- return;
- }
- on dynamic catch(dynamic exception, dart.core::StackTrace* stack_trace) {
- :async_completer.{dart.async::Completer::completeError}(exception, stack_trace);
- }
- :async_stack_trace = dart.async::_asyncStackTraceHelper(:async_op);
- :async_op_then = dart.async::_asyncThenWrapperHelper(:async_op);
- :async_op_error = dart.async::_asyncErrorWrapperHelper(:async_op);
- :async_completer.{dart.async::_AsyncAwaitCompleter::start}(:async_op);
- return :async_completer.{dart.async::Completer::future};
- };
- static method foo() → dart.async::Future<dart.core::int*>* /* originally async */ {
- final dart.async::_AsyncAwaitCompleter<dart.core::int*>* :async_completer = new dart.async::_AsyncAwaitCompleter::•<dart.core::int*>();
- FutureOr<dart.core::int*>* :return_value;
- dynamic :async_stack_trace;
- (dynamic) →* dynamic :async_op_then;
- (dart.core::Object*, dart.core::StackTrace*) →* dynamic :async_op_error;
- dart.core::int* :await_jump_var = 0;
- dynamic :await_ctx_var;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L2:
- {
- :return_value = 42;
- break #L2;
- }
- dart.async::_completeOnAsyncReturn(:async_completer, :return_value);
- return;
- }
- on dynamic catch(dynamic exception, dart.core::StackTrace* stack_trace) {
- :async_completer.{dart.async::Completer::completeError}(exception, stack_trace);
- }
- :async_stack_trace = dart.async::_asyncStackTraceHelper(:async_op);
- :async_op_then = dart.async::_asyncThenWrapperHelper(:async_op);
- :async_op_error = dart.async::_asyncErrorWrapperHelper(:async_op);
- :async_completer.{dart.async::_AsyncAwaitCompleter::start}(:async_op);
- return :async_completer.{dart.async::Completer::future};
- }
- static method simpleAsyncAwait(dart.async::Future<dart.core::int*>* a, dart.async::Future<dart.core::int*>* b) → dart.async::Future<dart.core::int*>* /* originally async */ {
- final dart.async::_AsyncAwaitCompleter<dart.core::int*>* :async_completer = new dart.async::_AsyncAwaitCompleter::•<dart.core::int*>();
- FutureOr<dart.core::int*>* :return_value;
- dynamic :async_stack_trace;
- (dynamic) →* dynamic :async_op_then;
- (dart.core::Object*, dart.core::StackTrace*) →* dynamic :async_op_error;
- dart.core::int* :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :async_temporary_0;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L3:
- {
- [yield] let dynamic #t2 = dart.async::_awaitHelper(a, :async_op_then, :async_op_error, :async_op) in null;
- :async_temporary_0 = dart._internal::unsafeCast<dart.core::int*>(:result);
- [yield] let dynamic #t3 = dart.async::_awaitHelper(b, :async_op_then, :async_op_error, :async_op) in null;
- :return_value = dart._internal::unsafeCast<dart.core::int*>(:async_temporary_0).{dart.core::num::+}(dart._internal::unsafeCast<dart.core::int*>(:result));
- break #L3;
- }
- dart.async::_completeOnAsyncReturn(:async_completer, :return_value);
- return;
- }
- on dynamic catch(dynamic exception, dart.core::StackTrace* stack_trace) {
- :async_completer.{dart.async::Completer::completeError}(exception, stack_trace);
- }
- :async_stack_trace = dart.async::_asyncStackTraceHelper(:async_op);
- :async_op_then = dart.async::_asyncThenWrapperHelper(:async_op);
- :async_op_error = dart.async::_asyncErrorWrapperHelper(:async_op);
- :async_completer.{dart.async::_AsyncAwaitCompleter::start}(:async_op);
- return :async_completer.{dart.async::Completer::future};
- }
- static method loops(dart.core::List<dart.core::int*>* list) → dart.async::Future<dart.core::int*>* /* originally async */ {
- final dart.async::_AsyncAwaitCompleter<dart.core::int*>* :async_completer = new dart.async::_AsyncAwaitCompleter::•<dart.core::int*>();
- FutureOr<dart.core::int*>* :return_value;
- dynamic :async_stack_trace;
- (dynamic) →* dynamic :async_op_then;
- (dart.core::Object*, dart.core::StackTrace*) →* dynamic :async_op_error;
- dart.core::int* :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :async_temporary_0;
- dynamic :async_temporary_1;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L4:
- {
- dart.core::int* sum = 0;
- for (dart.core::int* i = 0; i.{dart.core::num::<}(10); i = i.{dart.core::num::+}(1)) {
- {
- dart.core::Iterator<dart.core::int*>* :sync-for-iterator = list.{dart.core::Iterable::iterator};
- for (; :sync-for-iterator.{dart.core::Iterator::moveNext}(); ) {
- dart.core::int* j = :sync-for-iterator.{dart.core::Iterator::current};
- {
- :async_temporary_1 = sum;
- :async_temporary_0 = i.{dart.core::num::+}(j);
- [yield] let dynamic #t4 = dart.async::_awaitHelper(#lib::foo(), :async_op_then, :async_op_error, :async_op) in null;
- sum = dart._internal::unsafeCast<dart.core::int*>(:async_temporary_1).{dart.core::num::+}(dart._internal::unsafeCast<dart.core::int*>(:async_temporary_0).{dart.core::num::+}(dart._internal::unsafeCast<dart.core::int*>(:result)));
- }
- }
- }
- }
- for (dart.core::int* k = 0; k.{dart.core::num::<}(10); k = k.{dart.core::num::+}(1)) {
- sum = sum.{dart.core::num::+}(k);
- }
- :return_value = sum;
- break #L4;
- }
- dart.async::_completeOnAsyncReturn(:async_completer, :return_value);
- return;
- }
- on dynamic catch(dynamic exception, dart.core::StackTrace* stack_trace) {
- :async_completer.{dart.async::Completer::completeError}(exception, stack_trace);
- }
- :async_stack_trace = dart.async::_asyncStackTraceHelper(:async_op);
- :async_op_then = dart.async::_asyncThenWrapperHelper(:async_op);
- :async_op_error = dart.async::_asyncErrorWrapperHelper(:async_op);
- :async_completer.{dart.async::_AsyncAwaitCompleter::start}(:async_op);
- return :async_completer.{dart.async::Completer::future};
- }
- static method tryCatchRethrow(dart.async::Future<dart.core::int*>* a, dart.async::Future<dart.core::int*>* b, dart.async::Future<dart.core::int*>* c) → dart.async::Future<dart.core::int*>* /* originally async */ {
- final dart.async::_AsyncAwaitCompleter<dart.core::int*>* :async_completer = new dart.async::_AsyncAwaitCompleter::•<dart.core::int*>();
- FutureOr<dart.core::int*>* :return_value;
- dynamic :async_stack_trace;
- (dynamic) →* dynamic :async_op_then;
- (dart.core::Object*, dart.core::StackTrace*) →* dynamic :async_op_error;
- dart.core::int* :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- dynamic :saved_try_context_var2;
- dynamic :exception0;
- dynamic :stack_trace0;
- dynamic :async_temporary_0;
- dynamic :async_temporary_1;
- dynamic :async_temporary_2;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L5:
- {
- dart.core::int* x = 1;
- try
- try {
- :async_temporary_0 = x;
- [yield] let dynamic #t5 = dart.async::_awaitHelper(a, :async_op_then, :async_op_error, :async_op) in null;
- x = dart._internal::unsafeCast<dart.core::int*>(:async_temporary_0).{dart.core::num::+}(dart._internal::unsafeCast<dart.core::int*>(:result));
- }
- on dynamic catch(final dynamic e) {
- if(e is dart.core::Error*) {
- :return_value = 42;
- break #L5;
- }
- :async_temporary_1 = x;
- [yield] let dynamic #t6 = dart.async::_awaitHelper(b, :async_op_then, :async_op_error, :async_op) in null;
- x = dart._internal::unsafeCast<dart.core::int*>(:async_temporary_1).{dart.core::num::+}(dart._internal::unsafeCast<dart.core::int*>(:result));
- rethrow;
- }
- finally {
- dart.core::print("fin");
- :async_temporary_2 = x;
- [yield] let dynamic #t7 = dart.async::_awaitHelper(c, :async_op_then, :async_op_error, :async_op) in null;
- x = dart._internal::unsafeCast<dart.core::int*>(:async_temporary_2).{dart.core::num::+}(dart._internal::unsafeCast<dart.core::int*>(:result));
- :return_value = x;
- break #L5;
- }
- }
- dart.async::_completeOnAsyncReturn(:async_completer, :return_value);
- return;
- }
- on dynamic catch(dynamic exception, dart.core::StackTrace* stack_trace) {
- :async_completer.{dart.async::Completer::completeError}(exception, stack_trace);
- }
- :async_stack_trace = dart.async::_asyncStackTraceHelper(:async_op);
- :async_op_then = dart.async::_asyncThenWrapperHelper(:async_op);
- :async_op_error = dart.async::_asyncErrorWrapperHelper(:async_op);
- :async_completer.{dart.async::_AsyncAwaitCompleter::start}(:async_op);
- return :async_completer.{dart.async::Completer::future};
- }
- static method closure(dart.async::Future<dart.core::int*>* a) → dynamic {
- dart.core::int* x = 3;
- function nested() → dart.async::Future<dart.core::int*>* /* originally async */ {
- final dart.async::_AsyncAwaitCompleter<dart.core::int*>* :async_completer = new dart.async::_AsyncAwaitCompleter::•<dart.core::int*>();
- FutureOr<dart.core::int*>* :return_value;
- dynamic :async_stack_trace;
- (dynamic) →* dynamic :async_op_then;
- (dart.core::Object*, dart.core::StackTrace*) →* dynamic :async_op_error;
- dart.core::int* :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- dynamic :saved_try_context_var1;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L6:
- {
- dart.core::int* y = 4;
- try {
- x = 5;
- [yield] let dynamic #t8 = dart.async::_awaitHelper(a, :async_op_then, :async_op_error, :async_op) in null;
- y = dart._internal::unsafeCast<dart.core::int*>(:result);
- :return_value = x.{dart.core::num::+}(y);
- break #L6;
- }
- finally {
- dart.core::print("fin");
- }
- }
- dart.async::_completeOnAsyncReturn(:async_completer, :return_value);
- return;
- }
- on dynamic catch(dynamic exception, dart.core::StackTrace* stack_trace) {
- :async_completer.{dart.async::Completer::completeError}(exception, stack_trace);
- }
- :async_stack_trace = dart.async::_asyncStackTraceHelper(:async_op);
- :async_op_then = dart.async::_asyncThenWrapperHelper(:async_op);
- :async_op_error = dart.async::_asyncErrorWrapperHelper(:async_op);
- :async_completer.{dart.async::_AsyncAwaitCompleter::start}(:async_op);
- return :async_completer.{dart.async::Completer::future};
- }
- return nested;
- }
- static method testAssert(dart.async::Future<dart.core::int*>* a) → dart.async::Future<dart.core::int*>* /* originally async */ {
- final dart.async::_AsyncAwaitCompleter<dart.core::int*>* :async_completer = new dart.async::_AsyncAwaitCompleter::•<dart.core::int*>();
- FutureOr<dart.core::int*>* :return_value;
- dynamic :async_stack_trace;
- (dynamic) →* dynamic :async_op_then;
- (dart.core::Object*, dart.core::StackTrace*) →* dynamic :async_op_error;
- dart.core::int* :await_jump_var = 0;
- dynamic :await_ctx_var;
- dynamic :saved_try_context_var0;
- function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
- try {
- #L7:
- {
- assert {
- [yield] let dynamic #t9 = dart.async::_awaitHelper(a, :async_op_then, :async_op_error, :async_op) in null;
- assert(dart._internal::unsafeCast<dart.core::int*>(:result).{dart.core::num::==}(42));
- }
- :return_value = 7;
- break #L7;
- }
- dart.async::_completeOnAsyncReturn(:async_completer, :return_value);
- return;
- }
- on dynamic catch(dynamic exception, dart.core::StackTrace* stack_trace) {
- :async_completer.{dart.async::Completer::completeError}(exception, stack_trace);
- }
- :async_stack_trace = dart.async::_asyncStackTraceHelper(:async_op);
- :async_op_then = dart.async::_asyncThenWrapperHelper(:async_op);
- :async_op_error = dart.async::_asyncErrorWrapperHelper(:async_op);
- :async_completer.{dart.async::_AsyncAwaitCompleter::start}(:async_op);
- return :async_completer.{dart.async::Completer::future};
- }
- static method main() → dynamic {}
-}
diff --git a/pkg/vm/testcases/bytecode/bootstrapping.dart b/pkg/vm/testcases/bytecode/bootstrapping.dart
deleted file mode 100644
index 3f8c850..0000000
--- a/pkg/vm/testcases/bytecode/bootstrapping.dart
+++ /dev/null
@@ -1,155 +0,0 @@
-// 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.
-
-// Selection of methods used during bootstrapping.
-
-// ignore_for_file: native_function_body_in_non_sdk_code
-// ignore_for_file: unused_element, unused_field
-
-// -----------------------------------------------------------------
-
-void _printString(String s) native "Builtin_PrintString";
-
-void _print(arg) {
- _printString(arg.toString());
-}
-
-_getPrintClosure() => _print;
-
-// -----------------------------------------------------------------
-
-typedef void _ScheduleImmediateClosure(void callback());
-
-class _ScheduleImmediate {
- static _ScheduleImmediateClosure _closure;
-}
-
-void _setScheduleImmediateClosure(_ScheduleImmediateClosure closure) {
- _ScheduleImmediate._closure = closure;
-}
-
-// -----------------------------------------------------------------
-
-class _NamespaceImpl implements _Namespace {
- _NamespaceImpl._();
-
- static _NamespaceImpl _create(_NamespaceImpl namespace, var n)
- native "Namespace_Create";
- static int _getPointer(_NamespaceImpl namespace)
- native "Namespace_GetPointer";
- static int _getDefault() native "Namespace_GetDefault";
-
- // If the platform supports "namespaces", this method is called by the
- // embedder with the platform-specific namespace information.
- static _NamespaceImpl _cachedNamespace = null;
- static void _setupNamespace(var namespace) {
- _cachedNamespace = _create(new _NamespaceImpl._(), namespace);
- }
-
- static _NamespaceImpl get _namespace {
- if (_cachedNamespace == null) {
- // The embedder has not supplied a namespace before one is needed, so
- // instead use a safe-ish default value.
- _cachedNamespace = _create(new _NamespaceImpl._(), _getDefault());
- }
- return _cachedNamespace;
- }
-
- static int get _namespacePointer => _getPointer(_namespace);
-}
-
-class _Namespace {
- static void _setupNamespace(var namespace) {
- _NamespaceImpl._setupNamespace(namespace);
- }
-
- static _Namespace get _namespace => _NamespaceImpl._namespace;
-
- static int get _namespacePointer => _NamespaceImpl._namespacePointer;
-}
-
-// -----------------------------------------------------------------
-
-// These may be set to different values by the embedder by calling
-// _setStdioFDs when initializing dart:io.
-int _stdinFD = 0;
-int _stdoutFD = 1;
-int _stderrFD = 2;
-
-// This is an embedder entrypoint.
-void _setStdioFDs(int stdin, int stdout, int stderr) {
- _stdinFD = stdin;
- _stdoutFD = stdout;
- _stderrFD = stderr;
-}
-
-// -----------------------------------------------------------------
-
-class VMLibraryHooks {
- // Example: "dart:isolate _Timer._factory"
- static var timerFactory;
-
- // Example: "dart:io _EventHandler._sendData"
- static var eventHandlerSendData;
-
- // A nullary closure that answers the current clock value in milliseconds.
- // Example: "dart:io _EventHandler._timerMillisecondClock"
- static var timerMillisecondClock;
-
- // Implementation of Resource.readAsBytes.
- static var resourceReadAsBytes;
-
- // Implementation of package root/map provision.
- static var packageRootString;
- static var packageConfigString;
- static var packageRootUriFuture;
- static var packageConfigUriFuture;
- static var resolvePackageUriFuture;
-
- static var _computeScriptUri;
- static var _cachedScript;
- static set platformScript(var f) {
- _computeScriptUri = f;
- _cachedScript = null;
- }
-
- static get platformScript {
- if (_cachedScript == null && _computeScriptUri != null) {
- _cachedScript = _computeScriptUri();
- }
- return _cachedScript;
- }
-}
-
-String _rawScript;
-Uri _scriptUri() {
- if (_rawScript.startsWith('http:') ||
- _rawScript.startsWith('https:') ||
- _rawScript.startsWith('file:')) {
- return Uri.parse(_rawScript);
- } else {
- return Uri.base.resolveUri(new Uri.file(_rawScript));
- }
-}
-
-_setupHooks() {
- VMLibraryHooks.platformScript = _scriptUri;
-}
-
-class Stdin {}
-
-Stdin _stdin;
-
-class _StdIOUtils {
- static Stdin _getStdioInputStream(int fd) => null;
-}
-
-Stdin get stdin {
- _stdin ??= _StdIOUtils._getStdioInputStream(_stdinFD);
- return _stdin;
-}
-
-// -----------------------------------------------------------------
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/bootstrapping.dart.expect b/pkg/vm/testcases/bytecode/bootstrapping.dart.expect
deleted file mode 100644
index 7ad0a46..0000000
--- a/pkg/vm/testcases/bytecode/bootstrapping.dart.expect
+++ /dev/null
@@ -1,1078 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-Field '_stdinFD', type = dart:core::int*, reflectable, static, has-initializer
- value = const 0
-
-Field '_stdoutFD', type = dart:core::int*, reflectable, static, has-initializer
- value = const 1
-
-Field '_stderrFD', type = dart:core::int*, reflectable, static, has-initializer
- value = const 2
-
-Field '_rawScript', type = dart:core::String*, reflectable, static
- value = null
-
-Field '_stdin', type = #lib::Stdin*, reflectable, static
- value = null
-
-Function '_printString', static, reflectable, debuggable, native 'Builtin_PrintString'
- parameters [dart:core::String* 's'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- NativeCall CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = NativeEntry Builtin_PrintString
-}
-
-
-Function '_print', static, reflectable, debuggable
- parameters [dynamic 'arg'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- InterfaceCall CP#0, 1
- DirectCall CP#2, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::Object::toString', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = DirectCall '#lib::_printString', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-Function '_getPrintClosure', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const tear-off #lib::_print
-}
-
-
-Function '_setScheduleImmediateClosure', static, reflectable, debuggable
- parameters [FunctionType (FunctionType ()* -> void)* -> void 'closure'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- StoreStaticTOS CP#0
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = StaticField #lib::_ScheduleImmediate::_closure (field)
-}
-
-
-Function '_setStdioFDs', static, reflectable, debuggable
- parameters [dart:core::int* 'stdin', dart:core::int* 'stdout', dart:core::int* 'stderr'] (required: 3)
- return-type void
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-7]
- StoreStaticTOS CP#0
- Push FP[-6]
- StoreStaticTOS CP#1
- Push FP[-5]
- StoreStaticTOS CP#2
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = StaticField #lib::_stdinFD (field)
- [1] = StaticField #lib::_stdoutFD (field)
- [2] = StaticField #lib::_stderrFD (field)
-}
-
-
-Function '_scriptUri', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dart:core::Uri*
-
-Bytecode {
- Entry 2
- CheckStack 0
- LoadStatic CP#0
- PushConstant CP#1
- InterfaceCall CP#2, 2
- AssertBoolean 0
- JumpIfTrue L1
- LoadStatic CP#0
- PushConstant CP#4
- InterfaceCall CP#2, 2
- AssertBoolean 0
- JumpIfTrue L1
- LoadStatic CP#0
- PushConstant CP#5
- InterfaceCall CP#2, 2
- AssertBoolean 0
- JumpIfFalse L2
-L1:
- LoadStatic CP#0
- DirectCall CP#6, 1
- ReturnTOS
-L2:
- DirectCall CP#8, 0
- PushNull
- LoadStatic CP#0
- DirectCall CP#10, 2
- InterfaceCall CP#12, 2
- ReturnTOS
-}
-ConstantPool {
- [0] = StaticField #lib::_rawScript (field)
- [1] = ObjectRef 'http:'
- [2] = InterfaceCall 'dart:core::String::startsWith', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
- [4] = ObjectRef 'https:'
- [5] = ObjectRef 'file:'
- [6] = DirectCall 'dart:core::Uri::parse', ArgDesc num-args 1, num-type-args 0, names []
- [7] = Reserved
- [8] = DirectCall 'dart:core::Uri::get:base', ArgDesc num-args 0, num-type-args 0, names []
- [9] = Reserved
- [10] = DirectCall 'dart:core::_Uri::file (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [11] = Reserved
- [12] = InterfaceCall 'dart:core::Uri::resolveUri', ArgDesc num-args 2, num-type-args 0, names []
- [13] = Reserved
-}
-
-
-Function '_setupHooks', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- PushConstant CP#0
- DirectCall CP#1, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const tear-off #lib::_scriptUri
- [1] = DirectCall '#lib::VMLibraryHooks::set:platformScript', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
-}
-
-
-Function 'get:stdin', getter, static, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::Stdin*
-
-Bytecode {
- Entry 2
- CheckStack 0
- LoadStatic CP#0
- JumpIfNotNull L1
- LoadStatic CP#1
- DirectCall CP#2, 1
- StoreLocal r1
- Push r1
- StoreStaticTOS CP#0
- PopLocal r0
- Jump L2
-L1:
- PushNull
- PopLocal r0
-L2:
- Push r0
- Drop1
- LoadStatic CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = StaticField #lib::_stdin (field)
- [1] = StaticField #lib::_stdinFD (field)
- [2] = DirectCall '#lib::_StdIOUtils::_getStdioInputStream', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-Class '_ScheduleImmediate', script = '#lib'
- extends dart:core::Object*
-
-Field '_closure', type = FunctionType (FunctionType ()* -> void)* -> void, reflectable, static, has-initializer
- value = null
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::_ScheduleImmediate*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class '_NamespaceImpl', script = '#lib'
- extends dart:core::Object*
- implements [#lib::_Namespace*]
-
-Field '_cachedNamespace', type = #lib::_NamespaceImpl*, reflectable, static, has-initializer
- value = null
-
-Function '_', constructor, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::_NamespaceImpl*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function '_create', static, reflectable, debuggable, native 'Namespace_Create'
- parameters [#lib::_NamespaceImpl* 'namespace', dynamic 'n'] (required: 2)
- return-type #lib::_NamespaceImpl*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-6]
- Push FP[-5]
- NativeCall CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = NativeEntry Namespace_Create
-}
-
-
-Function '_getPointer', static, reflectable, debuggable, native 'Namespace_GetPointer'
- parameters [#lib::_NamespaceImpl* 'namespace'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- NativeCall CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = NativeEntry Namespace_GetPointer
-}
-
-
-Function '_getDefault', static, reflectable, debuggable, native 'Namespace_GetDefault'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Bytecode {
- Entry 0
- CheckStack 0
- NativeCall CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = NativeEntry Namespace_GetDefault
-}
-
-
-Function '_setupNamespace', static, reflectable, debuggable
- parameters [dynamic 'namespace'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 2
- CheckStack 0
- Allocate CP#0
- StoreLocal r1
- Push r1
- DirectCall CP#1, 1
- Drop1
- Push FP[-5]
- DirectCall CP#3, 2
- StoreStaticTOS CP#5
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = Class #lib::_NamespaceImpl
- [1] = DirectCall '#lib::_NamespaceImpl::_ (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
- [3] = DirectCall '#lib::_NamespaceImpl::_create', ArgDesc num-args 2, num-type-args 0, names []
- [4] = Reserved
- [5] = StaticField #lib::_NamespaceImpl::_cachedNamespace (field)
-}
-
-
-Function 'get:_namespace', getter, static, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::_NamespaceImpl*
-
-Bytecode {
- Entry 2
- CheckStack 0
- LoadStatic CP#0
- JumpIfNotNull L1
- Allocate CP#1
- StoreLocal r1
- Push r1
- DirectCall CP#2, 1
- Drop1
- DirectCall CP#4, 0
- DirectCall CP#6, 2
- StoreStaticTOS CP#0
-L1:
- LoadStatic CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = StaticField #lib::_NamespaceImpl::_cachedNamespace (field)
- [1] = Class #lib::_NamespaceImpl
- [2] = DirectCall '#lib::_NamespaceImpl::_ (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = DirectCall '#lib::_NamespaceImpl::_getDefault', ArgDesc num-args 0, num-type-args 0, names []
- [5] = Reserved
- [6] = DirectCall '#lib::_NamespaceImpl::_create', ArgDesc num-args 2, num-type-args 0, names []
- [7] = Reserved
-}
-
-
-Function 'get:_namespacePointer', getter, static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Bytecode {
- Entry 0
- CheckStack 0
- DirectCall CP#0, 0
- DirectCall CP#2, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::_NamespaceImpl::get:_namespace', ArgDesc num-args 0, num-type-args 0, names []
- [1] = Reserved
- [2] = DirectCall '#lib::_NamespaceImpl::_getPointer', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class '_Namespace', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::_Namespace*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function '_setupNamespace', static, reflectable, debuggable
- parameters [dynamic 'namespace'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::_NamespaceImpl::_setupNamespace', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_namespace', getter, static, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::_Namespace*
-
-Bytecode {
- Entry 0
- CheckStack 0
- DirectCall CP#0, 0
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::_NamespaceImpl::get:_namespace', ArgDesc num-args 0, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_namespacePointer', getter, static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Bytecode {
- Entry 0
- CheckStack 0
- DirectCall CP#0, 0
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::_NamespaceImpl::get:_namespacePointer', ArgDesc num-args 0, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'VMLibraryHooks', script = '#lib'
- extends dart:core::Object*
-
-Field 'timerFactory', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Field 'eventHandlerSendData', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Field 'timerMillisecondClock', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Field 'resourceReadAsBytes', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Field 'packageRootString', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Field 'packageConfigString', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Field 'packageRootUriFuture', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Field 'packageConfigUriFuture', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Field 'resolvePackageUriFuture', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Field '_computeScriptUri', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Field '_cachedScript', type = dynamic, reflectable, static, has-initializer
- value = null
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::VMLibraryHooks*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'set:platformScript', setter, static, reflectable, debuggable
- parameters [dynamic 'f'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- StoreStaticTOS CP#0
- PushNull
- StoreStaticTOS CP#1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = StaticField #lib::VMLibraryHooks::_computeScriptUri (field)
- [1] = StaticField #lib::VMLibraryHooks::_cachedScript (field)
-}
-
-
-Function 'get:platformScript', getter, static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- LoadStatic CP#0
- JumpIfNotNull L1
- LoadStatic CP#1
- JumpIfNull L1
- LoadStatic CP#1
- DynamicCall CP#2, 1
- StoreStaticTOS CP#0
-L1:
- LoadStatic CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = StaticField #lib::VMLibraryHooks::_cachedScript (field)
- [1] = StaticField #lib::VMLibraryHooks::_computeScriptUri (field)
- [2] = DynamicCall 'call', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'Stdin', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::Stdin*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class '_StdIOUtils', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::_StdIOUtils*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function '_getStdioInputStream', static, reflectable, debuggable
- parameters [dart:core::int* 'fd'] (required: 1)
- return-type #lib::Stdin*
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-
-}
-]library #lib from "#lib" as #lib {
-
- typedef _ScheduleImmediateClosure = (() →* void) →* void;
- class _ScheduleImmediate extends dart.core::Object {
- static field (() →* void) →* void _closure = null;
- synthetic constructor •() → #lib::_ScheduleImmediate*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class _NamespaceImpl extends dart.core::Object implements #lib::_Namespace {
- static field #lib::_NamespaceImpl* _cachedNamespace = null;
- constructor _() → #lib::_NamespaceImpl*
- : super dart.core::Object::•()
- ;
- @#C2
- external static method _create(#lib::_NamespaceImpl* namespace, dynamic n) → #lib::_NamespaceImpl*;
- @#C4
- external static method _getPointer(#lib::_NamespaceImpl* namespace) → dart.core::int*;
- @#C6
- external static method _getDefault() → dart.core::int*;
- static method _setupNamespace(dynamic namespace) → void {
- #lib::_NamespaceImpl::_cachedNamespace = #lib::_NamespaceImpl::_create(new #lib::_NamespaceImpl::_(), namespace);
- }
- static get _namespace() → #lib::_NamespaceImpl* {
- if(#lib::_NamespaceImpl::_cachedNamespace.{#lib::_NamespaceImpl::==}(null)) {
- #lib::_NamespaceImpl::_cachedNamespace = #lib::_NamespaceImpl::_create(new #lib::_NamespaceImpl::_(), #lib::_NamespaceImpl::_getDefault());
- }
- return #lib::_NamespaceImpl::_cachedNamespace;
- }
- static get _namespacePointer() → dart.core::int*
- return #lib::_NamespaceImpl::_getPointer(#lib::_NamespaceImpl::_namespace);
- abstract member-signature get _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class _Namespace extends dart.core::Object {
- synthetic constructor •() → #lib::_Namespace*
- : super dart.core::Object::•()
- ;
- static method _setupNamespace(dynamic namespace) → void {
- #lib::_NamespaceImpl::_setupNamespace(namespace);
- }
- static get _namespace() → #lib::_Namespace*
- return #lib::_NamespaceImpl::_namespace;
- static get _namespacePointer() → dart.core::int*
- return #lib::_NamespaceImpl::_namespacePointer;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class VMLibraryHooks extends dart.core::Object {
- static field dynamic timerFactory = null;
- static field dynamic eventHandlerSendData = null;
- static field dynamic timerMillisecondClock = null;
- static field dynamic resourceReadAsBytes = null;
- static field dynamic packageRootString = null;
- static field dynamic packageConfigString = null;
- static field dynamic packageRootUriFuture = null;
- static field dynamic packageConfigUriFuture = null;
- static field dynamic resolvePackageUriFuture = null;
- static field dynamic _computeScriptUri = null;
- static field dynamic _cachedScript = null;
- synthetic constructor •() → #lib::VMLibraryHooks*
- : super dart.core::Object::•()
- ;
- static set platformScript(dynamic f) → void {
- #lib::VMLibraryHooks::_computeScriptUri = f;
- #lib::VMLibraryHooks::_cachedScript = null;
- }
- static get platformScript() → dynamic {
- if(#lib::VMLibraryHooks::_cachedScript.{dart.core::Object::==}(null) && !#lib::VMLibraryHooks::_computeScriptUri.{dart.core::Object::==}(null)) {
- #lib::VMLibraryHooks::_cachedScript = [@vm.call-site-attributes.metadata=receiverType:dynamic] #lib::VMLibraryHooks::_computeScriptUri.call();
- }
- return #lib::VMLibraryHooks::_cachedScript;
- }
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class Stdin extends dart.core::Object {
- synthetic constructor •() → #lib::Stdin*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class _StdIOUtils extends dart.core::Object {
- synthetic constructor •() → #lib::_StdIOUtils*
- : super dart.core::Object::•()
- ;
- static method _getStdioInputStream(dart.core::int* fd) → #lib::Stdin*
- return null;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- static field dart.core::int* _stdinFD = 0;
- static field dart.core::int* _stdoutFD = 1;
- static field dart.core::int* _stderrFD = 2;
- static field dart.core::String* _rawScript;
- static field #lib::Stdin* _stdin;
- @#C8
- external static method _printString(dart.core::String* s) → void;
- static method _print(dynamic arg) → void {
- #lib::_printString(arg.{dart.core::Object::toString}());
- }
- static method _getPrintClosure() → dynamic
- return #C9;
- static method _setScheduleImmediateClosure((() →* void) →* void closure) → void {
- #lib::_ScheduleImmediate::_closure = closure;
- }
- static method _setStdioFDs(dart.core::int* stdin, dart.core::int* stdout, dart.core::int* stderr) → void {
- #lib::_stdinFD = stdin;
- #lib::_stdoutFD = stdout;
- #lib::_stderrFD = stderr;
- }
- static method _scriptUri() → dart.core::Uri* {
- if(#lib::_rawScript.{dart.core::String::startsWith}("http:") || #lib::_rawScript.{dart.core::String::startsWith}("https:") || #lib::_rawScript.{dart.core::String::startsWith}("file:")) {
- return dart.core::Uri::parse(#lib::_rawScript);
- }
- else {
- return dart.core::Uri::base.{dart.core::Uri::resolveUri}(dart.core::_Uri::file(#lib::_rawScript));
- }
- }
- static method _setupHooks() → dynamic {
- #lib::VMLibraryHooks::platformScript = #C10;
- }
- static get stdin() → #lib::Stdin* {
- #lib::_stdin.{#lib::Stdin::==}(null) ?{#lib::Stdin*} #lib::_stdin = #lib::_StdIOUtils::_getStdioInputStream(#lib::_stdinFD) : null;
- return #lib::_stdin;
- }
- static method main() → dynamic {}
-}
-constants {
- #C1 = "Namespace_Create"
- #C2 = dart._internal::ExternalName {name:#C1}
- #C3 = "Namespace_GetPointer"
- #C4 = dart._internal::ExternalName {name:#C3}
- #C5 = "Namespace_GetDefault"
- #C6 = dart._internal::ExternalName {name:#C5}
- #C7 = "Builtin_PrintString"
- #C8 = dart._internal::ExternalName {name:#C7}
- #C9 = tearoff #lib::_print
- #C10 = tearoff #lib::_scriptUri
-}
diff --git a/pkg/vm/testcases/bytecode/closures.dart b/pkg/vm/testcases/bytecode/closures.dart
deleted file mode 100644
index 669a8f2..0000000
--- a/pkg/vm/testcases/bytecode/closures.dart
+++ /dev/null
@@ -1,168 +0,0 @@
-// 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.
-
-int simpleClosure() {
- int x = 5;
- var inc = (int y) {
- x = x + y;
- };
- inc(3);
- return x;
-}
-
-class C1 {}
-
-class C2 {}
-
-class C3 {}
-
-class C4 {}
-
-class C5 {}
-
-class C6 {}
-
-class C7 {}
-
-class C8 {}
-
-class A<T1, T2> {
- void foo<T3, T4>() {
- void nested1<T5, T6>() {
- void nested2<T7, T8>() {
- var nested3 = () {
- print([T1, T2, T3, T4, T5, T6, T7, T8]);
- callWithArgs<T1, T2, T3, T4, T5, T6, T7, T8>();
- };
- nested3();
- }
-
- nested2<C7, C8>();
- nested2<List<C7>, List<C8>>();
- }
-
- nested1<C5, C6>();
- nested1<List<C5>, List<C6>>();
- }
-}
-
-void callWithArgs<T1, T2, T3, T4, T5, T6, T7, T8>() {
- print([T1, T2, T3, T4, T5, T6, T7, T8]);
-}
-
-void callA() {
- new A<C1, C2>().foo<C3, C4>();
- new A<C1, C2>().foo<List<C3>, List<C4>>();
- new A<List<C1>, List<C2>>().foo<List<C3>, List<C4>>();
-}
-
-class B {
- int foo;
-
- void topLevel() {
- {
- int x = 1;
-
- {
- int y = 2;
- int z = 3;
-
- var closure1 = (int y) {
- x = y + 1;
-
- if (x > 5) {
- int w = 4;
-
- void closure2() {
- z = x + 2;
- w = foo + y;
- }
-
- closure2();
-
- print(w);
- }
- };
-
- closure1(10);
- closure1(11);
-
- print(y);
- print(z);
- }
-
- print(x);
- }
-
- {
- int x = 42;
-
- var closure3 = () {
- foo = x;
- };
-
- closure3();
- }
- }
-}
-
-class C {
- void testForLoop() {
- int delta = 0;
- List<Function> getI = <Function>[];
- List<Function> setI = <Function>[];
- for (int i = 0; i < 10; i++) {
- getI.add(() => i + delta);
- setI.add((int ii) {
- i = ii + delta;
- });
- }
- }
-
- void testForInLoop(List<int> list) {
- for (var i in list) {
- var inc = () {
- i = i + 1;
- };
- inc();
- print(i);
- }
- }
-}
-
-typedef IntFunc(int arg);
-
-IntFunc testPartialInstantiation() {
- void foo<T>(T t) {}
- IntFunc intFunc = foo;
- return intFunc;
-}
-
-class D<T> {
- foo(T t) {
- return () => t;
- }
-
- bar() {
- return () {
- inner() {}
-
- inner();
- };
- }
-}
-
-abstract class E {
- int Function(int x, int y) foo1;
- int Function<T>(T x, T y) get foo2;
- int evalArg1();
- int evalArg2();
- E getE();
-
- int testCallThroughGetter1() => foo1(evalArg1(), evalArg2());
- int testCallThroughGetter2() => foo2<int>(evalArg1(), evalArg2());
- int testCallThroughGetter3() => getE().foo2<int>(evalArg1(), evalArg2());
-}
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/closures.dart.expect b/pkg/vm/testcases/bytecode/closures.dart.expect
deleted file mode 100644
index e0baf44..0000000
--- a/pkg/vm/testcases/bytecode/closures.dart.expect
+++ /dev/null
@@ -1,2543 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'simpleClosure', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Bytecode {
- Entry 4
- CheckStack 0
- AllocateContext 0, 1
- PopLocal r0
- Push r0
- PushInt 5
- StoreContextVar 0, 0
- AllocateClosure CP#0
- StoreLocal r3
- Push r3
- PushNull
- StoreFieldTOS CP#7
- Push r3
- PushNull
- StoreFieldTOS CP#9
- Push r3
- PushConstant CP#0
- StoreFieldTOS CP#11
- Push r3
- Push r0
- StoreFieldTOS CP#1
- PopLocal r2
- Push r2
- StoreLocal r3
- PushInt 3
- Push r3
- UncheckedClosureCall CP#13, 2
- Drop1
- Push r0
- LoadContextVar 0, 0
- ReturnTOS
-}
-ConstantPool {
- [0] = ClosureFunction 0
- [1] = InstanceField dart:core::_Closure::_context (field)
- [2] = Reserved
- [3] = Type dart:core::int*
- [4] = ObjectRef 'y'
- [5] = SubtypeTestCache
- [6] = EndClosureFunctionScope
- [7] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [8] = Reserved
- [9] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [10] = Reserved
- [11] = InstanceField dart:core::_Closure::_function (field)
- [12] = Reserved
- [13] = ObjectRef ArgDesc num-args 2, num-type-args 0, names []
-}
-Closure #lib::simpleClosure::'<anonymous closure>' (dart:core::int* y) -> dart:core::Null?
-ClosureCode {
- Entry 3
- Push FP[-6]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- JumpIfUnchecked L1
- Push FP[-5]
- PushConstant CP#3
- PushNull
- PushNull
- PushConstant CP#4
- AssertAssignable 1, CP#5
- Drop1
-L1:
- Push r0
- Push r0
- LoadContextVar 0, 0
- Push FP[-5]
- AddInt
- StoreContextVar 0, 0
- PushNull
- ReturnTOS
-}
-
-
-Function 'callWithArgs', static, reflectable, debuggable
- type-params <dart:core::Object* T1, dart:core::Object* T2, dart:core::Object* T3, dart:core::Object* T4, dart:core::Object* T5, dart:core::Object* T6, dart:core::Object* T7, dart:core::Object* T8>
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 2
- CheckFunctionTypeArgs 8, r0
- CheckStack 0
- PushConstant CP#0
- StoreLocal r1
- Push r1
- PushInt 8
- CreateArrayTOS
- StoreLocal r1
- Push r1
- PushInt 0
- PushNull
- Push r0
- InstantiateType CP#1
- StoreIndexedTOS
- Push r1
- PushInt 1
- PushNull
- Push r0
- InstantiateType CP#2
- StoreIndexedTOS
- Push r1
- PushInt 2
- PushNull
- Push r0
- InstantiateType CP#3
- StoreIndexedTOS
- Push r1
- PushInt 3
- PushNull
- Push r0
- InstantiateType CP#4
- StoreIndexedTOS
- Push r1
- PushInt 4
- PushNull
- Push r0
- InstantiateType CP#5
- StoreIndexedTOS
- Push r1
- PushInt 5
- PushNull
- Push r0
- InstantiateType CP#6
- StoreIndexedTOS
- Push r1
- PushInt 6
- PushNull
- Push r0
- InstantiateType CP#7
- StoreIndexedTOS
- Push r1
- PushInt 7
- PushNull
- Push r0
- InstantiateType CP#8
- StoreIndexedTOS
- DirectCall CP#9, 2
- DirectCall CP#11, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < dart:core::Type* >
- [1] = Type #lib::callWithArgs::TypeParam/0*
- [2] = Type #lib::callWithArgs::TypeParam/1*
- [3] = Type #lib::callWithArgs::TypeParam/2*
- [4] = Type #lib::callWithArgs::TypeParam/3*
- [5] = Type #lib::callWithArgs::TypeParam/4*
- [6] = Type #lib::callWithArgs::TypeParam/5*
- [7] = Type #lib::callWithArgs::TypeParam/6*
- [8] = Type #lib::callWithArgs::TypeParam/7*
- [9] = DirectCall 'dart:core::List::_fromLiteral (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [10] = Reserved
- [11] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [12] = Reserved
-}
-
-
-Function 'callA', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 1
- CheckStack 0
- PushConstant CP#0
- PushConstant CP#2
- PushConstant CP#1
- AllocateT
- StoreLocal r0
- Push r0
- DirectCall CP#3, 1
- Drop1
- InterfaceCall CP#5, 2
- Drop1
- PushConstant CP#7
- PushConstant CP#2
- PushConstant CP#1
- AllocateT
- StoreLocal r0
- Push r0
- DirectCall CP#3, 1
- Drop1
- InterfaceCall CP#5, 2
- Drop1
- PushConstant CP#7
- PushConstant CP#8
- PushConstant CP#1
- AllocateT
- StoreLocal r0
- Push r0
- DirectCall CP#3, 1
- Drop1
- InterfaceCall CP#5, 2
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < #lib::C3*, #lib::C4* >
- [1] = Class #lib::A
- [2] = ObjectRef < #lib::C1*, #lib::C2* >
- [3] = DirectCall '#lib::A:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [4] = Reserved
- [5] = InterfaceCall '#lib::A::foo', ArgDesc num-args 1, num-type-args 2, names []
- [6] = Reserved
- [7] = ObjectRef < dart:core::List < #lib::C3* >*, dart:core::List < #lib::C4* >* >
- [8] = ObjectRef < dart:core::List < #lib::C1* >*, dart:core::List < #lib::C2* >* >
-}
-
-
-Function 'testPartialInstantiation', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type FunctionType (dart:core::int*)* -> dynamic
-
-Bytecode {
- Entry 7
- CheckStack 0
- AllocateClosure CP#0
- StoreLocal r3
- Push r3
- PushNull
- StoreFieldTOS CP#14
- Push r3
- PushNull
- StoreFieldTOS CP#6
- Push r3
- PushConstant CP#5
- StoreFieldTOS CP#3
- Push r3
- PushConstant CP#0
- StoreFieldTOS CP#16
- Push r3
- Push r0
- StoreFieldTOS CP#1
- PopLocal r2
- Push r2
- StoreLocal r3
- PushConstant CP#18
- StoreLocal r6
- DirectCall CP#19, 2
- Drop1
- Allocate CP#21
- StoreLocal r5
- Push r6
- StoreFieldTOS CP#3
- Push r5
- Push r3
- LoadFieldTOS CP#14
- StoreFieldTOS CP#14
- Push r5
- Push r3
- LoadFieldTOS CP#6
- StoreFieldTOS CP#6
- Push r5
- Push r3
- LoadFieldTOS CP#16
- StoreFieldTOS CP#16
- Push r5
- Push r3
- LoadFieldTOS CP#1
- StoreFieldTOS CP#1
- Push r5
- PopLocal r4
- Push r4
- ReturnTOS
-}
-ConstantPool {
- [0] = ClosureFunction 0
- [1] = InstanceField dart:core::_Closure::_context (field)
- [2] = Reserved
- [3] = InstanceField dart:core::_Closure::_delayed_type_arguments (field)
- [4] = Reserved
- [5] = EmptyTypeArguments
- [6] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [7] = Reserved
- [8] = DirectCall 'dart:_internal::_prependTypeArguments', ArgDesc num-args 4, num-type-args 0, names []
- [9] = Reserved
- [10] = Type #lib::testPartialInstantiation::Closure/0::TypeParam/0*
- [11] = ObjectRef 't'
- [12] = SubtypeTestCache
- [13] = EndClosureFunctionScope
- [14] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [15] = Reserved
- [16] = InstanceField dart:core::_Closure::_function (field)
- [17] = Reserved
- [18] = ObjectRef < dart:core::int* >
- [19] = DirectCall 'dart:_internal::_boundsCheckForPartialInstantiation', ArgDesc num-args 2, num-type-args 0, names []
- [20] = Reserved
- [21] = Class dart:core::_Closure
-}
-Closure #lib::testPartialInstantiation::'foo' <dart:core::Object* T> (#lib::testPartialInstantiation::Closure/0::TypeParam/0* t) -> void
-ClosureCode {
- Entry 3
- Push FP[-6]
- LoadFieldTOS CP#1
- PopLocal r1
- Push FP[-6]
- LoadFieldTOS CP#3
- StoreLocal r0
- PushConstant CP#5
- JumpIfEqStrict L1
- CheckFunctionTypeArgs 0, r2
- Jump L2
-L1:
- CheckFunctionTypeArgs 1, r0
-L2:
- CheckStack 0
- Push r0
- Push FP[-6]
- LoadFieldTOS CP#6
- PushInt 0
- PushInt 1
- DirectCall CP#8, 4
- PopLocal r0
- JumpIfUnchecked L3
- Push FP[-5]
- PushConstant CP#10
- PushNull
- Push r0
- PushConstant CP#11
- AssertAssignable 0, CP#12
- Drop1
-L3:
- PushNull
- ReturnTOS
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-Class 'C1', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::C1*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'C2', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::C2*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'C3', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::C3*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'C4', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::C4*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'C5', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::C5*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'C6', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::C6*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'C7', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::C7*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'C8', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::C8*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'A', script = '#lib'
- type-params <dart:core::Object* T1, dart:core::Object* T2> (args: 2)
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::A < #lib::A::TypeParam/0*, #lib::A::TypeParam/1* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'foo', reflectable, debuggable
- type-params <dart:core::Object* T3, dart:core::Object* T4>
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 5
- CheckFunctionTypeArgs 2, r0
- CheckStack 0
- AllocateContext 0, 1
- PopLocal r1
- Push r1
- Push FP[-5]
- StoreContextVar 0, 0
- AllocateClosure CP#0
- StoreLocal r4
- Push r4
- Push FP[-5]
- LoadTypeArgumentsField CP#14
- StoreFieldTOS CP#30
- Push r4
- Push r0
- StoreFieldTOS CP#6
- Push r4
- PushConstant CP#5
- StoreFieldTOS CP#3
- Push r4
- PushConstant CP#0
- StoreFieldTOS CP#32
- Push r4
- Push r1
- StoreFieldTOS CP#1
- PopLocal r3
- PushConstant CP#40
- Push r3
- StoreLocal r4
- Push r4
- UncheckedClosureCall CP#37, 2
- Drop1
- PushConstant CP#41
- Push r3
- StoreLocal r4
- Push r4
- UncheckedClosureCall CP#37, 2
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ClosureFunction 0
- [1] = InstanceField dart:core::_Closure::_context (field)
- [2] = Reserved
- [3] = InstanceField dart:core::_Closure::_delayed_type_arguments (field)
- [4] = Reserved
- [5] = EmptyTypeArguments
- [6] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [7] = Reserved
- [8] = DirectCall 'dart:_internal::_prependTypeArguments', ArgDesc num-args 4, num-type-args 0, names []
- [9] = Reserved
- [10] = ClosureFunction 1
- [11] = ClosureFunction 2
- [12] = ObjectRef < dart:core::Type* >
- [13] = Type #lib::A::TypeParam/0*
- [14] = TypeArgumentsField #lib::A
- [15] = Type #lib::A::TypeParam/1*
- [16] = Type #lib::A::foo::TypeParam/0*
- [17] = Type #lib::A::foo::TypeParam/1*
- [18] = Type #lib::A::foo::Closure/0::TypeParam/0*
- [19] = Type #lib::A::foo::Closure/0::TypeParam/1*
- [20] = Type #lib::A::foo::Closure/1::TypeParam/0*
- [21] = Type #lib::A::foo::Closure/1::TypeParam/1*
- [22] = DirectCall 'dart:core::List::_fromLiteral (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [23] = Reserved
- [24] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [25] = Reserved
- [26] = ObjectRef < #lib::A::TypeParam/0*, #lib::A::TypeParam/1*, #lib::A::foo::TypeParam/0*, #lib::A::foo::TypeParam/1*, #lib::A::foo::Closure/0::TypeParam/0*, #lib::A::foo::Closure/0::TypeParam/1*, #lib::A::foo::Closure/1::TypeParam/0*, #lib::A::foo::Closure/1::TypeParam/1* >
- [27] = DirectCall '#lib::callWithArgs', ArgDesc num-args 0, num-type-args 8, names []
- [28] = Reserved
- [29] = EndClosureFunctionScope
- [30] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [31] = Reserved
- [32] = InstanceField dart:core::_Closure::_function (field)
- [33] = Reserved
- [34] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
- [35] = EndClosureFunctionScope
- [36] = ObjectRef < #lib::C7*, #lib::C8* >
- [37] = ObjectRef ArgDesc num-args 1, num-type-args 2, names []
- [38] = ObjectRef < dart:core::List < #lib::C7* >*, dart:core::List < #lib::C8* >* >
- [39] = EndClosureFunctionScope
- [40] = ObjectRef < #lib::C5*, #lib::C6* >
- [41] = ObjectRef < dart:core::List < #lib::C5* >*, dart:core::List < #lib::C6* >* >
-}
-Closure #lib::A::foo::'nested1' <dart:core::Object* T5, dart:core::Object* T6> () -> void
-ClosureCode {
- Entry 5
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r1
- Push FP[-5]
- LoadFieldTOS CP#3
- StoreLocal r0
- PushConstant CP#5
- JumpIfEqStrict L1
- CheckFunctionTypeArgs 0, r2
- Jump L2
-L1:
- CheckFunctionTypeArgs 2, r0
-L2:
- CheckStack 0
- Push r0
- Push FP[-5]
- LoadFieldTOS CP#6
- PushInt 2
- PushInt 4
- DirectCall CP#8, 4
- PopLocal r0
- AllocateClosure CP#10
- StoreLocal r4
- Push r4
- Push r1
- LoadContextVar 0, 0
- LoadTypeArgumentsField CP#14
- StoreFieldTOS CP#30
- Push r4
- Push r0
- StoreFieldTOS CP#6
- Push r4
- PushConstant CP#5
- StoreFieldTOS CP#3
- Push r4
- PushConstant CP#10
- StoreFieldTOS CP#32
- Push r4
- Push r1
- StoreFieldTOS CP#1
- PopLocal r3
- PushConstant CP#36
- Push r3
- StoreLocal r4
- Push r4
- UncheckedClosureCall CP#37, 2
- Drop1
- PushConstant CP#38
- Push r3
- StoreLocal r4
- Push r4
- UncheckedClosureCall CP#37, 2
- Drop1
- PushNull
- ReturnTOS
-}
-
-Closure #lib::A::foo::Closure/0::'nested2' <dart:core::Object* T7, dart:core::Object* T8> () -> void
-ClosureCode {
- Entry 5
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r1
- Push FP[-5]
- LoadFieldTOS CP#3
- StoreLocal r0
- PushConstant CP#5
- JumpIfEqStrict L1
- CheckFunctionTypeArgs 0, r2
- Jump L2
-L1:
- CheckFunctionTypeArgs 2, r0
-L2:
- CheckStack 0
- Push r0
- Push FP[-5]
- LoadFieldTOS CP#6
- PushInt 4
- PushInt 6
- DirectCall CP#8, 4
- PopLocal r0
- AllocateClosure CP#11
- StoreLocal r4
- Push r4
- Push r1
- LoadContextVar 0, 0
- LoadTypeArgumentsField CP#14
- StoreFieldTOS CP#30
- Push r4
- Push r0
- StoreFieldTOS CP#6
- Push r4
- PushConstant CP#11
- StoreFieldTOS CP#32
- Push r4
- Push r1
- StoreFieldTOS CP#1
- PopLocal r3
- Push r3
- StoreLocal r4
- Push r4
- UncheckedClosureCall CP#34, 1
- Drop1
- PushNull
- ReturnTOS
-}
-
-Closure #lib::A::foo::Closure/1::'<anonymous closure>' () -> dart:core::Null?
-ClosureCode {
- Entry 4
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r1
- CheckStack 0
- Push FP[-5]
- LoadFieldTOS CP#6
- PopLocal r0
- PushConstant CP#12
- StoreLocal r3
- Push r3
- PushInt 8
- CreateArrayTOS
- StoreLocal r3
- Push r3
- PushInt 0
- Push r1
- LoadContextVar 0, 0
- LoadTypeArgumentsField CP#14
- PushNull
- InstantiateType CP#13
- StoreIndexedTOS
- Push r3
- PushInt 1
- Push r1
- LoadContextVar 0, 0
- LoadTypeArgumentsField CP#14
- PushNull
- InstantiateType CP#15
- StoreIndexedTOS
- Push r3
- PushInt 2
- PushNull
- Push r0
- InstantiateType CP#16
- StoreIndexedTOS
- Push r3
- PushInt 3
- PushNull
- Push r0
- InstantiateType CP#17
- StoreIndexedTOS
- Push r3
- PushInt 4
- PushNull
- Push r0
- InstantiateType CP#18
- StoreIndexedTOS
- Push r3
- PushInt 5
- PushNull
- Push r0
- InstantiateType CP#19
- StoreIndexedTOS
- Push r3
- PushInt 6
- PushNull
- Push r0
- InstantiateType CP#20
- StoreIndexedTOS
- Push r3
- PushInt 7
- PushNull
- Push r0
- InstantiateType CP#21
- StoreIndexedTOS
- DirectCall CP#22, 2
- DirectCall CP#24, 1
- Drop1
- Push r1
- LoadContextVar 0, 0
- LoadTypeArgumentsField CP#14
- Push r0
- InstantiateTypeArgumentsTOS 0, CP#26
- DirectCall CP#27, 1
- Drop1
- PushNull
- ReturnTOS
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'B', script = '#lib'
- extends dart:core::Object*
-
-Field 'foo', type = dart:core::int*, getter = 'get:foo', setter = 'set:foo', reflectable, has-initializer
- value = null
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::B*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-Nullable fields: [#lib::B::foo (field)]
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'topLevel', reflectable, debuggable
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 5
- CheckStack 0
- AllocateContext 0, 4
- PopLocal r0
- Push r0
- Push FP[-5]
- StoreContextVar 0, 0
- Push r0
- PushInt 1
- StoreContextVar 0, 1
- PushInt 2
- PopLocal r2
- Push r0
- PushInt 3
- StoreContextVar 0, 2
- AllocateClosure CP#0
- StoreLocal r4
- Push r4
- PushNull
- StoreFieldTOS CP#10
- Push r4
- PushNull
- StoreFieldTOS CP#12
- Push r4
- PushConstant CP#0
- StoreFieldTOS CP#14
- Push r4
- Push r0
- StoreFieldTOS CP#1
- PopLocal r3
- Push r3
- StoreLocal r4
- PushInt 10
- Push r4
- UncheckedClosureCall CP#20, 2
- Drop1
- Push r3
- StoreLocal r4
- PushInt 11
- Push r4
- UncheckedClosureCall CP#20, 2
- Drop1
- Push r2
- DirectCall CP#17, 1
- Drop1
- Push r0
- LoadContextVar 0, 2
- DirectCall CP#17, 1
- Drop1
- Push r0
- LoadContextVar 0, 1
- DirectCall CP#17, 1
- Drop1
- Push r0
- PushInt 42
- StoreContextVar 0, 3
- AllocateClosure CP#21
- StoreLocal r3
- Push r3
- PushNull
- StoreFieldTOS CP#10
- Push r3
- PushNull
- StoreFieldTOS CP#12
- Push r3
- PushConstant CP#21
- StoreFieldTOS CP#14
- Push r3
- Push r0
- StoreFieldTOS CP#1
- PopLocal r2
- Push r2
- StoreLocal r3
- Push r3
- UncheckedClosureCall CP#16, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ClosureFunction 0
- [1] = InstanceField dart:core::_Closure::_context (field)
- [2] = Reserved
- [3] = Type dart:core::int*
- [4] = ObjectRef 'y'
- [5] = SubtypeTestCache
- [6] = ClosureFunction 1
- [7] = InterfaceCall '#lib::B::get:foo', ArgDesc num-args 1, num-type-args 0, names []
- [8] = Reserved
- [9] = EndClosureFunctionScope
- [10] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [11] = Reserved
- [12] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [13] = Reserved
- [14] = InstanceField dart:core::_Closure::_function (field)
- [15] = Reserved
- [16] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
- [17] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [18] = Reserved
- [19] = EndClosureFunctionScope
- [20] = ObjectRef ArgDesc num-args 2, num-type-args 0, names []
- [21] = ClosureFunction 2
- [22] = InterfaceCall '#lib::B::set:foo', ArgDesc num-args 2, num-type-args 0, names []
- [23] = Reserved
- [24] = EndClosureFunctionScope
-}
-Closure #lib::B::topLevel::'<anonymous closure>' (dart:core::int* y) -> dart:core::Null?
-ClosureCode {
- Entry 4
- Push FP[-6]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- AllocateContext 1, 2
- StoreLocal r1
- Push r1
- Push r0
- StoreContextParent
- PopLocal r0
- Push r0
- Push FP[-5]
- StoreContextVar 1, 0
- JumpIfUnchecked L1
- Push FP[-5]
- PushConstant CP#3
- PushNull
- PushNull
- PushConstant CP#4
- AssertAssignable 1, CP#5
- Drop1
-L1:
- Push r0
- LoadContextParent
- Push r0
- LoadContextVar 1, 0
- PushInt 1
- AddInt
- StoreContextVar 0, 1
- Push r0
- LoadContextParent
- LoadContextVar 0, 1
- PushInt 5
- CompareIntGt
- JumpIfFalse L2
- Push r0
- PushInt 4
- StoreContextVar 1, 1
- AllocateClosure CP#6
- StoreLocal r2
- Push r2
- PushNull
- StoreFieldTOS CP#10
- Push r2
- PushNull
- StoreFieldTOS CP#12
- Push r2
- PushConstant CP#6
- StoreFieldTOS CP#14
- Push r2
- Push r0
- StoreFieldTOS CP#1
- PopLocal r3
- Push r3
- StoreLocal r2
- Push r2
- UncheckedClosureCall CP#16, 1
- Drop1
- Push r0
- LoadContextVar 1, 1
- DirectCall CP#17, 1
- Drop1
-L2:
- PushNull
- ReturnTOS
-}
-
-Closure #lib::B::topLevel::Closure/0::'closure2' () -> void
-ClosureCode {
- Entry 3
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- Push r0
- LoadContextParent
- Push r0
- LoadContextParent
- LoadContextVar 0, 1
- PushInt 2
- AddInt
- StoreContextVar 0, 2
- Push r0
- Push r0
- LoadContextParent
- LoadContextVar 0, 0
- InterfaceCall CP#7, 1
- Push r0
- LoadContextVar 1, 0
- AddInt
- StoreContextVar 1, 1
- PushNull
- ReturnTOS
-}
-
-Closure #lib::B::topLevel::'<anonymous closure>' () -> dart:core::Null?
-ClosureCode {
- Entry 3
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- Push r0
- LoadContextVar 0, 0
- Push r0
- LoadContextVar 0, 3
- InterfaceCall CP#22, 2
- Drop1
- PushNull
- ReturnTOS
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'C', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::C*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'testForLoop', reflectable, debuggable
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 5
- CheckStack 0
- AllocateContext 0, 1
- PopLocal r0
- Push r0
- PushInt 0
- StoreContextVar 0, 0
- PushConstant CP#0
- PushConstant CP#1
- DirectCall CP#2, 2
- PopLocal r2
- PushConstant CP#0
- PushConstant CP#1
- DirectCall CP#2, 2
- PopLocal r4
- AllocateContext 1, 1
- StoreLocal r1
- Push r1
- Push r0
- StoreContextParent
- PopLocal r0
- Push r0
- PushInt 0
- StoreContextVar 1, 0
-L2:
- CheckStack 1
- Push r0
- LoadContextVar 1, 0
- PushInt 10
- CompareIntLt
- JumpIfFalse L1
- Push r2
- AllocateClosure CP#4
- StoreLocal r3
- Push r3
- PushNull
- StoreFieldTOS CP#8
- Push r3
- PushNull
- StoreFieldTOS CP#10
- Push r3
- PushConstant CP#4
- StoreFieldTOS CP#12
- Push r3
- Push r0
- StoreFieldTOS CP#5
- InstantiatedInterfaceCall CP#14, 2
- Drop1
- Push r4
- AllocateClosure CP#17
- StoreLocal r3
- Push r3
- PushNull
- StoreFieldTOS CP#8
- Push r3
- PushNull
- StoreFieldTOS CP#10
- Push r3
- PushConstant CP#17
- StoreFieldTOS CP#12
- Push r3
- Push r0
- StoreFieldTOS CP#5
- InstantiatedInterfaceCall CP#14, 2
- Drop1
- Push r0
- CloneContext 1, 1
- PopLocal r0
- Push r0
- Push r0
- LoadContextVar 1, 0
- PushInt 1
- AddInt
- StoreLocal r3
- StoreContextVar 1, 0
- Push r3
- Drop1
- Jump L2
-L1:
- Push r0
- LoadContextParent
- PopLocal r0
- Push r0
- LoadContextParent
- PopLocal r0
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < dart:core::Function* >
- [1] = ObjectRef const <dynamic> []
- [2] = DirectCall 'dart:core::List::_fromLiteral (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
- [4] = ClosureFunction 0
- [5] = InstanceField dart:core::_Closure::_context (field)
- [6] = Reserved
- [7] = EndClosureFunctionScope
- [8] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [9] = Reserved
- [10] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [11] = Reserved
- [12] = InstanceField dart:core::_Closure::_function (field)
- [13] = Reserved
- [14] = InstantiatedInterfaceCall 'dart:core::List::add', ArgDesc num-args 2, num-type-args 0, names [], receiver dart:core::List < dart:core::Function* >*
- [15] = Reserved
- [16] = Reserved
- [17] = ClosureFunction 1
- [18] = Type dart:core::int*
- [19] = ObjectRef 'ii'
- [20] = SubtypeTestCache
- [21] = EndClosureFunctionScope
-}
-Closure #lib::C::testForLoop::'<anonymous closure>' () -> dart:core::int*
-ClosureCode {
- Entry 2
- Push FP[-5]
- LoadFieldTOS CP#5
- PopLocal r0
- CheckStack 0
- Push r0
- LoadContextVar 1, 0
- Push r0
- LoadContextParent
- LoadContextVar 0, 0
- AddInt
- ReturnTOS
-}
-
-Closure #lib::C::testForLoop::'<anonymous closure>' (dart:core::int* ii) -> dart:core::Null?
-ClosureCode {
- Entry 3
- Push FP[-6]
- LoadFieldTOS CP#5
- PopLocal r0
- CheckStack 0
- JumpIfUnchecked L1
- Push FP[-5]
- PushConstant CP#18
- PushNull
- PushNull
- PushConstant CP#19
- AssertAssignable 1, CP#20
- Drop1
-L1:
- Push r0
- Push FP[-5]
- Push r0
- LoadContextParent
- LoadContextVar 0, 0
- AddInt
- StoreContextVar 1, 0
- PushNull
- ReturnTOS
-}
-
-
-Function 'testForInLoop', reflectable, debuggable
- parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 5
- CheckStack 0
- Push FP[-5]
- InterfaceCall CP#0, 1
- PopLocal r2
-L2:
- CheckStack 1
- Push r2
- InterfaceCall CP#2, 1
- AssertBoolean 0
- JumpIfFalse L1
- AllocateContext 0, 1
- PopLocal r0
- Push r0
- Push r2
- InterfaceCall CP#4, 1
- StoreContextVar 0, 0
- AllocateClosure CP#6
- StoreLocal r4
- Push r4
- PushNull
- StoreFieldTOS CP#10
- Push r4
- PushNull
- StoreFieldTOS CP#12
- Push r4
- PushConstant CP#6
- StoreFieldTOS CP#14
- Push r4
- Push r0
- StoreFieldTOS CP#7
- PopLocal r3
- Push r3
- StoreLocal r4
- Push r4
- UncheckedClosureCall CP#16, 1
- Drop1
- Push r0
- LoadContextVar 0, 0
- DirectCall CP#17, 1
- Drop1
- Push r0
- LoadContextParent
- PopLocal r0
- Jump L2
-L1:
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::Iterable::get:iterator', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall 'dart:core::Iterator::moveNext', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = InterfaceCall 'dart:core::Iterator::get:current', ArgDesc num-args 1, num-type-args 0, names []
- [5] = Reserved
- [6] = ClosureFunction 0
- [7] = InstanceField dart:core::_Closure::_context (field)
- [8] = Reserved
- [9] = EndClosureFunctionScope
- [10] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [11] = Reserved
- [12] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [13] = Reserved
- [14] = InstanceField dart:core::_Closure::_function (field)
- [15] = Reserved
- [16] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
- [17] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [18] = Reserved
-}
-Closure #lib::C::testForInLoop::'<anonymous closure>' () -> dart:core::Null?
-ClosureCode {
- Entry 3
- Push FP[-5]
- LoadFieldTOS CP#7
- PopLocal r0
- CheckStack 0
- Push r0
- Push r0
- LoadContextVar 0, 0
- PushInt 1
- AddInt
- StoreContextVar 0, 0
- PushNull
- ReturnTOS
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'D', script = '#lib'
- type-params <dart:core::Object* T> (args: 1)
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::D < #lib::D::TypeParam/0* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'foo', reflectable, debuggable
- parameters [#lib::D::TypeParam/0* 't'] (required: 1)
- return-type dynamic
-
-Bytecode {
- Entry 3
- CheckStack 0
- AllocateContext 0, 1
- PopLocal r0
- Push r0
- Push FP[-5]
- StoreContextVar 0, 0
- JumpIfUnchecked L1
- Push FP[-5]
- PushConstant CP#0
- Push FP[-6]
- LoadTypeArgumentsField CP#1
- PushNull
- PushConstant CP#2
- AssertAssignable 0, CP#3
- Drop1
-L1:
- AllocateClosure CP#4
- StoreLocal r2
- Push r2
- Push FP[-6]
- LoadTypeArgumentsField CP#1
- StoreFieldTOS CP#8
- Push r2
- PushNull
- StoreFieldTOS CP#10
- Push r2
- PushConstant CP#4
- StoreFieldTOS CP#12
- Push r2
- Push r0
- StoreFieldTOS CP#5
- ReturnTOS
-}
-Parameter flags: [2]
-ConstantPool {
- [0] = Type #lib::D::TypeParam/0*
- [1] = TypeArgumentsField #lib::D
- [2] = ObjectRef 't'
- [3] = SubtypeTestCache
- [4] = ClosureFunction 0
- [5] = InstanceField dart:core::_Closure::_context (field)
- [6] = Reserved
- [7] = EndClosureFunctionScope
- [8] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [9] = Reserved
- [10] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [11] = Reserved
- [12] = InstanceField dart:core::_Closure::_function (field)
- [13] = Reserved
-}
-Closure #lib::D::foo::'<anonymous closure>' () -> #lib::D::TypeParam/0*
-ClosureCode {
- Entry 2
- Push FP[-5]
- LoadFieldTOS CP#5
- PopLocal r0
- CheckStack 0
- Push r0
- LoadContextVar 0, 0
- ReturnTOS
-}
-
-
-Function 'bar', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 3
- CheckStack 0
- AllocateContext 0, 1
- PopLocal r0
- Push r0
- Push FP[-5]
- StoreContextVar 0, 0
- AllocateClosure CP#0
- StoreLocal r2
- Push r2
- Push FP[-5]
- LoadTypeArgumentsField CP#5
- StoreFieldTOS CP#6
- Push r2
- PushNull
- StoreFieldTOS CP#8
- Push r2
- PushConstant CP#0
- StoreFieldTOS CP#10
- Push r2
- Push r0
- StoreFieldTOS CP#1
- ReturnTOS
-}
-ConstantPool {
- [0] = ClosureFunction 0
- [1] = InstanceField dart:core::_Closure::_context (field)
- [2] = Reserved
- [3] = ClosureFunction 1
- [4] = EndClosureFunctionScope
- [5] = TypeArgumentsField #lib::D
- [6] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [7] = Reserved
- [8] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [9] = Reserved
- [10] = InstanceField dart:core::_Closure::_function (field)
- [11] = Reserved
- [12] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
- [13] = EndClosureFunctionScope
-}
-Closure #lib::D::bar::'<anonymous closure>' () -> dart:core::Null?
-ClosureCode {
- Entry 4
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- AllocateClosure CP#3
- StoreLocal r3
- Push r3
- Push r0
- LoadContextVar 0, 0
- LoadTypeArgumentsField CP#5
- StoreFieldTOS CP#6
- Push r3
- PushNull
- StoreFieldTOS CP#8
- Push r3
- PushConstant CP#3
- StoreFieldTOS CP#10
- Push r3
- Push r0
- StoreFieldTOS CP#1
- PopLocal r2
- Push r2
- StoreLocal r3
- Push r3
- UncheckedClosureCall CP#12, 1
- Drop1
- PushNull
- ReturnTOS
-}
-
-Closure #lib::D::bar::Closure/0::'inner' () -> dart:core::Null?
-ClosureCode {
- Entry 2
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'E', script = '#lib', abstract
- extends dart:core::Object*
-
-Field 'foo1', type = FunctionType (dart:core::int*, dart:core::int*)* -> dart:core::int*, getter = 'get:foo1', setter = 'set:foo1', reflectable, has-initializer
- value = null
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::E*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-Nullable fields: [#lib::E::foo1 (field)]
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:foo2', getter, abstract, reflectable, debuggable
- parameters [] (required: 0)
- return-type FunctionType <dart:core::Object* T> (null::TypeParam/0*, null::TypeParam/0*)* -> dart:core::int*
-
-Function 'evalArg1', abstract, reflectable, debuggable
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'evalArg2', abstract, reflectable, debuggable
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'getE', abstract, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::E*
-
-Function 'testCallThroughGetter1', reflectable, debuggable
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Bytecode {
- Entry 3
- CheckStack 0
- Push FP[-5]
- InterfaceCall CP#0, 1
- PopLocal r0
- Push FP[-5]
- InterfaceCall CP#2, 1
- PopLocal r1
- Push FP[-5]
- InterfaceCall CP#4, 1
- StoreLocal r2
- Push r0
- Push r1
- Push r2
- UncheckedClosureCall CP#6, 3
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall '#lib::E::evalArg1', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall '#lib::E::evalArg2', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = InterfaceCall '#lib::E::get:foo1', ArgDesc num-args 1, num-type-args 0, names []
- [5] = Reserved
- [6] = ObjectRef ArgDesc num-args 3, num-type-args 0, names []
-}
-
-
-Function 'testCallThroughGetter2', reflectable, debuggable
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Bytecode {
- Entry 3
- CheckStack 0
- Push FP[-5]
- InterfaceCall CP#0, 1
- PopLocal r0
- Push FP[-5]
- InterfaceCall CP#2, 1
- PopLocal r1
- PushConstant CP#4
- Push FP[-5]
- InterfaceCall CP#5, 1
- StoreLocal r2
- Push r0
- Push r1
- Push r2
- UncheckedClosureCall CP#7, 4
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall '#lib::E::evalArg1', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall '#lib::E::evalArg2', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = ObjectRef < dart:core::int* >
- [5] = InterfaceCall '#lib::E::get:foo2', ArgDesc num-args 1, num-type-args 0, names []
- [6] = Reserved
- [7] = ObjectRef ArgDesc num-args 3, num-type-args 1, names []
-}
-
-
-Function 'testCallThroughGetter3', reflectable, debuggable
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Bytecode {
- Entry 4
- CheckStack 0
- Push FP[-5]
- InterfaceCall CP#0, 1
- PopLocal r0
- Push FP[-5]
- InterfaceCall CP#2, 1
- PopLocal r1
- Push FP[-5]
- InterfaceCall CP#4, 1
- PopLocal r2
- PushConstant CP#6
- Push r0
- InterfaceCall CP#7, 1
- StoreLocal r3
- Push r1
- Push r2
- Push r3
- UncheckedClosureCall CP#9, 4
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall '#lib::E::getE', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall '#lib::E::evalArg1', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = InterfaceCall '#lib::E::evalArg2', ArgDesc num-args 1, num-type-args 0, names []
- [5] = Reserved
- [6] = ObjectRef < dart:core::int* >
- [7] = InterfaceCall '#lib::E::get:foo2', ArgDesc num-args 1, num-type-args 0, names []
- [8] = Reserved
- [9] = ObjectRef ArgDesc num-args 3, num-type-args 1, names []
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-
-}
-]library #lib from "#lib" as #lib {
-
- typedef IntFunc = (dart.core::int*) →* dynamic;
- class C1 extends dart.core::Object {
- synthetic constructor •() → #lib::C1*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class C2 extends dart.core::Object {
- synthetic constructor •() → #lib::C2*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class C3 extends dart.core::Object {
- synthetic constructor •() → #lib::C3*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class C4 extends dart.core::Object {
- synthetic constructor •() → #lib::C4*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class C5 extends dart.core::Object {
- synthetic constructor •() → #lib::C5*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class C6 extends dart.core::Object {
- synthetic constructor •() → #lib::C6*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class C7 extends dart.core::Object {
- synthetic constructor •() → #lib::C7*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class C8 extends dart.core::Object {
- synthetic constructor •() → #lib::C8*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class A<T1 extends dart.core::Object* = dynamic, T2 extends dart.core::Object* = dynamic> extends dart.core::Object {
- synthetic constructor •() → #lib::A<#lib::A::T1*, #lib::A::T2*>*
- : super dart.core::Object::•()
- ;
- method foo<T3 extends dart.core::Object* = dynamic, T4 extends dart.core::Object* = dynamic>() → void {
- function nested1<T5 extends dart.core::Object* = dynamic, T6 extends dart.core::Object* = dynamic>() → void {
- function nested2<T7 extends dart.core::Object* = dynamic, T8 extends dart.core::Object* = dynamic>() → void {
- () →* dart.core::Null? nested3 = () → dart.core::Null? {
- dart.core::print(<dart.core::Type*>[#lib::A::T1*, #lib::A::T2*, #lib::A::foo::T3*, #lib::A::foo::T4*, T5*, T6*, T7*, T8*]);
- #lib::callWithArgs<#lib::A::T1*, #lib::A::T2*, #lib::A::foo::T3*, #lib::A::foo::T4*, T5*, T6*, T7*, T8*>();
- };
- [@vm.call-site-attributes.metadata=receiverType:dart.core::Null? Function()*] nested3.call();
- }
- [@vm.call-site-attributes.metadata=receiverType:void Function<T7, T8>()*] nested2.call<#lib::C7*, #lib::C8*>();
- [@vm.call-site-attributes.metadata=receiverType:void Function<T7, T8>()*] nested2.call<dart.core::List<#lib::C7*>*, dart.core::List<#lib::C8*>*>();
- }
- [@vm.call-site-attributes.metadata=receiverType:void Function<T5, T6>()*] nested1.call<#lib::C5*, #lib::C6*>();
- [@vm.call-site-attributes.metadata=receiverType:void Function<T5, T6>()*] nested1.call<dart.core::List<#lib::C5*>*, dart.core::List<#lib::C6*>*>();
- }
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class B extends dart.core::Object {
- field dart.core::int* foo = null;
- synthetic constructor •() → #lib::B*
- : super dart.core::Object::•()
- ;
- method topLevel() → void {
- {
- dart.core::int* x = 1;
- {
- dart.core::int* y = 2;
- dart.core::int* z = 3;
- (dart.core::int*) →* dart.core::Null? closure1 = (dart.core::int* y) → dart.core::Null? {
- x = y.{dart.core::num::+}(1);
- if(x.{dart.core::num::>}(5)) {
- dart.core::int* w = 4;
- function closure2() → void {
- z = x.{dart.core::num::+}(2);
- w = this.{#lib::B::foo}.{dart.core::num::+}(y);
- }
- [@vm.call-site-attributes.metadata=receiverType:void Function()*] closure2.call();
- dart.core::print(w);
- }
- };
- [@vm.call-site-attributes.metadata=receiverType:dart.core::Null? Function(dart.core::int*)*] closure1.call(10);
- [@vm.call-site-attributes.metadata=receiverType:dart.core::Null? Function(dart.core::int*)*] closure1.call(11);
- dart.core::print(y);
- dart.core::print(z);
- }
- dart.core::print(x);
- }
- {
- dart.core::int* x = 42;
- () →* dart.core::Null? closure3 = () → dart.core::Null? {
- this.{#lib::B::foo} = x;
- };
- [@vm.call-site-attributes.metadata=receiverType:dart.core::Null? Function()*] closure3.call();
- }
- }
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class C extends dart.core::Object {
- synthetic constructor •() → #lib::C*
- : super dart.core::Object::•()
- ;
- method testForLoop() → void {
- dart.core::int* delta = 0;
- dart.core::List<dart.core::Function*>* getI = <dart.core::Function*>[];
- dart.core::List<dart.core::Function*>* setI = <dart.core::Function*>[];
- for (dart.core::int* i = 0; i.{dart.core::num::<}(10); i = i.{dart.core::num::+}(1)) {
- [@vm.call-site-attributes.metadata=receiverType:dart.core::List<dart.core::Function*>*] getI.{dart.core::List::add}(() → dart.core::int* => i.{dart.core::num::+}(delta));
- [@vm.call-site-attributes.metadata=receiverType:dart.core::List<dart.core::Function*>*] setI.{dart.core::List::add}((dart.core::int* ii) → dart.core::Null? {
- i = ii.{dart.core::num::+}(delta);
- });
- }
- }
- method testForInLoop(dart.core::List<dart.core::int*>* list) → void {
- {
- dart.core::Iterator<dart.core::int*>* :sync-for-iterator = list.{dart.core::Iterable::iterator};
- for (; :sync-for-iterator.{dart.core::Iterator::moveNext}(); ) {
- dart.core::int* i = :sync-for-iterator.{dart.core::Iterator::current};
- {
- () →* dart.core::Null? inc = () → dart.core::Null? {
- i = i.{dart.core::num::+}(1);
- };
- [@vm.call-site-attributes.metadata=receiverType:dart.core::Null? Function()*] inc.call();
- dart.core::print(i);
- }
- }
- }
- }
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class D<T extends dart.core::Object* = dynamic> extends dart.core::Object {
- synthetic constructor •() → #lib::D<#lib::D::T*>*
- : super dart.core::Object::•()
- ;
- method foo(generic-covariant-impl #lib::D::T* t) → dynamic {
- return () → #lib::D::T* => t;
- }
- method bar() → dynamic {
- return () → dart.core::Null? {
- function inner() → dart.core::Null? {}
- [@vm.call-site-attributes.metadata=receiverType:dart.core::Null? Function()*] inner.call();
- };
- }
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- abstract class E extends dart.core::Object {
- field (dart.core::int*, dart.core::int*) →* dart.core::int* foo1 = null;
- synthetic constructor •() → #lib::E*
- : super dart.core::Object::•()
- ;
- abstract get foo2() → <T extends dart.core::Object* = dynamic>(T*, T*) →* dart.core::int*;
- abstract method evalArg1() → dart.core::int*;
- abstract method evalArg2() → dart.core::int*;
- abstract method getE() → #lib::E*;
- method testCallThroughGetter1() → dart.core::int*
- return let final dart.core::int* #t1 = this.{#lib::E::evalArg1}() in let final dart.core::int* #t2 = this.{#lib::E::evalArg2}() in [@vm.call-site-attributes.metadata=receiverType:dart.core::int* Function(dart.core::int*, dart.core::int*)*] this.{#lib::E::foo1}.call(#t1, #t2);
- method testCallThroughGetter2() → dart.core::int*
- return let final dart.core::int* #t3 = this.{#lib::E::evalArg1}() in let final dart.core::int* #t4 = this.{#lib::E::evalArg2}() in [@vm.call-site-attributes.metadata=receiverType:dart.core::int* Function<T>(T*, T*)*] this.{#lib::E::foo2}.call<dart.core::int*>(#t3, #t4);
- method testCallThroughGetter3() → dart.core::int*
- return let final #lib::E* #t5 = this.{#lib::E::getE}() in let final dart.core::int* #t6 = this.{#lib::E::evalArg1}() in let final dart.core::int* #t7 = this.{#lib::E::evalArg2}() in [@vm.call-site-attributes.metadata=receiverType:dart.core::int* Function<T>(T*, T*)*] #t5.{#lib::E::foo2}.call<dart.core::int*>(#t6, #t7);
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- static method simpleClosure() → dart.core::int* {
- dart.core::int* x = 5;
- (dart.core::int*) →* dart.core::Null? inc = (dart.core::int* y) → dart.core::Null? {
- x = x.{dart.core::num::+}(y);
- };
- [@vm.call-site-attributes.metadata=receiverType:dart.core::Null? Function(dart.core::int*)*] inc.call(3);
- return x;
- }
- static method callWithArgs<T1 extends dart.core::Object* = dynamic, T2 extends dart.core::Object* = dynamic, T3 extends dart.core::Object* = dynamic, T4 extends dart.core::Object* = dynamic, T5 extends dart.core::Object* = dynamic, T6 extends dart.core::Object* = dynamic, T7 extends dart.core::Object* = dynamic, T8 extends dart.core::Object* = dynamic>() → void {
- dart.core::print(<dart.core::Type*>[#lib::callWithArgs::T1*, #lib::callWithArgs::T2*, #lib::callWithArgs::T3*, #lib::callWithArgs::T4*, #lib::callWithArgs::T5*, #lib::callWithArgs::T6*, #lib::callWithArgs::T7*, #lib::callWithArgs::T8*]);
- }
- static method callA() → void {
- new #lib::A::•<#lib::C1*, #lib::C2*>().{#lib::A::foo}<#lib::C3*, #lib::C4*>();
- new #lib::A::•<#lib::C1*, #lib::C2*>().{#lib::A::foo}<dart.core::List<#lib::C3*>*, dart.core::List<#lib::C4*>*>();
- new #lib::A::•<dart.core::List<#lib::C1*>*, dart.core::List<#lib::C2*>*>().{#lib::A::foo}<dart.core::List<#lib::C3*>*, dart.core::List<#lib::C4*>*>();
- }
- static method testPartialInstantiation() → (dart.core::int*) →* dynamic {
- function foo<T extends dart.core::Object* = dynamic>(T* t) → void {}
- (dart.core::int*) →* dynamic intFunc = foo<dart.core::int*>;
- return intFunc;
- }
- static method main() → dynamic {}
-}
diff --git a/pkg/vm/testcases/bytecode/deferred_lib.dart b/pkg/vm/testcases/bytecode/deferred_lib.dart
deleted file mode 100644
index b93cc06..0000000
--- a/pkg/vm/testcases/bytecode/deferred_lib.dart
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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.
-
-import "hello.dart" deferred as lib;
-
-callDeferred() => lib.main();
-
-testLoadLibrary() => lib.loadLibrary();
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/deferred_lib.dart.expect b/pkg/vm/testcases/bytecode/deferred_lib.dart.expect
deleted file mode 100644
index a3a1685..0000000
--- a/pkg/vm/testcases/bytecode/deferred_lib.dart.expect
+++ /dev/null
@@ -1,75 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'callDeferred', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- PushNull
- DirectCall CP#0, 1
- PopLocal r0
- DirectCall CP#2, 0
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:async::Future::value (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = DirectCall '#pkg/vm/testcases/bytecode/hello.dart::main', ArgDesc num-args 0, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-Function 'testLoadLibrary', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- DirectCall CP#0, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:async::Future::value (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- import "#pkg/vm/testcases/bytecode/hello.dart" deferred as lib;
-
- static method callDeferred() → dynamic
- return let final dynamic #t1 = CheckLibraryIsLoaded(lib) in #lib1::main();
- static method testLoadLibrary() → dynamic
- return LoadLibrary(lib);
- static method main() → dynamic {}
-}
diff --git a/pkg/vm/testcases/bytecode/field_initializers.dart b/pkg/vm/testcases/bytecode/field_initializers.dart
deleted file mode 100644
index 6d9f57e..0000000
--- a/pkg/vm/testcases/bytecode/field_initializers.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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.
-
-class A {
- int foo1;
- int foo2 = null;
- int foo3 = 42;
- int foo4;
- int foo5 = 43;
-
- A(this.foo4) : foo5 = 44;
- A.constr2(int x, int y)
- : foo1 = x,
- foo5 = y + 1;
-
- A.redirecting1() : this(45);
- A.redirecting2(int a, int b, int c) : this.constr2(a, b * c);
-}
-
-class B extends A {
- int foo6 = 46;
- static int foo7 = 47;
- static const int foo8 = 48;
-
- B() : super(49);
- B.c2(int i, int j)
- : foo6 = 50,
- super.redirecting2(i, j, 51);
-}
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/field_initializers.dart.expect b/pkg/vm/testcases/bytecode/field_initializers.dart.expect
deleted file mode 100644
index b0ad191..0000000
--- a/pkg/vm/testcases/bytecode/field_initializers.dart.expect
+++ /dev/null
@@ -1,315 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-Class 'A', script = '#lib'
- extends dart:core::Object*
-
-Field 'foo1', type = dart:core::int*, getter = 'get:foo1', setter = 'set:foo1', reflectable
- value = null
-
-Field 'foo2', type = dart:core::int*, getter = 'get:foo2', setter = 'set:foo2', reflectable, has-initializer
- value = null
-
-Field 'foo3', type = dart:core::int*, getter = 'get:foo3', setter = 'set:foo3', reflectable, has-initializer
- value = const 42
-
-Field 'foo4', type = dart:core::int*, getter = 'get:foo4', setter = 'set:foo4', reflectable
- value = null
-
-Field 'foo5', type = dart:core::int*, getter = 'get:foo5', setter = 'set:foo5', reflectable, has-initializer
- value = const 43
-
-Function '', constructor, reflectable, debuggable
- parameters [dart:core::int* 'foo4'] (required: 1)
- return-type #lib::A*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-6]
- PushInt 42
- StoreFieldTOS CP#0
- PushInt 43
- Drop1
- Push FP[-6]
- Push FP[-5]
- StoreFieldTOS CP#2
- Push FP[-6]
- PushInt 44
- StoreFieldTOS CP#4
- Push FP[-6]
- DirectCall CP#6, 1
- Drop1
- PushNull
- ReturnTOS
-}
-Nullable fields: [#lib::A::foo1 (field), #lib::A::foo2 (field)]
-ConstantPool {
- [0] = InstanceField #lib::A::foo3 (field)
- [1] = Reserved
- [2] = InstanceField #lib::A::foo4 (field)
- [3] = Reserved
- [4] = InstanceField #lib::A::foo5 (field)
- [5] = Reserved
- [6] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [7] = Reserved
-}
-
-
-Function 'constr2', constructor, reflectable, debuggable
- parameters [dart:core::int* 'x', dart:core::int* 'y'] (required: 2)
- return-type #lib::A*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-7]
- PushInt 42
- StoreFieldTOS CP#0
- PushInt 43
- Drop1
- Push FP[-7]
- Push FP[-6]
- StoreFieldTOS CP#2
- Push FP[-7]
- Push FP[-5]
- PushInt 1
- AddInt
- StoreFieldTOS CP#4
- Push FP[-7]
- DirectCall CP#6, 1
- Drop1
- PushNull
- ReturnTOS
-}
-Nullable fields: [#lib::A::foo2 (field), #lib::A::foo4 (field)]
-ConstantPool {
- [0] = InstanceField #lib::A::foo3 (field)
- [1] = Reserved
- [2] = InstanceField #lib::A::foo1 (field)
- [3] = Reserved
- [4] = InstanceField #lib::A::foo5 (field)
- [5] = Reserved
- [6] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [7] = Reserved
-}
-
-
-Function 'redirecting1', constructor, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::A*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- PushInt 45
- DirectCall CP#0, 2
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::A:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'redirecting2', constructor, reflectable, debuggable
- parameters [dart:core::int* 'a', dart:core::int* 'b', dart:core::int* 'c'] (required: 3)
- return-type #lib::A*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-8]
- Push FP[-7]
- Push FP[-6]
- Push FP[-5]
- MulInt
- DirectCall CP#0, 3
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::A::constr2 (constructor)', ArgDesc num-args 3, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'B', script = '#lib'
- extends #lib::A*
-
-Field 'foo6', type = dart:core::int*, getter = 'get:foo6', setter = 'set:foo6', reflectable, has-initializer
- value = const 46
-
-Field 'foo7', type = dart:core::int*, reflectable, static, has-initializer
- value = const 47
-
-Field 'foo8', type = dart:core::int*, reflectable, static, const, final, has-initializer
- value = const 48
-
-Function '', constructor, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::B*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- PushInt 46
- StoreFieldTOS CP#0
- Push FP[-5]
- PushInt 49
- DirectCall CP#2, 2
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = InstanceField #lib::B::foo6 (field)
- [1] = Reserved
- [2] = DirectCall '#lib::A:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-Function 'c2', constructor, reflectable, debuggable
- parameters [dart:core::int* 'i', dart:core::int* 'j'] (required: 2)
- return-type #lib::B*
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushInt 46
- Drop1
- Push FP[-7]
- PushInt 50
- StoreFieldTOS CP#0
- Push FP[-7]
- Push FP[-6]
- Push FP[-5]
- PushInt 51
- DirectCall CP#2, 4
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = InstanceField #lib::B::foo6 (field)
- [1] = Reserved
- [2] = DirectCall '#lib::A::redirecting2 (constructor)', ArgDesc num-args 4, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- class A extends dart.core::Object {
- field dart.core::int* foo1;
- field dart.core::int* foo2 = null;
- field dart.core::int* foo3 = 42;
- field dart.core::int* foo4;
- field dart.core::int* foo5 = 43;
- constructor •(dart.core::int* foo4) → #lib::A*
- : #lib::A::foo1 = null, #lib::A::foo4 = foo4, #lib::A::foo5 = 44, super dart.core::Object::•()
- ;
- constructor constr2(dart.core::int* x, dart.core::int* y) → #lib::A*
- : #lib::A::foo4 = null, #lib::A::foo1 = x, #lib::A::foo5 = y.{dart.core::num::+}(1), super dart.core::Object::•()
- ;
- constructor redirecting1() → #lib::A*
- : this #lib::A::•(45)
- ;
- constructor redirecting2(dart.core::int* a, dart.core::int* b, dart.core::int* c) → #lib::A*
- : this #lib::A::constr2(a, b.{dart.core::num::*}(c))
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class B extends #lib::A {
- field dart.core::int* foo6 = 46;
- static field dart.core::int* foo7 = 47;
- static const field dart.core::int* foo8 = #C1;
- constructor •() → #lib::B*
- : super #lib::A::•(49)
- ;
- constructor c2(dart.core::int* i, dart.core::int* j) → #lib::B*
- : #lib::B::foo6 = 50, super #lib::A::redirecting2(i, j, 51)
- ;
- }
- static method main() → dynamic {}
-}
-constants {
- #C1 = 48
-}
diff --git a/pkg/vm/testcases/bytecode/hello.dart b/pkg/vm/testcases/bytecode/hello.dart
deleted file mode 100644
index 65a1a2a..0000000
--- a/pkg/vm/testcases/bytecode/hello.dart
+++ /dev/null
@@ -1,7 +0,0 @@
-// 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.
-
-main() {
- print('Hello, Dart Bytecode!');
-}
diff --git a/pkg/vm/testcases/bytecode/hello.dart.expect b/pkg/vm/testcases/bytecode/hello.dart.expect
deleted file mode 100644
index 12f2f55..0000000
--- a/pkg/vm/testcases/bytecode/hello.dart.expect
+++ /dev/null
@@ -1,39 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- DirectCall CP#1, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef 'Hello, Dart Bytecode!'
- [1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- static method main() → dynamic {
- dart.core::print("Hello, Dart Bytecode!");
- }
-}
diff --git a/pkg/vm/testcases/bytecode/instance_creation.dart b/pkg/vm/testcases/bytecode/instance_creation.dart
deleted file mode 100644
index 8bfa5d7..0000000
--- a/pkg/vm/testcases/bytecode/instance_creation.dart
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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.
-
-// ignore_for_file: native_function_body_in_non_sdk_code
-
-class Base<T1, T2> {
- T1 t1;
- T2 t2;
-
- Base() {
- print('Base: $T1, $T2');
- }
-}
-
-class A extends Base<int, String> {
- A(String s);
-}
-
-class B<T> extends Base<List<T>, String> {
- B() {
- print('B: $T');
- }
-}
-
-class C {
- C(String s) {
- print('C: $s');
- }
-}
-
-foo1() => new C('hello');
-
-void foo2() {
- new A('hi');
- new B<int>();
-}
-
-void foo3<T>() {
- new B<List<T>>();
-}
-
-class E<K, V> {
- test_reuse1() => new Map<K, V>();
-}
-
-class F<K, V> extends E<String, List<V>> {
- test_reuse2() => new Map<String, List<V>>();
-}
-
-class G<K, V> {
- G();
- factory G.test_factory() => new H<String, K, V>();
-}
-
-class H<P1, P2, P3> extends G<P2, P3> {}
-
-void foo4() {
- new G<int, List<String>>.test_factory();
-}
-
-class I {
- I(param);
- factory I.test_factory2({param}) => new I(param);
-}
-
-void foo5() {
- new I.test_factory2();
- new I.test_factory2(param: 42);
-}
-
-class J {
- factory J() native "agent_J";
-}
-
-abstract class K<A, B> {
- factory K() => new TestTypeArgReuse<A, B>();
-}
-
-class TestTypeArgReuse<P, Q> extends Base<P, Q> implements K<P, Q> {}
-
-foo6() => new List<String>();
-
-foo7(int n) => new List<int>(n);
-
-main() {
- foo1();
- foo2();
- foo3<String>();
-}
diff --git a/pkg/vm/testcases/bytecode/instance_creation.dart.expect b/pkg/vm/testcases/bytecode/instance_creation.dart.expect
deleted file mode 100644
index 173a1d8..0000000
--- a/pkg/vm/testcases/bytecode/instance_creation.dart.expect
+++ /dev/null
@@ -1,1127 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'foo1', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- Allocate CP#0
- StoreLocal r0
- Push r0
- PushConstant CP#1
- DirectCall CP#2, 2
- Drop1
- ReturnTOS
-}
-ConstantPool {
- [0] = Class #lib::C
- [1] = ObjectRef 'hello'
- [2] = DirectCall '#lib::C:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-Function 'foo2', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 1
- CheckStack 0
- PushConstant CP#1
- PushConstant CP#0
- AllocateT
- StoreLocal r0
- Push r0
- PushConstant CP#2
- DirectCall CP#3, 2
- Drop1
- Drop1
- PushConstant CP#6
- PushConstant CP#5
- AllocateT
- StoreLocal r0
- Push r0
- DirectCall CP#7, 1
- Drop1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = Class #lib::A
- [1] = ObjectRef < dart:core::int*, dart:core::String* >
- [2] = ObjectRef 'hi'
- [3] = DirectCall '#lib::A:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [4] = Reserved
- [5] = Class #lib::B
- [6] = ObjectRef < dart:core::List < dart:core::int* >*, dart:core::String*, dart:core::int* >
- [7] = DirectCall '#lib::B:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [8] = Reserved
-}
-
-
-Function 'foo3', static, reflectable, debuggable
- type-params <dart:core::Object* T>
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 2
- CheckFunctionTypeArgs 1, r0
- CheckStack 0
- PushNull
- Push r0
- InstantiateTypeArgumentsTOS 0, CP#1
- PushConstant CP#0
- AllocateT
- StoreLocal r1
- Push r1
- DirectCall CP#2, 1
- Drop1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = Class #lib::B
- [1] = ObjectRef < dart:core::List < dart:core::List < #lib::foo3::TypeParam/0* >* >*, dart:core::String*, dart:core::List < #lib::foo3::TypeParam/0* >* >
- [2] = DirectCall '#lib::B:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-Function 'foo4', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- DirectCall CP#1, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < dart:core::int*, dart:core::List < dart:core::String* >* >
- [1] = DirectCall '#lib::G::test_factory (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
-}
-
-
-Function 'foo5', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- DirectCall CP#0, 1
- Drop1
- PushNull
- PushInt 42
- DirectCall CP#2, 2
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::I::test_factory2 (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = DirectCall '#lib::I::test_factory2 (constructor)', ArgDesc num-args 2, num-type-args 0, names ['param']
- [3] = Reserved
-}
-
-
-Function 'foo6', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- PushInt 0
- DirectCall CP#1, 2
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < dart:core::String* >
- [1] = DirectCall 'dart:core::_GrowableList:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [2] = Reserved
-}
-
-
-Function 'foo7', static, reflectable, debuggable
- parameters [dart:core::int* 'n'] (required: 1)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- Push FP[-5]
- DirectCall CP#1, 2
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < dart:core::int* >
- [1] = DirectCall 'dart:core::_List:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [2] = Reserved
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- DirectCall CP#0, 0
- Drop1
- DirectCall CP#2, 0
- Drop1
- PushConstant CP#4
- DirectCall CP#5, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::foo1', ArgDesc num-args 0, num-type-args 0, names []
- [1] = Reserved
- [2] = DirectCall '#lib::foo2', ArgDesc num-args 0, num-type-args 0, names []
- [3] = Reserved
- [4] = ObjectRef < dart:core::String* >
- [5] = DirectCall '#lib::foo3', ArgDesc num-args 0, num-type-args 1, names []
- [6] = Reserved
-}
-
-Class 'Base', script = '#lib'
- type-params <dart:core::Object* T1, dart:core::Object* T2> (args: 2)
- extends dart:core::Object*
-
-Field 't1', type = #lib::Base::TypeParam/0*, getter = 'get:t1', setter = 'set:t1', reflectable, has-initializer
- value = null
-
-Field 't2', type = #lib::Base::TypeParam/1*, getter = 'get:t2', setter = 'set:t2', reflectable, has-initializer
- value = null
-
-Function '', constructor, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::Base < #lib::Base::TypeParam/0*, #lib::Base::TypeParam/1* >*
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- PushInt 4
- CreateArrayTOS
- StoreLocal r0
- Push r0
- PushInt 0
- PushConstant CP#2
- StoreIndexedTOS
- Push r0
- PushInt 1
- Push FP[-5]
- LoadTypeArgumentsField CP#4
- PushNull
- InstantiateType CP#3
- StoreIndexedTOS
- Push r0
- PushInt 2
- PushConstant CP#5
- StoreIndexedTOS
- Push r0
- PushInt 3
- Push FP[-5]
- LoadTypeArgumentsField CP#4
- PushNull
- InstantiateType CP#6
- StoreIndexedTOS
- DirectCall CP#7, 1
- DirectCall CP#9, 1
- Drop1
- PushNull
- ReturnTOS
-}
-Nullable fields: [#lib::Base::t1 (field), #lib::Base::t2 (field)]
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = ObjectRef 'Base: '
- [3] = Type #lib::Base::TypeParam/0*
- [4] = TypeArgumentsField #lib::Base
- [5] = ObjectRef ', '
- [6] = Type #lib::Base::TypeParam/1*
- [7] = DirectCall 'dart:core::_StringBase::_interpolate', ArgDesc num-args 1, num-type-args 0, names []
- [8] = Reserved
- [9] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [10] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'A', script = '#lib'
- extends #lib::Base < dart:core::int*, dart:core::String* >*
-
-
-Function '', constructor, reflectable, debuggable
- parameters [dart:core::String* 's'] (required: 1)
- return-type #lib::A < dart:core::int*, dart:core::String* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-6]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::Base:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-Class 'B', script = '#lib'
- type-params <dart:core::Object* T> (args: 3)
- extends #lib::Base < dart:core::List < #lib::B::TypeParam/0* >*, dart:core::String* >*
-
-
-Function '', constructor, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::B < dart:core::List < #lib::B::TypeParam/0* >*, dart:core::String*, #lib::B::TypeParam/0* >*
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r0
- Push r0
- PushInt 0
- PushConstant CP#2
- StoreIndexedTOS
- Push r0
- PushInt 1
- Push FP[-5]
- LoadTypeArgumentsField CP#4
- PushNull
- InstantiateType CP#3
- StoreIndexedTOS
- DirectCall CP#5, 1
- DirectCall CP#7, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::Base:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = ObjectRef 'B: '
- [3] = Type #lib::B::TypeParam/0*
- [4] = TypeArgumentsField #lib::B
- [5] = DirectCall 'dart:core::_StringBase::_interpolate', ArgDesc num-args 1, num-type-args 0, names []
- [6] = Reserved
- [7] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [8] = Reserved
-}
-
-Class 'C', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable, debuggable
- parameters [dart:core::String* 's'] (required: 1)
- return-type #lib::C*
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-6]
- DirectCall CP#0, 1
- Drop1
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r0
- Push r0
- PushInt 0
- PushConstant CP#2
- StoreIndexedTOS
- Push r0
- PushInt 1
- Push FP[-5]
- StoreIndexedTOS
- DirectCall CP#3, 1
- DirectCall CP#5, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = ObjectRef 'C: '
- [3] = DirectCall 'dart:core::_StringBase::_interpolate', ArgDesc num-args 1, num-type-args 0, names []
- [4] = Reserved
- [5] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [6] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'E', script = '#lib'
- type-params <dart:core::Object* K, dart:core::Object* V> (args: 2)
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::E < #lib::E::TypeParam/0*, #lib::E::TypeParam/1* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'test_reuse1', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- LoadTypeArgumentsField CP#0
- DirectCall CP#1, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = TypeArgumentsField #lib::E
- [1] = DirectCall 'dart:core::Map:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'F', script = '#lib'
- type-params <dart:core::Object* K, dart:core::Object* V> (args: 4)
- extends #lib::E < dart:core::String*, dart:core::List < #lib::F::TypeParam/1* >* >*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::F < dart:core::String*, dart:core::List < #lib::F::TypeParam/1* >*, #lib::F::TypeParam/0*, #lib::F::TypeParam/1* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::E:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'test_reuse2', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- LoadTypeArgumentsField CP#0
- DirectCall CP#1, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = TypeArgumentsField #lib::F
- [1] = DirectCall 'dart:core::Map:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
-}
-
-Class 'G', script = '#lib'
- type-params <dart:core::Object* K, dart:core::Object* V> (args: 2)
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::G < #lib::G::TypeParam/0*, #lib::G::TypeParam/1* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'test_factory', factory, static, reflectable, debuggable
- type-params <dart:core::Object* K, dart:core::Object* V>
- parameters [] (required: 0)
- return-type #lib::G < #lib::G::test_factory (constructor)::TypeParam/0*, #lib::G::test_factory (constructor)::TypeParam/1* >*
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- PushNull
- InstantiateTypeArgumentsTOS 0, CP#1
- PushConstant CP#0
- AllocateT
- StoreLocal r0
- Push r0
- DirectCall CP#2, 1
- Drop1
- ReturnTOS
-}
-ConstantPool {
- [0] = Class #lib::H
- [1] = ObjectRef < #lib::G::test_factory (constructor)::TypeParam/0*, #lib::G::test_factory (constructor)::TypeParam/1*, dart:core::String*, #lib::G::test_factory (constructor)::TypeParam/0*, #lib::G::test_factory (constructor)::TypeParam/1* >
- [2] = DirectCall '#lib::H:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'H', script = '#lib'
- type-params <dart:core::Object* P1, dart:core::Object* P2, dart:core::Object* P3> (args: 5)
- extends #lib::G < #lib::H::TypeParam/1*, #lib::H::TypeParam/2* >*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::H < #lib::H::TypeParam/1*, #lib::H::TypeParam/2*, #lib::H::TypeParam/0*, #lib::H::TypeParam/1*, #lib::H::TypeParam/2* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::G:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-Class 'I', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable, debuggable
- parameters [dynamic 'param'] (required: 1)
- return-type #lib::I*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-6]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'test_factory2', factory, static, has-optional-named-params, reflectable, debuggable
- parameters [dynamic 'param'] (required: 0)
- return-type #lib::I*
-
-Bytecode {
- EntryOptional 1, 0, 1
- LoadConstant r1, CP#0
- LoadConstant r1, CP#1
- Frame 1
- CheckStack 0
- Allocate CP#2
- StoreLocal r2
- Push r2
- Push r1
- DirectCall CP#3, 2
- Drop1
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef 'param'
- [1] = ObjectRef null
- [2] = Class #lib::I
- [3] = DirectCall '#lib::I:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [4] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'J', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', factory, static, reflectable, debuggable, native 'agent_J'
- parameters [] (required: 0)
- return-type #lib::J*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- NativeCall CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = NativeEntry agent_J
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'K', script = '#lib', abstract
- type-params <dart:core::Object* A, dart:core::Object* B> (args: 2)
- extends dart:core::Object*
-
-
-Function '', factory, static, reflectable, debuggable
- type-params <dart:core::Object* A, dart:core::Object* B>
- parameters [] (required: 0)
- return-type #lib::K < #lib::K:: (constructor)::TypeParam/0*, #lib::K:: (constructor)::TypeParam/1* >*
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- PushConstant CP#0
- AllocateT
- StoreLocal r0
- Push r0
- DirectCall CP#1, 1
- Drop1
- ReturnTOS
-}
-ConstantPool {
- [0] = Class #lib::TestTypeArgReuse
- [1] = DirectCall '#lib::TestTypeArgReuse:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'TestTypeArgReuse', script = '#lib'
- type-params <dart:core::Object* P, dart:core::Object* Q> (args: 2)
- extends #lib::Base < #lib::TestTypeArgReuse::TypeParam/0*, #lib::TestTypeArgReuse::TypeParam/1* >*
- implements [#lib::K < #lib::TestTypeArgReuse::TypeParam/0*, #lib::TestTypeArgReuse::TypeParam/1* >*]
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::TestTypeArgReuse < #lib::TestTypeArgReuse::TypeParam/0*, #lib::TestTypeArgReuse::TypeParam/1* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::Base:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- class Base<T1 extends dart.core::Object* = dynamic, T2 extends dart.core::Object* = dynamic> extends dart.core::Object {
- generic-covariant-impl field #lib::Base::T1* t1 = null;
- generic-covariant-impl field #lib::Base::T2* t2 = null;
- constructor •() → #lib::Base<#lib::Base::T1*, #lib::Base::T2*>*
- : super dart.core::Object::•() {
- dart.core::print("Base: ${#lib::Base::T1*}, ${#lib::Base::T2*}");
- }
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class A extends #lib::Base<dart.core::int*, dart.core::String*> {
- constructor •(dart.core::String* s) → #lib::A*
- : super #lib::Base::•()
- ;
- }
- class B<T extends dart.core::Object* = dynamic> extends #lib::Base<dart.core::List<#lib::B::T*>*, dart.core::String*> {
- constructor •() → #lib::B<#lib::B::T*>*
- : super #lib::Base::•() {
- dart.core::print("B: ${#lib::B::T*}");
- }
- }
- class C extends dart.core::Object {
- constructor •(dart.core::String* s) → #lib::C*
- : super dart.core::Object::•() {
- dart.core::print("C: ${s}");
- }
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class E<K extends dart.core::Object* = dynamic, V extends dart.core::Object* = dynamic> extends dart.core::Object {
- synthetic constructor •() → #lib::E<#lib::E::K*, #lib::E::V*>*
- : super dart.core::Object::•()
- ;
- method test_reuse1() → dynamic
- return dart.core::Map::•<#lib::E::K*, #lib::E::V*>();
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class F<K extends dart.core::Object* = dynamic, V extends dart.core::Object* = dynamic> extends #lib::E<dart.core::String*, dart.core::List<#lib::F::V*>*> {
- synthetic constructor •() → #lib::F<#lib::F::K*, #lib::F::V*>*
- : super #lib::E::•()
- ;
- method test_reuse2() → dynamic
- return dart.core::Map::•<dart.core::String*, dart.core::List<#lib::F::V*>*>();
- }
- class G<K extends dart.core::Object* = dynamic, V extends dart.core::Object* = dynamic> extends dart.core::Object {
- constructor •() → #lib::G<#lib::G::K*, #lib::G::V*>*
- : super dart.core::Object::•()
- ;
- static factory test_factory<K extends dart.core::Object* = dynamic, V extends dart.core::Object* = dynamic>() → #lib::G<#lib::G::test_factory::K*, #lib::G::test_factory::V*>*
- return new #lib::H::•<dart.core::String*, #lib::G::test_factory::K*, #lib::G::test_factory::V*>();
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class H<P1 extends dart.core::Object* = dynamic, P2 extends dart.core::Object* = dynamic, P3 extends dart.core::Object* = dynamic> extends #lib::G<#lib::H::P2*, #lib::H::P3*> {
- synthetic constructor •() → #lib::H<#lib::H::P1*, #lib::H::P2*, #lib::H::P3*>*
- : super #lib::G::•()
- ;
- }
- class I extends dart.core::Object {
- constructor •(dynamic param) → #lib::I*
- : super dart.core::Object::•()
- ;
- static factory test_factory2({dynamic param = #C1}) → #lib::I*
- return new #lib::I::•(param);
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class J extends dart.core::Object {
- @#C3
- external static factory •() → #lib::J*;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- abstract class K<A extends dart.core::Object* = dynamic, B extends dart.core::Object* = dynamic> extends dart.core::Object {
- static factory •<A extends dart.core::Object* = dynamic, B extends dart.core::Object* = dynamic>() → #lib::K<#lib::K::•::A*, #lib::K::•::B*>*
- return new #lib::TestTypeArgReuse::•<#lib::K::•::A*, #lib::K::•::B*>();
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class TestTypeArgReuse<P extends dart.core::Object* = dynamic, Q extends dart.core::Object* = dynamic> extends #lib::Base<#lib::TestTypeArgReuse::P*, #lib::TestTypeArgReuse::Q*> implements #lib::K<#lib::TestTypeArgReuse::P*, #lib::TestTypeArgReuse::Q*> {
- synthetic constructor •() → #lib::TestTypeArgReuse<#lib::TestTypeArgReuse::P*, #lib::TestTypeArgReuse::Q*>*
- : super #lib::Base::•()
- ;
- }
- static method foo1() → dynamic
- return new #lib::C::•("hello");
- static method foo2() → void {
- new #lib::A::•("hi");
- new #lib::B::•<dart.core::int*>();
- }
- static method foo3<T extends dart.core::Object* = dynamic>() → void {
- new #lib::B::•<dart.core::List<#lib::foo3::T*>*>();
- }
- static method foo4() → void {
- #lib::G::test_factory<dart.core::int*, dart.core::List<dart.core::String*>*>();
- }
- static method foo5() → void {
- #lib::I::test_factory2();
- #lib::I::test_factory2(param: 42);
- }
- static method foo6() → dynamic
- return dart.core::_GrowableList::•<dart.core::String*>(0);
- static method foo7(dart.core::int* n) → dynamic
- return dart.core::_List::•<dart.core::int*>(n);
- static method main() → dynamic {
- #lib::foo1();
- #lib::foo2();
- #lib::foo3<dart.core::String*>();
- }
-}
-constants {
- #C1 = null
- #C2 = "agent_J"
- #C3 = dart._internal::ExternalName {name:#C2}
-}
diff --git a/pkg/vm/testcases/bytecode/literals.dart b/pkg/vm/testcases/bytecode/literals.dart
deleted file mode 100644
index c4c3ea8..0000000
--- a/pkg/vm/testcases/bytecode/literals.dart
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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.
-
-enum A {
- elem1,
- elem2,
- elem3,
- elem4,
-}
-
-class B {
- final int i;
- const B(this.i);
-}
-
-class C extends B {
- final int j;
- const C(int a, int b, int c)
- : j = a + b,
- super(c * 5);
-}
-
-class D {
- final x;
- final y;
- const D(this.x, [this.y]);
-}
-
-const c1 = A.elem3;
-const c2 = 'hello!';
-const c3 = c2.length;
-const c4 = const C(1, 2, 3);
-const c5 = const D(const B(4));
-
-void test_constants1() {
- print(c1);
- print(c2);
- print(c3);
- print(c4);
- print(c5);
-}
-
-void test_constants2() {
- print(42);
- print('foo');
- print(A.elem2);
- print(const [42, 'foo', int]);
- print(const <String, A>{'E2': A.elem2, 'E4': A.elem4});
- print(
- const D(const C(4, 5, 6), const {'foo': 42, 'bar': const B(c2.length)}));
-}
-
-void test_list_literal(int a) {
- print([1, a, 3]);
- print(<String>['a', a.toString(), 'b']);
-}
-
-void test_map_literal<T>(int a, int b, T c) {
- print({1: a, b: 2});
- print(<String, int>{'foo': a, b.toString(): 3});
- print(<String, T>{});
- print(<T, int>{c: 4});
-}
-
-void test_symbol() {
- print(#test_symbol);
- print(#_private_symbol);
-}
-
-void test_type_literal<T>() {
- print(String);
- print(T);
-}
-
-class E<T> {
- const E();
-}
-
-class F<P, Q> extends E<Map<P, Q>> {
- const F();
-}
-
-testGenericConstInstance() => const F<int, String>();
-
-typedef GenericFunctionType = X Function<X>(X);
-testGenericFunctionTypeLiteral() => GenericFunctionType;
-
-double fieldWithDoubleLiteralInitializer = 1.0;
-testFieldWithDoubleLiteralInitializer() => fieldWithDoubleLiteralInitializer;
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/literals.dart.expect b/pkg/vm/testcases/bytecode/literals.dart.expect
deleted file mode 100644
index 2d3b56d..0000000
--- a/pkg/vm/testcases/bytecode/literals.dart.expect
+++ /dev/null
@@ -1,1013 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-Field 'c1', type = #lib::A*, getter = 'get:c1', reflectable, static, const, final, has-initializer
- initializer
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const #lib::A* {#lib::A::index (field): const 2, #lib::A::_name (field): 'A.elem3'}
-}
-
-
-Field 'c2', type = dart:core::String*, reflectable, static, const, final, has-initializer
- value = 'hello!'
-
-Field 'c3', type = dart:core::int*, reflectable, static, const, final, has-initializer
- value = const 6
-
-Field 'c4', type = #lib::C*, getter = 'get:c4', reflectable, static, const, final, has-initializer
- initializer
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const #lib::C* {#lib::C::j (field): const 3, #lib::B::i (field): const 15}
-}
-
-
-Field 'c5', type = #lib::D*, getter = 'get:c5', reflectable, static, const, final, has-initializer
- initializer
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const #lib::D* {#lib::D::x (field): const #lib::B* {#lib::B::i (field): const 4}, #lib::D::y (field): null}
-}
-
-
-Field 'fieldWithDoubleLiteralInitializer', type = dart:core::double*, reflectable, static, has-initializer
- value = const 1.0
-
-Function 'test_constants1', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- DirectCall CP#1, 1
- Drop1
- PushConstant CP#3
- DirectCall CP#1, 1
- Drop1
- PushInt 6
- DirectCall CP#1, 1
- Drop1
- PushConstant CP#4
- DirectCall CP#1, 1
- Drop1
- PushConstant CP#5
- DirectCall CP#1, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const #lib::A* {#lib::A::index (field): const 2, #lib::A::_name (field): 'A.elem3'}
- [1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
- [3] = ObjectRef 'hello!'
- [4] = ObjectRef const #lib::C* {#lib::C::j (field): const 3, #lib::B::i (field): const 15}
- [5] = ObjectRef const #lib::D* {#lib::D::x (field): const #lib::B* {#lib::B::i (field): const 4}, #lib::D::y (field): null}
-}
-
-
-Function 'test_constants2', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushInt 42
- DirectCall CP#0, 1
- Drop1
- PushConstant CP#2
- DirectCall CP#0, 1
- Drop1
- PushConstant CP#3
- DirectCall CP#0, 1
- Drop1
- PushConstant CP#4
- DirectCall CP#0, 1
- Drop1
- PushConstant CP#5
- DirectCall CP#0, 1
- Drop1
- PushConstant CP#6
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = ObjectRef 'foo'
- [3] = ObjectRef const #lib::A* {#lib::A::index (field): const 1, #lib::A::_name (field): 'A.elem2'}
- [4] = ObjectRef const <dart:core::Object*> [const 42, 'foo', dart:core::int*]
- [5] = ObjectRef const dart:core::_ImmutableMap < dart:core::String*, #lib::A* >* {dart:core::_ImmutableMap::_kvPairs (field): const <dynamic> ['E2', const #lib::A* {#lib::A::index (field): const 1, #lib::A::_name (field): 'A.elem2'}, 'E4', const #lib::A* {#lib::A::index (field): const 3, #lib::A::_name (field): 'A.elem4'}]}
- [6] = ObjectRef const #lib::D* {#lib::D::x (field): const #lib::C* {#lib::C::j (field): const 9, #lib::B::i (field): const 30}, #lib::D::y (field): const dart:core::_ImmutableMap < dart:core::String*, dart:core::Object* >* {dart:core::_ImmutableMap::_kvPairs (field): const <dynamic> ['foo', const 42, 'bar', const #lib::B* {#lib::B::i (field): const 6}]}}
-}
-
-
-Function 'test_list_literal', static, reflectable, debuggable
- parameters [dart:core::int* 'a'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 1
- CheckStack 0
- PushConstant CP#0
- StoreLocal r0
- Push r0
- PushInt 3
- CreateArrayTOS
- StoreLocal r0
- Push r0
- PushInt 0
- PushInt 1
- StoreIndexedTOS
- Push r0
- PushInt 1
- Push FP[-5]
- StoreIndexedTOS
- Push r0
- PushInt 2
- PushInt 3
- StoreIndexedTOS
- DirectCall CP#1, 2
- DirectCall CP#3, 1
- Drop1
- PushConstant CP#5
- StoreLocal r0
- Push r0
- PushInt 3
- CreateArrayTOS
- StoreLocal r0
- Push r0
- PushInt 0
- PushConstant CP#6
- StoreIndexedTOS
- Push r0
- PushInt 1
- Push FP[-5]
- InterfaceCall CP#7, 1
- StoreIndexedTOS
- Push r0
- PushInt 2
- PushConstant CP#9
- StoreIndexedTOS
- DirectCall CP#1, 2
- DirectCall CP#3, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < dart:core::int* >
- [1] = DirectCall 'dart:core::List::_fromLiteral (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [2] = Reserved
- [3] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [4] = Reserved
- [5] = ObjectRef < dart:core::String* >
- [6] = ObjectRef 'a'
- [7] = InterfaceCall 'dart:core::int::toString', ArgDesc num-args 1, num-type-args 0, names []
- [8] = Reserved
- [9] = ObjectRef 'b'
-}
-
-
-Function 'test_map_literal', static, reflectable, debuggable
- type-params <dart:core::Object* T>
- parameters [dart:core::int* 'a', dart:core::int* 'b', #lib::test_map_literal::TypeParam/0* 'c'] (required: 3)
- return-type void
-
-Bytecode {
- Entry 2
- CheckFunctionTypeArgs 1, r0
- CheckStack 0
- PushConstant CP#0
- PushConstant CP#1
- PushInt 4
- CreateArrayTOS
- StoreLocal r1
- Push r1
- PushInt 0
- PushInt 1
- StoreIndexedTOS
- Push r1
- PushInt 1
- Push FP[-7]
- StoreIndexedTOS
- Push r1
- PushInt 2
- Push FP[-6]
- StoreIndexedTOS
- Push r1
- PushInt 3
- PushInt 2
- StoreIndexedTOS
- DirectCall CP#2, 2
- DirectCall CP#4, 1
- Drop1
- PushConstant CP#6
- PushConstant CP#1
- PushInt 4
- CreateArrayTOS
- StoreLocal r1
- Push r1
- PushInt 0
- PushConstant CP#7
- StoreIndexedTOS
- Push r1
- PushInt 1
- Push FP[-7]
- StoreIndexedTOS
- Push r1
- PushInt 2
- Push FP[-6]
- InterfaceCall CP#8, 1
- StoreIndexedTOS
- Push r1
- PushInt 3
- PushInt 3
- StoreIndexedTOS
- DirectCall CP#2, 2
- DirectCall CP#4, 1
- Drop1
- PushNull
- Push r0
- InstantiateTypeArgumentsTOS 0, CP#10
- PushConstant CP#11
- DirectCall CP#2, 2
- DirectCall CP#4, 1
- Drop1
- PushNull
- Push r0
- InstantiateTypeArgumentsTOS 0, CP#12
- PushConstant CP#1
- PushInt 2
- CreateArrayTOS
- StoreLocal r1
- Push r1
- PushInt 0
- Push FP[-5]
- StoreIndexedTOS
- Push r1
- PushInt 1
- PushInt 4
- StoreIndexedTOS
- DirectCall CP#2, 2
- DirectCall CP#4, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < dart:core::int*, dart:core::int* >
- [1] = ObjectRef < dynamic >
- [2] = DirectCall 'dart:core::Map::_fromLiteral (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
- [4] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [5] = Reserved
- [6] = ObjectRef < dart:core::String*, dart:core::int* >
- [7] = ObjectRef 'foo'
- [8] = InterfaceCall 'dart:core::int::toString', ArgDesc num-args 1, num-type-args 0, names []
- [9] = Reserved
- [10] = ObjectRef < dart:core::String*, #lib::test_map_literal::TypeParam/0* >
- [11] = ObjectRef const <dynamic> []
- [12] = ObjectRef < #lib::test_map_literal::TypeParam/0*, dart:core::int* >
-}
-
-
-Function 'test_symbol', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- DirectCall CP#1, 1
- Drop1
- PushConstant CP#3
- DirectCall CP#1, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const 'test_symbol'
- [1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
- [3] = ObjectRef const '_private_symbol'
-}
-
-
-Function 'test_type_literal', static, reflectable, debuggable
- type-params <dart:core::Object* T>
- parameters [] (required: 0)
- return-type void
-
-Bytecode {
- Entry 1
- CheckFunctionTypeArgs 1, r0
- CheckStack 0
- PushConstant CP#0
- DirectCall CP#1, 1
- Drop1
- PushNull
- Push r0
- InstantiateType CP#3
- DirectCall CP#1, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = Type dart:core::String*
- [1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
- [3] = Type #lib::test_type_literal::TypeParam/0*
-}
-
-
-Function 'testGenericConstInstance', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const #lib::F < dart:core::Map < dart:core::int*, dart:core::String* >*, dart:core::int*, dart:core::String* >* {}
-}
-
-
-Function 'testGenericFunctionTypeLiteral', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = Type FunctionType <dart:core::Object* X> (null::TypeParam/0*)* -> null::TypeParam/0*
-}
-
-
-Function 'testFieldWithDoubleLiteralInitializer', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- LoadStatic CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = StaticField #lib::fieldWithDoubleLiteralInitializer (field)
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-Class 'A', script = '#lib', enum
- extends dart:core::Object*
-
-Field 'index', type = dart:core::int*, getter = 'get:index', reflectable, final
- value = null
-
-Field '_name', type = dart:core::String*, getter = 'get:_name', reflectable, final
- value = null
-
-Field 'values', type = dart:core::List < #lib::A* >*, getter = 'get:values', reflectable, static, const, final, has-initializer
- initializer
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const <#lib::A*> [const #lib::A* {#lib::A::index (field): const 0, #lib::A::_name (field): 'A.elem1'}, const #lib::A* {#lib::A::index (field): const 1, #lib::A::_name (field): 'A.elem2'}, const #lib::A* {#lib::A::index (field): const 2, #lib::A::_name (field): 'A.elem3'}, const #lib::A* {#lib::A::index (field): const 3, #lib::A::_name (field): 'A.elem4'}]
-}
-
-
-Field 'elem1', type = #lib::A*, getter = 'get:elem1', reflectable, static, const, final, has-initializer
- initializer
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const #lib::A* {#lib::A::index (field): const 0, #lib::A::_name (field): 'A.elem1'}
-}
-
-
-Field 'elem2', type = #lib::A*, getter = 'get:elem2', reflectable, static, const, final, has-initializer
- initializer
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const #lib::A* {#lib::A::index (field): const 1, #lib::A::_name (field): 'A.elem2'}
-}
-
-
-Field 'elem3', type = #lib::A*, getter = 'get:elem3', reflectable, static, const, final, has-initializer
- initializer
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const #lib::A* {#lib::A::index (field): const 2, #lib::A::_name (field): 'A.elem3'}
-}
-
-
-Field 'elem4', type = #lib::A*, getter = 'get:elem4', reflectable, static, const, final, has-initializer
- initializer
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef const #lib::A* {#lib::A::index (field): const 3, #lib::A::_name (field): 'A.elem4'}
-}
-
-
-Function '', constructor, const, reflectable, debuggable
- parameters [dart:core::int* 'index', dart:core::String* '_name'] (required: 2)
- return-type #lib::A*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-7]
- Push FP[-6]
- StoreFieldTOS CP#0
- Push FP[-7]
- Push FP[-5]
- StoreFieldTOS CP#2
- Push FP[-7]
- DirectCall CP#4, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = InstanceField #lib::A::index (field)
- [1] = Reserved
- [2] = InstanceField #lib::A::_name (field)
- [3] = Reserved
- [4] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [5] = Reserved
-}
-
-
-Function 'toString', reflectable, debuggable
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- InterfaceCall CP#0, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall '#lib::A::get:_name', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'B', script = '#lib'
- extends dart:core::Object*
-
-Field 'i', type = dart:core::int*, getter = 'get:i', reflectable, final
- value = null
-
-Function '', constructor, const, reflectable, debuggable
- parameters [dart:core::int* 'i'] (required: 1)
- return-type #lib::B*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-6]
- Push FP[-5]
- StoreFieldTOS CP#0
- Push FP[-6]
- DirectCall CP#2, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = InstanceField #lib::B::i (field)
- [1] = Reserved
- [2] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'C', script = '#lib'
- extends #lib::B*
-
-Field 'j', type = dart:core::int*, getter = 'get:j', reflectable, final
- value = null
-
-Function '', constructor, const, reflectable, debuggable
- parameters [dart:core::int* 'a', dart:core::int* 'b', dart:core::int* 'c'] (required: 3)
- return-type #lib::C*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-8]
- Push FP[-7]
- Push FP[-6]
- AddInt
- StoreFieldTOS CP#0
- Push FP[-8]
- Push FP[-5]
- PushInt 5
- MulInt
- DirectCall CP#2, 2
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = InstanceField #lib::C::j (field)
- [1] = Reserved
- [2] = DirectCall '#lib::B:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
-}
-
-Class 'D', script = '#lib'
- extends dart:core::Object*
-
-Field 'x', type = dynamic, getter = 'get:x', reflectable, final
- value = null
-
-Field 'y', type = dynamic, getter = 'get:y', reflectable, final
- value = null
-
-Function '', constructor, const, has-optional-positional-params, reflectable, debuggable
- parameters [dynamic 'x', dynamic 'y'] (required: 1)
- return-type #lib::D*
-
-Bytecode {
- EntryOptional 2, 1, 0
- LoadConstant r2, CP#0
- Frame 0
- CheckStack 0
- Push r0
- Push r1
- StoreFieldTOS CP#1
- Push r0
- Push r2
- StoreFieldTOS CP#3
- Push r0
- DirectCall CP#5, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef null
- [1] = InstanceField #lib::D::x (field)
- [2] = Reserved
- [3] = InstanceField #lib::D::y (field)
- [4] = Reserved
- [5] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [6] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'E', script = '#lib'
- type-params <dart:core::Object* T> (args: 1)
- extends dart:core::Object*
-
-
-Function '', constructor, const, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::E < #lib::E::TypeParam/0* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'F', script = '#lib'
- type-params <dart:core::Object* P, dart:core::Object* Q> (args: 3)
- extends #lib::E < dart:core::Map < #lib::F::TypeParam/0*, #lib::F::TypeParam/1* >* >*
-
-
-Function '', constructor, const, reflectable, debuggable
- parameters [] (required: 0)
- return-type #lib::F < dart:core::Map < #lib::F::TypeParam/0*, #lib::F::TypeParam/1* >*, #lib::F::TypeParam/0*, #lib::F::TypeParam/1* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::E:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- typedef GenericFunctionType = <X extends dart.core::Object* = dynamic>(X*) →* X*;
- class A extends dart.core::Object /*isEnum*/ {
- final field dart.core::int* index;
- final field dart.core::String* _name;
- static const field dart.core::List<#lib::A*>* values = #C13;
- static const field #lib::A* elem1 = #C3;
- static const field #lib::A* elem2 = #C6;
- static const field #lib::A* elem3 = #C9;
- static const field #lib::A* elem4 = #C12;
- const constructor •(dart.core::int* index, dart.core::String* _name) → #lib::A*
- : #lib::A::index = index, #lib::A::_name = _name, super dart.core::Object::•()
- ;
- method toString() → dart.core::String*
- return this.{#lib::A::_name};
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class B extends dart.core::Object /*hasConstConstructor*/ {
- final field dart.core::int* i;
- const constructor •(dart.core::int* i) → #lib::B*
- : #lib::B::i = i, super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class C extends #lib::B /*hasConstConstructor*/ {
- final field dart.core::int* j;
- const constructor •(dart.core::int* a, dart.core::int* b, dart.core::int* c) → #lib::C*
- : #lib::C::j = a.{dart.core::num::+}(b), super #lib::B::•(c.{dart.core::num::*}(5))
- ;
- }
- class D extends dart.core::Object /*hasConstConstructor*/ {
- final field dynamic x;
- final field dynamic y;
- const constructor •(dynamic x, [dynamic y = #C14]) → #lib::D*
- : #lib::D::x = x, #lib::D::y = y, super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class E<T extends dart.core::Object* = dynamic> extends dart.core::Object /*hasConstConstructor*/ {
- const constructor •() → #lib::E<#lib::E::T*>*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class F<P extends dart.core::Object* = dynamic, Q extends dart.core::Object* = dynamic> extends #lib::E<dart.core::Map<#lib::F::P*, #lib::F::Q*>*> /*hasConstConstructor*/ {
- const constructor •() → #lib::F<#lib::F::P*, #lib::F::Q*>*
- : super #lib::E::•()
- ;
- }
- static const field #lib::A* c1 = #C9;
- static const field dart.core::String* c2 = #C15;
- static const field dart.core::int* c3 = #C16;
- static const field #lib::C* c4 = #C18;
- static const field #lib::D* c5 = #C21;
- static field dart.core::double* fieldWithDoubleLiteralInitializer = 1.0;
- static method test_constants1() → void {
- dart.core::print(#C9);
- dart.core::print(#C15);
- dart.core::print(#C16);
- dart.core::print(#C18);
- dart.core::print(#C21);
- }
- static method test_constants2() → void {
- dart.core::print(42);
- dart.core::print("foo");
- dart.core::print(#C6);
- dart.core::print(#C25);
- dart.core::print(#C29);
- dart.core::print(#C37);
- }
- static method test_list_literal(dart.core::int* a) → void {
- dart.core::print(<dart.core::int*>[1, a, 3]);
- dart.core::print(<dart.core::String*>["a", a.{dart.core::int::toString}(), "b"]);
- }
- static method test_map_literal<T extends dart.core::Object* = dynamic>(dart.core::int* a, dart.core::int* b, #lib::test_map_literal::T* c) → void {
- dart.core::print(<dart.core::int*, dart.core::int*>{1: a, b: 2});
- dart.core::print(<dart.core::String*, dart.core::int*>{"foo": a, b.{dart.core::int::toString}(): 3});
- dart.core::print(<dart.core::String*, #lib::test_map_literal::T*>{});
- dart.core::print(<#lib::test_map_literal::T*, dart.core::int*>{c: 4});
- }
- static method test_symbol() → void {
- dart.core::print(#C38);
- dart.core::print(#C39);
- }
- static method test_type_literal<T extends dart.core::Object* = dynamic>() → void {
- dart.core::print(dart.core::String*);
- dart.core::print(#lib::test_type_literal::T*);
- }
- static method testGenericConstInstance() → dynamic
- return #C40;
- static method testGenericFunctionTypeLiteral() → dynamic
- return <X extends dart.core::Object* = dynamic>(X*) →* X*;
- static method testFieldWithDoubleLiteralInitializer() → dynamic
- return #lib::fieldWithDoubleLiteralInitializer;
- static method main() → dynamic {}
-}
-constants {
- #C1 = 0
- #C2 = "A.elem1"
- #C3 = #lib::A {index:#C1, _name:#C2}
- #C4 = 1
- #C5 = "A.elem2"
- #C6 = #lib::A {index:#C4, _name:#C5}
- #C7 = 2
- #C8 = "A.elem3"
- #C9 = #lib::A {index:#C7, _name:#C8}
- #C10 = 3
- #C11 = "A.elem4"
- #C12 = #lib::A {index:#C10, _name:#C11}
- #C13 = <#lib::A*>[#C3, #C6, #C9, #C12]
- #C14 = null
- #C15 = "hello!"
- #C16 = 6
- #C17 = 15
- #C18 = #lib::C {j:#C10, i:#C17}
- #C19 = 4
- #C20 = #lib::B {i:#C19}
- #C21 = #lib::D {x:#C20, y:#C14}
- #C22 = 42
- #C23 = "foo"
- #C24 = TypeLiteralConstant(dart.core::int*)
- #C25 = <dart.core::Object*>[#C22, #C23, #C24]
- #C26 = "E2"
- #C27 = "E4"
- #C28 = <dynamic>[#C26, #C6, #C27, #C12]
- #C29 = dart.core::_ImmutableMap<dart.core::String*, #lib::A*> {_kvPairs:#C28}
- #C30 = 9
- #C31 = 30
- #C32 = #lib::C {j:#C30, i:#C31}
- #C33 = "bar"
- #C34 = #lib::B {i:#C16}
- #C35 = <dynamic>[#C23, #C22, #C33, #C34]
- #C36 = dart.core::_ImmutableMap<dart.core::String*, dart.core::Object*> {_kvPairs:#C35}
- #C37 = #lib::D {x:#C32, y:#C36}
- #C38 = #test_symbol
- #C39 = ##lib::_private_symbol
- #C40 = #lib::F<dart.core::int*, dart.core::String*> {}
-}
diff --git a/pkg/vm/testcases/bytecode/loops.dart b/pkg/vm/testcases/bytecode/loops.dart
deleted file mode 100644
index 4d9dd1b..0000000
--- a/pkg/vm/testcases/bytecode/loops.dart
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.
-
-int test_for(List<int> list) {
- int sum = 0;
- for (int i = 0; i < list.length; i++) {
- sum = sum + list[i];
- }
- return sum;
-}
-
-int test_for_break(List<int> list) {
- int sum = 0;
- for (int i = 0; i >= 0; i++) {
- if (i >= list.length) {
- break;
- }
- sum = sum + list[i];
- }
- return sum;
-}
-
-int test_for_continue(List<int> list) {
- int sum = 0;
- for (int i = -100; i < list.length; i++) {
- if (i < 0) {
- continue;
- }
- sum = sum + list[i];
- }
- return sum;
-}
-
-int test_while(List<int> list) {
- int sum = 0;
- int i = 0;
- while (i < list.length) {
- sum = sum + list[i++];
- }
- return sum;
-}
-
-int test_do_while(List<int> list) {
- int sum = 0;
- int i = 0;
- do {
- sum = sum + list[i];
- ++i;
- } while (i < list.length);
- return sum;
-}
-
-int test_for_in(List<int> list) {
- int sum = 0;
- for (var e in list) {
- sum = sum + e;
- }
- return sum;
-}
-
-int test_for_in_with_outer_var(List<int> list) {
- int sum = 0;
- int e = 42;
- for (e in list) {
- sum = sum + e;
- }
- return sum;
-}
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/loops.dart.expect b/pkg/vm/testcases/bytecode/loops.dart.expect
deleted file mode 100644
index 11d1d08..0000000
--- a/pkg/vm/testcases/bytecode/loops.dart.expect
+++ /dev/null
@@ -1,429 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'test_for', static, reflectable, debuggable
- parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 2
- CheckStack 0
- PushInt 0
- PopLocal r0
- PushInt 0
- PopLocal r1
-L2:
- CheckStack 1
- Push r1
- Push FP[-5]
- InterfaceCall CP#0, 1
- InterfaceCall CP#2, 2
- AssertBoolean 0
- JumpIfFalse L1
- Push r0
- Push FP[-5]
- Push r1
- InterfaceCall CP#4, 2
- AddInt
- PopLocal r0
- Push r1
- PushInt 1
- AddInt
- StoreLocal r1
- Drop1
- Jump L2
-L1:
- Push r0
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall 'dart:core::num::<', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
- [4] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
- [5] = Reserved
-}
-
-
-Function 'test_for_break', static, reflectable, debuggable
- parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 2
- CheckStack 0
- PushInt 0
- PopLocal r0
- PushInt 0
- PopLocal r1
-L3:
- CheckStack 1
- Push r1
- PushInt 0
- CompareIntGe
- JumpIfFalse L1
- Push r1
- Push FP[-5]
- InterfaceCall CP#0, 1
- InterfaceCall CP#2, 2
- AssertBoolean 0
- JumpIfFalse L2
- Jump L1
-L2:
- Push r0
- Push FP[-5]
- Push r1
- InterfaceCall CP#4, 2
- AddInt
- PopLocal r0
- Push r1
- PushInt 1
- AddInt
- StoreLocal r1
- Drop1
- Jump L3
-L1:
- Push r0
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall 'dart:core::num::>=', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
- [4] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
- [5] = Reserved
-}
-
-
-Function 'test_for_continue', static, reflectable, debuggable
- parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 2
- CheckStack 0
- PushInt 0
- PopLocal r0
- PushInt 100
- NegateInt
- PopLocal r1
-L4:
- CheckStack 1
- Push r1
- Push FP[-5]
- InterfaceCall CP#0, 1
- InterfaceCall CP#2, 2
- AssertBoolean 0
- JumpIfFalse L1
- Push r1
- PushInt 0
- CompareIntLt
- JumpIfFalse L2
- Jump L3
-L2:
- Push r0
- Push FP[-5]
- Push r1
- InterfaceCall CP#4, 2
- AddInt
- PopLocal r0
-L3:
- Push r1
- PushInt 1
- AddInt
- StoreLocal r1
- Drop1
- Jump L4
-L1:
- Push r0
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall 'dart:core::num::<', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
- [4] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
- [5] = Reserved
-}
-
-
-Function 'test_while', static, reflectable, debuggable
- parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 4
- CheckStack 0
- PushInt 0
- PopLocal r0
- PushInt 0
- PopLocal r1
-L2:
- CheckStack 1
- Push r1
- Push FP[-5]
- InterfaceCall CP#0, 1
- InterfaceCall CP#2, 2
- AssertBoolean 0
- JumpIfFalse L1
- Push r0
- Push FP[-5]
- Push r1
- PopLocal r2
- Push r2
- PushInt 1
- AddInt
- StoreLocal r1
- PopLocal r3
- Push r2
- InterfaceCall CP#4, 2
- AddInt
- PopLocal r0
- Jump L2
-L1:
- Push r0
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall 'dart:core::num::<', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
- [4] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
- [5] = Reserved
-}
-
-
-Function 'test_do_while', static, reflectable, debuggable
- parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 2
- CheckStack 0
- PushInt 0
- PopLocal r0
- PushInt 0
- PopLocal r1
-L1:
- CheckStack 1
- Push r0
- Push FP[-5]
- Push r1
- InterfaceCall CP#0, 2
- AddInt
- PopLocal r0
- Push r1
- PushInt 1
- AddInt
- PopLocal r1
- Push r1
- Push FP[-5]
- InterfaceCall CP#2, 1
- InterfaceCall CP#4, 2
- AssertBoolean 0
- JumpIfTrue L1
- Push r0
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = InterfaceCall 'dart:core::num::<', ArgDesc num-args 2, num-type-args 0, names []
- [5] = Reserved
-}
-
-
-Function 'test_for_in', static, reflectable, debuggable
- parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 3
- CheckStack 0
- PushInt 0
- PopLocal r0
- Push FP[-5]
- InterfaceCall CP#0, 1
- PopLocal r1
-L2:
- CheckStack 1
- Push r1
- InterfaceCall CP#2, 1
- AssertBoolean 0
- JumpIfFalse L1
- Push r1
- InterfaceCall CP#4, 1
- PopLocal r2
- Push r0
- Push r2
- AddInt
- PopLocal r0
- Jump L2
-L1:
- Push r0
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::Iterable::get:iterator', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall 'dart:core::Iterator::moveNext', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = InterfaceCall 'dart:core::Iterator::get:current', ArgDesc num-args 1, num-type-args 0, names []
- [5] = Reserved
-}
-
-
-Function 'test_for_in_with_outer_var', static, reflectable, debuggable
- parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 4
- CheckStack 0
- PushInt 0
- PopLocal r0
- PushInt 42
- PopLocal r1
- Push FP[-5]
- InterfaceCall CP#0, 1
- PopLocal r2
-L2:
- CheckStack 1
- Push r2
- InterfaceCall CP#2, 1
- AssertBoolean 0
- JumpIfFalse L1
- Push r2
- InterfaceCall CP#4, 1
- PopLocal r3
- Push r3
- PopLocal r1
- Push r0
- Push r1
- AddInt
- PopLocal r0
- Jump L2
-L1:
- Push r0
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::Iterable::get:iterator', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
- [2] = InterfaceCall 'dart:core::Iterator::moveNext', ArgDesc num-args 1, num-type-args 0, names []
- [3] = Reserved
- [4] = InterfaceCall 'dart:core::Iterator::get:current', ArgDesc num-args 1, num-type-args 0, names []
- [5] = Reserved
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- static method test_for(dart.core::List<dart.core::int*>* list) → dart.core::int* {
- dart.core::int* sum = 0;
- for (dart.core::int* i = 0; i.{dart.core::num::<}(list.{dart.core::List::length}); i = i.{dart.core::num::+}(1)) {
- sum = sum.{dart.core::num::+}(list.{dart.core::List::[]}(i));
- }
- return sum;
- }
- static method test_for_break(dart.core::List<dart.core::int*>* list) → dart.core::int* {
- dart.core::int* sum = 0;
- #L1:
- for (dart.core::int* i = 0; i.{dart.core::num::>=}(0); i = i.{dart.core::num::+}(1)) {
- if(i.{dart.core::num::>=}(list.{dart.core::List::length})) {
- break #L1;
- }
- sum = sum.{dart.core::num::+}(list.{dart.core::List::[]}(i));
- }
- return sum;
- }
- static method test_for_continue(dart.core::List<dart.core::int*>* list) → dart.core::int* {
- dart.core::int* sum = 0;
- for (dart.core::int* i = 100.{dart.core::int::unary-}(); i.{dart.core::num::<}(list.{dart.core::List::length}); i = i.{dart.core::num::+}(1))
- #L2:
- {
- if(i.{dart.core::num::<}(0)) {
- break #L2;
- }
- sum = sum.{dart.core::num::+}(list.{dart.core::List::[]}(i));
- }
- return sum;
- }
- static method test_while(dart.core::List<dart.core::int*>* list) → dart.core::int* {
- dart.core::int* sum = 0;
- dart.core::int* i = 0;
- while (i.{dart.core::num::<}(list.{dart.core::List::length})) {
- sum = sum.{dart.core::num::+}(list.{dart.core::List::[]}(let final dart.core::int* #t1 = i in let final dart.core::int* #t2 = i = #t1.{dart.core::num::+}(1) in #t1));
- }
- return sum;
- }
- static method test_do_while(dart.core::List<dart.core::int*>* list) → dart.core::int* {
- dart.core::int* sum = 0;
- dart.core::int* i = 0;
- do {
- sum = sum.{dart.core::num::+}(list.{dart.core::List::[]}(i));
- i = i.{dart.core::num::+}(1);
- }
- while (i.{dart.core::num::<}(list.{dart.core::List::length}))
- return sum;
- }
- static method test_for_in(dart.core::List<dart.core::int*>* list) → dart.core::int* {
- dart.core::int* sum = 0;
- {
- dart.core::Iterator<dart.core::int*>* :sync-for-iterator = list.{dart.core::Iterable::iterator};
- for (; :sync-for-iterator.{dart.core::Iterator::moveNext}(); ) {
- dart.core::int* e = :sync-for-iterator.{dart.core::Iterator::current};
- {
- sum = sum.{dart.core::num::+}(e);
- }
- }
- }
- return sum;
- }
- static method test_for_in_with_outer_var(dart.core::List<dart.core::int*>* list) → dart.core::int* {
- dart.core::int* sum = 0;
- dart.core::int* e = 42;
- {
- dart.core::Iterator<dart.core::int*>* :sync-for-iterator = list.{dart.core::Iterable::iterator};
- for (; :sync-for-iterator.{dart.core::Iterator::moveNext}(); ) {
- final dart.core::int* #t3 = :sync-for-iterator.{dart.core::Iterator::current};
- {
- e = #t3;
- sum = sum.{dart.core::num::+}(e);
- }
- }
- }
- return sum;
- }
- static method main() → dynamic {}
-}
diff --git a/pkg/vm/testcases/bytecode/optional_params.dart b/pkg/vm/testcases/bytecode/optional_params.dart
deleted file mode 100644
index 908f596..0000000
--- a/pkg/vm/testcases/bytecode/optional_params.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.
-
-void foo1(x, [a = 'default_a', b = 'default_b']) {
- print('x = $x');
- print('a = $a');
- print('b = $b');
-}
-
-void foo2(y, z, {c = 'default_c', a = 42, b = const ['default_b']}) {
- print('y = $y');
- print('z = $z');
- print('a = $a');
- print('b = $b');
- print('c = $c');
-}
-
-void foo3<P, Q>(z, y, {bool a: false, Map<P, Q> b}) {
- print(P);
- print(y);
- print(b);
-}
-
-main() {
- foo1('fixed_x', 'concrete_a');
- foo2('fixed_y', 'fixed_z', a: 'concrete_a');
-}
diff --git a/pkg/vm/testcases/bytecode/optional_params.dart.expect b/pkg/vm/testcases/bytecode/optional_params.dart.expect
deleted file mode 100644
index 5e959bc..0000000
--- a/pkg/vm/testcases/bytecode/optional_params.dart.expect
+++ /dev/null
@@ -1,298 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'foo1', static, has-optional-positional-params, reflectable, debuggable
- parameters [dynamic 'x', dynamic 'a', dynamic 'b'] (required: 1)
- return-type void
-
-Bytecode {
- EntryOptional 1, 2, 0
- LoadConstant r1, CP#0
- LoadConstant r2, CP#1
- Frame 1
- CheckStack 0
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r3
- Push r3
- PushInt 0
- PushConstant CP#2
- StoreIndexedTOS
- Push r3
- PushInt 1
- Push r0
- StoreIndexedTOS
- DirectCall CP#3, 1
- DirectCall CP#5, 1
- Drop1
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r3
- Push r3
- PushInt 0
- PushConstant CP#7
- StoreIndexedTOS
- Push r3
- PushInt 1
- Push r1
- StoreIndexedTOS
- DirectCall CP#3, 1
- DirectCall CP#5, 1
- Drop1
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r3
- Push r3
- PushInt 0
- PushConstant CP#8
- StoreIndexedTOS
- Push r3
- PushInt 1
- Push r2
- StoreIndexedTOS
- DirectCall CP#3, 1
- DirectCall CP#5, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef 'default_a'
- [1] = ObjectRef 'default_b'
- [2] = ObjectRef 'x = '
- [3] = DirectCall 'dart:core::_StringBase::_interpolate', ArgDesc num-args 1, num-type-args 0, names []
- [4] = Reserved
- [5] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [6] = Reserved
- [7] = ObjectRef 'a = '
- [8] = ObjectRef 'b = '
-}
-
-
-Function 'foo2', static, has-optional-named-params, reflectable, debuggable
- parameters [dynamic 'y', dynamic 'z', dynamic 'c', dynamic 'a', dynamic 'b'] (required: 2)
- return-type void
-
-Bytecode {
- EntryOptional 2, 0, 3
- LoadConstant r2, CP#0
- LoadConstant r2, CP#1
- LoadConstant r3, CP#2
- LoadConstant r3, CP#3
- LoadConstant r4, CP#4
- LoadConstant r4, CP#5
- Frame 1
- CheckStack 0
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r5
- Push r5
- PushInt 0
- PushConstant CP#6
- StoreIndexedTOS
- Push r5
- PushInt 1
- Push r0
- StoreIndexedTOS
- DirectCall CP#7, 1
- DirectCall CP#9, 1
- Drop1
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r5
- Push r5
- PushInt 0
- PushConstant CP#11
- StoreIndexedTOS
- Push r5
- PushInt 1
- Push r1
- StoreIndexedTOS
- DirectCall CP#7, 1
- DirectCall CP#9, 1
- Drop1
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r5
- Push r5
- PushInt 0
- PushConstant CP#12
- StoreIndexedTOS
- Push r5
- PushInt 1
- Push r2
- StoreIndexedTOS
- DirectCall CP#7, 1
- DirectCall CP#9, 1
- Drop1
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r5
- Push r5
- PushInt 0
- PushConstant CP#13
- StoreIndexedTOS
- Push r5
- PushInt 1
- Push r3
- StoreIndexedTOS
- DirectCall CP#7, 1
- DirectCall CP#9, 1
- Drop1
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r5
- Push r5
- PushInt 0
- PushConstant CP#14
- StoreIndexedTOS
- Push r5
- PushInt 1
- Push r4
- StoreIndexedTOS
- DirectCall CP#7, 1
- DirectCall CP#9, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef 'a'
- [1] = ObjectRef const 42
- [2] = ObjectRef 'b'
- [3] = ObjectRef const <dart:core::String*> ['default_b']
- [4] = ObjectRef 'c'
- [5] = ObjectRef 'default_c'
- [6] = ObjectRef 'y = '
- [7] = DirectCall 'dart:core::_StringBase::_interpolate', ArgDesc num-args 1, num-type-args 0, names []
- [8] = Reserved
- [9] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [10] = Reserved
- [11] = ObjectRef 'z = '
- [12] = ObjectRef 'a = '
- [13] = ObjectRef 'b = '
- [14] = ObjectRef 'c = '
-}
-
-
-Function 'foo3', static, has-optional-named-params, reflectable, debuggable
- type-params <dart:core::Object* P, dart:core::Object* Q>
- parameters [dynamic 'z', dynamic 'y', dart:core::bool* 'a', dart:core::Map < #lib::foo3::TypeParam/0*, #lib::foo3::TypeParam/1* >* 'b'] (required: 2)
- return-type void
-
-Bytecode {
- EntryOptional 2, 0, 2
- LoadConstant r2, CP#0
- LoadConstant r2, CP#1
- LoadConstant r3, CP#2
- LoadConstant r3, CP#3
- Frame 1
- CheckFunctionTypeArgs 2, r4
- CheckStack 0
- PushNull
- Push r4
- InstantiateType CP#4
- DirectCall CP#5, 1
- Drop1
- Push r1
- DirectCall CP#5, 1
- Drop1
- Push r3
- DirectCall CP#5, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef 'a'
- [1] = ObjectRef const false
- [2] = ObjectRef 'b'
- [3] = ObjectRef null
- [4] = Type #lib::foo3::TypeParam/0*
- [5] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [6] = Reserved
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushConstant CP#0
- PushConstant CP#1
- DirectCall CP#2, 2
- Drop1
- PushConstant CP#4
- PushConstant CP#5
- PushConstant CP#1
- DirectCall CP#6, 3
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef 'fixed_x'
- [1] = ObjectRef 'concrete_a'
- [2] = DirectCall '#lib::foo1', ArgDesc num-args 2, num-type-args 0, names []
- [3] = Reserved
- [4] = ObjectRef 'fixed_y'
- [5] = ObjectRef 'fixed_z'
- [6] = DirectCall '#lib::foo2', ArgDesc num-args 3, num-type-args 0, names ['a']
- [7] = Reserved
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- static method foo1(dynamic x, [dynamic a = #C1, dynamic b = #C2]) → void {
- dart.core::print("x = ${x}");
- dart.core::print("a = ${a}");
- dart.core::print("b = ${b}");
- }
- static method foo2(dynamic y, dynamic z, {dynamic c = #C3, dynamic a = #C4, dynamic b = #C5}) → void {
- dart.core::print("y = ${y}");
- dart.core::print("z = ${z}");
- dart.core::print("a = ${a}");
- dart.core::print("b = ${b}");
- dart.core::print("c = ${c}");
- }
- static method foo3<P extends dart.core::Object* = dynamic, Q extends dart.core::Object* = dynamic>(dynamic z, dynamic y, {dart.core::bool* a = #C6, dart.core::Map<#lib::foo3::P*, #lib::foo3::Q*>* b = #C7}) → void {
- dart.core::print(#lib::foo3::P*);
- dart.core::print(y);
- dart.core::print(b);
- }
- static method main() → dynamic {
- #lib::foo1("fixed_x", "concrete_a");
- #lib::foo2("fixed_y", "fixed_z", a: "concrete_a");
- }
-}
-constants {
- #C1 = "default_a"
- #C2 = "default_b"
- #C3 = "default_c"
- #C4 = 42
- #C5 = <dart.core::String*>[#C2]
- #C6 = false
- #C7 = null
-}
diff --git a/pkg/vm/testcases/bytecode/super_calls.dart b/pkg/vm/testcases/bytecode/super_calls.dart
deleted file mode 100644
index 8bd86b7..0000000
--- a/pkg/vm/testcases/bytecode/super_calls.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.
-
-// Tests various super-calls.
-// Class B requires super-mixin semantics (used in Flutter).
-
-class Base1 {
- void foo<T>(T a1, int a2) {}
- get bar => 42;
- set bazz(int x) {}
-}
-
-class A extends Base1 {
- testSuperCall(int x) => super.foo<String>('a1', 2);
- testSuperTearOff() => super.foo;
- testSuperGet() => super.bar;
- testSuperCallViaGetter() => super.bar<int>('param');
- testSuperSet() {
- super.bazz = 3;
- }
-}
-
-abstract class Base2 {
- void foo<T>(String a1, T a2, int a3);
- get bar;
- set bazz(int x);
-}
-
-abstract class B extends Base2 {
- testSuperCall(int x) => super.foo<double>('a1', 3.14, 5);
- testSuperTearOff() => super.foo;
- testSuperGet() => super.bar;
- testSuperCallViaGetter() => super.bar<int>('param');
- testSuperSet() {
- super.bazz = 3;
- }
-}
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/super_calls.dart.expect b/pkg/vm/testcases/bytecode/super_calls.dart.expect
deleted file mode 100644
index 2f8ccc5..0000000
--- a/pkg/vm/testcases/bytecode/super_calls.dart.expect
+++ /dev/null
@@ -1,627 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-Class 'Base1', script = '#lib'
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::Base1*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'foo', reflectable, debuggable
- type-params <dart:core::Object* T>
- parameters [#lib::Base1::foo::TypeParam/0* 'a1', dart:core::int* 'a2'] (required: 2)
- return-type void
-
-Bytecode {
- Entry 1
- CheckFunctionTypeArgs 1, r0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-
-Function 'get:bar', getter, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushInt 42
- ReturnTOS
-}
-ConstantPool {
-}
-
-
-Function 'set:bazz', setter, reflectable, debuggable
- parameters [dart:core::int* 'x'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'A', script = '#lib'
- extends #lib::Base1*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::A*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::Base1:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'testSuperCall', reflectable, debuggable
- parameters [dart:core::int* 'x'] (required: 1)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- PushConstant CP#0
- Push FP[-6]
- PushConstant CP#1
- PushInt 2
- UncheckedDirectCall CP#2, 4
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < dart:core::String* >
- [1] = ObjectRef 'a1'
- [2] = DirectCall '#lib::Base1::foo', ArgDesc num-args 3, num-type-args 1, names []
- [3] = Reserved
-}
-
-
-Function 'testSuperTearOff', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::Base1::get:foo', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'testSuperGet', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::Base1::get:bar', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'testSuperCallViaGetter', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- PushConstant CP#0
- Push FP[-5]
- DirectCall CP#1, 1
- PushConstant CP#3
- DynamicCall CP#4, 3
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < dart:core::int* >
- [1] = DirectCall '#lib::Base1::get:bar', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
- [3] = ObjectRef 'param'
- [4] = DynamicCall 'call', ArgDesc num-args 2, num-type-args 1, names []
- [5] = Reserved
-}
-
-
-Function 'testSuperSet', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- PushInt 3
- UncheckedDirectCall CP#0, 2
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::Base1::set:bazz', ArgDesc num-args 2, num-type-args 0, names []
- [1] = Reserved
-}
-
-Class 'Base2', script = '#lib', abstract
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::Base2*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'foo', abstract, reflectable, debuggable
- type-params <dart:core::Object* T>
- parameters [dart:core::String* 'a1', #lib::Base2::foo::TypeParam/0* 'a2', dart:core::int* 'a3'] (required: 3)
- return-type void
-
-Function 'get:bar', getter, abstract, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Function 'set:bazz', setter, abstract, reflectable, debuggable
- parameters [dart:core::int* 'x'] (required: 1)
- return-type void
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'B', script = '#lib', abstract
- extends #lib::Base2*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::B*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::Base2:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'testSuperCall', reflectable, debuggable
- parameters [dart:core::int* 'x'] (required: 1)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-6]
- PushConstant CP#1
- PushConstant CP#0
- PushConstant CP#2
- PushInt 5
- CreateArrayTOS
- StoreLocal r0
- Push r0
- PushInt 0
- PushConstant CP#3
- StoreIndexedTOS
- Push r0
- PushInt 1
- Push FP[-6]
- StoreIndexedTOS
- Push r0
- PushInt 2
- PushConstant CP#4
- StoreIndexedTOS
- Push r0
- PushInt 3
- PushConstant CP#5
- StoreIndexedTOS
- Push r0
- PushInt 4
- PushInt 5
- StoreIndexedTOS
- PushTrue
- DirectCall CP#6, 4
- DirectCall CP#8, 2
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef ArgDesc num-args 4, num-type-args 1, names []
- [1] = ObjectRef 'foo'
- [2] = ObjectRef < dynamic >
- [3] = ObjectRef < dart:core::double* >
- [4] = ObjectRef 'a1'
- [5] = ObjectRef const 3.14
- [6] = DirectCall 'dart:core::_InvocationMirror::_allocateInvocationMirror', ArgDesc num-args 4, num-type-args 0, names []
- [7] = Reserved
- [8] = DirectCall 'dart:core::Object::noSuchMethod', ArgDesc num-args 2, num-type-args 0, names []
- [9] = Reserved
-}
-
-
-Function 'testSuperTearOff', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- PushConstant CP#1
- PushConstant CP#0
- PushConstant CP#2
- PushInt 1
- CreateArrayTOS
- StoreLocal r0
- Push r0
- PushInt 0
- Push FP[-5]
- StoreIndexedTOS
- PushTrue
- DirectCall CP#3, 4
- DirectCall CP#5, 2
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
- [1] = ObjectRef 'foo'
- [2] = ObjectRef < dynamic >
- [3] = DirectCall 'dart:core::_InvocationMirror::_allocateInvocationMirror', ArgDesc num-args 4, num-type-args 0, names []
- [4] = Reserved
- [5] = DirectCall 'dart:core::Object::noSuchMethod', ArgDesc num-args 2, num-type-args 0, names []
- [6] = Reserved
-}
-
-
-Function 'testSuperGet', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- PushConstant CP#1
- PushConstant CP#0
- PushConstant CP#2
- PushInt 1
- CreateArrayTOS
- StoreLocal r0
- Push r0
- PushInt 0
- Push FP[-5]
- StoreIndexedTOS
- PushTrue
- DirectCall CP#3, 4
- DirectCall CP#5, 2
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
- [1] = ObjectRef 'bar'
- [2] = ObjectRef < dynamic >
- [3] = DirectCall 'dart:core::_InvocationMirror::_allocateInvocationMirror', ArgDesc num-args 4, num-type-args 0, names []
- [4] = Reserved
- [5] = DirectCall 'dart:core::Object::noSuchMethod', ArgDesc num-args 2, num-type-args 0, names []
- [6] = Reserved
-}
-
-
-Function 'testSuperCallViaGetter', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- PushConstant CP#0
- Push FP[-5]
- PushConstant CP#2
- PushConstant CP#1
- PushConstant CP#3
- PushInt 1
- CreateArrayTOS
- StoreLocal r0
- Push r0
- PushInt 0
- Push FP[-5]
- StoreIndexedTOS
- PushTrue
- DirectCall CP#4, 4
- DirectCall CP#6, 2
- PushConstant CP#8
- DynamicCall CP#9, 3
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef < dart:core::int* >
- [1] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
- [2] = ObjectRef 'bar'
- [3] = ObjectRef < dynamic >
- [4] = DirectCall 'dart:core::_InvocationMirror::_allocateInvocationMirror', ArgDesc num-args 4, num-type-args 0, names []
- [5] = Reserved
- [6] = DirectCall 'dart:core::Object::noSuchMethod', ArgDesc num-args 2, num-type-args 0, names []
- [7] = Reserved
- [8] = ObjectRef 'param'
- [9] = DynamicCall 'call', ArgDesc num-args 2, num-type-args 1, names []
- [10] = Reserved
-}
-
-
-Function 'testSuperSet', reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- PushConstant CP#1
- PushConstant CP#0
- PushConstant CP#2
- PushInt 2
- CreateArrayTOS
- StoreLocal r0
- Push r0
- PushInt 0
- Push FP[-5]
- StoreIndexedTOS
- Push r0
- PushInt 1
- PushInt 3
- StoreIndexedTOS
- PushTrue
- DirectCall CP#3, 4
- DirectCall CP#5, 2
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = ObjectRef ArgDesc num-args 2, num-type-args 0, names []
- [1] = ObjectRef 'bazz'
- [2] = ObjectRef < dynamic >
- [3] = DirectCall 'dart:core::_InvocationMirror::_allocateInvocationMirror', ArgDesc num-args 4, num-type-args 0, names []
- [4] = Reserved
- [5] = DirectCall 'dart:core::Object::noSuchMethod', ArgDesc num-args 2, num-type-args 0, names []
- [6] = Reserved
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- class Base1 extends dart.core::Object {
- synthetic constructor •() → #lib::Base1*
- : super dart.core::Object::•()
- ;
- method foo<T extends dart.core::Object* = dynamic>(#lib::Base1::foo::T* a1, dart.core::int* a2) → void {}
- get bar() → dynamic
- return 42;
- set bazz(dart.core::int* x) → void {}
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class A extends #lib::Base1 {
- synthetic constructor •() → #lib::A*
- : super #lib::Base1::•()
- ;
- method testSuperCall(dart.core::int* x) → dynamic
- return super.{#lib::Base1::foo}<dart.core::String*>("a1", 2);
- method testSuperTearOff() → dynamic
- return super.{#lib::Base1::foo};
- method testSuperGet() → dynamic
- return super.{#lib::Base1::bar};
- method testSuperCallViaGetter() → dynamic
- return [@vm.call-site-attributes.metadata=receiverType:dynamic] super.{#lib::Base1::bar}.call<dart.core::int*>("param");
- method testSuperSet() → dynamic {
- super.{#lib::Base1::bazz} = 3;
- }
- }
- abstract class Base2 extends dart.core::Object {
- synthetic constructor •() → #lib::Base2*
- : super dart.core::Object::•()
- ;
- abstract method foo<T extends dart.core::Object* = dynamic>(dart.core::String* a1, #lib::Base2::foo::T* a2, dart.core::int* a3) → void;
- abstract get bar() → dynamic;
- abstract set bazz(dart.core::int* x) → void;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- abstract class B extends #lib::Base2 {
- synthetic constructor •() → #lib::B*
- : super #lib::Base2::•()
- ;
- method testSuperCall(dart.core::int* x) → dynamic
- return super.{#lib::Base2::foo}<dart.core::double*>("a1", 3.14, 5);
- method testSuperTearOff() → dynamic
- return super.{#lib::Base2::foo};
- method testSuperGet() → dynamic
- return super.{#lib::Base2::bar};
- method testSuperCallViaGetter() → dynamic
- return [@vm.call-site-attributes.metadata=receiverType:dynamic] super.{#lib::Base2::bar}.call<dart.core::int*>("param");
- method testSuperSet() → dynamic {
- super.{#lib::Base2::bazz} = 3;
- }
- }
- static method main() → dynamic {}
-}
diff --git a/pkg/vm/testcases/bytecode/switch.dart b/pkg/vm/testcases/bytecode/switch.dart
deleted file mode 100644
index da20adb..0000000
--- a/pkg/vm/testcases/bytecode/switch.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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.
-
-int foo1(int x) {
- int y;
- switch (x) {
- case 1:
- y = 11;
- break;
- case 2:
- y = 22;
- break;
- case 3:
- y = 33;
- break;
- }
- return y;
-}
-
-int foo2(int x) {
- int y;
- switch (x) {
- case 1:
- case 2:
- case 3:
- y = 11;
- break;
- case 4:
- case 5:
- case 6:
- y = 22;
- break;
- default:
- y = 33;
- }
- return y;
-}
-
-int foo3(int x) {
- int y;
- switch (x) {
- case 1:
- case 2:
- case 3:
- y = 11;
- continue L5;
- case 4:
- L5:
- case 5:
- case 6:
- y = 22;
- return 42;
- default:
- y = 33;
- }
- return y;
-}
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/switch.dart.expect b/pkg/vm/testcases/bytecode/switch.dart.expect
deleted file mode 100644
index 555f7a8..0000000
--- a/pkg/vm/testcases/bytecode/switch.dart.expect
+++ /dev/null
@@ -1,279 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'foo1', static, reflectable, debuggable
- parameters [dart:core::int* 'x'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 2
- CheckStack 0
- PushNull
- PopLocal r0
- Push FP[-5]
- PopLocal r1
- PushInt 1
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L1
- PushInt 2
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L2
- PushInt 3
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L3
- Jump L4
-L1:
- PushInt 11
- PopLocal r0
- Jump L4
-L2:
- PushInt 22
- PopLocal r0
- Jump L4
-L3:
- PushInt 33
- PopLocal r0
- Jump L4
-L4:
- Push r0
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::Object::==', ArgDesc num-args 2, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'foo2', static, reflectable, debuggable
- parameters [dart:core::int* 'x'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 2
- CheckStack 0
- PushNull
- PopLocal r0
- Push FP[-5]
- PopLocal r1
- PushInt 1
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L1
- PushInt 2
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L1
- PushInt 3
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L1
- PushInt 4
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L2
- PushInt 5
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L2
- PushInt 6
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L2
- Jump L3
-L1:
- PushInt 11
- PopLocal r0
- Jump L4
-L2:
- PushInt 22
- PopLocal r0
- Jump L4
-L3:
- PushInt 33
- PopLocal r0
-L4:
- Push r0
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::Object::==', ArgDesc num-args 2, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'foo3', static, reflectable, debuggable
- parameters [dart:core::int* 'x'] (required: 1)
- return-type dart:core::int*
-
-Bytecode {
- Entry 2
- CheckStack 0
- PushNull
- PopLocal r0
- Push FP[-5]
- PopLocal r1
- PushInt 1
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L1
- PushInt 2
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L1
- PushInt 3
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L1
- PushInt 4
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L2
- PushInt 5
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L2
- PushInt 6
- Push r1
- InterfaceCall CP#0, 2
- JumpIfTrue L2
- Jump L3
-L1:
- PushInt 11
- PopLocal r0
- Jump L2
-L2:
- PushInt 22
- PopLocal r0
- PushInt 42
- ReturnTOS
-L3:
- PushInt 33
- PopLocal r0
- Push r0
- ReturnTOS
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::Object::==', ArgDesc num-args 2, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- static method foo1(dart.core::int* x) → dart.core::int* {
- dart.core::int* y;
- #L1:
- switch(x) {
- #L2:
- case #C1:
- {
- y = 11;
- break #L1;
- }
- #L3:
- case #C2:
- {
- y = 22;
- break #L1;
- }
- #L4:
- case #C3:
- {
- y = 33;
- break #L1;
- }
- }
- return y;
- }
- static method foo2(dart.core::int* x) → dart.core::int* {
- dart.core::int* y;
- #L5:
- switch(x) {
- #L6:
- case #C1:
- case #C2:
- case #C3:
- {
- y = 11;
- break #L5;
- }
- #L7:
- case #C4:
- case #C5:
- case #C6:
- {
- y = 22;
- break #L5;
- }
- #L8:
- default:
- {
- y = 33;
- }
- }
- return y;
- }
- static method foo3(dart.core::int* x) → dart.core::int* {
- dart.core::int* y;
- switch(x) {
- #L9:
- case #C1:
- case #C2:
- case #C3:
- {
- y = 11;
- continue #L10;
- }
- #L10:
- case #C4:
- case #C5:
- case #C6:
- {
- y = 22;
- return 42;
- }
- #L11:
- default:
- {
- y = 33;
- }
- }
- return y;
- }
- static method main() → dynamic {}
-}
-constants {
- #C1 = 1
- #C2 = 2
- #C3 = 3
- #C4 = 4
- #C5 = 5
- #C6 = 6
-}
diff --git a/pkg/vm/testcases/bytecode/try_blocks.dart b/pkg/vm/testcases/bytecode/try_blocks.dart
deleted file mode 100644
index d07c18f..0000000
--- a/pkg/vm/testcases/bytecode/try_blocks.dart
+++ /dev/null
@@ -1,153 +0,0 @@
-// 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.
-
-testTryCatch1() {
- try {
- print('danger!');
- } catch (e) {
- print('caught $e');
- }
-}
-
-testTryCatch2() {
- try {
- print('danger!');
- } on TypeError {
- print('caught type error');
- } on AssertionError catch (e) {
- print('caught assertion error $e');
- } on Error catch (e, st) {
- print('caught error $e $st');
- } catch (e, st) {
- print('caught something $e $st');
- }
-}
-
-testTryCatch3() {
- int x = 1;
- try {
- int y = 2;
- void foo() {
- try {
- print('danger foo');
- } catch (e) {
- print(x);
- y = 3;
- }
- }
-
- foo();
- print(y);
- } catch (e, st) {
- print('caught $e $st');
-
- void bar() {
- try {
- print('danger bar');
- } on Error catch (e) {
- print('error $e, captured stack trace: $st');
- }
- }
-
- return bar;
- }
-}
-
-testRethrow(bool cond) {
- try {
- try {
- print('try 1 > try 2');
- } catch (e) {
- try {
- print('try 1 > catch 2 > try 3');
- if (cond) {
- rethrow;
- }
- } catch (e) {
- print('try 1 > catch 2 > catch 3');
- }
- }
- } catch (e, st) {
- print('catch 1');
- print(st);
- }
-}
-
-testTryFinally1() {
- for (int i = 0; i < 10; i++) {
- try {
- if (i > 5) {
- break;
- }
- } finally {
- print(i);
- }
- }
-}
-
-testTryFinally2(int x) {
- switch (x) {
- case 1:
- try {
- print('before try 1');
- int y = 3;
- try {
- print('try');
- void foo() {
- print(x);
- print(y);
- }
-
- foo();
- continue L;
- } finally {
- print('finally 1');
- }
- print('after try 1');
- } finally {
- print('finally 2');
- }
- break;
- L:
- case 2:
- print('case 2');
- break;
- }
-}
-
-testTryFinally3() {
- int x = 11;
- var y;
- try {
- y = () {
- print(x);
- try {
- print('try 1');
- return 42;
- } finally {
- try {
- print('try 2');
- return 43;
- } finally {
- print(x);
- }
- }
- };
- } finally {
- print(x);
- y();
- }
-}
-
-testTryCatchFinally() {
- try {
- print('try');
- } catch (e) {
- print('catch');
- } finally {
- print('finally');
- }
-}
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/try_blocks.dart.expect b/pkg/vm/testcases/bytecode/try_blocks.dart.expect
deleted file mode 100644
index 8ce1cbf..0000000
--- a/pkg/vm/testcases/bytecode/try_blocks.dart.expect
+++ /dev/null
@@ -1,1162 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-
-Function 'testTryCatch1', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 4
- CheckStack 0
-Try #0 start:
- PushConstant CP#0
- DirectCall CP#1, 1
- Drop1
- Jump L1
-Try #0 end:
-Try #0 handler:
- SetFrame 4
- MoveSpecial exception, r0
- MoveSpecial stackTrace, r1
- Push r0
- PopLocal r2
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r3
- Push r3
- PushInt 0
- PushConstant CP#4
- StoreIndexedTOS
- Push r3
- PushInt 1
- Push r2
- StoreIndexedTOS
- DirectCall CP#5, 1
- DirectCall CP#1, 1
- Drop1
- Jump L1
-L1:
- PushNull
- ReturnTOS
-}
-ExceptionsTable {
- try-index 0, outer -1, start 4, end 14, handler 14, types [CP#3]
-}
-ConstantPool {
- [0] = ObjectRef 'danger!'
- [1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
- [3] = Type dynamic
- [4] = ObjectRef 'caught '
- [5] = DirectCall 'dart:core::_StringBase::_interpolate', ArgDesc num-args 1, num-type-args 0, names []
- [6] = Reserved
-}
-
-
-Function 'testTryCatch2', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 5
- CheckStack 0
-Try #0 start:
- PushConstant CP#0
- DirectCall CP#1, 1
- Drop1
- Jump L1
-Try #0 end:
-Try #0 handler:
- SetFrame 5
- MoveSpecial exception, r0
- MoveSpecial stackTrace, r1
- Push r0
- PushConstant CP#3
- InterfaceCall CP#4, 2
- JumpIfFalse L2
- PushConstant CP#6
- DirectCall CP#1, 1
- Drop1
- Jump L1
-L2:
- Push r0
- PushConstant CP#7
- InterfaceCall CP#4, 2
- JumpIfFalse L3
- Push r0
- PopLocal r2
- PushNull
- PushInt 2
- CreateArrayTOS
- StoreLocal r3
- Push r3
- PushInt 0
- PushConstant CP#8
- StoreIndexedTOS
- Push r3
- PushInt 1
- Push r2
- StoreIndexedTOS
- DirectCall CP#9, 1
- DirectCall CP#1, 1
- Drop1
- Jump L1
-L3:
- Push r0
- PushConstant CP#11
- InterfaceCall CP#4, 2
- JumpIfFalse L4
- Push r0
- PopLocal r2
- Push r1
- PopLocal r3
- PushNull
- PushInt 4
- CreateArrayTOS
- StoreLocal r4
- Push r4
- PushInt 0
- PushConstant CP#12
- StoreIndexedTOS
- Push r4
- PushInt 1
- Push r2
- StoreIndexedTOS
- Push r4
- PushInt 2
- PushConstant CP#13
- StoreIndexedTOS
- Push r4
- PushInt 3
- Push r3
- StoreIndexedTOS
- DirectCall CP#9, 1
- DirectCall CP#1, 1
- Drop1
- Jump L1
-L4:
- Push r0
- PopLocal r2
- Push r1
- PopLocal r3
- PushNull
- PushInt 4
- CreateArrayTOS
- StoreLocal r4
- Push r4
- PushInt 0
- PushConstant CP#15
- StoreIndexedTOS
- Push r4
- PushInt 1
- Push r2
- StoreIndexedTOS
- Push r4
- PushInt 2
- PushConstant CP#13
- StoreIndexedTOS
- Push r4
- PushInt 3
- Push r3
- StoreIndexedTOS
- DirectCall CP#9, 1
- DirectCall CP#1, 1
- Drop1
- Jump L1
-L1:
- PushNull
- ReturnTOS
-}
-ExceptionsTable {
- try-index 0, outer -1, start 4, end 14, handler 14, needs-stack-trace, types [CP#3, CP#7, CP#11, CP#14]
-}
-ConstantPool {
- [0] = ObjectRef 'danger!'
- [1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
- [3] = Type dart:core::TypeError*
- [4] = InterfaceCall 'dart:core::Object::_simpleInstanceOf', ArgDesc num-args 2, num-type-args 0, names []
- [5] = Reserved
- [6] = ObjectRef 'caught type error'
- [7] = Type dart:core::AssertionError*
- [8] = ObjectRef 'caught assertion error '
- [9] = DirectCall 'dart:core::_StringBase::_interpolate', ArgDesc num-args 1, num-type-args 0, names []
- [10] = Reserved
- [11] = Type dart:core::Error*
- [12] = ObjectRef 'caught error '
- [13] = ObjectRef ' '
- [14] = Type dynamic
- [15] = ObjectRef 'caught something '
-}
-
-
-Function 'testTryCatch3', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 7
- CheckStack 0
- AllocateContext 0, 3
- PopLocal r0
- Push r0
- PushInt 1
- StoreContextVar 0, 0
- Push r0
- PopLocal r2
-Try #0 start:
- Push r0
- PushInt 2
- StoreContextVar 0, 1
- AllocateClosure CP#0
- StoreLocal r5
- Push r5
- PushNull
- StoreFieldTOS CP#8
- Push r5
- PushNull
- StoreFieldTOS CP#10
- Push r5
- PushConstant CP#0
- StoreFieldTOS CP#12
- Push r5
- Push r0
- StoreFieldTOS CP#1
- PopLocal r4
- Push r4
- StoreLocal r5
- Push r5
- UncheckedClosureCall CP#14, 1
- Drop1
- Push r0
- LoadContextVar 0, 1
- DirectCall CP#4, 1
- Drop1
- Jump L1
-Try #0 end:
-Try #0 handler:
- SetFrame 7
- Push r2
- PopLocal r0
- MoveSpecial exception, r2
- MoveSpecial stackTrace, r3
- Push r2
- PopLocal r4
- Push r0
- Push r3
- StoreContextVar 0, 2
- PushNull
- PushInt 4
- CreateArrayTOS
- StoreLocal r5
- Push r5
- PushInt 0
- PushConstant CP#15
- StoreIndexedTOS
- Push r5
- PushInt 1
- Push r4
- StoreIndexedTOS
- Push r5
- PushInt 2
- PushConstant CP#16
- StoreIndexedTOS
- Push r5
- PushInt 3
- Push r0
- LoadContextVar 0, 2
- StoreIndexedTOS
- DirectCall CP#17, 1
- DirectCall CP#4, 1
- Drop1
- AllocateClosure CP#19
- StoreLocal r5
- Push r5
- PushNull
- StoreFieldTOS CP#8
- Push r5
- PushNull
- StoreFieldTOS CP#10
- Push r5
- PushConstant CP#19
- StoreFieldTOS CP#12
- Push r5
- Push r0
- StoreFieldTOS CP#1
- PopLocal r6
- Push r6
- ReturnTOS
-L1:
- Push r0
- LoadContextParent
- PopLocal r0
- PushNull
- ReturnTOS
-}
-ExceptionsTable {
- try-index 0, outer -1, start 20, end 78, handler 78, needs-stack-trace, types [CP#6]
-}
-ConstantPool {
- [0] = ClosureFunction 0
- [1] = InstanceField dart:core::_Closure::_context (field)
- [2] = Reserved
- [3] = ObjectRef 'danger foo'
- [4] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [5] = Reserved
- [6] = Type dynamic
- [7] = EndClosureFunctionScope
- [8] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [9] = Reserved
- [10] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [11] = Reserved
- [12] = InstanceField dart:core::_Closure::_function (field)
- [13] = Reserved
- [14] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
- [15] = ObjectRef 'caught '
- [16] = ObjectRef ' '
- [17] = DirectCall 'dart:core::_StringBase::_interpolate', ArgDesc num-args 1, num-type-args 0, names []
- [18] = Reserved
- [19] = ClosureFunction 1
- [20] = ObjectRef 'danger bar'
- [21] = Type dart:core::Error*
- [22] = InterfaceCall 'dart:core::Object::_simpleInstanceOf', ArgDesc num-args 2, num-type-args 0, names []
- [23] = Reserved
- [24] = ObjectRef 'error '
- [25] = ObjectRef ', captured stack trace: '
- [26] = EndClosureFunctionScope
-}
-Closure #lib::testTryCatch3::'foo' () -> void
-ClosureCode {
- Entry 6
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- Push r0
- PopLocal r2
-Try #0 start:
- PushConstant CP#3
- DirectCall CP#4, 1
- Drop1
- Jump L1
-Try #0 end:
-Try #0 handler:
- SetFrame 6
- Push r2
- PopLocal r0
- MoveSpecial exception, r2
- MoveSpecial stackTrace, r3
- Push r2
- PopLocal r4
- Push r0
- LoadContextVar 0, 0
- DirectCall CP#4, 1
- Drop1
- Push r0
- PushInt 3
- StoreContextVar 0, 1
- Jump L1
-L1:
- PushNull
- ReturnTOS
-}
-
-Closure #lib::testTryCatch3::'bar' () -> void
-ClosureCode {
- Entry 6
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- Push r0
- PopLocal r2
-Try #0 start:
- PushConstant CP#20
- DirectCall CP#4, 1
- Drop1
- Jump L1
-Try #0 end:
-Try #0 handler:
- SetFrame 6
- Push r2
- PopLocal r0
- MoveSpecial exception, r2
- MoveSpecial stackTrace, r3
- Push r2
- PushConstant CP#21
- InterfaceCall CP#22, 2
- JumpIfFalse L2
- Push r2
- PopLocal r4
- PushNull
- PushInt 4
- CreateArrayTOS
- StoreLocal r5
- Push r5
- PushInt 0
- PushConstant CP#24
- StoreIndexedTOS
- Push r5
- PushInt 1
- Push r4
- StoreIndexedTOS
- Push r5
- PushInt 2
- PushConstant CP#25
- StoreIndexedTOS
- Push r5
- PushInt 3
- Push r0
- LoadContextVar 0, 2
- StoreIndexedTOS
- DirectCall CP#17, 1
- DirectCall CP#4, 1
- Drop1
- Jump L1
-L2:
- Push r2
- Push r3
- Throw 1
-L1:
- PushNull
- ReturnTOS
-}
-
-
-Function 'testRethrow', static, reflectable, debuggable
- parameters [dart:core::bool* 'cond'] (required: 1)
- return-type dynamic
-
-Bytecode {
- Entry 8
- CheckStack 0
-Try #0 start:
-Try #1 start:
- PushConstant CP#0
- DirectCall CP#1, 1
- Drop1
- Jump L1
-Try #1 end:
-Try #1 handler:
- SetFrame 8
- MoveSpecial exception, r2
- MoveSpecial stackTrace, r3
- Push r2
- PopLocal r4
-Try #2 start:
- PushConstant CP#4
- DirectCall CP#1, 1
- Drop1
- Push FP[-5]
- AssertBoolean 0
- JumpIfFalse L2
- Push r2
- Push r3
- Throw 1
-L2:
- Jump L3
-Try #2 end:
-Try #2 handler:
- SetFrame 8
- MoveSpecial exception, r5
- MoveSpecial stackTrace, r6
- Push r5
- PopLocal r7
- PushConstant CP#5
- DirectCall CP#1, 1
- Drop1
- Jump L3
-L3:
- Jump L1
-L1:
- Jump L4
-Try #0 end:
-Try #0 handler:
- SetFrame 8
- MoveSpecial exception, r0
- MoveSpecial stackTrace, r1
- Push r0
- PopLocal r2
- Push r1
- PopLocal r3
- PushConstant CP#6
- DirectCall CP#1, 1
- Drop1
- Push r3
- DirectCall CP#1, 1
- Drop1
- Jump L4
-L4:
- PushNull
- ReturnTOS
-}
-ExceptionsTable {
- try-index 0, outer -1, start 4, end 80, handler 80, needs-stack-trace, types [CP#3]
- try-index 1, outer 0, start 4, end 14, handler 14, needs-stack-trace, types [CP#3]
- try-index 2, outer 0, start 26, end 50, handler 50, types [CP#3]
-}
-ConstantPool {
- [0] = ObjectRef 'try 1 > try 2'
- [1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
- [3] = Type dynamic
- [4] = ObjectRef 'try 1 > catch 2 > try 3'
- [5] = ObjectRef 'try 1 > catch 2 > catch 3'
- [6] = ObjectRef 'catch 1'
-}
-
-
-Function 'testTryFinally1', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 3
- CheckStack 0
- PushInt 0
- PopLocal r0
-L5:
- CheckStack 1
- Push r0
- PushInt 10
- CompareIntLt
- JumpIfFalse L1
-Try #0 start:
- Push r0
- PushInt 5
- CompareIntGt
- JumpIfFalse L2
- Jump L3
-L2:
- Jump L4
-Try #0 end:
-Try #0 handler:
- SetFrame 3
- MoveSpecial exception, r1
- MoveSpecial stackTrace, r2
- Push r0
- DirectCall CP#1, 1
- Drop1
- Push r1
- Push r2
- Throw 1
-L3:
- Push r0
- DirectCall CP#1, 1
- Drop1
- Jump L1
-L4:
- Push r0
- DirectCall CP#1, 1
- Drop1
- Push r0
- PushInt 1
- AddInt
- StoreLocal r0
- Drop1
- Jump L5
-L1:
- PushNull
- ReturnTOS
-}
-ExceptionsTable {
- try-index 0, outer -1, start 19, end 36, handler 36, needs-stack-trace, synthetic, types [CP#0]
-}
-ConstantPool {
- [0] = Type dynamic
- [1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
-}
-
-
-Function 'testTryFinally2', static, reflectable, debuggable
- parameters [dart:core::int* 'x'] (required: 1)
- return-type dynamic
-
-Bytecode {
- Entry 9
- CheckStack 0
- AllocateContext 0, 2
- PopLocal r0
- Push r0
- Push FP[-5]
- StoreContextVar 0, 0
- Push r0
- LoadContextVar 0, 0
- PopLocal r2
- PushInt 1
- Push r2
- InterfaceCall CP#0, 2
- JumpIfTrue L1
- PushInt 2
- Push r2
- InterfaceCall CP#0, 2
- JumpIfTrue L2
- Jump L3
-L1:
- Push r0
- PopLocal r3
-Try #0 start:
- PushConstant CP#2
- DirectCall CP#3, 1
- Drop1
- Push r0
- PushInt 3
- StoreContextVar 0, 1
- Push r0
- PopLocal r5
-Try #1 start:
- PushConstant CP#5
- DirectCall CP#3, 1
- Drop1
- AllocateClosure CP#6
- StoreLocal r8
- Push r8
- PushNull
- StoreFieldTOS CP#10
- Push r8
- PushNull
- StoreFieldTOS CP#12
- Push r8
- PushConstant CP#6
- StoreFieldTOS CP#14
- Push r8
- Push r0
- StoreFieldTOS CP#7
- PopLocal r7
- Push r7
- StoreLocal r8
- Push r8
- UncheckedClosureCall CP#16, 1
- Drop1
- Jump L4
-Try #1 end:
-Try #1 handler:
- SetFrame 9
- Push r5
- PopLocal r0
- MoveSpecial exception, r5
- MoveSpecial stackTrace, r6
- PushConstant CP#18
- DirectCall CP#3, 1
- Drop1
- Push r5
- Push r6
- Throw 1
-L4:
- Push r5
- PopLocal r0
- PushConstant CP#18
- DirectCall CP#3, 1
- Drop1
- Jump L5
-Try #0 end:
-Try #0 handler:
- SetFrame 9
- Push r3
- PopLocal r0
- MoveSpecial exception, r3
- MoveSpecial stackTrace, r4
- PushConstant CP#20
- DirectCall CP#3, 1
- Drop1
- Push r3
- Push r4
- Throw 1
-L5:
- Push r3
- PopLocal r0
- PushConstant CP#20
- DirectCall CP#3, 1
- Drop1
- Jump L2
-L2:
- PushConstant CP#21
- DirectCall CP#3, 1
- Drop1
- Jump L3
-L3:
- PushNull
- ReturnTOS
-}
-ExceptionsTable {
- try-index 0, outer -1, start 53, end 156, handler 156, needs-stack-trace, synthetic, types [CP#17]
- try-index 1, outer 0, start 70, end 118, handler 118, needs-stack-trace, synthetic, types [CP#17]
-}
-ConstantPool {
- [0] = InterfaceCall 'dart:core::Object::==', ArgDesc num-args 2, num-type-args 0, names []
- [1] = Reserved
- [2] = ObjectRef 'before try 1'
- [3] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [4] = Reserved
- [5] = ObjectRef 'try'
- [6] = ClosureFunction 0
- [7] = InstanceField dart:core::_Closure::_context (field)
- [8] = Reserved
- [9] = EndClosureFunctionScope
- [10] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [11] = Reserved
- [12] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [13] = Reserved
- [14] = InstanceField dart:core::_Closure::_function (field)
- [15] = Reserved
- [16] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
- [17] = Type dynamic
- [18] = ObjectRef 'finally 1'
- [19] = ObjectRef 'after try 1'
- [20] = ObjectRef 'finally 2'
- [21] = ObjectRef 'case 2'
-}
-Closure #lib::testTryFinally2::'foo' () -> void
-ClosureCode {
- Entry 2
- Push FP[-5]
- LoadFieldTOS CP#7
- PopLocal r0
- CheckStack 0
- Push r0
- LoadContextVar 0, 0
- DirectCall CP#3, 1
- Drop1
- Push r0
- LoadContextVar 0, 1
- DirectCall CP#3, 1
- Drop1
- PushNull
- ReturnTOS
-}
-
-
-Function 'testTryFinally3', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 6
- CheckStack 0
- AllocateContext 0, 1
- PopLocal r0
- Push r0
- PushInt 11
- StoreContextVar 0, 0
- PushNull
- PopLocal r2
- Push r0
- PopLocal r3
-Try #0 start:
- AllocateClosure CP#0
- StoreLocal r5
- Push r5
- PushNull
- StoreFieldTOS CP#9
- Push r5
- PushNull
- StoreFieldTOS CP#11
- Push r5
- PushConstant CP#0
- StoreFieldTOS CP#13
- Push r5
- Push r0
- StoreFieldTOS CP#1
- PopLocal r2
- Jump L1
-Try #0 end:
-Try #0 handler:
- SetFrame 6
- Push r3
- PopLocal r0
- MoveSpecial exception, r3
- MoveSpecial stackTrace, r4
- Push r0
- LoadContextVar 0, 0
- DirectCall CP#3, 1
- Drop1
- Push r2
- DynamicCall CP#15, 1
- Drop1
- Push r3
- Push r4
- Throw 1
-L1:
- Push r3
- PopLocal r0
- Push r0
- LoadContextVar 0, 0
- DirectCall CP#3, 1
- Drop1
- Push r2
- DynamicCall CP#15, 1
- Drop1
- Push r0
- LoadContextParent
- PopLocal r0
- PushNull
- ReturnTOS
-}
-ExceptionsTable {
- try-index 0, outer -1, start 23, end 55, handler 55, needs-stack-trace, synthetic, types [CP#6]
-}
-ConstantPool {
- [0] = ClosureFunction 0
- [1] = InstanceField dart:core::_Closure::_context (field)
- [2] = Reserved
- [3] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [4] = Reserved
- [5] = ObjectRef 'try 1'
- [6] = Type dynamic
- [7] = ObjectRef 'try 2'
- [8] = EndClosureFunctionScope
- [9] = InstanceField dart:core::_Closure::_instantiator_type_arguments (field)
- [10] = Reserved
- [11] = InstanceField dart:core::_Closure::_function_type_arguments (field)
- [12] = Reserved
- [13] = InstanceField dart:core::_Closure::_function (field)
- [14] = Reserved
- [15] = DynamicCall 'call', ArgDesc num-args 1, num-type-args 0, names []
- [16] = Reserved
-}
-Closure #lib::testTryFinally3::'<anonymous closure>' () -> dart:core::int*
-ClosureCode {
- Entry 6
- Push FP[-5]
- LoadFieldTOS CP#1
- PopLocal r0
- CheckStack 0
- Push r0
- LoadContextVar 0, 0
- DirectCall CP#3, 1
- Drop1
- Push r0
- PopLocal r2
-Try #0 start:
- PushConstant CP#5
- DirectCall CP#3, 1
- Drop1
- Jump L1
-Try #0 end:
-Try #0 handler:
- SetFrame 6
- Push r2
- PopLocal r0
- MoveSpecial exception, r2
- MoveSpecial stackTrace, r3
- Push r0
- PopLocal r4
-Try #1 start:
- PushConstant CP#7
- DirectCall CP#3, 1
- Drop1
- Jump L2
-Try #1 end:
-Try #1 handler:
- SetFrame 6
- Push r4
- PopLocal r0
- MoveSpecial exception, r4
- MoveSpecial stackTrace, r5
- Push r0
- LoadContextVar 0, 0
- DirectCall CP#3, 1
- Drop1
- Push r4
- Push r5
- Throw 1
-L2:
- Push r4
- PopLocal r0
- Push r0
- LoadContextVar 0, 0
- DirectCall CP#3, 1
- Drop1
- PushInt 43
- ReturnTOS
-L1:
- Push r2
- PopLocal r0
- Push r0
- PopLocal r4
-Try #2 start:
- PushConstant CP#7
- DirectCall CP#3, 1
- Drop1
- Jump L3
-Try #2 end:
-Try #2 handler:
- SetFrame 6
- Push r4
- PopLocal r0
- MoveSpecial exception, r4
- MoveSpecial stackTrace, r5
- Push r0
- LoadContextVar 0, 0
- DirectCall CP#3, 1
- Drop1
- Push r4
- Push r5
- Throw 1
-L3:
- Push r4
- PopLocal r0
- Push r0
- LoadContextVar 0, 0
- DirectCall CP#3, 1
- Drop1
- PushInt 43
- ReturnTOS
-}
-
-
-Function 'testTryCatchFinally', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 5
- CheckStack 0
-Try #0 start:
-Try #1 start:
- PushConstant CP#0
- DirectCall CP#1, 1
- Drop1
- Jump L1
-Try #1 end:
-Try #1 handler:
- SetFrame 5
- MoveSpecial exception, r2
- MoveSpecial stackTrace, r3
- Push r2
- PopLocal r4
- PushConstant CP#4
- DirectCall CP#1, 1
- Drop1
- Jump L1
-L1:
- Jump L2
-Try #0 end:
-Try #0 handler:
- SetFrame 5
- MoveSpecial exception, r0
- MoveSpecial stackTrace, r1
- PushConstant CP#5
- DirectCall CP#1, 1
- Drop1
- Push r0
- Push r1
- Throw 1
-L2:
- PushConstant CP#5
- DirectCall CP#1, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ExceptionsTable {
- try-index 0, outer -1, start 4, end 40, handler 40, needs-stack-trace, synthetic, types [CP#3]
- try-index 1, outer 0, start 4, end 14, handler 14, types [CP#3]
-}
-ConstantPool {
- [0] = ObjectRef 'try'
- [1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [2] = Reserved
- [3] = Type dynamic
- [4] = ObjectRef 'catch'
- [5] = ObjectRef 'finally'
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- static method testTryCatch1() → dynamic {
- try {
- dart.core::print("danger!");
- }
- on dynamic catch(final dynamic e) {
- dart.core::print("caught ${e}");
- }
- }
- static method testTryCatch2() → dynamic {
- try {
- dart.core::print("danger!");
- }
- on dart.core::TypeError* catch(no-exception-var) {
- dart.core::print("caught type error");
- }
- on dart.core::AssertionError* catch(final dart.core::AssertionError* e) {
- dart.core::print("caught assertion error ${e}");
- }
- on dart.core::Error* catch(final dart.core::Error* e, final dart.core::StackTrace* st) {
- dart.core::print("caught error ${e} ${st}");
- }
- on dynamic catch(final dynamic e, final dart.core::StackTrace* st) {
- dart.core::print("caught something ${e} ${st}");
- }
- }
- static method testTryCatch3() → dynamic {
- dart.core::int* x = 1;
- try {
- dart.core::int* y = 2;
- function foo() → void {
- try {
- dart.core::print("danger foo");
- }
- on dynamic catch(final dynamic e) {
- dart.core::print(x);
- y = 3;
- }
- }
- [@vm.call-site-attributes.metadata=receiverType:void Function()*] foo.call();
- dart.core::print(y);
- }
- on dynamic catch(final dynamic e, final dart.core::StackTrace* st) {
- dart.core::print("caught ${e} ${st}");
- function bar() → void {
- try {
- dart.core::print("danger bar");
- }
- on dart.core::Error* catch(final dart.core::Error* e) {
- dart.core::print("error ${e}, captured stack trace: ${st}");
- }
- }
- return bar;
- }
- }
- static method testRethrow(dart.core::bool* cond) → dynamic {
- try {
- try {
- dart.core::print("try 1 > try 2");
- }
- on dynamic catch(final dynamic e) {
- try {
- dart.core::print("try 1 > catch 2 > try 3");
- if(cond) {
- rethrow;
- }
- }
- on dynamic catch(final dynamic e) {
- dart.core::print("try 1 > catch 2 > catch 3");
- }
- }
- }
- on dynamic catch(final dynamic e, final dart.core::StackTrace* st) {
- dart.core::print("catch 1");
- dart.core::print(st);
- }
- }
- static method testTryFinally1() → dynamic {
- #L1:
- for (dart.core::int* i = 0; i.{dart.core::num::<}(10); i = i.{dart.core::num::+}(1)) {
- try {
- if(i.{dart.core::num::>}(5)) {
- break #L1;
- }
- }
- finally {
- dart.core::print(i);
- }
- }
- }
- static method testTryFinally2(dart.core::int* x) → dynamic {
- #L2:
- switch(x) {
- #L3:
- case #C1:
- {
- try {
- dart.core::print("before try 1");
- dart.core::int* y = 3;
- try {
- dart.core::print("try");
- function foo() → void {
- dart.core::print(x);
- dart.core::print(y);
- }
- [@vm.call-site-attributes.metadata=receiverType:void Function()*] foo.call();
- continue #L4;
- }
- finally {
- dart.core::print("finally 1");
- }
- dart.core::print("after try 1");
- }
- finally {
- dart.core::print("finally 2");
- }
- break #L2;
- }
- #L4:
- case #C2:
- {
- dart.core::print("case 2");
- break #L2;
- }
- }
- }
- static method testTryFinally3() → dynamic {
- dart.core::int* x = 11;
- dynamic y;
- try {
- y = () → dart.core::int* {
- dart.core::print(x);
- try {
- dart.core::print("try 1");
- return 42;
- }
- finally {
- try {
- dart.core::print("try 2");
- return 43;
- }
- finally {
- dart.core::print(x);
- }
- }
- };
- }
- finally {
- dart.core::print(x);
- [@vm.call-site-attributes.metadata=receiverType:dynamic] y.call();
- }
- }
- static method testTryCatchFinally() → dynamic {
- try
- try {
- dart.core::print("try");
- }
- on dynamic catch(final dynamic e) {
- dart.core::print("catch");
- }
- finally {
- dart.core::print("finally");
- }
- }
- static method main() → dynamic {}
-}
-constants {
- #C1 = 1
- #C2 = 2
-}
diff --git a/pkg/vm/testcases/bytecode/type_ops.dart b/pkg/vm/testcases/bytecode/type_ops.dart
deleted file mode 100644
index d9ff5eb..0000000
--- a/pkg/vm/testcases/bytecode/type_ops.dart
+++ /dev/null
@@ -1,76 +0,0 @@
-// 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.
-
-class A<T> {}
-
-class B extends A<String> {}
-
-class C<T1, T2, T3> extends B {}
-
-foo1(x) {
- if (x is B) {
- print('11');
- }
- if (x is C<int, Object, dynamic>) {
- print('12');
- }
- return x as A<int>;
-}
-
-class D<P, Q> extends C<int, Q, P> {
- Map<P, Q> foo;
-
- D(tt) : foo = tt;
-
- foo2(y) {
- if (y is A<P>) {
- print('21');
- }
- if (y is C<dynamic, Q, List<P>>) {
- print('22');
- }
- foo = y;
- }
-
- foo3<T1, T2>(z) {
- if (z is A<T1>) {
- print('31');
- }
- if (z is C<Map<T1, P>, List<T2>, Q>) {
- print('32');
- }
- return (z as Map<T2, Q>).values;
- }
-
- Map<P, Q> foo4(w) {
- List<Map<P, Q>> list = [w];
- return w;
- }
-}
-
-List<Iterable> globalVar;
-
-void foo5(x) {
- globalVar = x;
-}
-
-class E<P extends String> {
- factory E() => null;
- void foo6<T extends P, U extends List<T>>(Map<T, U> map) {}
-}
-
-abstract class F<T> {
- void foo7<Q extends T>(Q a, covariant num b, T c);
- void foo8<Q extends T>(Q a, covariant num b, T c);
-}
-
-class G<T> {
- void foo7<Q extends T>(Q a, int b, T c) {}
-}
-
-class H<T> extends G<T> implements F<T> {
- void foo8<Q extends T>(Q a, int b, T c) {}
-}
-
-main() {}
diff --git a/pkg/vm/testcases/bytecode/type_ops.dart.expect b/pkg/vm/testcases/bytecode/type_ops.dart.expect
deleted file mode 100644
index e97a149..0000000
--- a/pkg/vm/testcases/bytecode/type_ops.dart.expect
+++ /dev/null
@@ -1,977 +0,0 @@
-main = #lib::main;
- [@vm.bytecode=
-BytecodeMetadata {
-Bytecode (version: stable)
-Main library: #lib
-Library '#lib'
- name '#lib'
- script '#lib'
-
-Class '', script = '#lib'
-
-Field 'globalVar', type = dart:core::List < dart:core::Iterable null* >*, reflectable, static
- value = null
-
-Function 'foo1', static, reflectable, debuggable
- parameters [dynamic 'x'] (required: 1)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- PushConstant CP#0
- InterfaceCall CP#1, 2
- JumpIfFalse L1
- PushConstant CP#3
- DirectCall CP#4, 1
- Drop1
-L1:
- Push FP[-5]
- PushNull
- PushNull
- PushConstant CP#6
- InterfaceCall CP#7, 4
- JumpIfFalse L2
- PushConstant CP#9
- DirectCall CP#4, 1
- Drop1
-L2:
- Push FP[-5]
- PushConstant CP#10
- PushNull
- PushNull
- PushConstant CP#11
- AssertAssignable 0, CP#12
- ReturnTOS
-}
-ConstantPool {
- [0] = Type #lib::B < dart:core::String* >*
- [1] = InterfaceCall 'dart:core::Object::_simpleInstanceOf', ArgDesc num-args 2, num-type-args 0, names []
- [2] = Reserved
- [3] = ObjectRef '11'
- [4] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [5] = Reserved
- [6] = Type #lib::C < dart:core::String*, dart:core::int*, dart:core::Object*, dynamic >*
- [7] = InterfaceCall 'dart:core::Object::_instanceOf', ArgDesc num-args 4, num-type-args 0, names []
- [8] = Reserved
- [9] = ObjectRef '12'
- [10] = Type #lib::A < dart:core::int* >*
- [11] = ObjectRef ' in type cast'
- [12] = SubtypeTestCache
-}
-
-
-Function 'foo5', static, reflectable, debuggable
- parameters [dynamic 'x'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- PushConstant CP#0
- PushNull
- PushNull
- PushConstant CP#1
- AssertAssignable 0, CP#2
- StoreStaticTOS CP#3
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = Type dart:core::List < dart:core::Iterable null* >*
- [1] = ObjectRef ''
- [2] = SubtypeTestCache
- [3] = StaticField #lib::globalVar (field)
-}
-
-
-Function 'main', static, reflectable, debuggable
- parameters [] (required: 0)
- return-type dynamic
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-ConstantPool {
-}
-
-Class 'A', script = '#lib'
- type-params <dart:core::Object* T> (args: 1)
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::A < #lib::A::TypeParam/0* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'B', script = '#lib'
- extends #lib::A < dart:core::String* >*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::B < dart:core::String* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::A:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-Class 'C', script = '#lib'
- type-params <dart:core::Object* T1, dart:core::Object* T2, dart:core::Object* T3> (args: 4)
- extends #lib::B < dart:core::String* >*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::C < dart:core::String*, #lib::C::TypeParam/0*, #lib::C::TypeParam/1*, #lib::C::TypeParam/2* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::B:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-Class 'D', script = '#lib'
- type-params <dart:core::Object* P, dart:core::Object* Q> (args: 5)
- extends #lib::C < dart:core::String*, dart:core::int*, #lib::D::TypeParam/1*, #lib::D::TypeParam/0* >*
-
-Field 'foo', type = dart:core::Map < #lib::D::TypeParam/0*, #lib::D::TypeParam/1* >*, getter = 'get:foo', setter = 'set:foo', reflectable
- value = null
-
-Function '', constructor, reflectable, debuggable
- parameters [dynamic 'tt'] (required: 1)
- return-type #lib::D < dart:core::String*, dart:core::int*, #lib::D::TypeParam/1*, #lib::D::TypeParam/0*, #lib::D::TypeParam/1* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-6]
- Push FP[-5]
- PushConstant CP#0
- Push FP[-6]
- LoadTypeArgumentsField CP#1
- PushNull
- PushConstant CP#2
- AssertAssignable 0, CP#3
- StoreFieldTOS CP#4
- Push FP[-6]
- DirectCall CP#6, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = Type dart:core::Map < #lib::D::TypeParam/0*, #lib::D::TypeParam/1* >*
- [1] = TypeArgumentsField #lib::D
- [2] = ObjectRef ''
- [3] = SubtypeTestCache
- [4] = InstanceField #lib::D::foo (field)
- [5] = Reserved
- [6] = DirectCall '#lib::C:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [7] = Reserved
-}
-
-
-Function 'foo2', reflectable, debuggable
- parameters [dynamic 'y'] (required: 1)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckStack 0
- Push FP[-5]
- Push FP[-6]
- LoadTypeArgumentsField CP#0
- PushNull
- PushConstant CP#1
- InterfaceCall CP#2, 4
- JumpIfFalse L1
- PushConstant CP#4
- DirectCall CP#5, 1
- Drop1
-L1:
- Push FP[-5]
- Push FP[-6]
- LoadTypeArgumentsField CP#0
- PushNull
- PushConstant CP#7
- InterfaceCall CP#2, 4
- JumpIfFalse L2
- PushConstant CP#8
- DirectCall CP#5, 1
- Drop1
-L2:
- Push FP[-6]
- Push FP[-5]
- PushConstant CP#9
- Push FP[-6]
- LoadTypeArgumentsField CP#0
- PushNull
- PushConstant CP#10
- AssertAssignable 0, CP#11
- UncheckedInterfaceCall CP#12, 2
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = TypeArgumentsField #lib::D
- [1] = Type #lib::A < #lib::D::TypeParam/0* >*
- [2] = InterfaceCall 'dart:core::Object::_instanceOf', ArgDesc num-args 4, num-type-args 0, names []
- [3] = Reserved
- [4] = ObjectRef '21'
- [5] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [6] = Reserved
- [7] = Type #lib::C < dart:core::String*, dynamic, #lib::D::TypeParam/1*, dart:core::List < #lib::D::TypeParam/0* >* >*
- [8] = ObjectRef '22'
- [9] = Type dart:core::Map < #lib::D::TypeParam/0*, #lib::D::TypeParam/1* >*
- [10] = ObjectRef ''
- [11] = SubtypeTestCache
- [12] = InterfaceCall '#lib::D::set:foo', ArgDesc num-args 2, num-type-args 0, names []
- [13] = Reserved
-}
-
-
-Function 'foo3', reflectable, debuggable
- type-params <dart:core::Object* T1, dart:core::Object* T2>
- parameters [dynamic 'z'] (required: 1)
- return-type dynamic
-
-Bytecode {
- Entry 1
- CheckFunctionTypeArgs 2, r0
- CheckStack 0
- Push FP[-5]
- PushNull
- Push r0
- PushConstant CP#0
- InterfaceCall CP#1, 4
- JumpIfFalse L1
- PushConstant CP#3
- DirectCall CP#4, 1
- Drop1
-L1:
- Push FP[-5]
- Push FP[-6]
- LoadTypeArgumentsField CP#6
- Push r0
- PushConstant CP#7
- InterfaceCall CP#1, 4
- JumpIfFalse L2
- PushConstant CP#8
- DirectCall CP#4, 1
- Drop1
-L2:
- Push FP[-5]
- PushConstant CP#9
- Push FP[-6]
- LoadTypeArgumentsField CP#6
- Push r0
- PushConstant CP#10
- AssertAssignable 0, CP#11
- InterfaceCall CP#12, 1
- ReturnTOS
-}
-ConstantPool {
- [0] = Type #lib::A < #lib::D::foo3::TypeParam/0* >*
- [1] = InterfaceCall 'dart:core::Object::_instanceOf', ArgDesc num-args 4, num-type-args 0, names []
- [2] = Reserved
- [3] = ObjectRef '31'
- [4] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
- [5] = Reserved
- [6] = TypeArgumentsField #lib::D
- [7] = Type #lib::C < dart:core::String*, dart:core::Map < #lib::D::foo3::TypeParam/0*, #lib::D::TypeParam/0* >*, dart:core::List < #lib::D::foo3::TypeParam/1* >*, #lib::D::TypeParam/1* >*
- [8] = ObjectRef '32'
- [9] = Type dart:core::Map < #lib::D::foo3::TypeParam/1*, #lib::D::TypeParam/1* >*
- [10] = ObjectRef ' in type cast'
- [11] = SubtypeTestCache
- [12] = InterfaceCall 'dart:core::Map::get:values', ArgDesc num-args 1, num-type-args 0, names []
- [13] = Reserved
-}
-
-
-Function 'foo4', reflectable, debuggable
- parameters [dynamic 'w'] (required: 1)
- return-type dart:core::Map < #lib::D::TypeParam/0*, #lib::D::TypeParam/1* >*
-
-Bytecode {
- Entry 2
- CheckStack 0
- Push FP[-6]
- LoadTypeArgumentsField CP#0
- PushNull
- InstantiateTypeArgumentsTOS 0, CP#1
- StoreLocal r1
- Push r1
- PushInt 1
- CreateArrayTOS
- StoreLocal r1
- Push r1
- PushInt 0
- Push FP[-5]
- PushConstant CP#2
- Push FP[-6]
- LoadTypeArgumentsField CP#0
- PushNull
- PushConstant CP#3
- AssertAssignable 0, CP#4
- StoreIndexedTOS
- DirectCall CP#5, 2
- PopLocal r0
- Push FP[-5]
- PushConstant CP#2
- Push FP[-6]
- LoadTypeArgumentsField CP#0
- PushNull
- PushConstant CP#3
- AssertAssignable 0, CP#7
- ReturnTOS
-}
-ConstantPool {
- [0] = TypeArgumentsField #lib::D
- [1] = ObjectRef < dart:core::Map < #lib::D::TypeParam/0*, #lib::D::TypeParam/1* >* >
- [2] = Type dart:core::Map < #lib::D::TypeParam/0*, #lib::D::TypeParam/1* >*
- [3] = ObjectRef ''
- [4] = SubtypeTestCache
- [5] = DirectCall 'dart:core::List::_fromLiteral (constructor)', ArgDesc num-args 2, num-type-args 0, names []
- [6] = Reserved
- [7] = SubtypeTestCache
-}
-
-Class 'E', script = '#lib'
- type-params <dart:core::String* P> (args: 1)
- extends dart:core::Object*
-
-
-Function '', factory, static, reflectable, debuggable
- type-params <dart:core::String* P>
- parameters [] (required: 0)
- return-type #lib::E < #lib::E:: (constructor)::TypeParam/0* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- PushNull
- ReturnTOS
-}
-Default function type arguments: CP#0
-ConstantPool {
- [0] = ObjectRef < dart:core::String* >
-}
-
-
-Function 'foo6', reflectable, debuggable
- type-params <#lib::E::TypeParam/0* T, dart:core::List < #lib::E::foo6::TypeParam/0* >* U>
- parameters [dart:core::Map < #lib::E::foo6::TypeParam/0*, #lib::E::foo6::TypeParam/1* >* 'map'] (required: 1)
- return-type void
-
-Bytecode {
- Entry 1
- CheckFunctionTypeArgs 2, r0
- JumpIfNotZeroTypeArgs L1
- Push FP[-6]
- LoadTypeArgumentsField CP#0
- PushNull
- InstantiateTypeArgumentsTOS 0, CP#1
- PopLocal r0
-L1:
- CheckStack 0
- JumpIfUnchecked L2
- Push FP[-6]
- LoadTypeArgumentsField CP#0
- Push r0
- PushConstant CP#2
- PushConstant CP#3
- PushConstant CP#4
- AssertSubtype
-L2:
- PushNull
- ReturnTOS
-}
-Default function type arguments: CP#1
-ConstantPool {
- [0] = TypeArgumentsField #lib::E
- [1] = ObjectRef < #lib::E::TypeParam/0*, dart:core::List < #lib::E::TypeParam/0* >* >
- [2] = Type #lib::E::foo6::TypeParam/0*
- [3] = Type #lib::E::TypeParam/0*
- [4] = ObjectRef 'T'
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'F', script = '#lib', abstract
- type-params <dart:core::Object* T> (args: 1)
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::F < #lib::F::TypeParam/0* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'foo7', abstract, reflectable, debuggable
- type-params <#lib::F::TypeParam/0* Q>
- parameters [#lib::F::foo7::TypeParam/0* 'a', dart:core::num* 'b', #lib::F::TypeParam/0* 'c'] (required: 3)
- return-type void
-
-Function 'foo8', abstract, reflectable, debuggable
- type-params <#lib::F::TypeParam/0* Q>
- parameters [#lib::F::foo8::TypeParam/0* 'a', dart:core::num* 'b', #lib::F::TypeParam/0* 'c'] (required: 3)
- return-type void
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'G', script = '#lib'
- type-params <dart:core::Object* T> (args: 1)
- extends dart:core::Object*
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::G < #lib::G::TypeParam/0* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'foo7', reflectable, debuggable
- type-params <#lib::G::TypeParam/0* Q>
- parameters [#lib::G::foo7::TypeParam/0* 'a', dart:core::int* 'b', #lib::G::TypeParam/0* 'c'] (required: 3)
- return-type void
-
-Bytecode {
- Entry 1
- CheckFunctionTypeArgs 1, r0
- JumpIfNotZeroTypeArgs L1
- Push FP[-8]
- LoadTypeArgumentsField CP#0
- PopLocal r0
-L1:
- CheckStack 0
- JumpIfUnchecked L2
- Push FP[-8]
- LoadTypeArgumentsField CP#0
- Push r0
- PushConstant CP#1
- PushConstant CP#2
- PushConstant CP#3
- AssertSubtype
- Push FP[-5]
- PushConstant CP#2
- Push FP[-8]
- LoadTypeArgumentsField CP#0
- PushNull
- PushConstant CP#4
- AssertAssignable 0, CP#5
- Drop1
-L2:
- PushNull
- ReturnTOS
-}
-Parameter flags: [0, 0, 2]
-Default function type arguments: CP#6
-ConstantPool {
- [0] = TypeArgumentsField #lib::G
- [1] = Type #lib::G::foo7::TypeParam/0*
- [2] = Type #lib::G::TypeParam/0*
- [3] = ObjectRef 'Q'
- [4] = ObjectRef 'c'
- [5] = SubtypeTestCache
- [6] = ObjectRef < #lib::G::TypeParam/0* >
-}
-
-
-Function 'get:_identityHashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function '_instanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'instantiatorTypeArguments', dynamic 'functionTypeArguments', dynamic 'type'] (required: 3)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOf', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfTrue', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '_simpleInstanceOfFalse', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'type'] (required: 1)
- return-type dart:core::bool*
-
-Function '==', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dynamic 'other'] (required: 1)
- return-type dart:core::bool*
-
-Function 'get:hashCode', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::int*
-
-Function 'toString', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::String*
-
-Function 'noSuchMethod', abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [dart:core::Invocation* 'invocation'] (required: 1)
- return-type dynamic
-
-Function 'get:runtimeType', getter, abstract, debuggable, custom-script = 'org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart'
- parameters [] (required: 0)
- return-type dart:core::Type*
-Class 'H', script = '#lib'
- type-params <dart:core::Object* T> (args: 1)
- extends #lib::G < #lib::H::TypeParam/0* >*
- implements [#lib::F < #lib::H::TypeParam/0* >*]
-
-
-Function '', constructor, reflectable
- parameters [] (required: 0)
- return-type #lib::H < #lib::H::TypeParam/0* >*
-
-Bytecode {
- Entry 0
- CheckStack 0
- Push FP[-5]
- DirectCall CP#0, 1
- Drop1
- PushNull
- ReturnTOS
-}
-ConstantPool {
- [0] = DirectCall '#lib::G:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
- [1] = Reserved
-}
-
-
-Function 'foo8', reflectable, debuggable
- type-params <#lib::H::TypeParam/0* Q>
- parameters [#lib::H::foo8::TypeParam/0* 'a', dart:core::int* 'b', #lib::H::TypeParam/0* 'c'] (required: 3)
- return-type void
-
-Bytecode {
- Entry 1
- CheckFunctionTypeArgs 1, r0
- JumpIfNotZeroTypeArgs L1
- Push FP[-8]
- LoadTypeArgumentsField CP#0
- PopLocal r0
-L1:
- CheckStack 0
- JumpIfUnchecked L2
- Push FP[-8]
- LoadTypeArgumentsField CP#0
- Push r0
- PushConstant CP#1
- PushConstant CP#2
- PushConstant CP#3
- AssertSubtype
- Push FP[-5]
- PushConstant CP#2
- Push FP[-8]
- LoadTypeArgumentsField CP#0
- PushNull
- PushConstant CP#4
- AssertAssignable 0, CP#5
- Drop1
-L2:
- Push FP[-6]
- PushConstant CP#6
- PushNull
- PushNull
- PushConstant CP#7
- AssertAssignable 1, CP#8
- Drop1
- PushNull
- ReturnTOS
-}
-Parameter flags: [0, 1, 2]
-Default function type arguments: CP#9
-ConstantPool {
- [0] = TypeArgumentsField #lib::H
- [1] = Type #lib::H::foo8::TypeParam/0*
- [2] = Type #lib::H::TypeParam/0*
- [3] = ObjectRef 'Q'
- [4] = ObjectRef 'c'
- [5] = SubtypeTestCache
- [6] = Type dart:core::int*
- [7] = ObjectRef 'b'
- [8] = SubtypeTestCache
- [9] = ObjectRef < #lib::H::TypeParam/0* >
-}
-
-
-Function 'foo7', reflectable, debuggable, forwarding-stub
- type-params <#lib::H::TypeParam/0* Q>
- parameters [#lib::H::foo7::TypeParam/0* 'a', dart:core::num* 'b', #lib::H::TypeParam/0* 'c'] (required: 3)
- return-type void
-
-Bytecode {
- Entry 2
- CheckFunctionTypeArgs 1, r0
- JumpIfNotZeroTypeArgs L1
- Push FP[-8]
- LoadTypeArgumentsField CP#0
- PopLocal r0
-L1:
- CheckStack 0
- JumpIfUnchecked L2
- Push FP[-8]
- LoadTypeArgumentsField CP#0
- Push r0
- PushConstant CP#1
- PushConstant CP#2
- PushConstant CP#3
- AssertSubtype
- Push FP[-5]
- PushConstant CP#2
- Push FP[-8]
- LoadTypeArgumentsField CP#0
- PushNull
- PushConstant CP#4
- AssertAssignable 0, CP#5
- Drop1
-L2:
- Push FP[-6]
- PushConstant CP#6
- PushNull
- PushNull
- PushConstant CP#7
- AssertAssignable 1, CP#8
- Drop1
- PushNull
- Push r0
- InstantiateTypeArgumentsTOS 0, CP#9
- Push FP[-8]
- Push FP[-7]
- Push FP[-6]
- Push FP[-5]
- UncheckedDirectCall CP#10, 5
- ReturnTOS
-}
-Parameter flags: [0, 1, 2]
-Forwarding stub target: CP#12
-Default function type arguments: CP#13
-ConstantPool {
- [0] = TypeArgumentsField #lib::H
- [1] = Type #lib::H::foo7::TypeParam/0*
- [2] = Type #lib::H::TypeParam/0*
- [3] = ObjectRef 'Q'
- [4] = ObjectRef 'c'
- [5] = SubtypeTestCache
- [6] = Type dart:core::int*
- [7] = ObjectRef 'b'
- [8] = SubtypeTestCache
- [9] = ObjectRef < #lib::H::foo7::TypeParam/0* >
- [10] = DirectCall '#lib::G::foo7', ArgDesc num-args 4, num-type-args 1, names []
- [11] = Reserved
- [12] = ObjectRef #lib::G::foo7
- [13] = ObjectRef < #lib::H::TypeParam/0* >
-}
-
-
-}
-]library #lib from "#lib" as #lib {
-
- class A<T extends dart.core::Object* = dynamic> extends dart.core::Object {
- synthetic constructor •() → #lib::A<#lib::A::T*>*
- : super dart.core::Object::•()
- ;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class B extends #lib::A<dart.core::String*> {
- synthetic constructor •() → #lib::B*
- : super #lib::A::•()
- ;
- }
- class C<T1 extends dart.core::Object* = dynamic, T2 extends dart.core::Object* = dynamic, T3 extends dart.core::Object* = dynamic> extends #lib::B {
- synthetic constructor •() → #lib::C<#lib::C::T1*, #lib::C::T2*, #lib::C::T3*>*
- : super #lib::B::•()
- ;
- }
- class D<P extends dart.core::Object* = dynamic, Q extends dart.core::Object* = dynamic> extends #lib::C<dart.core::int*, #lib::D::Q*, #lib::D::P*> {
- generic-covariant-impl field dart.core::Map<#lib::D::P*, #lib::D::Q*>* foo;
- constructor •(dynamic tt) → #lib::D<#lib::D::P*, #lib::D::Q*>*
- : #lib::D::foo = tt as{TypeError,ForDynamic} dart.core::Map<#lib::D::P*, #lib::D::Q*>*, super #lib::C::•()
- ;
- method foo2(dynamic y) → dynamic {
- if(y is #lib::A<#lib::D::P*>*) {
- dart.core::print("21");
- }
- if(y is #lib::C<dynamic, #lib::D::Q*, dart.core::List<#lib::D::P*>*>*) {
- dart.core::print("22");
- }
- [@vm.call-site-attributes.metadata=receiverType:#lib::D<#lib::D.P*, #lib::D.Q*>*] this.{#lib::D::foo} = y as{TypeError,ForDynamic} dart.core::Map<#lib::D::P*, #lib::D::Q*>*;
- }
- method foo3<T1 extends dart.core::Object* = dynamic, T2 extends dart.core::Object* = dynamic>(dynamic z) → dynamic {
- if(z is #lib::A<#lib::D::foo3::T1*>*) {
- dart.core::print("31");
- }
- if(z is #lib::C<dart.core::Map<#lib::D::foo3::T1*, #lib::D::P*>*, dart.core::List<#lib::D::foo3::T2*>*, #lib::D::Q*>*) {
- dart.core::print("32");
- }
- return (z as dart.core::Map<#lib::D::foo3::T2*, #lib::D::Q*>*).{dart.core::Map::values};
- }
- method foo4(dynamic w) → dart.core::Map<#lib::D::P*, #lib::D::Q*>* {
- dart.core::List<dart.core::Map<#lib::D::P*, #lib::D::Q*>*>* list = <dart.core::Map<#lib::D::P*, #lib::D::Q*>*>[w as{TypeError,ForDynamic} dart.core::Map<#lib::D::P*, #lib::D::Q*>*];
- return w as{TypeError,ForDynamic} dart.core::Map<#lib::D::P*, #lib::D::Q*>*;
- }
- }
- class E<P extends dart.core::String* = dart.core::String*> extends dart.core::Object {
- static factory •<P extends dart.core::String* = dart.core::String*>() → #lib::E<#lib::E::•::P*>*
- return null;
- method foo6<generic-covariant-impl T extends #lib::E::P* = #lib::E::P*, U extends dart.core::List<#lib::E::foo6::T*>* = dart.core::List<#lib::E::P*>*>(dart.core::Map<#lib::E::foo6::T*, #lib::E::foo6::U*>* map) → void {}
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- abstract class F<T extends dart.core::Object* = dynamic> extends dart.core::Object {
- synthetic constructor •() → #lib::F<#lib::F::T*>*
- : super dart.core::Object::•()
- ;
- abstract method foo7<generic-covariant-impl Q extends #lib::F::T* = #lib::F::T*>(#lib::F::foo7::Q* a, covariant dart.core::num* b, generic-covariant-impl #lib::F::T* c) → void;
- abstract method foo8<generic-covariant-impl Q extends #lib::F::T* = #lib::F::T*>(#lib::F::foo8::Q* a, covariant dart.core::num* b, generic-covariant-impl #lib::F::T* c) → void;
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class G<T extends dart.core::Object* = dynamic> extends dart.core::Object {
- synthetic constructor •() → #lib::G<#lib::G::T*>*
- : super dart.core::Object::•()
- ;
- method foo7<generic-covariant-impl Q extends #lib::G::T* = #lib::G::T*>(#lib::G::foo7::Q* a, dart.core::int* b, generic-covariant-impl #lib::G::T* c) → void {}
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
- abstract member-signature operator /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ hashCode() → dart.core::int*; -> dart.core::Object::hashCode
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ toString() → dart.core::String*; -> dart.core::Object::toString
- abstract member-signature method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
- abstract member-signature get /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/object_patch.dart */ runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
- }
- class H<T extends dart.core::Object* = dynamic> extends #lib::G<#lib::H::T*> implements #lib::F<#lib::H::T*> {
- synthetic constructor •() → #lib::H<#lib::H::T*>*
- : super #lib::G::•()
- ;
- method foo8<generic-covariant-impl Q extends #lib::H::T* = #lib::H::T*>(#lib::H::foo8::Q* a, covariant dart.core::int* b, generic-covariant-impl #lib::H::T* c) → void {}
- forwarding-stub method foo7<generic-covariant-impl Q extends #lib::H::T* = #lib::H::T*>(#lib::H::foo7::Q* a, covariant dart.core::num* b, generic-covariant-impl #lib::H::T* c) → void
- return super.{#lib::G::foo7}<#lib::H::foo7::Q*>(a, b, c);
- }
- static field dart.core::List<dart.core::Iterable<dynamic>*>* globalVar;
- static method foo1(dynamic x) → dynamic {
- if(x is #lib::B*) {
- dart.core::print("11");
- }
- if(x is #lib::C<dart.core::int*, dart.core::Object*, dynamic>*) {
- dart.core::print("12");
- }
- return x as #lib::A<dart.core::int*>*;
- }
- static method foo5(dynamic x) → void {
- #lib::globalVar = x as{TypeError,ForDynamic} dart.core::List<dart.core::Iterable<dynamic>*>*;
- }
- static method main() → dynamic {}
-}
diff --git a/pkg/vm/tool/precompiler2 b/pkg/vm/tool/precompiler2
index ef80061..6010ee8 100755
--- a/pkg/vm/tool/precompiler2
+++ b/pkg/vm/tool/precompiler2
@@ -36,9 +36,6 @@
--no-tfa | \
--protobuf-tree-shaker | \
--protobuf-tree-shaker-v2 | \
- --gen-bytecode | \
- --no-gen-bytecode | \
- --bytecode-options=* | \
--minimal-kernel | \
--no-embed-sources | \
-D* )
diff --git a/runtime/tests/vm/dart/product_aot_kernel_test.dart b/runtime/tests/vm/dart/product_aot_kernel_test.dart
index 5bc2f13..d46dd14 100644
--- a/runtime/tests/vm/dart/product_aot_kernel_test.dart
+++ b/runtime/tests/vm/dart/product_aot_kernel_test.dart
@@ -13,7 +13,6 @@
show BinaryBuilderWithMetadata;
import 'package:kernel/kernel.dart';
import 'package:path/path.dart' as path;
-import 'package:vm/metadata/bytecode.dart' show BytecodeMetadataRepository;
import 'use_flag_test_helper.dart';
@@ -48,45 +47,22 @@
// libraries.
final component = Component();
- final bytecodeMetadataRepository = BytecodeMetadataRepository();
- component.addMetadataRepository(bytecodeMetadataRepository);
final List<int> bytes = File(helloDillFile).readAsBytesSync();
new BinaryBuilderWithMetadata(bytes).readComponent(component);
- final bytecodeComponent =
- bytecodeMetadataRepository.mapping[component]?.component;
- if (bytecodeComponent != null) {
- final libVmService = bytecodeComponent.libraries.singleWhere(
- (lib) => lib.importUri.toString() == "'dart:_vmservice'");
- final libVmServiceToplevelClass = libVmService.classes.single;
- Expect.isTrue(libVmServiceToplevelClass.name.toString() == "''");
- Expect.isTrue(libVmServiceToplevelClass.members.functions.isEmpty);
- Expect.isTrue(libVmServiceToplevelClass.members.fields.isEmpty);
+ final libVmService = component.libraries
+ .singleWhere((lib) => lib.importUri.toString() == 'dart:_vmservice');
+ Expect.isTrue(libVmService.procedures.isEmpty);
+ Expect.isTrue(libVmService.classes.isEmpty);
+ Expect.isTrue(libVmService.fields.isEmpty);
- final libVmServiceIo = bytecodeComponent.libraries.singleWhere(
- (lib) => lib.importUri.toString() == "'dart:vmservice_io'");
- final libVmServiceIoToplevelClass = libVmServiceIo.classes.single;
- Expect.isTrue(libVmServiceIoToplevelClass.name.toString() == "''");
- Expect.isTrue(libVmServiceIoToplevelClass.members.functions.isEmpty);
+ final libVmServiceIo = component.libraries
+ .singleWhere((lib) => lib.importUri.toString() == 'dart:vmservice_io');
+ Expect.isTrue(libVmServiceIo.procedures.isEmpty);
+ Expect.isTrue(libVmServiceIo.classes.isEmpty);
- // Those fields are currently accessed by by the embedder, even in product
- // mode.
- Expect.isTrue(libVmServiceIoToplevelClass.members.fields.length <= 11);
- } else {
- final libVmService = component.libraries
- .singleWhere((lib) => lib.importUri.toString() == 'dart:_vmservice');
- Expect.isTrue(libVmService.procedures.isEmpty);
- Expect.isTrue(libVmService.classes.isEmpty);
- Expect.isTrue(libVmService.fields.isEmpty);
-
- final libVmServiceIo = component.libraries.singleWhere(
- (lib) => lib.importUri.toString() == 'dart:vmservice_io');
- Expect.isTrue(libVmServiceIo.procedures.isEmpty);
- Expect.isTrue(libVmServiceIo.classes.isEmpty);
-
- // Those fields are currently accessed by by the embedder, even in product
- // mode.
- Expect.isTrue(libVmServiceIo.fields.length <= 11);
- }
+ // Those fields are currently accessed by by the embedder, even in product
+ // mode.
+ Expect.isTrue(libVmServiceIo.fields.length <= 11);
});
}
diff --git a/runtime/tests/vm/dart_2/product_aot_kernel_test.dart b/runtime/tests/vm/dart_2/product_aot_kernel_test.dart
index 5bc2f13..d46dd14 100644
--- a/runtime/tests/vm/dart_2/product_aot_kernel_test.dart
+++ b/runtime/tests/vm/dart_2/product_aot_kernel_test.dart
@@ -13,7 +13,6 @@
show BinaryBuilderWithMetadata;
import 'package:kernel/kernel.dart';
import 'package:path/path.dart' as path;
-import 'package:vm/metadata/bytecode.dart' show BytecodeMetadataRepository;
import 'use_flag_test_helper.dart';
@@ -48,45 +47,22 @@
// libraries.
final component = Component();
- final bytecodeMetadataRepository = BytecodeMetadataRepository();
- component.addMetadataRepository(bytecodeMetadataRepository);
final List<int> bytes = File(helloDillFile).readAsBytesSync();
new BinaryBuilderWithMetadata(bytes).readComponent(component);
- final bytecodeComponent =
- bytecodeMetadataRepository.mapping[component]?.component;
- if (bytecodeComponent != null) {
- final libVmService = bytecodeComponent.libraries.singleWhere(
- (lib) => lib.importUri.toString() == "'dart:_vmservice'");
- final libVmServiceToplevelClass = libVmService.classes.single;
- Expect.isTrue(libVmServiceToplevelClass.name.toString() == "''");
- Expect.isTrue(libVmServiceToplevelClass.members.functions.isEmpty);
- Expect.isTrue(libVmServiceToplevelClass.members.fields.isEmpty);
+ final libVmService = component.libraries
+ .singleWhere((lib) => lib.importUri.toString() == 'dart:_vmservice');
+ Expect.isTrue(libVmService.procedures.isEmpty);
+ Expect.isTrue(libVmService.classes.isEmpty);
+ Expect.isTrue(libVmService.fields.isEmpty);
- final libVmServiceIo = bytecodeComponent.libraries.singleWhere(
- (lib) => lib.importUri.toString() == "'dart:vmservice_io'");
- final libVmServiceIoToplevelClass = libVmServiceIo.classes.single;
- Expect.isTrue(libVmServiceIoToplevelClass.name.toString() == "''");
- Expect.isTrue(libVmServiceIoToplevelClass.members.functions.isEmpty);
+ final libVmServiceIo = component.libraries
+ .singleWhere((lib) => lib.importUri.toString() == 'dart:vmservice_io');
+ Expect.isTrue(libVmServiceIo.procedures.isEmpty);
+ Expect.isTrue(libVmServiceIo.classes.isEmpty);
- // Those fields are currently accessed by by the embedder, even in product
- // mode.
- Expect.isTrue(libVmServiceIoToplevelClass.members.fields.length <= 11);
- } else {
- final libVmService = component.libraries
- .singleWhere((lib) => lib.importUri.toString() == 'dart:_vmservice');
- Expect.isTrue(libVmService.procedures.isEmpty);
- Expect.isTrue(libVmService.classes.isEmpty);
- Expect.isTrue(libVmService.fields.isEmpty);
-
- final libVmServiceIo = component.libraries.singleWhere(
- (lib) => lib.importUri.toString() == 'dart:vmservice_io');
- Expect.isTrue(libVmServiceIo.procedures.isEmpty);
- Expect.isTrue(libVmServiceIo.classes.isEmpty);
-
- // Those fields are currently accessed by by the embedder, even in product
- // mode.
- Expect.isTrue(libVmServiceIo.fields.length <= 11);
- }
+ // Those fields are currently accessed by by the embedder, even in product
+ // mode.
+ Expect.isTrue(libVmServiceIo.fields.length <= 11);
});
}
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index e989d38..475ad93 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -817,7 +817,7 @@
FinalizationKind finalization) {
AbstractType& type = AbstractType::Handle();
AbstractType& finalized_type = AbstractType::Handle();
- // Finalize function type parameters and their upper bounds.
+ // Finalize function type parameters, including their bounds and default args.
const intptr_t num_parent_type_params = function.NumParentTypeParameters();
const intptr_t num_type_params = function.NumTypeParameters();
if (num_type_params > 0) {
@@ -841,6 +841,11 @@
if (finalized_type.raw() != type.raw()) {
type_param.set_bound(finalized_type);
}
+ type = type_param.default_argument();
+ finalized_type = FinalizeType(type, finalization);
+ if (finalized_type.raw() != type.raw()) {
+ type_param.set_default_argument(finalized_type);
+ }
}
}
// Finalize result type.
@@ -860,26 +865,31 @@
}
}
-// Finalize the upper bounds of the type parameters of class cls.
+// Finalize bounds and default arguments of the type parameters of class cls.
void ClassFinalizer::FinalizeUpperBounds(const Class& cls,
FinalizationKind finalization) {
const intptr_t num_type_params = cls.NumTypeParameters();
TypeParameter& type_param = TypeParameter::Handle();
- AbstractType& bound = AbstractType::Handle();
+ AbstractType& type = AbstractType::Handle();
const TypeArguments& type_params =
TypeArguments::Handle(cls.type_parameters());
ASSERT((type_params.IsNull() && (num_type_params == 0)) ||
(type_params.Length() == num_type_params));
for (intptr_t i = 0; i < num_type_params; i++) {
type_param ^= type_params.TypeAt(i);
- bound = type_param.bound();
+ // First, finalize the default argument (no cycles possible here).
+ type = type_param.default_argument();
+ type = FinalizeType(type, finalization);
+ type_param.set_default_argument(type);
+ // Next, finalize the bound.
+ type = type_param.bound();
// Bound may be finalized, but not canonical yet.
- if (bound.IsCanonical() || bound.IsBeingFinalized()) {
+ if (type.IsCanonical() || type.IsBeingFinalized()) {
// A bound involved in F-bounded quantification may form a cycle.
continue;
}
- bound = FinalizeType(bound, finalization);
- type_param.set_bound(bound);
+ type = FinalizeType(type, finalization);
+ type_param.set_bound(type);
}
}
diff --git a/runtime/vm/compiler/frontend/bytecode_reader.cc b/runtime/vm/compiler/frontend/bytecode_reader.cc
index ef3a137..15f3dda 100644
--- a/runtime/vm/compiler/frontend/bytecode_reader.cc
+++ b/runtime/vm/compiler/frontend/bytecode_reader.cc
@@ -649,18 +649,22 @@
TypeArguments::Handle(Z, TypeArguments::New(num_type_params));
String& name = String::Handle(Z);
TypeParameter& parameter = TypeParameter::Handle(Z);
- AbstractType& bound = AbstractType::Handle(Z);
+ AbstractType& type = AbstractType::Handle(Z);
for (intptr_t i = 0; i < num_type_params; ++i) {
name ^= ReadObject();
ASSERT(name.IsSymbol());
parameter = TypeParameter::New(parameterized_class, parameterized_function,
- i, name, bound,
+ i, name, /* bound = */ type,
/* is_generic_covariant_impl = */ false,
nullability, TokenPosition::kNoSource);
parameter.set_index(offset + i);
parameter.SetIsFinalized();
parameter.SetCanonical();
parameter.SetDeclaration(true);
+ // For functions, default type arguments aren't available here but with the
+ // bytecode, so update any non-dynamic default arguments when reading the
+ // bytecode. (For classes, we don't currently use this, so dynamic is fine.)
+ parameter.set_default_argument(Object::dynamic_type());
type_parameters.SetTypeAt(i, parameter);
}
@@ -686,23 +690,22 @@
// Step b) Fill in the bounds of all [TypeParameter]s.
for (intptr_t i = 0; i < num_type_params; ++i) {
parameter ^= type_parameters.TypeAt(i);
- bound ^= ReadObject();
+ type ^= ReadObject();
// Convert dynamic to Object? or Object* in bounds of type parameters so
// they are equivalent when doing subtype checks for function types.
// TODO(https://github.com/dart-lang/language/issues/495): revise this
// when function subtyping is fixed.
- if (bound.IsDynamicType()) {
- bound = nnbd_mode == NNBDMode::kOptedInLib
- ? I->object_store()->nullable_object_type()
- : I->object_store()->legacy_object_type();
+ if (type.IsDynamicType()) {
+ type = nnbd_mode == NNBDMode::kOptedInLib
+ ? I->object_store()->nullable_object_type()
+ : I->object_store()->legacy_object_type();
}
- parameter.set_bound(bound);
+ parameter.set_bound(type);
}
// Fix bounds in all derived type parameters (with different nullabilities).
if (active_class_->derived_type_parameters != nullptr) {
auto& derived = TypeParameter::Handle(Z);
- auto& bound = AbstractType::Handle(Z);
for (intptr_t i = 0, n = active_class_->derived_type_parameters->Length();
i < n; ++i) {
derived ^= active_class_->derived_type_parameters->At(i);
@@ -714,8 +717,10 @@
parameterized_function.raw()))) {
ASSERT(derived.IsFinalized());
parameter ^= type_parameters.TypeAt(derived.index() - offset);
- bound = parameter.bound();
- derived.set_bound(bound);
+ type = parameter.bound();
+ derived.set_bound(type);
+ type = parameter.default_argument();
+ derived.set_default_argument(type);
}
}
}
@@ -3119,7 +3124,19 @@
const intptr_t cp_index = reader_.ReadUInt();
const auto& type_args =
TypeArguments::CheckedHandle(Z, obj_pool.ObjectAt(cp_index));
- parsed_function->SetDefaultFunctionTypeArguments(type_args);
+ // In bytecode mode, all type parameters are created with a default
+ // argument of dynamic, so only need to update if not the all-dynamic TAV.
+ if (!type_args.IsNull()) {
+ auto& type_params = TypeArguments::Handle(Z, function.type_parameters());
+ ASSERT_EQUAL(type_params.Length(), type_args.Length());
+ auto& param = TypeParameter::Handle(Z);
+ auto& type = AbstractType::Handle(Z);
+ for (intptr_t i = 0; i < type_params.Length(); i++) {
+ param ^= type_params.TypeAt(i);
+ type = type_args.TypeAt(i);
+ param.set_default_argument(type);
+ }
+ }
}
if (function.HasOptionalParameters()) {
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index 7c7d7e7..da8192e 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -457,32 +457,6 @@
return instructions;
}
-void StreamingFlowGraphBuilder::ReadDefaultFunctionTypeArguments(
- const Function& function) {
- if (!function.IsGeneric()) {
- return;
- }
- AlternativeReadingScope alt(&reader_);
- FunctionNodeHelper function_node_helper(this);
- function_node_helper.ReadUntilExcluding(FunctionNodeHelper::kTypeParameters);
- intptr_t num_type_params = ReadListLength();
- ASSERT(num_type_params == function.NumTypeParameters());
- TypeArguments& default_types =
- TypeArguments::Handle(Z, TypeArguments::New(num_type_params));
- for (intptr_t i = 0; i < num_type_params; ++i) {
- TypeParameterHelper helper(this);
- helper.ReadUntilExcludingAndSetJustRead(TypeParameterHelper::kDefaultType);
- if (ReadTag() == kSomething) {
- default_types.SetTypeAt(i, T.BuildType());
- } else {
- default_types.SetTypeAt(i, Object::dynamic_type());
- }
- helper.Finish();
- }
- default_types = default_types.Canonicalize(thread(), nullptr);
- parsed_function()->SetDefaultFunctionTypeArguments(default_types);
-}
-
Fragment StreamingFlowGraphBuilder::DebugStepCheckInPrologue(
const Function& dart_function,
TokenPosition position) {
@@ -1215,7 +1189,6 @@
case FunctionLayout::kImplicitClosureFunction:
ReadUntilFunctionNode();
SetupDefaultParameterValues();
- ReadDefaultFunctionTypeArguments(function);
break;
case FunctionLayout::kImplicitGetter:
case FunctionLayout::kImplicitStaticGetter:
@@ -1230,7 +1203,6 @@
if (PeekTag() != kField) {
ReadUntilFunctionNode();
SetupDefaultParameterValues();
- ReadDefaultFunctionTypeArguments(function);
}
break;
case FunctionLayout::kSignatureFunction:
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
index 2f4b90f..ebaa6fb 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
@@ -63,7 +63,6 @@
void ReadForwardingStubTarget(const Function& function);
void EvaluateConstFieldValue(const Field& field);
void SetupDefaultParameterValues();
- void ReadDefaultFunctionTypeArguments(const Function& function);
FlowGraph* BuildGraphOfFieldInitializer();
Fragment BuildFieldInitializer(const Field& field,
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index 991a552..46daea0 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -2816,8 +2816,8 @@
Fragment FlowGraphBuilder::BuildDefaultTypeHandling(const Function& function) {
if (function.IsGeneric()) {
- const TypeArguments& default_types =
- parsed_function_->DefaultFunctionTypeArguments();
+ auto& default_types =
+ TypeArguments::ZoneHandle(Z, function.InstantiateToBounds(thread_));
if (!default_types.IsNull()) {
Fragment then;
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index a262192..b0af83b 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -3331,7 +3331,7 @@
}
ActiveTypeParametersScope scope(active_class, enclosing, type_parameters, Z);
- // Step b) Fill in the bounds of all [TypeParameter]s.
+ // Step b) Fill in the bounds and default arguments of all [TypeParameter]s.
for (intptr_t i = 0; i < type_parameter_count; i++) {
TypeParameterHelper helper(helper_);
helper.ReadUntilExcludingAndSetJustRead(TypeParameterHelper::kBound);
@@ -3350,14 +3350,21 @@
AbstractType& bound = BuildTypeWithoutFinalization(); // read ith bound.
parameter.set_bound(bound);
}
+ helper.ReadUntilExcludingAndSetJustRead(TypeParameterHelper::kDefaultType);
+ const AbstractType* default_arg = &Object::dynamic_type();
+ if (helper_->ReadTag() == kSomething) {
+ default_arg = &BuildTypeWithoutFinalization();
+ }
+ parameter.set_default_argument(*default_arg);
helper.Finish();
}
- // Fix bounds in all derived type parameters (with different nullabilities).
+ // Fix bounds and default arguments in all derived type parameters (with
+ // different nullabilities).
if (active_class->derived_type_parameters != nullptr) {
auto& derived = TypeParameter::Handle(Z);
- auto& bound = AbstractType::Handle(Z);
+ auto& type = AbstractType::Handle(Z);
for (intptr_t i = 0, n = active_class->derived_type_parameters->Length();
i < n; ++i) {
derived ^= active_class->derived_type_parameters->At(i);
@@ -3366,8 +3373,10 @@
derived.parameterized_function() == set_on.raw())) {
ASSERT(!derived.IsFinalized());
parameter ^= type_parameters.TypeAt(derived.index());
- bound = parameter.bound();
- derived.set_bound(bound);
+ type = parameter.bound();
+ derived.set_bound(type);
+ type = parameter.default_argument();
+ derived.set_default_argument(type);
}
}
}
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index 4a6d9e0..7873607 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -383,8 +383,8 @@
static constexpr dart::compiler::target::word Type_type_state_offset = 32;
static constexpr dart::compiler::target::word Type_nullability_offset = 33;
static constexpr dart::compiler::target::word
- TypeParameter_parameterized_class_id_offset = 28;
-static constexpr dart::compiler::target::word TypeParameter_index_offset = 36;
+ TypeParameter_parameterized_class_id_offset = 32;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 40;
static constexpr dart::compiler::target::word
TypeArguments_instantiations_offset = 4;
static constexpr dart::compiler::target::word TypeArguments_length_offset = 8;
@@ -506,7 +506,7 @@
static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 12;
static constexpr dart::compiler::target::word Type_InstanceSize = 36;
static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 20;
-static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 40;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 44;
static constexpr dart::compiler::target::word TypeRef_InstanceSize = 16;
static constexpr dart::compiler::target::word TypedData_InstanceSize = 12;
static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 12;
@@ -893,8 +893,8 @@
static constexpr dart::compiler::target::word Type_type_state_offset = 60;
static constexpr dart::compiler::target::word Type_nullability_offset = 61;
static constexpr dart::compiler::target::word
- TypeParameter_parameterized_class_id_offset = 56;
-static constexpr dart::compiler::target::word TypeParameter_index_offset = 64;
+ TypeParameter_parameterized_class_id_offset = 64;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 72;
static constexpr dart::compiler::target::word
TypeArguments_instantiations_offset = 8;
static constexpr dart::compiler::target::word TypeArguments_length_offset = 16;
@@ -1018,7 +1018,7 @@
static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16;
static constexpr dart::compiler::target::word Type_InstanceSize = 64;
static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40;
-static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 72;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 80;
static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32;
static constexpr dart::compiler::target::word TypedData_InstanceSize = 24;
static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24;
@@ -1399,8 +1399,8 @@
static constexpr dart::compiler::target::word Type_type_state_offset = 32;
static constexpr dart::compiler::target::word Type_nullability_offset = 33;
static constexpr dart::compiler::target::word
- TypeParameter_parameterized_class_id_offset = 28;
-static constexpr dart::compiler::target::word TypeParameter_index_offset = 36;
+ TypeParameter_parameterized_class_id_offset = 32;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 40;
static constexpr dart::compiler::target::word
TypeArguments_instantiations_offset = 4;
static constexpr dart::compiler::target::word TypeArguments_length_offset = 8;
@@ -1519,7 +1519,7 @@
static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 12;
static constexpr dart::compiler::target::word Type_InstanceSize = 36;
static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 20;
-static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 40;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 44;
static constexpr dart::compiler::target::word TypeRef_InstanceSize = 16;
static constexpr dart::compiler::target::word TypedData_InstanceSize = 12;
static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 12;
@@ -1906,8 +1906,8 @@
static constexpr dart::compiler::target::word Type_type_state_offset = 60;
static constexpr dart::compiler::target::word Type_nullability_offset = 61;
static constexpr dart::compiler::target::word
- TypeParameter_parameterized_class_id_offset = 56;
-static constexpr dart::compiler::target::word TypeParameter_index_offset = 64;
+ TypeParameter_parameterized_class_id_offset = 64;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 72;
static constexpr dart::compiler::target::word
TypeArguments_instantiations_offset = 8;
static constexpr dart::compiler::target::word TypeArguments_length_offset = 16;
@@ -2032,7 +2032,7 @@
static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16;
static constexpr dart::compiler::target::word Type_InstanceSize = 64;
static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40;
-static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 72;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 80;
static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32;
static constexpr dart::compiler::target::word TypedData_InstanceSize = 24;
static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24;
@@ -2412,8 +2412,8 @@
static constexpr dart::compiler::target::word Type_type_state_offset = 32;
static constexpr dart::compiler::target::word Type_nullability_offset = 33;
static constexpr dart::compiler::target::word
- TypeParameter_parameterized_class_id_offset = 28;
-static constexpr dart::compiler::target::word TypeParameter_index_offset = 36;
+ TypeParameter_parameterized_class_id_offset = 32;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 40;
static constexpr dart::compiler::target::word
TypeArguments_instantiations_offset = 4;
static constexpr dart::compiler::target::word TypeArguments_length_offset = 8;
@@ -2532,7 +2532,7 @@
static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 12;
static constexpr dart::compiler::target::word Type_InstanceSize = 36;
static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 20;
-static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 40;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 44;
static constexpr dart::compiler::target::word TypeRef_InstanceSize = 16;
static constexpr dart::compiler::target::word TypedData_InstanceSize = 12;
static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 12;
@@ -2916,8 +2916,8 @@
static constexpr dart::compiler::target::word Type_type_state_offset = 60;
static constexpr dart::compiler::target::word Type_nullability_offset = 61;
static constexpr dart::compiler::target::word
- TypeParameter_parameterized_class_id_offset = 56;
-static constexpr dart::compiler::target::word TypeParameter_index_offset = 64;
+ TypeParameter_parameterized_class_id_offset = 64;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 72;
static constexpr dart::compiler::target::word
TypeArguments_instantiations_offset = 8;
static constexpr dart::compiler::target::word TypeArguments_length_offset = 16;
@@ -3038,7 +3038,7 @@
static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16;
static constexpr dart::compiler::target::word Type_InstanceSize = 64;
static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40;
-static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 72;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 80;
static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32;
static constexpr dart::compiler::target::word TypedData_InstanceSize = 24;
static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24;
@@ -3416,8 +3416,8 @@
static constexpr dart::compiler::target::word Type_type_state_offset = 32;
static constexpr dart::compiler::target::word Type_nullability_offset = 33;
static constexpr dart::compiler::target::word
- TypeParameter_parameterized_class_id_offset = 28;
-static constexpr dart::compiler::target::word TypeParameter_index_offset = 36;
+ TypeParameter_parameterized_class_id_offset = 32;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 40;
static constexpr dart::compiler::target::word
TypeArguments_instantiations_offset = 4;
static constexpr dart::compiler::target::word TypeArguments_length_offset = 8;
@@ -3533,7 +3533,7 @@
static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 12;
static constexpr dart::compiler::target::word Type_InstanceSize = 36;
static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 20;
-static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 40;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 44;
static constexpr dart::compiler::target::word TypeRef_InstanceSize = 16;
static constexpr dart::compiler::target::word TypedData_InstanceSize = 12;
static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 12;
@@ -3917,8 +3917,8 @@
static constexpr dart::compiler::target::word Type_type_state_offset = 60;
static constexpr dart::compiler::target::word Type_nullability_offset = 61;
static constexpr dart::compiler::target::word
- TypeParameter_parameterized_class_id_offset = 56;
-static constexpr dart::compiler::target::word TypeParameter_index_offset = 64;
+ TypeParameter_parameterized_class_id_offset = 64;
+static constexpr dart::compiler::target::word TypeParameter_index_offset = 72;
static constexpr dart::compiler::target::word
TypeArguments_instantiations_offset = 8;
static constexpr dart::compiler::target::word TypeArguments_length_offset = 16;
@@ -4040,7 +4040,7 @@
static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16;
static constexpr dart::compiler::target::word Type_InstanceSize = 64;
static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40;
-static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 72;
+static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 80;
static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32;
static constexpr dart::compiler::target::word TypedData_InstanceSize = 24;
static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24;
@@ -4454,9 +4454,9 @@
static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 32;
static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 33;
static constexpr dart::compiler::target::word
- AOT_TypeParameter_parameterized_class_id_offset = 28;
+ AOT_TypeParameter_parameterized_class_id_offset = 32;
static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset =
- 36;
+ 40;
static constexpr dart::compiler::target::word
AOT_TypeArguments_instantiations_offset = 4;
static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset =
@@ -4597,7 +4597,7 @@
static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize =
20;
static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize =
- 40;
+ 44;
static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 12;
static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize =
@@ -5013,9 +5013,9 @@
static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 60;
static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 61;
static constexpr dart::compiler::target::word
- AOT_TypeParameter_parameterized_class_id_offset = 56;
+ AOT_TypeParameter_parameterized_class_id_offset = 64;
static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset =
- 64;
+ 72;
static constexpr dart::compiler::target::word
AOT_TypeArguments_instantiations_offset = 8;
static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset =
@@ -5157,7 +5157,7 @@
static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize =
40;
static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize =
- 72;
+ 80;
static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24;
static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize =
@@ -5576,9 +5576,9 @@
static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 60;
static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 61;
static constexpr dart::compiler::target::word
- AOT_TypeParameter_parameterized_class_id_offset = 56;
+ AOT_TypeParameter_parameterized_class_id_offset = 64;
static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset =
- 64;
+ 72;
static constexpr dart::compiler::target::word
AOT_TypeArguments_instantiations_offset = 8;
static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset =
@@ -5721,7 +5721,7 @@
static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize =
40;
static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize =
- 72;
+ 80;
static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24;
static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize =
@@ -6133,9 +6133,9 @@
static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 32;
static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 33;
static constexpr dart::compiler::target::word
- AOT_TypeParameter_parameterized_class_id_offset = 28;
+ AOT_TypeParameter_parameterized_class_id_offset = 32;
static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset =
- 36;
+ 40;
static constexpr dart::compiler::target::word
AOT_TypeArguments_instantiations_offset = 4;
static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset =
@@ -6273,7 +6273,7 @@
static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize =
20;
static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize =
- 40;
+ 44;
static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 16;
static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 12;
static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize =
@@ -6685,9 +6685,9 @@
static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 60;
static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 61;
static constexpr dart::compiler::target::word
- AOT_TypeParameter_parameterized_class_id_offset = 56;
+ AOT_TypeParameter_parameterized_class_id_offset = 64;
static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset =
- 64;
+ 72;
static constexpr dart::compiler::target::word
AOT_TypeArguments_instantiations_offset = 8;
static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset =
@@ -6826,7 +6826,7 @@
static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize =
40;
static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize =
- 72;
+ 80;
static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24;
static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize =
@@ -7241,9 +7241,9 @@
static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 60;
static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 61;
static constexpr dart::compiler::target::word
- AOT_TypeParameter_parameterized_class_id_offset = 56;
+ AOT_TypeParameter_parameterized_class_id_offset = 64;
static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset =
- 64;
+ 72;
static constexpr dart::compiler::target::word
AOT_TypeArguments_instantiations_offset = 8;
static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset =
@@ -7383,7 +7383,7 @@
static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize =
40;
static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize =
- 72;
+ 80;
static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32;
static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24;
static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize =
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index ab6f5b5..a35ccf7 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3284,6 +3284,33 @@
return num_type_args;
}
+static TypeArgumentsPtr InstantiateTypeArgumentsToBounds(
+ Thread* thread,
+ const TypeArguments& parameters) {
+ ASSERT(thread != nullptr);
+ if (parameters.IsNull()) {
+ return Object::empty_type_arguments().raw();
+ }
+ auto const zone = thread->zone();
+ const auto& result = TypeArguments::Handle(
+ zone, TypeArguments::New(parameters.Length(), Heap::kNew));
+ auto& param = TypeParameter::Handle(zone);
+ auto& type = AbstractType::Handle(zone);
+ for (intptr_t i = 0, n = parameters.Length(); i < n; i++) {
+ param ^= parameters.TypeAt(i);
+ type = param.default_argument();
+ ASSERT(type.IsFinalized());
+ result.SetTypeAt(i, type);
+ }
+ return result.Canonicalize(thread);
+}
+
+TypeArgumentsPtr Class::InstantiateToBounds(Thread* thread) const {
+ const auto& type_params =
+ TypeArguments::Handle(thread->zone(), type_parameters());
+ return InstantiateTypeArgumentsToBounds(thread, type_params);
+}
+
ClassPtr Class::SuperClass(bool original_classes) const {
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
@@ -7010,6 +7037,12 @@
}
}
+TypeArgumentsPtr Function::InstantiateToBounds(Thread* thread) const {
+ const auto& type_params =
+ TypeArguments::Handle(thread->zone(), type_parameters());
+ return InstantiateTypeArgumentsToBounds(thread, type_params);
+}
+
FunctionPtr Function::GetGeneratedClosure() const {
const auto& closure_functions = GrowableObjectArray::Handle(
Isolate::Current()->object_store()->closure_functions());
@@ -7967,90 +8000,6 @@
return Error::null();
}
-// Returns a TypeArguments object where, for each type parameter local to this
-// function, the entry in the TypeArguments is an instantiated version of its
-// bound. In the instantiated bound, any local function type parameter
-// references are replaced with the corresponding bound if that bound can be
-// fully instantiated without local function type parameters, otherwise dynamic.
-static TypeArgumentsPtr InstantiateTypeParametersToBounds(
- Thread* thread,
- const TokenPosition& token_pos,
- const TypeArguments& type_parameters,
- const TypeArguments& instantiator_type_args,
- intptr_t num_parent_type_args,
- const TypeArguments& parent_type_args) {
- ASSERT(!type_parameters.IsNull());
- auto const zone = thread->zone();
- const intptr_t kNumCurrentTypeArgs = type_parameters.Length();
- const intptr_t kNumTypeArgs = kNumCurrentTypeArgs + num_parent_type_args;
- auto& function_type_args = TypeArguments::Handle(zone);
-
- bool all_bounds_instantiated = true;
-
- // Create a type argument vector large enough for the parents' and current
- // type arguments.
- function_type_args = TypeArguments::New(kNumTypeArgs);
- auto& type = AbstractType::Handle(zone);
- auto& bound = AbstractType::Handle(zone);
- // First copy over the parent type args (or the dynamic type if null).
- for (intptr_t i = 0; i < num_parent_type_args; i++) {
- type = parent_type_args.IsNull() ? Type::DynamicType()
- : parent_type_args.TypeAt(i);
- function_type_args.SetTypeAt(i, type);
- }
- // Now try fully instantiating the bounds of each parameter using only
- // the instantiator and parent function type arguments. If possible, keep the
- // instantiated bound as the entry. Otherwise, just set that entry to dynamic.
- for (intptr_t i = num_parent_type_args; i < kNumTypeArgs; i++) {
- type = type_parameters.TypeAt(i - num_parent_type_args);
- const auto& param = TypeParameter::Cast(type);
- bound = param.bound();
- // Only instantiate up to the parent type parameters.
- if (!bound.IsInstantiated(kAny, num_parent_type_args)) {
- bound = bound.InstantiateFrom(instantiator_type_args, function_type_args,
- num_parent_type_args, Heap::kNew);
- }
- if (!bound.IsInstantiated()) {
- // There are local type variables used in this bound.
- bound = Type::DynamicType();
- all_bounds_instantiated = false;
- }
- function_type_args.SetTypeAt(i, bound);
- }
-
- // If all the bounds were instantiated in the first pass, then there can't
- // be any self or mutual recursion, so skip the bounds subtype check.
- if (all_bounds_instantiated) return function_type_args.raw();
-
- // Do another pass, using the set of TypeArguments we just created. If a given
- // bound was instantiated in the last pass, just copy it over. (We don't need
- // to iterate to a fixed point, since there should be no self or mutual
- // recursion in the bounds.)
- const auto& first_round =
- TypeArguments::Handle(zone, function_type_args.raw());
- function_type_args = TypeArguments::New(kNumTypeArgs);
- // Again, copy over the parent type arguments first.
- for (intptr_t i = 0; i < num_parent_type_args; i++) {
- type = first_round.TypeAt(i);
- function_type_args.SetTypeAt(i, type);
- }
- for (intptr_t i = num_parent_type_args; i < kNumTypeArgs; i++) {
- type = type_parameters.TypeAt(i - num_parent_type_args);
- const auto& param = TypeParameter::Cast(type);
- bound = first_round.TypeAt(i);
- // The dynamic type is never a bound, even when implicit, so it also marks
- // bounds that were not already fully instantiated.
- if (bound.raw() == Type::DynamicType()) {
- bound = param.bound();
- bound = bound.InstantiateFrom(instantiator_type_args, first_round,
- kAllFree, Heap::kNew);
- }
- function_type_args.SetTypeAt(i, bound);
- }
-
- return function_type_args.Canonicalize(thread);
-}
-
// Retrieves the function type arguments, if any. This could be explicitly
// passed type from the arguments array, delayed type arguments in closures,
// or instantiated bounds for the type parameters if no other source for
@@ -8087,31 +8036,27 @@
if (kNumCurrentTypeArgs == 0) return parent_type_args.raw();
auto& function_type_args = TypeArguments::Handle(zone);
+ // First check for delayed type arguments before using either provided or
+ // default type arguments.
+ bool has_delayed_type_args = false;
if (function.IsClosureFunction()) {
const auto& closure = Closure::Cast(receiver);
function_type_args = closure.delayed_type_arguments();
- if (function_type_args.raw() == Object::empty_type_arguments().raw()) {
- // There are no delayed type arguments, so set back to null.
- function_type_args = TypeArguments::null();
- } else {
- // We should never end up here when the receiver is a closure with delayed
- // type arguments unless this dynamically called closure function was
- // retrieved directly from the closure instead of going through
- // DartEntry::ResolveCallable, which appropriately checks for this case.
- ASSERT(args_desc.TypeArgsLen() == 0);
- }
+ has_delayed_type_args =
+ function_type_args.raw() != Object::empty_type_arguments().raw();
}
if (args_desc.TypeArgsLen() > 0) {
+ // We should never end up here when the receiver is a closure with delayed
+ // type arguments unless this dynamically called closure function was
+ // retrieved directly from the closure instead of going through
+ // DartEntry::ResolveCallable, which appropriately checks for this case.
+ ASSERT(!has_delayed_type_args);
function_type_args ^= args.At(0);
- }
-
- if (function_type_args.IsNull()) {
- // We have no explicitly provided function type arguments, so generate
- // some by instantiating the parameters to bounds.
- return InstantiateTypeParametersToBounds(
- thread, function.token_pos(), type_params, instantiator_type_args,
- kNumParentTypeArgs, parent_type_args);
+ } else if (!has_delayed_type_args) {
+ // We have no explicitly provided function type arguments, so instantiate
+ // the type parameters to bounds.
+ function_type_args = function.InstantiateToBounds(thread);
}
return function_type_args.Prepend(zone, parent_type_args, kNumParentTypeArgs,
@@ -21025,6 +20970,10 @@
StorePointer(&raw_ptr()->bound_, value.raw());
}
+void TypeParameter::set_default_argument(const AbstractType& value) const {
+ StorePointer(&raw_ptr()->default_argument_, value.raw());
+}
+
AbstractTypePtr TypeParameter::GetFromTypeArguments(
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments) const {
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 33f8660..7a6fc07 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1114,6 +1114,10 @@
// Return true if this class declares type parameters.
bool IsGeneric() const { return NumTypeParameters(Thread::Current()) > 0; }
+ // Returns a canonicalized vector of the type parameters instantiated
+ // to bounds. If non-generic, the empty type arguments vector is returned.
+ TypeArgumentsPtr InstantiateToBounds(Thread* thread) const;
+
// If this class is parameterized, each instance has a type_arguments field.
static const intptr_t kNoTypeArguments = -1;
intptr_t host_type_arguments_field_offset() const {
@@ -2768,6 +2772,10 @@
// Enclosing function of this local function.
FunctionPtr parent_function() const;
+ // Returns a canonicalized vector of the type parameters instantiated
+ // to bounds. If non-generic, the empty type arguments vector is returned.
+ TypeArgumentsPtr InstantiateToBounds(Thread* thread) const;
+
// Enclosed generated closure function of this local function.
// This will only work after the closure function has been allocated in the
// isolate's object_store.
@@ -8517,6 +8525,10 @@
void set_index(intptr_t value) const;
AbstractTypePtr bound() const { return raw_ptr()->bound_; }
void set_bound(const AbstractType& value) const;
+ AbstractTypePtr default_argument() const {
+ return raw_ptr()->default_argument_;
+ }
+ void set_default_argument(const AbstractType& value) const;
virtual TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
virtual bool IsInstantiated(Genericity genericity = kAny,
intptr_t num_free_fun_type_params = kAllFree,
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 9902dc6..fefbb4a 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -66,8 +66,7 @@
first_parameter_index_(),
num_stack_locals_(0),
have_seen_await_expr_(false),
- kernel_scopes_(NULL),
- default_function_type_arguments_(TypeArguments::ZoneHandle(zone())) {
+ kernel_scopes_(NULL) {
ASSERT(function.IsZoneHandle());
// Every function has a local variable for the current context.
LocalVariable* temp = new (zone())
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h
index 9c56692..22ae1f4 100644
--- a/runtime/vm/parser.h
+++ b/runtime/vm/parser.h
@@ -213,14 +213,6 @@
return scope()->VariableAt(i);
}
- void SetDefaultFunctionTypeArguments(const TypeArguments& value) {
- default_function_type_arguments_ = value.raw();
- }
-
- const TypeArguments& DefaultFunctionTypeArguments() const {
- return default_function_type_arguments_;
- }
-
// Remembers the set of covariant parameters.
// [covariant_parameters] is a bitvector of function.NumParameters() length.
void SetCovariantParameters(const BitVector* covariant_parameters);
@@ -288,8 +280,6 @@
const Function* forwarding_stub_super_target_ = nullptr;
kernel::ScopeBuildingResult* kernel_scopes_;
- TypeArguments& default_function_type_arguments_;
-
const BitVector* covariant_parameters_ = nullptr;
const BitVector* generic_covariant_impl_parameters_ = nullptr;
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 498fd5d..6436338 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -2289,6 +2289,11 @@
StringPtr name_;
SmiPtr hash_;
AbstractTypePtr bound_; // ObjectType if no explicit bound specified.
+ // The instantiation to bounds of this parameter as calculated by the CFE.
+ //
+ // TODO(dartbug.com/43901): Once a separate TypeParameters class has been
+ // added, move these there and remove them from TypeParameter objects.
+ AbstractTypePtr default_argument_;
FunctionPtr parameterized_function_;
VISIT_TO(ObjectPtr, parameterized_function_)
ClassIdTagType parameterized_class_id_;
diff --git a/tools/VERSION b/tools/VERSION
index 8b1debf..2f9367b 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 11
PATCH 0
-PRERELEASE 251
+PRERELEASE 252
PRERELEASE_PATCH 0
\ No newline at end of file