Version 2.14.0-223.0.dev
Merge commit 'd2e460675b469d56ac5727fa599a1f7bbf2ffae4' into 'dev'
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/ignore_diagnostic.dart b/pkg/analysis_server/lib/src/services/correction/dart/ignore_diagnostic.dart
new file mode 100644
index 0000000..93fd327
--- /dev/null
+++ b/pkg/analysis_server/lib/src/services/correction/dart/ignore_diagnostic.dart
@@ -0,0 +1,103 @@
+// Copyright (c) 2021, 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:analysis_server/src/services/correction/dart/abstract_producer.dart';
+import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analysis_server/src/services/correction/util.dart';
+import 'package:analyzer/error/error.dart';
+import 'package:analyzer/src/ignore_comments/ignore_info.dart';
+import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
+import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
+
+abstract class AbstractIgnoreDiagnostic extends CorrectionProducer {
+ AnalysisError get error => diagnostic as AnalysisError;
+
+ @override
+ List<Object>? get fixArguments => [_code];
+
+ String get _code => error.errorCode.name.toLowerCase();
+
+ Future<void> _computeEdit(
+ ChangeBuilder builder,
+ CorrectionUtils_InsertDesc insertDesc,
+ RegExp existingIgnorePattern,
+ String ignoreCommentType,
+ ) async {
+ final lineInfo = unit.lineInfo;
+ if (lineInfo == null) {
+ return;
+ }
+
+ await builder.addDartFileEdit(file, (builder) {
+ final offset = insertDesc.offset;
+
+ // Work out the offset of the start of the line so we can insert the new
+ // line there.
+ final location = lineInfo.getLocation(offset);
+ final zeroBasedLineNumber = location.lineNumber - 1;
+ final lineOffset = lineInfo.getOffsetOfLine(zeroBasedLineNumber);
+
+ if (zeroBasedLineNumber > 0) {
+ final previousLineOffset =
+ lineInfo.getOffsetOfLine(zeroBasedLineNumber - 1);
+
+ // If the line above already has an ignore comment, we need to append to
+ // it like "ignore: foo, bar".
+ final previousLineText = utils
+ .getText(previousLineOffset, lineOffset - previousLineOffset)
+ .trimRight();
+ if (previousLineText.trim().startsWith(existingIgnorePattern)) {
+ final offset = previousLineOffset + previousLineText.length;
+ builder.addSimpleInsertion(offset, ', $_code');
+ return;
+ }
+ }
+
+ final indent = utils.getLinePrefix(offset);
+ final prefix = insertDesc.prefix;
+ final comment = '// $ignoreCommentType: $_code';
+ final suffix = insertDesc.suffix;
+ builder.addSimpleInsertion(lineOffset, '$prefix$indent$comment\n$suffix');
+ });
+ }
+}
+
+class IgnoreDiagnosticInFile extends AbstractIgnoreDiagnostic {
+ @override
+ FixKind get fixKind => DartFixKind.IGNORE_ERROR_FILE;
+
+ @override
+ Future<void> compute(ChangeBuilder builder) async {
+ final insertDesc = utils.getInsertDescIgnoreForFile();
+ await _computeEdit(
+ builder,
+ insertDesc,
+ IgnoreInfo.IGNORE_FOR_FILE_MATCHER,
+ 'ignore_for_file',
+ );
+ }
+
+ /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
+ static IgnoreDiagnosticInFile newInstance() => IgnoreDiagnosticInFile();
+}
+
+class IgnoreDiagnosticOnLine extends AbstractIgnoreDiagnostic {
+ @override
+ FixKind get fixKind => DartFixKind.IGNORE_ERROR_LINE;
+
+ @override
+ Future<void> compute(ChangeBuilder builder) async {
+ final insertDesc = CorrectionUtils_InsertDesc();
+ insertDesc.offset = node.offset;
+ await _computeEdit(
+ builder,
+ insertDesc,
+ IgnoreInfo.IGNORE_MATCHER,
+ 'ignore',
+ );
+ }
+
+ /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
+ static IgnoreDiagnosticOnLine newInstance() => IgnoreDiagnosticOnLine();
+}
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index 97e39a21..f2a7e4b 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -447,6 +447,10 @@
FixKind('dart.fix.dataDriven', DartFixKindPriority.DEFAULT, '{0}');
static const EXTEND_CLASS_FOR_MIXIN = FixKind('dart.fix.extendClassForMixin',
DartFixKindPriority.DEFAULT, "Extend the class '{0}'");
+ static const IGNORE_ERROR_LINE = FixKind('dart.fix.ignore.line',
+ DartFixKindPriority.IGNORE, "Ignore '{0}' for this line");
+ static const IGNORE_ERROR_FILE = FixKind('dart.fix.ignore.file',
+ DartFixKindPriority.IGNORE - 1, "Ignore '{0}' for this file");
static const IMPORT_ASYNC =
FixKind('dart.fix.import.async', 49, "Import 'dart:async'");
static const IMPORT_LIBRARY_PREFIX = FixKind('dart.fix.import.libraryPrefix',
@@ -924,4 +928,5 @@
class DartFixKindPriority {
static const int DEFAULT = 50;
static const int IN_FILE = 40;
+ static const int IGNORE = 30;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index f56ee49..78b321a 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -74,6 +74,7 @@
import 'package:analysis_server/src/services/correction/dart/create_setter.dart';
import 'package:analysis_server/src/services/correction/dart/data_driven.dart';
import 'package:analysis_server/src/services/correction/dart/extend_class_for_mixin.dart';
+import 'package:analysis_server/src/services/correction/dart/ignore_diagnostic.dart';
import 'package:analysis_server/src/services/correction/dart/import_library.dart';
import 'package:analysis_server/src/services/correction/dart/inline_invocation.dart';
import 'package:analysis_server/src/services/correction/dart/inline_typedef.dart';
@@ -1280,6 +1281,16 @@
}
}
}
+
+ if (errorCode is LintCode || errorCode is HintCode) {
+ var generators = [
+ IgnoreDiagnosticOnLine.newInstance,
+ IgnoreDiagnosticInFile.newInstance,
+ ];
+ for (var generator in generators) {
+ await compute(generator());
+ }
+ }
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index 0fd70b7..0409ea4 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -574,6 +574,66 @@
/// Returns the indentation with the given level.
String getIndent(int level) => repeat(' ', level);
+ /// Returns a [InsertDesc] describing where to insert an ignore_for_file
+ /// comment.
+ ///
+ /// When an existing ignore_for_file comment is found, this returns the start
+ /// of the following line, although calling code may choose to fold into the
+ /// previous line.
+ CorrectionUtils_InsertDesc getInsertDescIgnoreForFile() {
+ var offset = 0;
+ var insertEmptyLineBefore = false;
+ var insertEmptyLineAfter = false;
+ var source = _buffer;
+
+ // Look for the last blank line in any leading comments (to insert after all
+ // header comments but not after any comment "attached" code). If an
+ // existing ignore_for_file comment is found while looking, then insert
+ // after that.
+
+ int? lastBlankLineOffset;
+ var insertOffset = 0;
+ while (offset < source.length - 1) {
+ var nextLineOffset = getLineNext(offset);
+ var line = source.substring(offset, nextLineOffset).trim();
+
+ if (line.startsWith('// ignore_for_file:')) {
+ // Found existing ignore, insert after this.
+ insertOffset = nextLineOffset;
+ break;
+ } else if (line.isEmpty) {
+ // Track last blank line, as we will insert there.
+ lastBlankLineOffset = offset;
+ offset = nextLineOffset;
+ } else if (line.startsWith('#!') || line.startsWith('//')) {
+ // Skip comment/hash-bang.
+ offset = nextLineOffset;
+ } else {
+ // We found some code.
+ // If we found a blank line, insert it after that.
+ if (lastBlankLineOffset != null) {
+ insertOffset = lastBlankLineOffset;
+ insertEmptyLineBefore = true;
+ } else {
+ // Otherwise, insert it before the first line of code.
+ insertOffset = offset;
+ insertEmptyLineAfter = true;
+ }
+ break;
+ }
+ }
+
+ var desc = CorrectionUtils_InsertDesc();
+ desc.offset = insertOffset;
+ if (insertEmptyLineBefore) {
+ desc.prefix = endOfLine;
+ }
+ if (insertEmptyLineAfter) {
+ desc.suffix = endOfLine;
+ }
+ return desc;
+ }
+
/// Returns a [InsertDesc] describing where to insert a new directive or a
/// top-level declaration at the top of the file.
CorrectionUtils_InsertDesc getInsertDescTop() {
diff --git a/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart b/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
index 1d62c11..2a9184a 100644
--- a/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
+++ b/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
@@ -156,6 +156,87 @@
expect(await ofKind(CodeActionKind.Refactor), isEmpty);
}
+ Future<void> test_ignoreDiagnosticForFile() async {
+ const content = '''
+// Header comment
+// Header comment
+// Header comment
+
+// This comment is attached to the below import
+import 'dart:async';
+[[import]] 'dart:convert';
+
+Future foo;''';
+
+ const expectedContent = '''
+// Header comment
+// Header comment
+// Header comment
+
+// ignore_for_file: unused_import
+
+// This comment is attached to the below import
+import 'dart:async';
+import 'dart:convert';
+
+Future foo;''';
+ newFile(mainFilePath, content: withoutMarkers(content));
+ await initialize(
+ textDocumentCapabilities: withCodeActionKinds(
+ emptyTextDocumentClientCapabilities, [CodeActionKind.QuickFix]),
+ );
+
+ // Find the ignore action.
+ final codeActions = await getCodeActions(mainFileUri.toString(),
+ range: rangeFromMarkers(content));
+ final fixAction = findEditAction(
+ codeActions,
+ CodeActionKind('quickfix.ignore.file'),
+ "Ignore 'unused_import' for this file")!;
+
+ // Ensure applying the changes will give us the expected content.
+ final contents = {
+ mainFilePath: withoutMarkers(content),
+ };
+ applyChanges(contents, fixAction.edit!.changes!);
+ expect(contents[mainFilePath], equals(expectedContent));
+ }
+
+ Future<void> test_ignoreDiagnosticForLine() async {
+ const content = '''
+import 'dart:async';
+[[import]] 'dart:convert';
+
+Future foo;''';
+
+ const expectedContent = '''
+import 'dart:async';
+// ignore: unused_import
+import 'dart:convert';
+
+Future foo;''';
+ newFile(mainFilePath, content: withoutMarkers(content));
+ await initialize(
+ textDocumentCapabilities: withCodeActionKinds(
+ emptyTextDocumentClientCapabilities, [CodeActionKind.QuickFix]),
+ );
+
+ // Find the ignore action.
+ final codeActions = await getCodeActions(mainFileUri.toString(),
+ range: rangeFromMarkers(content));
+ final fixAction = findEditAction(
+ codeActions,
+ CodeActionKind('quickfix.ignore.line'),
+ "Ignore 'unused_import' for this line")!;
+
+ // Ensure applying the changes will give us the expected content.
+ final contents = {
+ mainFilePath: withoutMarkers(content),
+ };
+ applyChanges(contents, fixAction.edit!.changes!);
+ expect(contents[mainFilePath], equals(expectedContent));
+ }
+
Future<void> test_noDuplicates_sameFix() async {
const content = '''
var a = [Test, Test, Te[[]]st];
diff --git a/pkg/analysis_server/test/src/services/correction/fix/ignore_diagnostic_test.dart b/pkg/analysis_server/test/src/services/correction/fix/ignore_diagnostic_test.dart
new file mode 100644
index 0000000..f29c3df
--- /dev/null
+++ b/pkg/analysis_server/test/src/services/correction/fix/ignore_diagnostic_test.dart
@@ -0,0 +1,124 @@
+// Copyright (c) 2021, 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:analysis_server/src/services/correction/fix.dart';
+import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'fix_processor.dart';
+
+void main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(IgnoreDiagnosticLineTest);
+ defineReflectiveTests(IgnoreDiagnosticFileTest);
+ });
+}
+
+@reflectiveTest
+class IgnoreDiagnosticFileTest extends FixProcessorTest {
+ @override
+ FixKind get kind => DartFixKind.IGNORE_ERROR_FILE;
+
+ Future<void> test_existingIgnores() async {
+ await resolveTestCode('''
+// Copyright header.
+
+// ignore_for_file: foo
+
+// Some other header.
+
+/// main dartcode
+void main(List<String> args) {
+ var a = 1;
+}
+''');
+ await assertHasFix('''
+// Copyright header.
+
+// ignore_for_file: foo, unused_local_variable
+
+// Some other header.
+
+/// main dartcode
+void main(List<String> args) {
+ var a = 1;
+}
+''');
+ }
+
+ Future<void> test_headers() async {
+ await resolveTestCode('''
+// Copyright header.
+
+// Some other header.
+
+/// main dartcode
+void main(List<String> args) {
+ var a = 1;
+}
+''');
+ await assertHasFix('''
+// Copyright header.
+
+// Some other header.
+
+// ignore_for_file: unused_local_variable
+
+/// main dartcode
+void main(List<String> args) {
+ var a = 1;
+}
+''');
+ }
+
+ Future<void> test_noHeader() async {
+ await resolveTestCode('''
+void main(List<String> args) {
+ var a = 1;
+}
+''');
+ await assertHasFix('''
+// ignore_for_file: unused_local_variable
+
+void main(List<String> args) {
+ var a = 1;
+}
+''');
+ }
+}
+
+@reflectiveTest
+class IgnoreDiagnosticLineTest extends FixProcessorTest {
+ @override
+ FixKind get kind => DartFixKind.IGNORE_ERROR_LINE;
+
+ Future<void> test_existingIgnore() async {
+ await resolveTestCode('''
+void main(List<String> args) {
+ // ignore: foo
+ var a = 1;
+}
+''');
+ await assertHasFix('''
+void main(List<String> args) {
+ // ignore: foo, unused_local_variable
+ var a = 1;
+}
+''');
+ }
+
+ Future<void> test_unusedCode() async {
+ await resolveTestCode('''
+void main(List<String> args) {
+ var a = 1;
+}
+''');
+ await assertHasFix('''
+void main(List<String> args) {
+ // ignore: unused_local_variable
+ var a = 1;
+}
+''');
+ }
+}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
index fe58f4e..f9946fa 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
@@ -85,6 +85,7 @@
import 'fix_in_file_test.dart' as fix_in_file;
import 'fix_processor_map_test.dart' as fix_processor_map;
import 'fix_test.dart' as fix;
+import 'ignore_diagnostic_test.dart' as ignore_error;
import 'import_async_test.dart' as import_async;
import 'import_library_prefix_test.dart' as import_library_prefix;
import 'import_library_project_test.dart' as import_library_project;
@@ -253,6 +254,7 @@
fix.main();
fix_in_file.main();
fix_processor_map.main();
+ ignore_error.main();
import_async.main();
import_library_prefix.main();
import_library_project.main();
diff --git a/pkg/analyzer/lib/src/ignore_comments/ignore_info.dart b/pkg/analyzer/lib/src/ignore_comments/ignore_info.dart
index a6f0f56..8f7b0b3 100644
--- a/pkg/analyzer/lib/src/ignore_comments/ignore_info.dart
+++ b/pkg/analyzer/lib/src/ignore_comments/ignore_info.dart
@@ -36,7 +36,7 @@
/// * ['//ignore: error_code', 'error_code']
///
/// Resulting codes may be in a list ('error_code_1,error_code2').
- static final RegExp _IGNORE_MATCHER =
+ static final RegExp IGNORE_MATCHER =
RegExp(r'//+[ ]*ignore:(.*)$', multiLine: true);
/// A regular expression for matching 'ignore_for_file' comments. Produces
@@ -45,7 +45,7 @@
/// * ['//ignore_for_file: error_code', 'error_code']
///
/// Resulting codes may be in a list ('error_code_1,error_code2').
- static final RegExp _IGNORE_FOR_FILE_MATCHER =
+ static final RegExp IGNORE_FOR_FILE_MATCHER =
RegExp(r'//[ ]*ignore_for_file:(.*)$', multiLine: true);
/// A table mapping line numbers to the diagnostics that are ignored on that
@@ -135,8 +135,8 @@
/// Calculate ignores for the given [content] with line [info].
@Deprecated('Use the constructor IgnoreInfo.forDart')
static IgnoreInfo calculateIgnores(String content, LineInfo info) {
- Iterable<Match> matches = _IGNORE_MATCHER.allMatches(content);
- Iterable<Match> fileMatches = _IGNORE_FOR_FILE_MATCHER.allMatches(content);
+ Iterable<Match> matches = IGNORE_MATCHER.allMatches(content);
+ Iterable<Match> fileMatches = IGNORE_FOR_FILE_MATCHER.allMatches(content);
if (matches.isEmpty && fileMatches.isEmpty) {
return _EMPTY_INFO;
}
@@ -186,11 +186,11 @@
var comment = currentToken.precedingComments;
while (comment != null) {
var lexeme = comment.lexeme;
- var match = IgnoreInfo._IGNORE_MATCHER.matchAsPrefix(lexeme);
+ var match = IgnoreInfo.IGNORE_MATCHER.matchAsPrefix(lexeme);
if (match != null) {
yield comment;
} else {
- match = IgnoreInfo._IGNORE_FOR_FILE_MATCHER.matchAsPrefix(lexeme);
+ match = IgnoreInfo.IGNORE_FOR_FILE_MATCHER.matchAsPrefix(lexeme);
if (match != null) {
yield comment;
}
diff --git a/runtime/bin/ffi_test/ffi_test_functions_generated.cc b/runtime/bin/ffi_test/ffi_test_functions_generated.cc
index 1e88249..246c329 100644
--- a/runtime/bin/ffi_test/ffi_test_functions_generated.cc
+++ b/runtime/bin/ffi_test/ffi_test_functions_generated.cc
@@ -4751,7 +4751,7 @@
<< "(" << static_cast<int>(a0) << ")"
<< "\n";
- Struct1ByteInt result;
+ Struct1ByteInt result = {};
result.a0 = a0;
@@ -4771,7 +4771,7 @@
<< ", " << static_cast<int>(a2) << ")"
<< "\n";
- Struct3BytesHomogeneousUint8 result;
+ Struct3BytesHomogeneousUint8 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -4795,7 +4795,7 @@
<< "(" << a0 << ", " << static_cast<int>(a1) << ")"
<< "\n";
- Struct3BytesInt2ByteAligned result;
+ Struct3BytesInt2ByteAligned result = {};
result.a0 = a0;
result.a1 = a1;
@@ -4815,7 +4815,7 @@
<< "(" << a0 << ", " << a1 << ")"
<< "\n";
- Struct4BytesHomogeneousInt16 result;
+ Struct4BytesHomogeneousInt16 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -4844,7 +4844,7 @@
<< ", " << static_cast<int>(a6) << ")"
<< "\n";
- Struct7BytesHomogeneousUint8 result;
+ Struct7BytesHomogeneousUint8 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -4876,7 +4876,7 @@
<< "(" << a0 << ", " << a1 << ", " << static_cast<int>(a2) << ")"
<< "\n";
- Struct7BytesInt4ByteAligned result;
+ Struct7BytesInt4ByteAligned result = {};
result.a0 = a0;
result.a1 = a1;
@@ -4899,7 +4899,7 @@
<< "(" << a0 << ", " << a1 << ", " << a2 << ")"
<< "\n";
- Struct8BytesInt result;
+ Struct8BytesInt result = {};
result.a0 = a0;
result.a1 = a1;
@@ -4920,7 +4920,7 @@
<< "(" << a0 << ", " << a1 << ")"
<< "\n";
- Struct8BytesHomogeneousFloat result;
+ Struct8BytesHomogeneousFloat result = {};
result.a0 = a0;
result.a1 = a1;
@@ -4941,7 +4941,7 @@
<< "(" << a0 << ", " << a1 << ", " << a2 << ")"
<< "\n";
- Struct8BytesMixed result;
+ Struct8BytesMixed result = {};
result.a0 = a0;
result.a1 = a1;
@@ -4976,7 +4976,7 @@
<< ", " << static_cast<int>(a8) << ")"
<< "\n";
- Struct9BytesHomogeneousUint8 result;
+ Struct9BytesHomogeneousUint8 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5012,7 +5012,7 @@
<< "(" << a0 << ", " << static_cast<int>(a1) << ")"
<< "\n";
- Struct9BytesInt4Or8ByteAligned result;
+ Struct9BytesInt4Or8ByteAligned result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5033,7 +5033,7 @@
<< "(" << a0 << ", " << a1 << ", " << a2 << ")"
<< "\n";
- Struct12BytesHomogeneousFloat result;
+ Struct12BytesHomogeneousFloat result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5054,7 +5054,7 @@
<< "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ")"
<< "\n";
- Struct16BytesHomogeneousFloat result;
+ Struct16BytesHomogeneousFloat result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5076,7 +5076,7 @@
<< "(" << a0 << ", " << a1 << ")"
<< "\n";
- Struct16BytesMixed result;
+ Struct16BytesMixed result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5099,7 +5099,7 @@
<< "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ")"
<< "\n";
- Struct16BytesMixed2 result;
+ Struct16BytesMixed2 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5125,7 +5125,7 @@
<< "(" << a0 << ", " << a1 << ", " << static_cast<int>(a2) << ")"
<< "\n";
- Struct17BytesInt result;
+ Struct17BytesInt result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5176,7 +5176,7 @@
<< ", " << static_cast<int>(a18) << ")"
<< "\n";
- Struct19BytesHomogeneousUint8 result;
+ Struct19BytesHomogeneousUint8 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5236,7 +5236,7 @@
<< ")"
<< "\n";
- Struct20BytesHomogeneousInt32 result;
+ Struct20BytesHomogeneousInt32 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5265,7 +5265,7 @@
<< ")"
<< "\n";
- Struct20BytesHomogeneousFloat result;
+ Struct20BytesHomogeneousFloat result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5292,7 +5292,7 @@
<< "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ")"
<< "\n";
- Struct32BytesHomogeneousDouble result;
+ Struct32BytesHomogeneousDouble result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5320,7 +5320,7 @@
<< ")"
<< "\n";
- Struct40BytesHomogeneousDouble result;
+ Struct40BytesHomogeneousDouble result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5500,7 +5500,7 @@
<< a127 << ")"
<< "\n";
- Struct1024BytesHomogeneousUint64 result;
+ Struct1024BytesHomogeneousUint64 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5688,7 +5688,7 @@
<< "(" << static_cast<int>(a0) << ", " << a1 << ")"
<< "\n";
- Struct3BytesPackedInt result;
+ Struct3BytesPackedInt result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5713,7 +5713,7 @@
<< static_cast<int>(a4) << ")"
<< "\n";
- Struct8BytesPackedInt result;
+ Struct8BytesPackedInt result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5740,7 +5740,7 @@
<< "(" << static_cast<int>(a0) << ", " << a1 << ")"
<< "\n";
- Struct9BytesPackedMixed result;
+ Struct9BytesPackedMixed result = {};
result.a0 = a0;
result.a1 = a1;
@@ -5759,7 +5759,7 @@
<< "(" << a0 << ")"
<< "\n";
- Union4BytesMixed result;
+ Union4BytesMixed result = {};
result.a0 = a0;
@@ -5777,7 +5777,7 @@
<< "(" << a0 << ")"
<< "\n";
- Union8BytesNestedFloat result;
+ Union8BytesNestedFloat result = {};
result.a0 = a0;
@@ -5797,7 +5797,7 @@
<< "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << "))"
<< "\n";
- Union9BytesNestedInt result;
+ Union9BytesNestedInt result = {};
result.a0.a0 = a0.a0;
result.a0.a1 = a0.a1;
@@ -5827,7 +5827,7 @@
<< "((" << a0.a0 << ", " << a0.a1 << "))"
<< "\n";
- Union16BytesNestedFloat result;
+ Union16BytesNestedFloat result = {};
result.a0.a0 = a0.a0;
result.a0.a1 = a0.a1;
@@ -6060,7 +6060,7 @@
<< static_cast<int>(a2) << ")"
<< "\n";
- StructAlignmentInt16 result;
+ StructAlignmentInt16 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -6084,7 +6084,7 @@
<< static_cast<int>(a2) << ")"
<< "\n";
- StructAlignmentInt32 result;
+ StructAlignmentInt32 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -6108,7 +6108,7 @@
<< static_cast<int>(a2) << ")"
<< "\n";
- StructAlignmentInt64 result;
+ StructAlignmentInt64 result = {};
result.a0 = a0;
result.a1 = a1;
@@ -6132,7 +6132,7 @@
<< a1.a1 << "))"
<< "\n";
- Struct8BytesNestedInt result;
+ Struct8BytesNestedInt result = {};
result.a0.a0 = a0.a0;
result.a0.a1 = a0.a1;
@@ -6155,7 +6155,7 @@
<< "((" << a0.a0 << "), (" << a1.a0 << "))"
<< "\n";
- Struct8BytesNestedFloat result;
+ Struct8BytesNestedFloat result = {};
result.a0.a0 = a0.a0;
result.a1.a0 = a1.a0;
@@ -6176,7 +6176,7 @@
<< "((" << a0.a0 << "), " << a1 << ")"
<< "\n";
- Struct8BytesNestedFloat2 result;
+ Struct8BytesNestedFloat2 result = {};
result.a0.a0 = a0.a0;
result.a1 = a1;
@@ -6197,7 +6197,7 @@
<< "((" << a0.a0 << ", " << a0.a1 << "), (" << a1.a0 << "))"
<< "\n";
- Struct8BytesNestedMixed result;
+ Struct8BytesNestedMixed result = {};
result.a0.a0 = a0.a0;
result.a0.a1 = a0.a1;
@@ -6222,7 +6222,7 @@
<< "), (" << a1.a1.a0 << ", " << a1.a1.a1 << ")))"
<< "\n";
- Struct16BytesNestedInt result;
+ Struct16BytesNestedInt result = {};
result.a0.a0.a0 = a0.a0.a0;
result.a0.a0.a1 = a0.a0.a1;
@@ -6258,7 +6258,7 @@
<< ", " << a1.a1.a1.a1 << "))))"
<< "\n";
- Struct32BytesNestedInt result;
+ Struct32BytesNestedInt result = {};
result.a0.a0.a0.a0 = a0.a0.a0.a0;
result.a0.a0.a0.a1 = a0.a0.a0.a1;
@@ -6303,7 +6303,7 @@
<< ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))"
<< "\n";
- StructNestedIntStructAlignmentInt16 result;
+ StructNestedIntStructAlignmentInt16 result = {};
result.a0.a0 = a0.a0;
result.a0.a1 = a0.a1;
@@ -6333,7 +6333,7 @@
<< ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))"
<< "\n";
- StructNestedIntStructAlignmentInt32 result;
+ StructNestedIntStructAlignmentInt32 result = {};
result.a0.a0 = a0.a0;
result.a0.a1 = a0.a1;
@@ -6363,7 +6363,7 @@
<< ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))"
<< "\n";
- StructNestedIntStructAlignmentInt64 result;
+ StructNestedIntStructAlignmentInt64 result = {};
result.a0.a0 = a0.a0;
result.a0.a1 = a0.a1;
@@ -6405,7 +6405,7 @@
<< ", " << a2.a3 << "), " << a3 << ")"
<< "\n";
- StructNestedIrregularEvenBigger result;
+ StructNestedIrregularEvenBigger result = {};
result.a0 = a0;
result.a1.a0.a0 = a1.a0.a0;
@@ -6480,16 +6480,16 @@
Struct1ByteInt a7,
Struct1ByteInt a8,
Struct1ByteInt a9)) {
- Struct1ByteInt a0;
- Struct1ByteInt a1;
- Struct1ByteInt a2;
- Struct1ByteInt a3;
- Struct1ByteInt a4;
- Struct1ByteInt a5;
- Struct1ByteInt a6;
- Struct1ByteInt a7;
- Struct1ByteInt a8;
- Struct1ByteInt a9;
+ Struct1ByteInt a0 = {};
+ Struct1ByteInt a1 = {};
+ Struct1ByteInt a2 = {};
+ Struct1ByteInt a3 = {};
+ Struct1ByteInt a4 = {};
+ Struct1ByteInt a5 = {};
+ Struct1ByteInt a6 = {};
+ Struct1ByteInt a7 = {};
+ Struct1ByteInt a8 = {};
+ Struct1ByteInt a9 = {};
a0.a0 = -1;
a1.a0 = 2;
@@ -6550,16 +6550,16 @@
Struct3BytesHomogeneousUint8 a7,
Struct3BytesHomogeneousUint8 a8,
Struct3BytesHomogeneousUint8 a9)) {
- Struct3BytesHomogeneousUint8 a0;
- Struct3BytesHomogeneousUint8 a1;
- Struct3BytesHomogeneousUint8 a2;
- Struct3BytesHomogeneousUint8 a3;
- Struct3BytesHomogeneousUint8 a4;
- Struct3BytesHomogeneousUint8 a5;
- Struct3BytesHomogeneousUint8 a6;
- Struct3BytesHomogeneousUint8 a7;
- Struct3BytesHomogeneousUint8 a8;
- Struct3BytesHomogeneousUint8 a9;
+ Struct3BytesHomogeneousUint8 a0 = {};
+ Struct3BytesHomogeneousUint8 a1 = {};
+ Struct3BytesHomogeneousUint8 a2 = {};
+ Struct3BytesHomogeneousUint8 a3 = {};
+ Struct3BytesHomogeneousUint8 a4 = {};
+ Struct3BytesHomogeneousUint8 a5 = {};
+ Struct3BytesHomogeneousUint8 a6 = {};
+ Struct3BytesHomogeneousUint8 a7 = {};
+ Struct3BytesHomogeneousUint8 a8 = {};
+ Struct3BytesHomogeneousUint8 a9 = {};
a0.a0 = 1;
a0.a1 = 2;
@@ -6655,16 +6655,16 @@
Struct3BytesInt2ByteAligned a7,
Struct3BytesInt2ByteAligned a8,
Struct3BytesInt2ByteAligned a9)) {
- Struct3BytesInt2ByteAligned a0;
- Struct3BytesInt2ByteAligned a1;
- Struct3BytesInt2ByteAligned a2;
- Struct3BytesInt2ByteAligned a3;
- Struct3BytesInt2ByteAligned a4;
- Struct3BytesInt2ByteAligned a5;
- Struct3BytesInt2ByteAligned a6;
- Struct3BytesInt2ByteAligned a7;
- Struct3BytesInt2ByteAligned a8;
- Struct3BytesInt2ByteAligned a9;
+ Struct3BytesInt2ByteAligned a0 = {};
+ Struct3BytesInt2ByteAligned a1 = {};
+ Struct3BytesInt2ByteAligned a2 = {};
+ Struct3BytesInt2ByteAligned a3 = {};
+ Struct3BytesInt2ByteAligned a4 = {};
+ Struct3BytesInt2ByteAligned a5 = {};
+ Struct3BytesInt2ByteAligned a6 = {};
+ Struct3BytesInt2ByteAligned a7 = {};
+ Struct3BytesInt2ByteAligned a8 = {};
+ Struct3BytesInt2ByteAligned a9 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -6738,16 +6738,16 @@
Struct4BytesHomogeneousInt16 a7,
Struct4BytesHomogeneousInt16 a8,
Struct4BytesHomogeneousInt16 a9)) {
- Struct4BytesHomogeneousInt16 a0;
- Struct4BytesHomogeneousInt16 a1;
- Struct4BytesHomogeneousInt16 a2;
- Struct4BytesHomogeneousInt16 a3;
- Struct4BytesHomogeneousInt16 a4;
- Struct4BytesHomogeneousInt16 a5;
- Struct4BytesHomogeneousInt16 a6;
- Struct4BytesHomogeneousInt16 a7;
- Struct4BytesHomogeneousInt16 a8;
- Struct4BytesHomogeneousInt16 a9;
+ Struct4BytesHomogeneousInt16 a0 = {};
+ Struct4BytesHomogeneousInt16 a1 = {};
+ Struct4BytesHomogeneousInt16 a2 = {};
+ Struct4BytesHomogeneousInt16 a3 = {};
+ Struct4BytesHomogeneousInt16 a4 = {};
+ Struct4BytesHomogeneousInt16 a5 = {};
+ Struct4BytesHomogeneousInt16 a6 = {};
+ Struct4BytesHomogeneousInt16 a7 = {};
+ Struct4BytesHomogeneousInt16 a8 = {};
+ Struct4BytesHomogeneousInt16 a9 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -6817,16 +6817,16 @@
Struct7BytesHomogeneousUint8 a7,
Struct7BytesHomogeneousUint8 a8,
Struct7BytesHomogeneousUint8 a9)) {
- Struct7BytesHomogeneousUint8 a0;
- Struct7BytesHomogeneousUint8 a1;
- Struct7BytesHomogeneousUint8 a2;
- Struct7BytesHomogeneousUint8 a3;
- Struct7BytesHomogeneousUint8 a4;
- Struct7BytesHomogeneousUint8 a5;
- Struct7BytesHomogeneousUint8 a6;
- Struct7BytesHomogeneousUint8 a7;
- Struct7BytesHomogeneousUint8 a8;
- Struct7BytesHomogeneousUint8 a9;
+ Struct7BytesHomogeneousUint8 a0 = {};
+ Struct7BytesHomogeneousUint8 a1 = {};
+ Struct7BytesHomogeneousUint8 a2 = {};
+ Struct7BytesHomogeneousUint8 a3 = {};
+ Struct7BytesHomogeneousUint8 a4 = {};
+ Struct7BytesHomogeneousUint8 a5 = {};
+ Struct7BytesHomogeneousUint8 a6 = {};
+ Struct7BytesHomogeneousUint8 a7 = {};
+ Struct7BytesHomogeneousUint8 a8 = {};
+ Struct7BytesHomogeneousUint8 a9 = {};
a0.a0 = 1;
a0.a1 = 2;
@@ -6978,16 +6978,16 @@
Struct7BytesInt4ByteAligned a7,
Struct7BytesInt4ByteAligned a8,
Struct7BytesInt4ByteAligned a9)) {
- Struct7BytesInt4ByteAligned a0;
- Struct7BytesInt4ByteAligned a1;
- Struct7BytesInt4ByteAligned a2;
- Struct7BytesInt4ByteAligned a3;
- Struct7BytesInt4ByteAligned a4;
- Struct7BytesInt4ByteAligned a5;
- Struct7BytesInt4ByteAligned a6;
- Struct7BytesInt4ByteAligned a7;
- Struct7BytesInt4ByteAligned a8;
- Struct7BytesInt4ByteAligned a9;
+ Struct7BytesInt4ByteAligned a0 = {};
+ Struct7BytesInt4ByteAligned a1 = {};
+ Struct7BytesInt4ByteAligned a2 = {};
+ Struct7BytesInt4ByteAligned a3 = {};
+ Struct7BytesInt4ByteAligned a4 = {};
+ Struct7BytesInt4ByteAligned a5 = {};
+ Struct7BytesInt4ByteAligned a6 = {};
+ Struct7BytesInt4ByteAligned a7 = {};
+ Struct7BytesInt4ByteAligned a8 = {};
+ Struct7BytesInt4ByteAligned a9 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -7073,16 +7073,16 @@
Struct8BytesInt a7,
Struct8BytesInt a8,
Struct8BytesInt a9)) {
- Struct8BytesInt a0;
- Struct8BytesInt a1;
- Struct8BytesInt a2;
- Struct8BytesInt a3;
- Struct8BytesInt a4;
- Struct8BytesInt a5;
- Struct8BytesInt a6;
- Struct8BytesInt a7;
- Struct8BytesInt a8;
- Struct8BytesInt a9;
+ Struct8BytesInt a0 = {};
+ Struct8BytesInt a1 = {};
+ Struct8BytesInt a2 = {};
+ Struct8BytesInt a3 = {};
+ Struct8BytesInt a4 = {};
+ Struct8BytesInt a5 = {};
+ Struct8BytesInt a6 = {};
+ Struct8BytesInt a7 = {};
+ Struct8BytesInt a8 = {};
+ Struct8BytesInt a9 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -7165,16 +7165,16 @@
Struct8BytesHomogeneousFloat a7,
Struct8BytesHomogeneousFloat a8,
Struct8BytesHomogeneousFloat a9)) {
- Struct8BytesHomogeneousFloat a0;
- Struct8BytesHomogeneousFloat a1;
- Struct8BytesHomogeneousFloat a2;
- Struct8BytesHomogeneousFloat a3;
- Struct8BytesHomogeneousFloat a4;
- Struct8BytesHomogeneousFloat a5;
- Struct8BytesHomogeneousFloat a6;
- Struct8BytesHomogeneousFloat a7;
- Struct8BytesHomogeneousFloat a8;
- Struct8BytesHomogeneousFloat a9;
+ Struct8BytesHomogeneousFloat a0 = {};
+ Struct8BytesHomogeneousFloat a1 = {};
+ Struct8BytesHomogeneousFloat a2 = {};
+ Struct8BytesHomogeneousFloat a3 = {};
+ Struct8BytesHomogeneousFloat a4 = {};
+ Struct8BytesHomogeneousFloat a5 = {};
+ Struct8BytesHomogeneousFloat a6 = {};
+ Struct8BytesHomogeneousFloat a7 = {};
+ Struct8BytesHomogeneousFloat a8 = {};
+ Struct8BytesHomogeneousFloat a9 = {};
a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -7244,16 +7244,16 @@
Struct8BytesMixed a7,
Struct8BytesMixed a8,
Struct8BytesMixed a9)) {
- Struct8BytesMixed a0;
- Struct8BytesMixed a1;
- Struct8BytesMixed a2;
- Struct8BytesMixed a3;
- Struct8BytesMixed a4;
- Struct8BytesMixed a5;
- Struct8BytesMixed a6;
- Struct8BytesMixed a7;
- Struct8BytesMixed a8;
- Struct8BytesMixed a9;
+ Struct8BytesMixed a0 = {};
+ Struct8BytesMixed a1 = {};
+ Struct8BytesMixed a2 = {};
+ Struct8BytesMixed a3 = {};
+ Struct8BytesMixed a4 = {};
+ Struct8BytesMixed a5 = {};
+ Struct8BytesMixed a6 = {};
+ Struct8BytesMixed a7 = {};
+ Struct8BytesMixed a8 = {};
+ Struct8BytesMixed a9 = {};
a0.a0 = -1.0;
a0.a1 = 2;
@@ -7339,16 +7339,16 @@
Struct9BytesHomogeneousUint8 a7,
Struct9BytesHomogeneousUint8 a8,
Struct9BytesHomogeneousUint8 a9)) {
- Struct9BytesHomogeneousUint8 a0;
- Struct9BytesHomogeneousUint8 a1;
- Struct9BytesHomogeneousUint8 a2;
- Struct9BytesHomogeneousUint8 a3;
- Struct9BytesHomogeneousUint8 a4;
- Struct9BytesHomogeneousUint8 a5;
- Struct9BytesHomogeneousUint8 a6;
- Struct9BytesHomogeneousUint8 a7;
- Struct9BytesHomogeneousUint8 a8;
- Struct9BytesHomogeneousUint8 a9;
+ Struct9BytesHomogeneousUint8 a0 = {};
+ Struct9BytesHomogeneousUint8 a1 = {};
+ Struct9BytesHomogeneousUint8 a2 = {};
+ Struct9BytesHomogeneousUint8 a3 = {};
+ Struct9BytesHomogeneousUint8 a4 = {};
+ Struct9BytesHomogeneousUint8 a5 = {};
+ Struct9BytesHomogeneousUint8 a6 = {};
+ Struct9BytesHomogeneousUint8 a7 = {};
+ Struct9BytesHomogeneousUint8 a8 = {};
+ Struct9BytesHomogeneousUint8 a9 = {};
a0.a0 = 1;
a0.a1 = 2;
@@ -7531,16 +7531,16 @@
Struct9BytesInt4Or8ByteAligned a7,
Struct9BytesInt4Or8ByteAligned a8,
Struct9BytesInt4Or8ByteAligned a9)) {
- Struct9BytesInt4Or8ByteAligned a0;
- Struct9BytesInt4Or8ByteAligned a1;
- Struct9BytesInt4Or8ByteAligned a2;
- Struct9BytesInt4Or8ByteAligned a3;
- Struct9BytesInt4Or8ByteAligned a4;
- Struct9BytesInt4Or8ByteAligned a5;
- Struct9BytesInt4Or8ByteAligned a6;
- Struct9BytesInt4Or8ByteAligned a7;
- Struct9BytesInt4Or8ByteAligned a8;
- Struct9BytesInt4Or8ByteAligned a9;
+ Struct9BytesInt4Or8ByteAligned a0 = {};
+ Struct9BytesInt4Or8ByteAligned a1 = {};
+ Struct9BytesInt4Or8ByteAligned a2 = {};
+ Struct9BytesInt4Or8ByteAligned a3 = {};
+ Struct9BytesInt4Or8ByteAligned a4 = {};
+ Struct9BytesInt4Or8ByteAligned a5 = {};
+ Struct9BytesInt4Or8ByteAligned a6 = {};
+ Struct9BytesInt4Or8ByteAligned a7 = {};
+ Struct9BytesInt4Or8ByteAligned a8 = {};
+ Struct9BytesInt4Or8ByteAligned a9 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -7611,12 +7611,12 @@
Struct12BytesHomogeneousFloat a3,
Struct12BytesHomogeneousFloat a4,
Struct12BytesHomogeneousFloat a5)) {
- Struct12BytesHomogeneousFloat a0;
- Struct12BytesHomogeneousFloat a1;
- Struct12BytesHomogeneousFloat a2;
- Struct12BytesHomogeneousFloat a3;
- Struct12BytesHomogeneousFloat a4;
- Struct12BytesHomogeneousFloat a5;
+ Struct12BytesHomogeneousFloat a0 = {};
+ Struct12BytesHomogeneousFloat a1 = {};
+ Struct12BytesHomogeneousFloat a2 = {};
+ Struct12BytesHomogeneousFloat a3 = {};
+ Struct12BytesHomogeneousFloat a4 = {};
+ Struct12BytesHomogeneousFloat a5 = {};
a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -7680,11 +7680,11 @@
Struct16BytesHomogeneousFloat a2,
Struct16BytesHomogeneousFloat a3,
Struct16BytesHomogeneousFloat a4)) {
- Struct16BytesHomogeneousFloat a0;
- Struct16BytesHomogeneousFloat a1;
- Struct16BytesHomogeneousFloat a2;
- Struct16BytesHomogeneousFloat a3;
- Struct16BytesHomogeneousFloat a4;
+ Struct16BytesHomogeneousFloat a0 = {};
+ Struct16BytesHomogeneousFloat a1 = {};
+ Struct16BytesHomogeneousFloat a2 = {};
+ Struct16BytesHomogeneousFloat a3 = {};
+ Struct16BytesHomogeneousFloat a4 = {};
a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -7756,16 +7756,16 @@
Struct16BytesMixed a7,
Struct16BytesMixed a8,
Struct16BytesMixed a9)) {
- Struct16BytesMixed a0;
- Struct16BytesMixed a1;
- Struct16BytesMixed a2;
- Struct16BytesMixed a3;
- Struct16BytesMixed a4;
- Struct16BytesMixed a5;
- Struct16BytesMixed a6;
- Struct16BytesMixed a7;
- Struct16BytesMixed a8;
- Struct16BytesMixed a9;
+ Struct16BytesMixed a0 = {};
+ Struct16BytesMixed a1 = {};
+ Struct16BytesMixed a2 = {};
+ Struct16BytesMixed a3 = {};
+ Struct16BytesMixed a4 = {};
+ Struct16BytesMixed a5 = {};
+ Struct16BytesMixed a6 = {};
+ Struct16BytesMixed a7 = {};
+ Struct16BytesMixed a8 = {};
+ Struct16BytesMixed a9 = {};
a0.a0 = -1.0;
a0.a1 = 2;
@@ -7837,16 +7837,16 @@
Struct16BytesMixed2 a7,
Struct16BytesMixed2 a8,
Struct16BytesMixed2 a9)) {
- Struct16BytesMixed2 a0;
- Struct16BytesMixed2 a1;
- Struct16BytesMixed2 a2;
- Struct16BytesMixed2 a3;
- Struct16BytesMixed2 a4;
- Struct16BytesMixed2 a5;
- Struct16BytesMixed2 a6;
- Struct16BytesMixed2 a7;
- Struct16BytesMixed2 a8;
- Struct16BytesMixed2 a9;
+ Struct16BytesMixed2 a0 = {};
+ Struct16BytesMixed2 a1 = {};
+ Struct16BytesMixed2 a2 = {};
+ Struct16BytesMixed2 a3 = {};
+ Struct16BytesMixed2 a4 = {};
+ Struct16BytesMixed2 a5 = {};
+ Struct16BytesMixed2 a6 = {};
+ Struct16BytesMixed2 a7 = {};
+ Struct16BytesMixed2 a8 = {};
+ Struct16BytesMixed2 a9 = {};
a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -7942,16 +7942,16 @@
Struct17BytesInt a7,
Struct17BytesInt a8,
Struct17BytesInt a9)) {
- Struct17BytesInt a0;
- Struct17BytesInt a1;
- Struct17BytesInt a2;
- Struct17BytesInt a3;
- Struct17BytesInt a4;
- Struct17BytesInt a5;
- Struct17BytesInt a6;
- Struct17BytesInt a7;
- Struct17BytesInt a8;
- Struct17BytesInt a9;
+ Struct17BytesInt a0 = {};
+ Struct17BytesInt a1 = {};
+ Struct17BytesInt a2 = {};
+ Struct17BytesInt a3 = {};
+ Struct17BytesInt a4 = {};
+ Struct17BytesInt a5 = {};
+ Struct17BytesInt a6 = {};
+ Struct17BytesInt a7 = {};
+ Struct17BytesInt a8 = {};
+ Struct17BytesInt a9 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -8038,16 +8038,16 @@
Struct19BytesHomogeneousUint8 a7,
Struct19BytesHomogeneousUint8 a8,
Struct19BytesHomogeneousUint8 a9)) {
- Struct19BytesHomogeneousUint8 a0;
- Struct19BytesHomogeneousUint8 a1;
- Struct19BytesHomogeneousUint8 a2;
- Struct19BytesHomogeneousUint8 a3;
- Struct19BytesHomogeneousUint8 a4;
- Struct19BytesHomogeneousUint8 a5;
- Struct19BytesHomogeneousUint8 a6;
- Struct19BytesHomogeneousUint8 a7;
- Struct19BytesHomogeneousUint8 a8;
- Struct19BytesHomogeneousUint8 a9;
+ Struct19BytesHomogeneousUint8 a0 = {};
+ Struct19BytesHomogeneousUint8 a1 = {};
+ Struct19BytesHomogeneousUint8 a2 = {};
+ Struct19BytesHomogeneousUint8 a3 = {};
+ Struct19BytesHomogeneousUint8 a4 = {};
+ Struct19BytesHomogeneousUint8 a5 = {};
+ Struct19BytesHomogeneousUint8 a6 = {};
+ Struct19BytesHomogeneousUint8 a7 = {};
+ Struct19BytesHomogeneousUint8 a8 = {};
+ Struct19BytesHomogeneousUint8 a9 = {};
a0.a0 = 1;
a0.a1 = 2;
@@ -8380,16 +8380,16 @@
Struct20BytesHomogeneousInt32 a7,
Struct20BytesHomogeneousInt32 a8,
Struct20BytesHomogeneousInt32 a9)) {
- Struct20BytesHomogeneousInt32 a0;
- Struct20BytesHomogeneousInt32 a1;
- Struct20BytesHomogeneousInt32 a2;
- Struct20BytesHomogeneousInt32 a3;
- Struct20BytesHomogeneousInt32 a4;
- Struct20BytesHomogeneousInt32 a5;
- Struct20BytesHomogeneousInt32 a6;
- Struct20BytesHomogeneousInt32 a7;
- Struct20BytesHomogeneousInt32 a8;
- Struct20BytesHomogeneousInt32 a9;
+ Struct20BytesHomogeneousInt32 a0 = {};
+ Struct20BytesHomogeneousInt32 a1 = {};
+ Struct20BytesHomogeneousInt32 a2 = {};
+ Struct20BytesHomogeneousInt32 a3 = {};
+ Struct20BytesHomogeneousInt32 a4 = {};
+ Struct20BytesHomogeneousInt32 a5 = {};
+ Struct20BytesHomogeneousInt32 a6 = {};
+ Struct20BytesHomogeneousInt32 a7 = {};
+ Struct20BytesHomogeneousInt32 a8 = {};
+ Struct20BytesHomogeneousInt32 a9 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -8487,7 +8487,7 @@
DART_EXPORT intptr_t TestPassStruct20BytesHomogeneousFloat(
// NOLINTNEXTLINE(whitespace/parens)
float (*f)(Struct20BytesHomogeneousFloat a0)) {
- Struct20BytesHomogeneousFloat a0;
+ Struct20BytesHomogeneousFloat a0 = {};
a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -8533,11 +8533,11 @@
Struct32BytesHomogeneousDouble a2,
Struct32BytesHomogeneousDouble a3,
Struct32BytesHomogeneousDouble a4)) {
- Struct32BytesHomogeneousDouble a0;
- Struct32BytesHomogeneousDouble a1;
- Struct32BytesHomogeneousDouble a2;
- Struct32BytesHomogeneousDouble a3;
- Struct32BytesHomogeneousDouble a4;
+ Struct32BytesHomogeneousDouble a0 = {};
+ Struct32BytesHomogeneousDouble a1 = {};
+ Struct32BytesHomogeneousDouble a2 = {};
+ Struct32BytesHomogeneousDouble a3 = {};
+ Struct32BytesHomogeneousDouble a4 = {};
a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -8597,7 +8597,7 @@
DART_EXPORT intptr_t TestPassStruct40BytesHomogeneousDouble(
// NOLINTNEXTLINE(whitespace/parens)
double (*f)(Struct40BytesHomogeneousDouble a0)) {
- Struct40BytesHomogeneousDouble a0;
+ Struct40BytesHomogeneousDouble a0 = {};
a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -8638,7 +8638,7 @@
DART_EXPORT intptr_t TestPassStruct1024BytesHomogeneousUint64(
// NOLINTNEXTLINE(whitespace/parens)
uint64_t (*f)(Struct1024BytesHomogeneousUint64 a0)) {
- Struct1024BytesHomogeneousUint64 a0;
+ Struct1024BytesHomogeneousUint64 a0 = {};
a0.a0 = 1;
a0.a1 = 2;
@@ -8846,13 +8846,13 @@
Struct16BytesHomogeneousFloat a7,
float a8)) {
float a0;
- Struct16BytesHomogeneousFloat a1;
+ Struct16BytesHomogeneousFloat a1 = {};
float a2;
- Struct16BytesHomogeneousFloat a3;
+ Struct16BytesHomogeneousFloat a3 = {};
float a4;
- Struct16BytesHomogeneousFloat a5;
+ Struct16BytesHomogeneousFloat a5 = {};
float a6;
- Struct16BytesHomogeneousFloat a7;
+ Struct16BytesHomogeneousFloat a7 = {};
float a8;
a0 = -1.0;
@@ -8923,13 +8923,13 @@
Struct32BytesHomogeneousDouble a7,
float a8)) {
float a0;
- Struct32BytesHomogeneousDouble a1;
+ Struct32BytesHomogeneousDouble a1 = {};
float a2;
- Struct32BytesHomogeneousDouble a3;
+ Struct32BytesHomogeneousDouble a3 = {};
float a4;
- Struct32BytesHomogeneousDouble a5;
+ Struct32BytesHomogeneousDouble a5 = {};
float a6;
- Struct32BytesHomogeneousDouble a7;
+ Struct32BytesHomogeneousDouble a7 = {};
float a8;
a0 = -1.0;
@@ -9004,13 +9004,13 @@
Struct16BytesMixed a7,
int8_t a8)) {
int8_t a0;
- Struct16BytesMixed a1;
+ Struct16BytesMixed a1 = {};
int8_t a2;
- Struct16BytesMixed a3;
+ Struct16BytesMixed a3 = {};
int8_t a4;
- Struct16BytesMixed a5;
+ Struct16BytesMixed a5 = {};
int8_t a6;
- Struct16BytesMixed a7;
+ Struct16BytesMixed a7 = {};
int8_t a8;
a0 = -1;
@@ -9081,10 +9081,10 @@
double a3;
double a4;
double a5;
- Struct16BytesMixed a6;
- Struct16BytesMixed a7;
- Struct16BytesMixed a8;
- Struct16BytesMixed a9;
+ Struct16BytesMixed a6 = {};
+ Struct16BytesMixed a7 = {};
+ Struct16BytesMixed a8 = {};
+ Struct16BytesMixed a9 = {};
int32_t a10;
a0 = -1.0;
@@ -9152,10 +9152,10 @@
int32_t a1;
int32_t a2;
int32_t a3;
- Struct16BytesMixed a4;
- Struct16BytesMixed a5;
- Struct16BytesMixed a6;
- Struct16BytesMixed a7;
+ Struct16BytesMixed a4 = {};
+ Struct16BytesMixed a5 = {};
+ Struct16BytesMixed a6 = {};
+ Struct16BytesMixed a7 = {};
double a8;
a0 = -1;
@@ -9210,9 +9210,9 @@
double (*f)(Struct40BytesHomogeneousDouble a0,
Struct4BytesHomogeneousInt16 a1,
Struct8BytesHomogeneousFloat a2)) {
- Struct40BytesHomogeneousDouble a0;
- Struct4BytesHomogeneousInt16 a1;
- Struct8BytesHomogeneousFloat a2;
+ Struct40BytesHomogeneousDouble a0 = {};
+ Struct4BytesHomogeneousInt16 a1 = {};
+ Struct8BytesHomogeneousFloat a2 = {};
a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -9315,28 +9315,28 @@
double a15;
int64_t a16;
int8_t a17;
- Struct1ByteInt a18;
+ Struct1ByteInt a18 = {};
int64_t a19;
int8_t a20;
- Struct4BytesHomogeneousInt16 a21;
+ Struct4BytesHomogeneousInt16 a21 = {};
int64_t a22;
int8_t a23;
- Struct8BytesInt a24;
+ Struct8BytesInt a24 = {};
int64_t a25;
int8_t a26;
- Struct8BytesHomogeneousFloat a27;
+ Struct8BytesHomogeneousFloat a27 = {};
int64_t a28;
int8_t a29;
- Struct8BytesMixed a30;
+ Struct8BytesMixed a30 = {};
int64_t a31;
int8_t a32;
- StructAlignmentInt16 a33;
+ StructAlignmentInt16 a33 = {};
int64_t a34;
int8_t a35;
- StructAlignmentInt32 a36;
+ StructAlignmentInt32 a36 = {};
int64_t a37;
int8_t a38;
- StructAlignmentInt64 a39;
+ StructAlignmentInt64 a39 = {};
a0 = -1;
a1 = 2;
@@ -9448,7 +9448,7 @@
DART_EXPORT intptr_t TestPassStructAlignmentInt16(
// NOLINTNEXTLINE(whitespace/parens)
int64_t (*f)(StructAlignmentInt16 a0)) {
- StructAlignmentInt16 a0;
+ StructAlignmentInt16 a0 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -9487,7 +9487,7 @@
DART_EXPORT intptr_t TestPassStructAlignmentInt32(
// NOLINTNEXTLINE(whitespace/parens)
int64_t (*f)(StructAlignmentInt32 a0)) {
- StructAlignmentInt32 a0;
+ StructAlignmentInt32 a0 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -9526,7 +9526,7 @@
DART_EXPORT intptr_t TestPassStructAlignmentInt64(
// NOLINTNEXTLINE(whitespace/parens)
int64_t (*f)(StructAlignmentInt64 a0)) {
- StructAlignmentInt64 a0;
+ StructAlignmentInt64 a0 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -9575,16 +9575,16 @@
Struct8BytesNestedInt a7,
Struct8BytesNestedInt a8,
Struct8BytesNestedInt a9)) {
- Struct8BytesNestedInt a0;
- Struct8BytesNestedInt a1;
- Struct8BytesNestedInt a2;
- Struct8BytesNestedInt a3;
- Struct8BytesNestedInt a4;
- Struct8BytesNestedInt a5;
- Struct8BytesNestedInt a6;
- Struct8BytesNestedInt a7;
- Struct8BytesNestedInt a8;
- Struct8BytesNestedInt a9;
+ Struct8BytesNestedInt a0 = {};
+ Struct8BytesNestedInt a1 = {};
+ Struct8BytesNestedInt a2 = {};
+ Struct8BytesNestedInt a3 = {};
+ Struct8BytesNestedInt a4 = {};
+ Struct8BytesNestedInt a5 = {};
+ Struct8BytesNestedInt a6 = {};
+ Struct8BytesNestedInt a7 = {};
+ Struct8BytesNestedInt a8 = {};
+ Struct8BytesNestedInt a9 = {};
a0.a0.a0 = -1;
a0.a0.a1 = 2;
@@ -9682,16 +9682,16 @@
Struct8BytesNestedFloat a7,
Struct8BytesNestedFloat a8,
Struct8BytesNestedFloat a9)) {
- Struct8BytesNestedFloat a0;
- Struct8BytesNestedFloat a1;
- Struct8BytesNestedFloat a2;
- Struct8BytesNestedFloat a3;
- Struct8BytesNestedFloat a4;
- Struct8BytesNestedFloat a5;
- Struct8BytesNestedFloat a6;
- Struct8BytesNestedFloat a7;
- Struct8BytesNestedFloat a8;
- Struct8BytesNestedFloat a9;
+ Struct8BytesNestedFloat a0 = {};
+ Struct8BytesNestedFloat a1 = {};
+ Struct8BytesNestedFloat a2 = {};
+ Struct8BytesNestedFloat a3 = {};
+ Struct8BytesNestedFloat a4 = {};
+ Struct8BytesNestedFloat a5 = {};
+ Struct8BytesNestedFloat a6 = {};
+ Struct8BytesNestedFloat a7 = {};
+ Struct8BytesNestedFloat a8 = {};
+ Struct8BytesNestedFloat a9 = {};
a0.a0.a0 = -1.0;
a0.a1.a0 = 2.0;
@@ -9765,16 +9765,16 @@
Struct8BytesNestedFloat2 a7,
Struct8BytesNestedFloat2 a8,
Struct8BytesNestedFloat2 a9)) {
- Struct8BytesNestedFloat2 a0;
- Struct8BytesNestedFloat2 a1;
- Struct8BytesNestedFloat2 a2;
- Struct8BytesNestedFloat2 a3;
- Struct8BytesNestedFloat2 a4;
- Struct8BytesNestedFloat2 a5;
- Struct8BytesNestedFloat2 a6;
- Struct8BytesNestedFloat2 a7;
- Struct8BytesNestedFloat2 a8;
- Struct8BytesNestedFloat2 a9;
+ Struct8BytesNestedFloat2 a0 = {};
+ Struct8BytesNestedFloat2 a1 = {};
+ Struct8BytesNestedFloat2 a2 = {};
+ Struct8BytesNestedFloat2 a3 = {};
+ Struct8BytesNestedFloat2 a4 = {};
+ Struct8BytesNestedFloat2 a5 = {};
+ Struct8BytesNestedFloat2 a6 = {};
+ Struct8BytesNestedFloat2 a7 = {};
+ Struct8BytesNestedFloat2 a8 = {};
+ Struct8BytesNestedFloat2 a9 = {};
a0.a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -9845,16 +9845,16 @@
Struct8BytesNestedMixed a7,
Struct8BytesNestedMixed a8,
Struct8BytesNestedMixed a9)) {
- Struct8BytesNestedMixed a0;
- Struct8BytesNestedMixed a1;
- Struct8BytesNestedMixed a2;
- Struct8BytesNestedMixed a3;
- Struct8BytesNestedMixed a4;
- Struct8BytesNestedMixed a5;
- Struct8BytesNestedMixed a6;
- Struct8BytesNestedMixed a7;
- Struct8BytesNestedMixed a8;
- Struct8BytesNestedMixed a9;
+ Struct8BytesNestedMixed a0 = {};
+ Struct8BytesNestedMixed a1 = {};
+ Struct8BytesNestedMixed a2 = {};
+ Struct8BytesNestedMixed a3 = {};
+ Struct8BytesNestedMixed a4 = {};
+ Struct8BytesNestedMixed a5 = {};
+ Struct8BytesNestedMixed a6 = {};
+ Struct8BytesNestedMixed a7 = {};
+ Struct8BytesNestedMixed a8 = {};
+ Struct8BytesNestedMixed a9 = {};
a0.a0.a0 = -1;
a0.a0.a1 = 2;
@@ -9929,8 +9929,8 @@
DART_EXPORT intptr_t TestPassStruct16BytesNestedIntx2(
// NOLINTNEXTLINE(whitespace/parens)
int64_t (*f)(Struct16BytesNestedInt a0, Struct16BytesNestedInt a1)) {
- Struct16BytesNestedInt a0;
- Struct16BytesNestedInt a1;
+ Struct16BytesNestedInt a0 = {};
+ Struct16BytesNestedInt a1 = {};
a0.a0.a0.a0 = -1;
a0.a0.a0.a1 = 2;
@@ -9987,8 +9987,8 @@
DART_EXPORT intptr_t TestPassStruct32BytesNestedIntx2(
// NOLINTNEXTLINE(whitespace/parens)
int64_t (*f)(Struct32BytesNestedInt a0, Struct32BytesNestedInt a1)) {
- Struct32BytesNestedInt a0;
- Struct32BytesNestedInt a1;
+ Struct32BytesNestedInt a0 = {};
+ Struct32BytesNestedInt a1 = {};
a0.a0.a0.a0.a0 = -1;
a0.a0.a0.a0.a1 = 2;
@@ -10070,7 +10070,7 @@
DART_EXPORT intptr_t TestPassStructNestedIntStructAlignmentInt16(
// NOLINTNEXTLINE(whitespace/parens)
int64_t (*f)(StructNestedIntStructAlignmentInt16 a0)) {
- StructNestedIntStructAlignmentInt16 a0;
+ StructNestedIntStructAlignmentInt16 a0 = {};
a0.a0.a0 = -1;
a0.a0.a1 = 2;
@@ -10114,7 +10114,7 @@
DART_EXPORT intptr_t TestPassStructNestedIntStructAlignmentInt32(
// NOLINTNEXTLINE(whitespace/parens)
int64_t (*f)(StructNestedIntStructAlignmentInt32 a0)) {
- StructNestedIntStructAlignmentInt32 a0;
+ StructNestedIntStructAlignmentInt32 a0 = {};
a0.a0.a0 = -1;
a0.a0.a1 = 2;
@@ -10158,7 +10158,7 @@
DART_EXPORT intptr_t TestPassStructNestedIntStructAlignmentInt64(
// NOLINTNEXTLINE(whitespace/parens)
int64_t (*f)(StructNestedIntStructAlignmentInt64 a0)) {
- StructNestedIntStructAlignmentInt64 a0;
+ StructNestedIntStructAlignmentInt64 a0 = {};
a0.a0.a0 = -1;
a0.a0.a1 = 2;
@@ -10205,10 +10205,10 @@
StructNestedIrregularEvenBigger a1,
StructNestedIrregularEvenBigger a2,
StructNestedIrregularEvenBigger a3)) {
- StructNestedIrregularEvenBigger a0;
- StructNestedIrregularEvenBigger a1;
- StructNestedIrregularEvenBigger a2;
- StructNestedIrregularEvenBigger a3;
+ StructNestedIrregularEvenBigger a0 = {};
+ StructNestedIrregularEvenBigger a1 = {};
+ StructNestedIrregularEvenBigger a2 = {};
+ StructNestedIrregularEvenBigger a3 = {};
a0.a0 = 1;
a0.a1.a0.a0 = 2;
@@ -10436,10 +10436,10 @@
Struct8BytesInlineArrayInt a1,
Struct8BytesInlineArrayInt a2,
Struct8BytesInlineArrayInt a3)) {
- Struct8BytesInlineArrayInt a0;
- Struct8BytesInlineArrayInt a1;
- Struct8BytesInlineArrayInt a2;
- Struct8BytesInlineArrayInt a3;
+ Struct8BytesInlineArrayInt a0 = {};
+ Struct8BytesInlineArrayInt a1 = {};
+ Struct8BytesInlineArrayInt a2 = {};
+ Struct8BytesInlineArrayInt a3 = {};
a0.a0[0] = 1;
a0.a0[1] = 2;
@@ -10531,10 +10531,10 @@
StructInlineArrayIrregular a1,
StructInlineArrayIrregular a2,
StructInlineArrayIrregular a3)) {
- StructInlineArrayIrregular a0;
- StructInlineArrayIrregular a1;
- StructInlineArrayIrregular a2;
- StructInlineArrayIrregular a3;
+ StructInlineArrayIrregular a0 = {};
+ StructInlineArrayIrregular a1 = {};
+ StructInlineArrayIrregular a2 = {};
+ StructInlineArrayIrregular a3 = {};
a0.a0[0].a0 = -1;
a0.a0[0].a1 = 2;
@@ -10600,7 +10600,7 @@
DART_EXPORT intptr_t TestPassStructInlineArray100Bytes(
// NOLINTNEXTLINE(whitespace/parens)
int32_t (*f)(StructInlineArray100Bytes a0)) {
- StructInlineArray100Bytes a0;
+ StructInlineArray100Bytes a0 = {};
a0.a0[0] = 1;
a0.a0[1] = 2;
@@ -10807,11 +10807,11 @@
StructStruct16BytesHomogeneousFloat2 a2,
StructStruct16BytesHomogeneousFloat2 a3,
StructStruct16BytesHomogeneousFloat2 a4)) {
- StructStruct16BytesHomogeneousFloat2 a0;
- StructStruct16BytesHomogeneousFloat2 a1;
- StructStruct16BytesHomogeneousFloat2 a2;
- StructStruct16BytesHomogeneousFloat2 a3;
- StructStruct16BytesHomogeneousFloat2 a4;
+ StructStruct16BytesHomogeneousFloat2 a0 = {};
+ StructStruct16BytesHomogeneousFloat2 a1 = {};
+ StructStruct16BytesHomogeneousFloat2 a2 = {};
+ StructStruct16BytesHomogeneousFloat2 a3 = {};
+ StructStruct16BytesHomogeneousFloat2 a4 = {};
a0.a0.a0 = -1.0;
a0.a1[0].a0 = 2.0;
@@ -10878,11 +10878,11 @@
StructStruct32BytesHomogeneousDouble2 a2,
StructStruct32BytesHomogeneousDouble2 a3,
StructStruct32BytesHomogeneousDouble2 a4)) {
- StructStruct32BytesHomogeneousDouble2 a0;
- StructStruct32BytesHomogeneousDouble2 a1;
- StructStruct32BytesHomogeneousDouble2 a2;
- StructStruct32BytesHomogeneousDouble2 a3;
- StructStruct32BytesHomogeneousDouble2 a4;
+ StructStruct32BytesHomogeneousDouble2 a0 = {};
+ StructStruct32BytesHomogeneousDouble2 a1 = {};
+ StructStruct32BytesHomogeneousDouble2 a2 = {};
+ StructStruct32BytesHomogeneousDouble2 a3 = {};
+ StructStruct32BytesHomogeneousDouble2 a4 = {};
a0.a0.a0 = -1.0;
a0.a1[0].a0 = 2.0;
@@ -10956,16 +10956,16 @@
StructStruct16BytesMixed3 a7,
StructStruct16BytesMixed3 a8,
StructStruct16BytesMixed3 a9)) {
- StructStruct16BytesMixed3 a0;
- StructStruct16BytesMixed3 a1;
- StructStruct16BytesMixed3 a2;
- StructStruct16BytesMixed3 a3;
- StructStruct16BytesMixed3 a4;
- StructStruct16BytesMixed3 a5;
- StructStruct16BytesMixed3 a6;
- StructStruct16BytesMixed3 a7;
- StructStruct16BytesMixed3 a8;
- StructStruct16BytesMixed3 a9;
+ StructStruct16BytesMixed3 a0 = {};
+ StructStruct16BytesMixed3 a1 = {};
+ StructStruct16BytesMixed3 a2 = {};
+ StructStruct16BytesMixed3 a3 = {};
+ StructStruct16BytesMixed3 a4 = {};
+ StructStruct16BytesMixed3 a5 = {};
+ StructStruct16BytesMixed3 a6 = {};
+ StructStruct16BytesMixed3 a7 = {};
+ StructStruct16BytesMixed3 a8 = {};
+ StructStruct16BytesMixed3 a9 = {};
a0.a0.a0 = -1.0;
a0.a1[0].a0 = 2.0;
@@ -11089,11 +11089,11 @@
Struct8BytesInlineArrayMultiDimensionalInt a5,
uint8_t a6)) {
uint8_t a0;
- Struct32BytesInlineArrayMultiDimensionalInt a1;
+ Struct32BytesInlineArrayMultiDimensionalInt a1 = {};
uint8_t a2;
- Struct8BytesInlineArrayMultiDimensionalInt a3;
+ Struct8BytesInlineArrayMultiDimensionalInt a3 = {};
uint8_t a4;
- Struct8BytesInlineArrayMultiDimensionalInt a5;
+ Struct8BytesInlineArrayMultiDimensionalInt a5 = {};
uint8_t a6;
a0 = 1;
@@ -11235,7 +11235,7 @@
Struct4BytesInlineArrayMultiDimensionalInt a1,
uint8_t a2)) {
uint8_t a0;
- Struct4BytesInlineArrayMultiDimensionalInt a1;
+ Struct4BytesInlineArrayMultiDimensionalInt a1 = {};
uint8_t a2;
a0 = 1;
@@ -11291,16 +11291,16 @@
Struct3BytesPackedInt a7,
Struct3BytesPackedInt a8,
Struct3BytesPackedInt a9)) {
- Struct3BytesPackedInt a0;
- Struct3BytesPackedInt a1;
- Struct3BytesPackedInt a2;
- Struct3BytesPackedInt a3;
- Struct3BytesPackedInt a4;
- Struct3BytesPackedInt a5;
- Struct3BytesPackedInt a6;
- Struct3BytesPackedInt a7;
- Struct3BytesPackedInt a8;
- Struct3BytesPackedInt a9;
+ Struct3BytesPackedInt a0 = {};
+ Struct3BytesPackedInt a1 = {};
+ Struct3BytesPackedInt a2 = {};
+ Struct3BytesPackedInt a3 = {};
+ Struct3BytesPackedInt a4 = {};
+ Struct3BytesPackedInt a5 = {};
+ Struct3BytesPackedInt a6 = {};
+ Struct3BytesPackedInt a7 = {};
+ Struct3BytesPackedInt a8 = {};
+ Struct3BytesPackedInt a9 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -11373,16 +11373,16 @@
Struct8BytesPackedInt a7,
Struct8BytesPackedInt a8,
Struct8BytesPackedInt a9)) {
- Struct8BytesPackedInt a0;
- Struct8BytesPackedInt a1;
- Struct8BytesPackedInt a2;
- Struct8BytesPackedInt a3;
- Struct8BytesPackedInt a4;
- Struct8BytesPackedInt a5;
- Struct8BytesPackedInt a6;
- Struct8BytesPackedInt a7;
- Struct8BytesPackedInt a8;
- Struct8BytesPackedInt a9;
+ Struct8BytesPackedInt a0 = {};
+ Struct8BytesPackedInt a1 = {};
+ Struct8BytesPackedInt a2 = {};
+ Struct8BytesPackedInt a3 = {};
+ Struct8BytesPackedInt a4 = {};
+ Struct8BytesPackedInt a5 = {};
+ Struct8BytesPackedInt a6 = {};
+ Struct8BytesPackedInt a7 = {};
+ Struct8BytesPackedInt a8 = {};
+ Struct8BytesPackedInt a9 = {};
a0.a0 = 1;
a0.a1 = 2;
@@ -11509,16 +11509,16 @@
double a10,
int32_t a11,
int32_t a12)) {
- Struct9BytesPackedMixed a0;
- Struct9BytesPackedMixed a1;
- Struct9BytesPackedMixed a2;
- Struct9BytesPackedMixed a3;
- Struct9BytesPackedMixed a4;
- Struct9BytesPackedMixed a5;
- Struct9BytesPackedMixed a6;
- Struct9BytesPackedMixed a7;
- Struct9BytesPackedMixed a8;
- Struct9BytesPackedMixed a9;
+ Struct9BytesPackedMixed a0 = {};
+ Struct9BytesPackedMixed a1 = {};
+ Struct9BytesPackedMixed a2 = {};
+ Struct9BytesPackedMixed a3 = {};
+ Struct9BytesPackedMixed a4 = {};
+ Struct9BytesPackedMixed a5 = {};
+ Struct9BytesPackedMixed a6 = {};
+ Struct9BytesPackedMixed a7 = {};
+ Struct9BytesPackedMixed a8 = {};
+ Struct9BytesPackedMixed a9 = {};
double a10;
int32_t a11;
int32_t a12;
@@ -11589,7 +11589,7 @@
DART_EXPORT intptr_t TestPassStruct5BytesPackedMixed(
// NOLINTNEXTLINE(whitespace/parens)
double (*f)(Struct5BytesPackedMixed a0)) {
- Struct5BytesPackedMixed a0;
+ Struct5BytesPackedMixed a0 = {};
a0.a0 = -1.0;
a0.a1 = 2;
@@ -11626,7 +11626,7 @@
DART_EXPORT intptr_t TestPassStructNestedAlignmentStruct5BytesPackedMixed(
// NOLINTNEXTLINE(whitespace/parens)
double (*f)(StructNestedAlignmentStruct5BytesPackedMixed a0)) {
- StructNestedAlignmentStruct5BytesPackedMixed a0;
+ StructNestedAlignmentStruct5BytesPackedMixed a0 = {};
a0.a0 = 1;
a0.a1.a0 = 2.0;
@@ -11665,7 +11665,7 @@
DART_EXPORT intptr_t TestPassStruct6BytesInlineArrayInt(
// NOLINTNEXTLINE(whitespace/parens)
double (*f)(Struct6BytesInlineArrayInt a0)) {
- Struct6BytesInlineArrayInt a0;
+ Struct6BytesInlineArrayInt a0 = {};
a0.a0[0].a0 = -1;
a0.a0[0].a1 = 2;
@@ -11706,7 +11706,7 @@
DART_EXPORT intptr_t TestPassStruct15BytesInlineArrayMixed(
// NOLINTNEXTLINE(whitespace/parens)
double (*f)(Struct15BytesInlineArrayMixed a0)) {
- Struct15BytesInlineArrayMixed a0;
+ Struct15BytesInlineArrayMixed a0 = {};
a0.a0[0].a0 = -1.0;
a0.a0[0].a1 = 2;
@@ -11759,16 +11759,16 @@
Union4BytesMixed a7,
Union4BytesMixed a8,
Union4BytesMixed a9)) {
- Union4BytesMixed a0;
- Union4BytesMixed a1;
- Union4BytesMixed a2;
- Union4BytesMixed a3;
- Union4BytesMixed a4;
- Union4BytesMixed a5;
- Union4BytesMixed a6;
- Union4BytesMixed a7;
- Union4BytesMixed a8;
- Union4BytesMixed a9;
+ Union4BytesMixed a0 = {};
+ Union4BytesMixed a1 = {};
+ Union4BytesMixed a2 = {};
+ Union4BytesMixed a3 = {};
+ Union4BytesMixed a4 = {};
+ Union4BytesMixed a5 = {};
+ Union4BytesMixed a6 = {};
+ Union4BytesMixed a7 = {};
+ Union4BytesMixed a8 = {};
+ Union4BytesMixed a9 = {};
a0.a0 = 1;
a1.a0 = 2;
@@ -11827,16 +11827,16 @@
Union8BytesNestedFloat a7,
Union8BytesNestedFloat a8,
Union8BytesNestedFloat a9)) {
- Union8BytesNestedFloat a0;
- Union8BytesNestedFloat a1;
- Union8BytesNestedFloat a2;
- Union8BytesNestedFloat a3;
- Union8BytesNestedFloat a4;
- Union8BytesNestedFloat a5;
- Union8BytesNestedFloat a6;
- Union8BytesNestedFloat a7;
- Union8BytesNestedFloat a8;
- Union8BytesNestedFloat a9;
+ Union8BytesNestedFloat a0 = {};
+ Union8BytesNestedFloat a1 = {};
+ Union8BytesNestedFloat a2 = {};
+ Union8BytesNestedFloat a3 = {};
+ Union8BytesNestedFloat a4 = {};
+ Union8BytesNestedFloat a5 = {};
+ Union8BytesNestedFloat a6 = {};
+ Union8BytesNestedFloat a7 = {};
+ Union8BytesNestedFloat a8 = {};
+ Union8BytesNestedFloat a9 = {};
a0.a0 = -1.0;
a1.a0 = 2.0;
@@ -11899,16 +11899,16 @@
Union9BytesNestedInt a7,
Union9BytesNestedInt a8,
Union9BytesNestedInt a9)) {
- Union9BytesNestedInt a0;
- Union9BytesNestedInt a1;
- Union9BytesNestedInt a2;
- Union9BytesNestedInt a3;
- Union9BytesNestedInt a4;
- Union9BytesNestedInt a5;
- Union9BytesNestedInt a6;
- Union9BytesNestedInt a7;
- Union9BytesNestedInt a8;
- Union9BytesNestedInt a9;
+ Union9BytesNestedInt a0 = {};
+ Union9BytesNestedInt a1 = {};
+ Union9BytesNestedInt a2 = {};
+ Union9BytesNestedInt a3 = {};
+ Union9BytesNestedInt a4 = {};
+ Union9BytesNestedInt a5 = {};
+ Union9BytesNestedInt a6 = {};
+ Union9BytesNestedInt a7 = {};
+ Union9BytesNestedInt a8 = {};
+ Union9BytesNestedInt a9 = {};
a0.a0.a0 = -1;
a0.a0.a1 = 2;
@@ -12052,16 +12052,16 @@
Union16BytesNestedInlineArrayFloat a7,
Union16BytesNestedInlineArrayFloat a8,
Union16BytesNestedInlineArrayFloat a9)) {
- Union16BytesNestedInlineArrayFloat a0;
- Union16BytesNestedInlineArrayFloat a1;
- Union16BytesNestedInlineArrayFloat a2;
- Union16BytesNestedInlineArrayFloat a3;
- Union16BytesNestedInlineArrayFloat a4;
- Union16BytesNestedInlineArrayFloat a5;
- Union16BytesNestedInlineArrayFloat a6;
- Union16BytesNestedInlineArrayFloat a7;
- Union16BytesNestedInlineArrayFloat a8;
- Union16BytesNestedInlineArrayFloat a9;
+ Union16BytesNestedInlineArrayFloat a0 = {};
+ Union16BytesNestedInlineArrayFloat a1 = {};
+ Union16BytesNestedInlineArrayFloat a2 = {};
+ Union16BytesNestedInlineArrayFloat a3 = {};
+ Union16BytesNestedInlineArrayFloat a4 = {};
+ Union16BytesNestedInlineArrayFloat a5 = {};
+ Union16BytesNestedInlineArrayFloat a6 = {};
+ Union16BytesNestedInlineArrayFloat a7 = {};
+ Union16BytesNestedInlineArrayFloat a8 = {};
+ Union16BytesNestedInlineArrayFloat a9 = {};
a0.a0[0] = -1.0;
a0.a0[1] = 2.0;
@@ -12171,16 +12171,16 @@
Union16BytesNestedFloat a7,
Union16BytesNestedFloat a8,
Union16BytesNestedFloat a9)) {
- Union16BytesNestedFloat a0;
- Union16BytesNestedFloat a1;
- Union16BytesNestedFloat a2;
- Union16BytesNestedFloat a3;
- Union16BytesNestedFloat a4;
- Union16BytesNestedFloat a5;
- Union16BytesNestedFloat a6;
- Union16BytesNestedFloat a7;
- Union16BytesNestedFloat a8;
- Union16BytesNestedFloat a9;
+ Union16BytesNestedFloat a0 = {};
+ Union16BytesNestedFloat a1 = {};
+ Union16BytesNestedFloat a2 = {};
+ Union16BytesNestedFloat a3 = {};
+ Union16BytesNestedFloat a4 = {};
+ Union16BytesNestedFloat a5 = {};
+ Union16BytesNestedFloat a6 = {};
+ Union16BytesNestedFloat a7 = {};
+ Union16BytesNestedFloat a8 = {};
+ Union16BytesNestedFloat a9 = {};
a0.a0.a0 = -1.0;
a0.a0.a1 = 2.0;
@@ -14652,7 +14652,7 @@
DART_EXPORT intptr_t TestReturnUnion9BytesNestedInt(
// NOLINTNEXTLINE(whitespace/parens)
Union9BytesNestedInt (*f)(Struct8BytesInt a0)) {
- Struct8BytesInt a0;
+ Struct8BytesInt a0 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -14707,7 +14707,7 @@
DART_EXPORT intptr_t TestReturnUnion16BytesNestedFloat(
// NOLINTNEXTLINE(whitespace/parens)
Union16BytesNestedFloat (*f)(Struct8BytesHomogeneousFloat a0)) {
- Struct8BytesHomogeneousFloat a0;
+ Struct8BytesHomogeneousFloat a0 = {};
a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -14754,7 +14754,7 @@
DART_EXPORT intptr_t TestReturnStructArgumentStruct1ByteInt(
// NOLINTNEXTLINE(whitespace/parens)
Struct1ByteInt (*f)(Struct1ByteInt a0)) {
- Struct1ByteInt a0;
+ Struct1ByteInt a0 = {};
a0.a0 = -1;
@@ -14810,7 +14810,7 @@
int32_t a5;
int32_t a6;
int32_t a7;
- Struct1ByteInt a8;
+ Struct1ByteInt a8 = {};
a0 = -1;
a1 = 2;
@@ -14860,7 +14860,7 @@
DART_EXPORT intptr_t TestReturnStructArgumentStruct8BytesHomogeneousFloat(
// NOLINTNEXTLINE(whitespace/parens)
Struct8BytesHomogeneousFloat (*f)(Struct8BytesHomogeneousFloat a0)) {
- Struct8BytesHomogeneousFloat a0;
+ Struct8BytesHomogeneousFloat a0 = {};
a0.a0 = -1.0;
a0.a1 = 2.0;
@@ -14902,7 +14902,7 @@
DART_EXPORT intptr_t TestReturnStructArgumentStruct20BytesHomogeneousInt32(
// NOLINTNEXTLINE(whitespace/parens)
Struct20BytesHomogeneousInt32 (*f)(Struct20BytesHomogeneousInt32 a0)) {
- Struct20BytesHomogeneousInt32 a0;
+ Struct20BytesHomogeneousInt32 a0 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -14975,7 +14975,7 @@
int32_t a5;
int32_t a6;
int32_t a7;
- Struct20BytesHomogeneousInt32 a8;
+ Struct20BytesHomogeneousInt32 a8 = {};
a0 = -1;
a1 = 2;
@@ -15040,7 +15040,7 @@
DART_EXPORT intptr_t TestReturnStructArgumentStruct8BytesInlineArrayInt(
// NOLINTNEXTLINE(whitespace/parens)
Struct8BytesInlineArrayInt (*f)(Struct8BytesInlineArrayInt a0)) {
- Struct8BytesInlineArrayInt a0;
+ Struct8BytesInlineArrayInt a0 = {};
a0.a0[0] = 1;
a0.a0[1] = 2;
@@ -15104,7 +15104,7 @@
// NOLINTNEXTLINE(whitespace/parens)
StructStruct16BytesHomogeneousFloat2 (*f)(
StructStruct16BytesHomogeneousFloat2 a0)) {
- StructStruct16BytesHomogeneousFloat2 a0;
+ StructStruct16BytesHomogeneousFloat2 a0 = {};
a0.a0.a0 = -1.0;
a0.a1[0].a0 = 2.0;
@@ -15160,7 +15160,7 @@
// NOLINTNEXTLINE(whitespace/parens)
StructStruct32BytesHomogeneousDouble2 (*f)(
StructStruct32BytesHomogeneousDouble2 a0)) {
- StructStruct32BytesHomogeneousDouble2 a0;
+ StructStruct32BytesHomogeneousDouble2 a0 = {};
a0.a0.a0 = -1.0;
a0.a1[0].a0 = 2.0;
@@ -15215,7 +15215,7 @@
DART_EXPORT intptr_t TestReturnStructArgumentStructStruct16BytesMixed3(
// NOLINTNEXTLINE(whitespace/parens)
StructStruct16BytesMixed3 (*f)(StructStruct16BytesMixed3 a0)) {
- StructStruct16BytesMixed3 a0;
+ StructStruct16BytesMixed3 a0 = {};
a0.a0.a0 = -1.0;
a0.a1[0].a0 = 2.0;
@@ -15437,8 +15437,8 @@
// NOLINTNEXTLINE(whitespace/parens)
Struct8BytesNestedInt (*f)(Struct4BytesHomogeneousInt16 a0,
Struct4BytesHomogeneousInt16 a1)) {
- Struct4BytesHomogeneousInt16 a0;
- Struct4BytesHomogeneousInt16 a1;
+ Struct4BytesHomogeneousInt16 a0 = {};
+ Struct4BytesHomogeneousInt16 a1 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -15490,8 +15490,8 @@
DART_EXPORT intptr_t TestReturnStruct8BytesNestedFloat(
// NOLINTNEXTLINE(whitespace/parens)
Struct8BytesNestedFloat (*f)(Struct4BytesFloat a0, Struct4BytesFloat a1)) {
- Struct4BytesFloat a0;
- Struct4BytesFloat a1;
+ Struct4BytesFloat a0 = {};
+ Struct4BytesFloat a1 = {};
a0.a0 = -1.0;
a1.a0 = 2.0;
@@ -15534,7 +15534,7 @@
DART_EXPORT intptr_t TestReturnStruct8BytesNestedFloat2(
// NOLINTNEXTLINE(whitespace/parens)
Struct8BytesNestedFloat2 (*f)(Struct4BytesFloat a0, float a1)) {
- Struct4BytesFloat a0;
+ Struct4BytesFloat a0 = {};
float a1;
a0.a0 = -1.0;
@@ -15578,8 +15578,8 @@
// NOLINTNEXTLINE(whitespace/parens)
Struct8BytesNestedMixed (*f)(Struct4BytesHomogeneousInt16 a0,
Struct4BytesFloat a1)) {
- Struct4BytesHomogeneousInt16 a0;
- Struct4BytesFloat a1;
+ Struct4BytesHomogeneousInt16 a0 = {};
+ Struct4BytesFloat a1 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -15627,8 +15627,8 @@
// NOLINTNEXTLINE(whitespace/parens)
Struct16BytesNestedInt (*f)(Struct8BytesNestedInt a0,
Struct8BytesNestedInt a1)) {
- Struct8BytesNestedInt a0;
- Struct8BytesNestedInt a1;
+ Struct8BytesNestedInt a0 = {};
+ Struct8BytesNestedInt a1 = {};
a0.a0.a0 = -1;
a0.a0.a1 = 2;
@@ -15700,8 +15700,8 @@
// NOLINTNEXTLINE(whitespace/parens)
Struct32BytesNestedInt (*f)(Struct16BytesNestedInt a0,
Struct16BytesNestedInt a1)) {
- Struct16BytesNestedInt a0;
- Struct16BytesNestedInt a1;
+ Struct16BytesNestedInt a0 = {};
+ Struct16BytesNestedInt a1 = {};
a0.a0.a0.a0 = -1;
a0.a0.a0.a1 = 2;
@@ -15814,8 +15814,8 @@
// NOLINTNEXTLINE(whitespace/parens)
StructNestedIntStructAlignmentInt16 (*f)(StructAlignmentInt16 a0,
StructAlignmentInt16 a1)) {
- StructAlignmentInt16 a0;
- StructAlignmentInt16 a1;
+ StructAlignmentInt16 a0 = {};
+ StructAlignmentInt16 a1 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -15879,8 +15879,8 @@
// NOLINTNEXTLINE(whitespace/parens)
StructNestedIntStructAlignmentInt32 (*f)(StructAlignmentInt32 a0,
StructAlignmentInt32 a1)) {
- StructAlignmentInt32 a0;
- StructAlignmentInt32 a1;
+ StructAlignmentInt32 a0 = {};
+ StructAlignmentInt32 a1 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -15944,8 +15944,8 @@
// NOLINTNEXTLINE(whitespace/parens)
StructNestedIntStructAlignmentInt64 (*f)(StructAlignmentInt64 a0,
StructAlignmentInt64 a1)) {
- StructAlignmentInt64 a0;
- StructAlignmentInt64 a1;
+ StructAlignmentInt64 a0 = {};
+ StructAlignmentInt64 a1 = {};
a0.a0 = -1;
a0.a1 = 2;
@@ -16012,8 +16012,8 @@
StructNestedIrregularBigger a2,
double a3)) {
uint64_t a0;
- StructNestedIrregularBigger a1;
- StructNestedIrregularBigger a2;
+ StructNestedIrregularBigger a1 = {};
+ StructNestedIrregularBigger a2 = {};
double a3;
a0 = 1;
diff --git a/runtime/tests/vm/dart/isolates/fast_object_copy_test.dart b/runtime/tests/vm/dart/isolates/fast_object_copy_test.dart
new file mode 100644
index 0000000..00297e1
--- /dev/null
+++ b/runtime/tests/vm/dart/isolates/fast_object_copy_test.dart
@@ -0,0 +1,482 @@
+// Copyright (c) 2021, 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.
+
+// VMOptions=
+// VMOptions=--enable-isolate-groups --experimental-enable-isolate-groups-jit
+
+// The tests in this file are particularly for an implementation that tries to
+// allocate the entire graph in BFS order using a fast new space allocation
+// running in non-GC safe mode and a fallback to a slower GC-safe mode that uses
+// handles.
+//
+// The tests will sometimes trigger the fallback from fast to slow case by
+// inserting an object that cannot be allocated in new space.
+
+import 'dart:async';
+import 'dart:io';
+import 'dart:isolate';
+import 'dart:nativewrappers';
+import 'dart:typed_data';
+
+import 'package:expect/expect.dart';
+
+class ClassWithNativeFields extends NativeFieldWrapperClass1 {}
+
+final Uint8List largeExternalTypedData =
+ File(Platform.resolvedExecutable).readAsBytesSync()..[0] = 42;
+final Uint8List largeInternalTypedData = Uint8List(20 * 1024 * 1024)..[0] = 42;
+
+final Uint8List smallExternalTypedData =
+ File(Platform.script.toFilePath()).readAsBytesSync();
+final Uint8List smallExternalTypedDataView =
+ Uint8List.view(smallExternalTypedData.buffer, 1, 1);
+
+final Uint8List smallInternalTypedData = Uint8List.fromList([0, 1, 2]);
+final Uint8List smallInternalTypedDataView =
+ Uint8List.view(smallInternalTypedData.buffer, 1, 1);
+
+final Uint8List notAllocatableInTLAB = largeInternalTypedData;
+final Object invalidObject = ClassWithNativeFields();
+
+final smallPrimitives = [
+ 1,
+ 0xffffffffffffffff,
+ 'foobar',
+ UserObject(1, 1.2, ''),
+ smallInternalTypedData,
+ smallInternalTypedDataView,
+];
+final smallContainers = [
+ [],
+ {},
+ [...smallPrimitives],
+ {for (final p in smallPrimitives) p: p},
+ UserObject(2, 2.3, smallPrimitives),
+];
+
+void expectGraphsMatch(dynamic a, dynamic b) {
+ if (a is int) {
+ Expect.equals(a, (b as int));
+ return;
+ }
+ if (a is double) {
+ Expect.equals(a, (b as double));
+ return;
+ }
+ if (a is String) {
+ Expect.equals(a, (b as String));
+ return;
+ }
+ if (a is UserObject) {
+ final cb = b as UserObject;
+ Expect.equals(a.unboxedInt, cb.unboxedInt);
+ Expect.equals(a.unboxedDouble, cb.unboxedDouble);
+ expectGraphsMatch(a.slot, cb.slot);
+ return;
+ }
+ if (a is Uint8List) {
+ final cb = b as Uint8List;
+ Expect.equals(a.length, cb.length);
+ Expect.equals(a.offsetInBytes, cb.offsetInBytes);
+ for (int i = 0; i < a.length; ++i) {
+ Expect.equals(a[i], cb[i]);
+ }
+ if (a.offsetInBytes != 0) {
+ expectGraphsMatch(a.buffer.asUint8List(), b.buffer.asUint8List());
+ }
+ return;
+ }
+ if (a is List) {
+ final cb = b as List;
+ Expect.equals(a.length, cb.length);
+ for (int i = 0; i < a.length; ++i) {
+ expectGraphsMatch(a[i], cb[i]);
+ }
+ return;
+ }
+ if (a is Map) {
+ final cb = b as Map;
+ Expect.equals(a.length, cb.length);
+ final aKeys = a.keys.toList();
+ final aValues = a.values.toList();
+ final cbKeys = cb.keys.toList();
+ final cbValues = cb.values.toList();
+ for (int i = 0; i < a.length; ++i) {
+ expectGraphsMatch(aKeys[i], cbKeys[i]);
+ }
+ for (int i = 0; i < a.length; ++i) {
+ expectGraphsMatch(aValues[i], cbValues[i]);
+ }
+ return;
+ }
+ throw 'Unexpected object encountered when matching object graphs $a / $b';
+}
+
+void expectViewOf(Uint8List view, Uint8List backing) {
+ final int offset = view.offsetInBytes;
+ Expect.isTrue(offset > 0);
+ final int old = backing[offset];
+ view[0] = ~view[0];
+ Expect.notEquals(old, backing[offset]);
+ view[0] = ~view[0];
+ Expect.equals(old, backing[offset]);
+}
+
+class HashIncrementer {
+ static int counter = 1;
+
+ int get hashCode => counter++;
+ bool operator ==(other) => identical(this, other);
+}
+
+class UserObject {
+ final int unboxedInt;
+ final double unboxedDouble;
+ final dynamic slot;
+
+ UserObject(this.unboxedInt, this.unboxedDouble, this.slot);
+}
+
+class SendReceiveTest {
+ late final ReceivePort receivePort;
+ late final SendPort sendPort;
+ late final StreamIterator si;
+
+ SendReceiveTest();
+
+ Future run() async {
+ receivePort = ReceivePort();
+ sendPort = receivePort.sendPort;
+ si = StreamIterator(receivePort);
+
+ await testTransferrable();
+ await testTransferrable2();
+ await testTransferrable3();
+ await testTransferrable4();
+ await testTransferrable5();
+
+ await testExternalTypedData();
+ await testExternalTypedData2();
+ await testExternalTypedData3();
+ await testExternalTypedData4();
+ await testExternalTypedData5();
+
+ await testInternalTypedDataView();
+ await testInternalTypedDataView2();
+ await testInternalTypedDataView3();
+ await testInternalTypedDataView4();
+
+ await testExternalTypedDataView();
+ await testExternalTypedDataView2();
+ await testExternalTypedDataView3();
+ await testExternalTypedDataView4();
+
+ await testMapRehash();
+ await testMapRehash2();
+ await testMapRehash3();
+
+ await testFastOnly();
+ await testSlowOnly();
+
+ si.cancel();
+ receivePort.close();
+ print('done');
+ }
+
+ Future testTransferrable() async {
+ print('testTransferrable');
+ final td = TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);
+ final graph = [
+ td,
+ invalidObject,
+ ];
+ Expect.throwsArgumentError(() => sendPort.send(graph));
+ Expect.equals(42, td.materialize().asInt8List()[0]);
+ }
+
+ Future testTransferrable2() async {
+ print('testTransferrable2');
+ final td = TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);
+ final graph = [
+ td,
+ notAllocatableInTLAB,
+ invalidObject,
+ ];
+ Expect.throwsArgumentError(() => sendPort.send(graph));
+ Expect.equals(42, td.materialize().asInt8List()[0]);
+ }
+
+ Future testTransferrable3() async {
+ print('testTransferrable3');
+ final td = TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);
+ final graph = [
+ td,
+ ];
+ final result = await sendReceive(graph);
+ Expect.throwsArgumentError(() => td.materialize());
+ final tdCopy = result[0];
+ Expect.equals(42, tdCopy.materialize().asInt8List()[0]);
+ }
+
+ Future testTransferrable4() async {
+ print('testTransferrable4');
+ final td = TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);
+ final graph = [
+ notAllocatableInTLAB,
+ td,
+ ];
+ final result = await sendReceive(graph);
+ Expect.throwsArgumentError(() => td.materialize());
+ final tdCopy = result[1] as TransferableTypedData;
+ Expect.equals(42, tdCopy.materialize().asInt8List()[0]);
+ }
+
+ Future testTransferrable5() async {
+ print('testTransferrable5');
+ final td = TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);
+ final tdCopy = await sendReceive(td);
+ Expect.throwsArgumentError(() => td.materialize());
+ Expect.equals(42, tdCopy.materialize().asInt8List()[0]);
+ }
+
+ Future testExternalTypedData() async {
+ print('testExternalTypedData');
+ final graph = [
+ notAllocatableInTLAB,
+ largeExternalTypedData,
+ ];
+ for (int i = 0; i < 10; ++i) {
+ final result = await sendReceive(graph);
+ final etd = result[1];
+ Expect.equals(42, etd[0]);
+ }
+ }
+
+ Future testExternalTypedData2() async {
+ print('testExternalTypedData2');
+ final graph = [
+ largeExternalTypedData,
+ notAllocatableInTLAB,
+ ];
+ for (int i = 0; i < 10; ++i) {
+ final result = await sendReceive(graph);
+ final etd = result[1];
+ Expect.equals(42, etd[0]);
+ }
+ }
+
+ Future testExternalTypedData3() async {
+ print('testExternalTypedData3');
+ final graph = [
+ notAllocatableInTLAB,
+ largeExternalTypedData,
+ invalidObject,
+ ];
+ Expect.throwsArgumentError(() => sendPort.send(graph));
+ }
+
+ Future testExternalTypedData4() async {
+ print('testExternalTypedData4');
+ final graph = [
+ largeExternalTypedData,
+ invalidObject,
+ ];
+ Expect.throwsArgumentError(() => sendPort.send(graph));
+ }
+
+ Future testExternalTypedData5() async {
+ print('testExternalTypedData5');
+ for (int i = 0; i < 10; ++i) {
+ final etd = await sendReceive(largeExternalTypedData);
+ Expect.equals(42, etd[0]);
+ }
+ }
+
+ Future testInternalTypedDataView() async {
+ print('testInternalTypedDataView');
+ final graph = [
+ smallInternalTypedDataView,
+ smallInternalTypedData,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[0], copiedGraph[1]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testInternalTypedDataView2() async {
+ print('testInternalTypedDataView2');
+ final graph = [
+ smallInternalTypedData,
+ smallInternalTypedDataView,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[1], copiedGraph[0]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testInternalTypedDataView3() async {
+ print('testInternalTypedDataView3');
+ final graph = [
+ smallInternalTypedDataView,
+ notAllocatableInTLAB,
+ smallInternalTypedData,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[2], copiedGraph[2]);
+ expectViewOf(copiedGraph[0], copiedGraph[2]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testInternalTypedDataView4() async {
+ print('testInternalTypedDataView4');
+ final graph = [
+ smallInternalTypedData,
+ notAllocatableInTLAB,
+ smallInternalTypedDataView,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[2], copiedGraph[0]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testExternalTypedDataView() async {
+ print('testExternalTypedDataView');
+ final graph = [
+ smallExternalTypedDataView,
+ smallExternalTypedData,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[0], copiedGraph[1]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testExternalTypedDataView2() async {
+ print('testExternalTypedDataView2');
+ final graph = [
+ smallExternalTypedData,
+ smallExternalTypedDataView,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[1], copiedGraph[0]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testExternalTypedDataView3() async {
+ print('testExternalTypedDataView3');
+ final graph = [
+ smallExternalTypedDataView,
+ notAllocatableInTLAB,
+ smallExternalTypedData,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[0], copiedGraph[2]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testExternalTypedDataView4() async {
+ print('testExternalTypedDataView4');
+ final graph = [
+ smallExternalTypedData,
+ notAllocatableInTLAB,
+ smallExternalTypedDataView,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[2], copiedGraph[0]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testMapRehash() async {
+ print('testMapRehash');
+ final obj = Object();
+ final graph = [
+ {obj: 42},
+ notAllocatableInTLAB,
+ ];
+ final result = await sendReceive(graph);
+ final mapCopy = result[0] as Map;
+ Expect.equals(42, mapCopy.values.single);
+ Expect.notIdentical(obj, mapCopy.keys.single);
+ Expect.notEquals(
+ identityHashCode(obj), identityHashCode(mapCopy.keys.single));
+ Expect.equals(null, mapCopy[obj]);
+ Expect.equals(42, mapCopy[mapCopy.keys.single]);
+ }
+
+ Future testMapRehash2() async {
+ print('testMapRehash2');
+ final obj = Object();
+ final graph = [
+ notAllocatableInTLAB,
+ {obj: 42},
+ ];
+ final result = await sendReceive(graph);
+ final mapCopy = result[1] as Map;
+ Expect.equals(42, mapCopy.values.single);
+ Expect.notIdentical(obj, mapCopy.keys.single);
+ Expect.notEquals(
+ identityHashCode(obj), identityHashCode(mapCopy.keys.single));
+ Expect.equals(null, mapCopy[obj]);
+ Expect.equals(42, mapCopy[mapCopy.keys.single]);
+ }
+
+ Future testMapRehash3() async {
+ print('testMapRehash3');
+ final obj = HashIncrementer();
+ final graph = [
+ {obj: 42},
+ notAllocatableInTLAB,
+ ];
+ final int before = HashIncrementer.counter;
+ await sendReceive(graph);
+ final int after = HashIncrementer.counter;
+ Expect.equals(before + 1, after);
+ }
+
+ Future testFastOnly() async {
+ print('testFastOnly');
+ for (final smallPrimitive in smallPrimitives) {
+ expectGraphsMatch(smallPrimitive, await sendReceive(smallPrimitive));
+ }
+ for (final smallContainer in smallContainers) {
+ expectGraphsMatch(smallContainer, await sendReceive(smallContainer));
+ }
+ }
+
+ Future testSlowOnly() async {
+ print('testSlowOnly');
+ for (final smallPrimitive in smallPrimitives) {
+ expectGraphsMatch([notAllocatableInTLAB, smallPrimitive],
+ await sendReceive([notAllocatableInTLAB, smallPrimitive]));
+ }
+ for (final smallContainer in smallContainers) {
+ expectGraphsMatch([notAllocatableInTLAB, smallContainer],
+ await sendReceive([notAllocatableInTLAB, smallContainer]));
+ }
+ }
+
+ Future<T> sendReceive<T>(T graph) async {
+ sendPort.send(graph);
+ Expect.isTrue(await si.moveNext());
+ return si.current as T;
+ }
+}
+
+main() async {
+ await SendReceiveTest().run();
+}
diff --git a/runtime/tests/vm/dart_2/isolates/fast_object_copy_test.dart b/runtime/tests/vm/dart_2/isolates/fast_object_copy_test.dart
new file mode 100644
index 0000000..9737462
--- /dev/null
+++ b/runtime/tests/vm/dart_2/isolates/fast_object_copy_test.dart
@@ -0,0 +1,482 @@
+// Copyright (c) 2021, 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.
+
+// VMOptions=
+// VMOptions=--enable-isolate-groups --experimental-enable-isolate-groups-jit
+
+// The tests in this file are particularly for an implementation that tries to
+// allocate the entire graph in BFS order using a fast new space allocation
+// running in non-GC safe mode and a fallback to a slower GC-safe mode that uses
+// handles.
+//
+// The tests will sometimes trigger the fallback from fast to slow case by
+// inserting an object that cannot be allocated in new space.
+
+import 'dart:async';
+import 'dart:io';
+import 'dart:isolate';
+import 'dart:nativewrappers';
+import 'dart:typed_data';
+
+import 'package:expect/expect.dart';
+
+class ClassWithNativeFields extends NativeFieldWrapperClass1 {}
+
+final Uint8List largeExternalTypedData =
+ File(Platform.resolvedExecutable).readAsBytesSync()..[0] = 42;
+final Uint8List largeInternalTypedData = Uint8List(20 * 1024 * 1024)..[0] = 42;
+
+final Uint8List smallExternalTypedData =
+ File(Platform.script.toFilePath()).readAsBytesSync();
+final Uint8List smallExternalTypedDataView =
+ Uint8List.view(smallExternalTypedData.buffer, 1, 1);
+
+final Uint8List smallInternalTypedData = Uint8List.fromList([0, 1, 2]);
+final Uint8List smallInternalTypedDataView =
+ Uint8List.view(smallInternalTypedData.buffer, 1, 1);
+
+final Uint8List notAllocatableInTLAB = largeInternalTypedData;
+final Object invalidObject = ClassWithNativeFields();
+
+final smallPrimitives = [
+ 1,
+ 0xffffffffffffffff,
+ 'foobar',
+ UserObject(1, 1.2, ''),
+ smallInternalTypedData,
+ smallInternalTypedDataView,
+];
+final smallContainers = [
+ [],
+ {},
+ [...smallPrimitives],
+ {for (final p in smallPrimitives) p: p},
+ UserObject(2, 2.3, smallPrimitives),
+];
+
+void expectGraphsMatch(dynamic a, dynamic b) {
+ if (a is int) {
+ Expect.equals(a, (b as int));
+ return;
+ }
+ if (a is double) {
+ Expect.equals(a, (b as double));
+ return;
+ }
+ if (a is String) {
+ Expect.equals(a, (b as String));
+ return;
+ }
+ if (a is UserObject) {
+ final cb = b as UserObject;
+ Expect.equals(a.unboxedInt, cb.unboxedInt);
+ Expect.equals(a.unboxedDouble, cb.unboxedDouble);
+ expectGraphsMatch(a.slot, cb.slot);
+ return;
+ }
+ if (a is Uint8List) {
+ final cb = b as Uint8List;
+ Expect.equals(a.length, cb.length);
+ Expect.equals(a.offsetInBytes, cb.offsetInBytes);
+ for (int i = 0; i < a.length; ++i) {
+ Expect.equals(a[i], cb[i]);
+ }
+ if (a.offsetInBytes != 0) {
+ expectGraphsMatch(a.buffer.asUint8List(), b.buffer.asUint8List());
+ }
+ return;
+ }
+ if (a is List) {
+ final cb = b as List;
+ Expect.equals(a.length, cb.length);
+ for (int i = 0; i < a.length; ++i) {
+ expectGraphsMatch(a[i], cb[i]);
+ }
+ return;
+ }
+ if (a is Map) {
+ final cb = b as Map;
+ Expect.equals(a.length, cb.length);
+ final aKeys = a.keys.toList();
+ final aValues = a.values.toList();
+ final cbKeys = cb.keys.toList();
+ final cbValues = cb.values.toList();
+ for (int i = 0; i < a.length; ++i) {
+ expectGraphsMatch(aKeys[i], cbKeys[i]);
+ }
+ for (int i = 0; i < a.length; ++i) {
+ expectGraphsMatch(aValues[i], cbValues[i]);
+ }
+ return;
+ }
+ throw 'Unexpected object encountered when matching object graphs $a / $b';
+}
+
+void expectViewOf(Uint8List view, Uint8List backing) {
+ final int offset = view.offsetInBytes;
+ Expect.isTrue(offset > 0);
+ final int old = backing[offset];
+ view[0] = ~view[0];
+ Expect.notEquals(old, backing[offset]);
+ view[0] = ~view[0];
+ Expect.equals(old, backing[offset]);
+}
+
+class HashIncrementer {
+ static int counter = 1;
+
+ int get hashCode => counter++;
+ bool operator ==(other) => identical(this, other);
+}
+
+class UserObject {
+ final int unboxedInt;
+ final double unboxedDouble;
+ final dynamic slot;
+
+ UserObject(this.unboxedInt, this.unboxedDouble, this.slot);
+}
+
+class SendReceiveTest {
+ ReceivePort receivePort;
+ SendPort sendPort;
+ StreamIterator si;
+
+ SendReceiveTest();
+
+ Future run() async {
+ receivePort = ReceivePort();
+ sendPort = receivePort.sendPort;
+ si = StreamIterator(receivePort);
+
+ await testTransferrable();
+ await testTransferrable2();
+ await testTransferrable3();
+ await testTransferrable4();
+ await testTransferrable5();
+
+ await testExternalTypedData();
+ await testExternalTypedData2();
+ await testExternalTypedData3();
+ await testExternalTypedData4();
+ await testExternalTypedData5();
+
+ await testInternalTypedDataView();
+ await testInternalTypedDataView2();
+ await testInternalTypedDataView3();
+ await testInternalTypedDataView4();
+
+ await testExternalTypedDataView();
+ await testExternalTypedDataView2();
+ await testExternalTypedDataView3();
+ await testExternalTypedDataView4();
+
+ await testMapRehash();
+ await testMapRehash2();
+ await testMapRehash3();
+
+ await testFastOnly();
+ await testSlowOnly();
+
+ si.cancel();
+ receivePort.close();
+ print('done');
+ }
+
+ Future testTransferrable() async {
+ print('testTransferrable');
+ final td = TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);
+ final graph = [
+ td,
+ invalidObject,
+ ];
+ Expect.throwsArgumentError(() => sendPort.send(graph));
+ Expect.equals(42, td.materialize().asInt8List()[0]);
+ }
+
+ Future testTransferrable2() async {
+ print('testTransferrable2');
+ final td = TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);
+ final graph = [
+ td,
+ notAllocatableInTLAB,
+ invalidObject,
+ ];
+ Expect.throwsArgumentError(() => sendPort.send(graph));
+ Expect.equals(42, td.materialize().asInt8List()[0]);
+ }
+
+ Future testTransferrable3() async {
+ print('testTransferrable3');
+ final td = TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);
+ final graph = [
+ td,
+ ];
+ final result = await sendReceive(graph);
+ Expect.throwsArgumentError(() => td.materialize());
+ final tdCopy = result[0];
+ Expect.equals(42, tdCopy.materialize().asInt8List()[0]);
+ }
+
+ Future testTransferrable4() async {
+ print('testTransferrable4');
+ final td = TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);
+ final graph = [
+ notAllocatableInTLAB,
+ td,
+ ];
+ final result = await sendReceive(graph);
+ Expect.throwsArgumentError(() => td.materialize());
+ final tdCopy = result[1] as TransferableTypedData;
+ Expect.equals(42, tdCopy.materialize().asInt8List()[0]);
+ }
+
+ Future testTransferrable5() async {
+ print('testTransferrable5');
+ final td = TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);
+ final tdCopy = await sendReceive(td);
+ Expect.throwsArgumentError(() => td.materialize());
+ Expect.equals(42, tdCopy.materialize().asInt8List()[0]);
+ }
+
+ Future testExternalTypedData() async {
+ print('testExternalTypedData');
+ final graph = [
+ notAllocatableInTLAB,
+ largeExternalTypedData,
+ ];
+ for (int i = 0; i < 10; ++i) {
+ final result = await sendReceive(graph);
+ final etd = result[1];
+ Expect.equals(42, etd[0]);
+ }
+ }
+
+ Future testExternalTypedData2() async {
+ print('testExternalTypedData2');
+ final graph = [
+ largeExternalTypedData,
+ notAllocatableInTLAB,
+ ];
+ for (int i = 0; i < 10; ++i) {
+ final result = await sendReceive(graph);
+ final etd = result[1];
+ Expect.equals(42, etd[0]);
+ }
+ }
+
+ Future testExternalTypedData3() async {
+ print('testExternalTypedData3');
+ final graph = [
+ notAllocatableInTLAB,
+ largeExternalTypedData,
+ invalidObject,
+ ];
+ Expect.throwsArgumentError(() => sendPort.send(graph));
+ }
+
+ Future testExternalTypedData4() async {
+ print('testExternalTypedData4');
+ final graph = [
+ largeExternalTypedData,
+ invalidObject,
+ ];
+ Expect.throwsArgumentError(() => sendPort.send(graph));
+ }
+
+ Future testExternalTypedData5() async {
+ print('testExternalTypedData5');
+ for (int i = 0; i < 10; ++i) {
+ final etd = await sendReceive(largeExternalTypedData);
+ Expect.equals(42, etd[0]);
+ }
+ }
+
+ Future testInternalTypedDataView() async {
+ print('testInternalTypedDataView');
+ final graph = [
+ smallInternalTypedDataView,
+ smallInternalTypedData,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[0], copiedGraph[1]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testInternalTypedDataView2() async {
+ print('testInternalTypedDataView2');
+ final graph = [
+ smallInternalTypedData,
+ smallInternalTypedDataView,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[1], copiedGraph[0]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testInternalTypedDataView3() async {
+ print('testInternalTypedDataView3');
+ final graph = [
+ smallInternalTypedDataView,
+ notAllocatableInTLAB,
+ smallInternalTypedData,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[2], copiedGraph[2]);
+ expectViewOf(copiedGraph[0], copiedGraph[2]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testInternalTypedDataView4() async {
+ print('testInternalTypedDataView4');
+ final graph = [
+ smallInternalTypedData,
+ notAllocatableInTLAB,
+ smallInternalTypedDataView,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[2], copiedGraph[0]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testExternalTypedDataView() async {
+ print('testExternalTypedDataView');
+ final graph = [
+ smallExternalTypedDataView,
+ smallExternalTypedData,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[0], copiedGraph[1]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testExternalTypedDataView2() async {
+ print('testExternalTypedDataView2');
+ final graph = [
+ smallExternalTypedData,
+ smallExternalTypedDataView,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[1], copiedGraph[0]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testExternalTypedDataView3() async {
+ print('testExternalTypedDataView3');
+ final graph = [
+ smallExternalTypedDataView,
+ notAllocatableInTLAB,
+ smallExternalTypedData,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[0], copiedGraph[2]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testExternalTypedDataView4() async {
+ print('testExternalTypedDataView4');
+ final graph = [
+ smallExternalTypedData,
+ notAllocatableInTLAB,
+ smallExternalTypedDataView,
+ ];
+ final copiedGraph = await sendReceive(graph);
+ Expect.notIdentical(graph[0], copiedGraph[0]);
+ Expect.notIdentical(graph[1], copiedGraph[1]);
+ expectViewOf(copiedGraph[2], copiedGraph[0]);
+ expectGraphsMatch(graph, copiedGraph);
+ }
+
+ Future testMapRehash() async {
+ print('testMapRehash');
+ final obj = Object();
+ final graph = [
+ {obj: 42},
+ notAllocatableInTLAB,
+ ];
+ final result = await sendReceive(graph);
+ final mapCopy = result[0] as Map;
+ Expect.equals(42, mapCopy.values.single);
+ Expect.notIdentical(obj, mapCopy.keys.single);
+ Expect.notEquals(
+ identityHashCode(obj), identityHashCode(mapCopy.keys.single));
+ Expect.equals(null, mapCopy[obj]);
+ Expect.equals(42, mapCopy[mapCopy.keys.single]);
+ }
+
+ Future testMapRehash2() async {
+ print('testMapRehash2');
+ final obj = Object();
+ final graph = [
+ notAllocatableInTLAB,
+ {obj: 42},
+ ];
+ final result = await sendReceive(graph);
+ final mapCopy = result[1] as Map;
+ Expect.equals(42, mapCopy.values.single);
+ Expect.notIdentical(obj, mapCopy.keys.single);
+ Expect.notEquals(
+ identityHashCode(obj), identityHashCode(mapCopy.keys.single));
+ Expect.equals(null, mapCopy[obj]);
+ Expect.equals(42, mapCopy[mapCopy.keys.single]);
+ }
+
+ Future testMapRehash3() async {
+ print('testMapRehash3');
+ final obj = HashIncrementer();
+ final graph = [
+ {obj: 42},
+ notAllocatableInTLAB,
+ ];
+ final int before = HashIncrementer.counter;
+ await sendReceive(graph);
+ final int after = HashIncrementer.counter;
+ Expect.equals(before + 1, after);
+ }
+
+ Future testFastOnly() async {
+ print('testFastOnly');
+ for (final smallPrimitive in smallPrimitives) {
+ expectGraphsMatch(smallPrimitive, await sendReceive(smallPrimitive));
+ }
+ for (final smallContainer in smallContainers) {
+ expectGraphsMatch(smallContainer, await sendReceive(smallContainer));
+ }
+ }
+
+ Future testSlowOnly() async {
+ print('testSlowOnly');
+ for (final smallPrimitive in smallPrimitives) {
+ expectGraphsMatch([notAllocatableInTLAB, smallPrimitive],
+ await sendReceive([notAllocatableInTLAB, smallPrimitive]));
+ }
+ for (final smallContainer in smallContainers) {
+ expectGraphsMatch([notAllocatableInTLAB, smallContainer],
+ await sendReceive([notAllocatableInTLAB, smallContainer]));
+ }
+ }
+
+ Future<T> sendReceive<T>(T graph) async {
+ sendPort.send(graph);
+ Expect.isTrue(await si.moveNext());
+ return si.current as T;
+ }
+}
+
+main() async {
+ await SendReceiveTest().run();
+}
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 91fe069..750271b 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -1265,9 +1265,6 @@
public:
MoveOperands(Location dest, Location src) : dest_(dest), src_(src) {}
- MoveOperands(const MoveOperands& other)
- : dest_(other.dest_), src_(other.src_) {}
-
MoveOperands& operator=(const MoveOperands& other) {
dest_ = other.dest_;
src_ = other.src_;
diff --git a/runtime/vm/compiler/backend/inliner.cc b/runtime/vm/compiler/backend/inliner.cc
index 3163f63..eb206db 100644
--- a/runtime/vm/compiler/backend/inliner.cc
+++ b/runtime/vm/compiler/backend/inliner.cc
@@ -1050,7 +1050,7 @@
} else if (PolymorphicInstanceCallInstr* instr =
call_data->call->AsPolymorphicInstanceCall()) {
entry_kind = instr->entry_kind();
- } else if (ClosureCallInstr* instr = call_data->call->AsClosureCall()) {
+ } else if (call_data->call->IsClosureCall()) {
// Closure functions only have one entry point.
}
kernel::FlowGraphBuilder builder(
diff --git a/runtime/vm/compiler/backend/linearscan.cc b/runtime/vm/compiler/backend/linearscan.cc
index 8e3e457..d337219 100644
--- a/runtime/vm/compiler/backend/linearscan.cc
+++ b/runtime/vm/compiler/backend/linearscan.cc
@@ -2739,7 +2739,7 @@
// Emit move on the edge from |pred| to |succ|.
static void EmitMoveOnEdge(BlockEntryInstr* succ,
BlockEntryInstr* pred,
- MoveOperands move) {
+ const MoveOperands& move) {
Instruction* last = pred->last_instruction();
if ((last->SuccessorCount() == 1) && !pred->IsGraphEntry()) {
ASSERT(last->IsGoto());
diff --git a/runtime/vm/compiler/backend/locations.h b/runtime/vm/compiler/backend/locations.h
index ad2dc86..dcac605 100644
--- a/runtime/vm/compiler/backend/locations.h
+++ b/runtime/vm/compiler/backend/locations.h
@@ -220,8 +220,8 @@
static Location Constant(const ConstantInstr* obj, int pair_index = 0) {
ASSERT((pair_index == 0) || (pair_index == 1));
Location loc(reinterpret_cast<uword>(obj) |
- (pair_index != 0 ? kPairLocationTag : 0) |
- kConstantTag);
+ (pair_index != 0 ? static_cast<uword>(kPairLocationTag) : 0) |
+ static_cast<uword>(kConstantTag));
ASSERT(obj == loc.constant_instruction());
ASSERT(loc.pair_index() == pair_index);
return loc;
diff --git a/runtime/vm/compiler/backend/redundancy_elimination.cc b/runtime/vm/compiler/backend/redundancy_elimination.cc
index e00327a..ad6fa8a 100644
--- a/runtime/vm/compiler/backend/redundancy_elimination.cc
+++ b/runtime/vm/compiler/backend/redundancy_elimination.cc
@@ -3630,7 +3630,7 @@
intptr_t num_elements = -1;
if (auto instr = alloc->AsAllocateObject()) {
cls = &(instr->cls());
- } else if (auto instr = alloc->AsAllocateClosure()) {
+ } else if (alloc->IsAllocateClosure()) {
cls = &Class::ZoneHandle(
flow_graph_->isolate_group()->object_store()->closure_class());
} else if (auto instr = alloc->AsAllocateContext()) {
diff --git a/runtime/vm/compiler/ffi/range.h b/runtime/vm/compiler/ffi/range.h
index 0848875..e8742b3 100644
--- a/runtime/vm/compiler/ffi/range.h
+++ b/runtime/vm/compiler/ffi/range.h
@@ -20,7 +20,7 @@
// Ranges are positive and non-empty.
//
// The end is exclusive.
-class Range : public ValueObject {
+class Range {
public:
// Constructs a Range from start (inclusive) and length.
//
@@ -36,9 +36,6 @@
return Range(start_inclusive, end_exclusive);
}
- Range(const Range& other)
- : start_(other.start_), end_exclusive_(other.end_exclusive_) {}
-
intptr_t start() const { return start_; }
intptr_t end_exclusive() const { return end_exclusive_; }
intptr_t end_inclusive() const { return end_exclusive_ - 1; }
@@ -84,10 +81,7 @@
private:
Range(intptr_t start_inclusive, intptr_t end_exclusive)
: start_(start_inclusive), end_exclusive_(end_exclusive) {
- if (!(start_ >= 0 && end_exclusive_ > start_)) {
- ASSERT(start_ >= 0);
- ASSERT(end_exclusive_ > start_);
- }
+ ASSERT(start_ < end_exclusive_);
}
const intptr_t start_;
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index d16f0cc..d8ce563 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -1951,13 +1951,13 @@
const auto info = new (helper_->zone_) UnboxingInfoMetadata();
info->SetArgsCount(num_args);
for (intptr_t i = 0; i < num_args; i++) {
- const auto arg_info = helper_->ReadByte();
+ const intptr_t arg_info = helper_->ReadByte();
assert(arg_info >= UnboxingInfoMetadata::kBoxed &&
arg_info < UnboxingInfoMetadata::kUnboxingCandidate);
info->unboxed_args_info[i] =
static_cast<UnboxingInfoMetadata::UnboxingInfoTag>(arg_info);
}
- const auto return_info = helper_->ReadByte();
+ const intptr_t return_info = helper_->ReadByte();
assert(return_info >= UnboxingInfoMetadata::kBoxed &&
return_info < UnboxingInfoMetadata::kUnboxingCandidate);
info->return_info =
diff --git a/runtime/vm/compiler/relocation_test.cc b/runtime/vm/compiler/relocation_test.cc
index 0596cd9..b698830 100644
--- a/runtime/vm/compiler/relocation_test.cc
+++ b/runtime/vm/compiler/relocation_test.cc
@@ -430,7 +430,7 @@
UNIT_TEST_CASE(PCRelativeCallPatterns) {
{
- uint8_t instruction[PcRelativeCallPattern::kLengthInBytes];
+ uint8_t instruction[PcRelativeCallPattern::kLengthInBytes] = {};
PcRelativeCallPattern pattern(reinterpret_cast<uword>(&instruction));
@@ -441,7 +441,7 @@
EXPECT_EQ(PcRelativeCallPattern::kUpperCallingRange, pattern.distance());
}
{
- uint8_t instruction[PcRelativeTailCallPattern::kLengthInBytes];
+ uint8_t instruction[PcRelativeTailCallPattern::kLengthInBytes] = {};
PcRelativeTailCallPattern pattern(reinterpret_cast<uword>(&instruction));
diff --git a/runtime/vm/heap/safepoint.cc b/runtime/vm/heap/safepoint.cc
index 811cb97..4a7e5de 100644
--- a/runtime/vm/heap/safepoint.cc
+++ b/runtime/vm/heap/safepoint.cc
@@ -71,15 +71,17 @@
}
SafepointHandler::SafepointHandler(IsolateGroup* isolate_group)
- : isolate_group_(isolate_group),
- handlers_{
- {isolate_group, SafepointLevel::kGC},
- {isolate_group, SafepointLevel::kGCAndDeopt},
- } {}
+ : isolate_group_(isolate_group) {
+ handlers_[SafepointLevel::kGC] =
+ new LevelHandler(isolate_group, SafepointLevel::kGC);
+ handlers_[SafepointLevel::kGCAndDeopt] =
+ new LevelHandler(isolate_group, SafepointLevel::kGCAndDeopt);
+}
SafepointHandler::~SafepointHandler() {
for (intptr_t level = 0; level < SafepointLevel::kNumLevels; ++level) {
- ASSERT(handlers_[level].owner_ == nullptr);
+ ASSERT(handlers_[level]->owner_ == nullptr);
+ delete handlers_[level];
}
}
@@ -92,8 +94,8 @@
MonitorLocker tl(threads_lock());
// Allow recursive deopt safepoint operation.
- if (handlers_[level].owner_ == T) {
- handlers_[level].operation_count_++;
+ if (handlers_[level]->owner_ == T) {
+ handlers_[level]->operation_count_++;
// If we own this safepoint level already we have to own the lower levels
// as well.
AssertWeOwnLowerLevelSafepoints(T, level);
@@ -112,17 +114,17 @@
// Wait until other safepoint operations are done & mark us as owning
// the safepoint - so no other thread can.
- while (handlers_[level].SafepointInProgress()) {
+ while (handlers_[level]->SafepointInProgress()) {
tl.Wait();
}
- handlers_[level].SetSafepointInProgress(T);
+ handlers_[level]->SetSafepointInProgress(T);
// Ensure a thread is at a safepoint or notify it to get to one.
- handlers_[level].NotifyThreadsToGetToSafepointLevel(T);
+ handlers_[level]->NotifyThreadsToGetToSafepointLevel(T);
}
// Now wait for all threads that are not already at a safepoint to check-in.
- handlers_[level].WaitUntilThreadsReachedSafepointLevel();
+ handlers_[level]->WaitUntilThreadsReachedSafepointLevel();
AcquireLowerLevelSafepoints(T, level);
}
@@ -130,7 +132,7 @@
void SafepointHandler::AssertWeOwnLowerLevelSafepoints(Thread* T,
SafepointLevel level) {
for (intptr_t lower_level = level - 1; lower_level >= 0; --lower_level) {
- RELEASE_ASSERT(handlers_[lower_level].owner_ == T);
+ RELEASE_ASSERT(handlers_[lower_level]->owner_ == T);
}
}
@@ -138,7 +140,7 @@
Thread* T,
SafepointLevel level) {
for (intptr_t lower_level = level - 1; lower_level >= 0; --lower_level) {
- RELEASE_ASSERT(handlers_[lower_level].owner_ != T);
+ RELEASE_ASSERT(handlers_[lower_level]->owner_ != T);
}
}
@@ -166,19 +168,19 @@
{
MonitorLocker sl(threads_lock());
- ASSERT(handlers_[level].SafepointInProgress());
- ASSERT(handlers_[level].owner_ == T);
+ ASSERT(handlers_[level]->SafepointInProgress());
+ ASSERT(handlers_[level]->owner_ == T);
AssertWeOwnLowerLevelSafepoints(T, level);
// We allow recursive safepoints.
- if (handlers_[level].operation_count_ > 1) {
- handlers_[level].operation_count_--;
+ if (handlers_[level]->operation_count_ > 1) {
+ handlers_[level]->operation_count_--;
return;
}
ReleaseLowerLevelSafepoints(T, level);
- handlers_[level].NotifyThreadsToContinue(T);
- handlers_[level].ResetSafepointInProgress(T);
+ handlers_[level]->NotifyThreadsToContinue(T);
+ handlers_[level]->ResetSafepointInProgress(T);
sl.NotifyAll();
}
ExitSafepointUsingLock(T);
@@ -207,20 +209,20 @@
void SafepointHandler::AcquireLowerLevelSafepoints(Thread* T,
SafepointLevel level) {
MonitorLocker tl(threads_lock());
- ASSERT(handlers_[level].owner_ == T);
+ ASSERT(handlers_[level]->owner_ == T);
for (intptr_t lower_level = level - 1; lower_level >= 0; --lower_level) {
- while (handlers_[lower_level].SafepointInProgress()) {
+ while (handlers_[lower_level]->SafepointInProgress()) {
tl.Wait();
}
- handlers_[lower_level].SetSafepointInProgress(T);
- ASSERT(handlers_[lower_level].owner_ == T);
+ handlers_[lower_level]->SetSafepointInProgress(T);
+ ASSERT(handlers_[lower_level]->owner_ == T);
}
}
void SafepointHandler::ReleaseLowerLevelSafepoints(Thread* T,
SafepointLevel level) {
for (intptr_t lower_level = 0; lower_level < level; ++lower_level) {
- handlers_[lower_level].ResetSafepointInProgress(T);
+ handlers_[lower_level]->ResetSafepointInProgress(T);
}
}
@@ -272,7 +274,7 @@
for (intptr_t level = T->current_safepoint_level(); level >= 0; --level) {
if (T->IsSafepointLevelRequestedLocked(
static_cast<SafepointLevel>(level))) {
- handlers_[level].NotifyWeAreParked(T);
+ handlers_[level]->NotifyWeAreParked(T);
}
}
}
diff --git a/runtime/vm/heap/safepoint.h b/runtime/vm/heap/safepoint.h
index 13552b7..363b3f5 100644
--- a/runtime/vm/heap/safepoint.h
+++ b/runtime/vm/heap/safepoint.h
@@ -77,7 +77,7 @@
bool IsOwnedByTheThread(Thread* thread) {
for (intptr_t level = 0; level < SafepointLevel::kNumLevels; ++level) {
- if (handlers_[level].owner_ == thread) {
+ if (handlers_[level]->owner_ == thread) {
return true;
}
}
@@ -86,7 +86,7 @@
bool AnySafepointInProgress() {
for (intptr_t level = 0; level < SafepointLevel::kNumLevels; ++level) {
- if (handlers_[level].SafepointInProgress()) {
+ if (handlers_[level]->SafepointInProgress()) {
return true;
}
}
@@ -171,7 +171,7 @@
IsolateGroup* isolate_group_;
- LevelHandler handlers_[SafepointLevel::kNumLevels];
+ LevelHandler* handlers_[SafepointLevel::kNumLevels];
friend class Isolate;
friend class IsolateGroup;
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 4017d9b..2979b4c 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -10247,8 +10247,7 @@
}
void FunctionType::set_type_state(uint8_t state) const {
- ASSERT((state >= UntaggedFunctionType::kAllocated) &&
- (state <= UntaggedFunctionType::kFinalizedUninstantiated));
+ ASSERT(state <= UntaggedFunctionType::kFinalizedUninstantiated);
StoreNonPointer(&untag()->type_state_, state);
}
@@ -21054,8 +21053,7 @@
}
void Type::set_type_state(uint8_t state) const {
- ASSERT((state >= UntaggedType::kAllocated) &&
- (state <= UntaggedType::kFinalizedUninstantiated));
+ ASSERT(state <= UntaggedType::kFinalizedUninstantiated);
StoreNonPointer(&untag()->type_state_, state);
}
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 03824ad..1d5cfa6 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -5862,7 +5862,7 @@
/*uses_global_table=*/false);
}
- class Iterator : public ValueObject {
+ class Iterator {
public:
Iterator(const CompressedStackMaps& maps,
const CompressedStackMaps& global_table);
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index e926685..4ebfbae 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -4256,7 +4256,7 @@
while (fgets(line, sizeof(line), fp) != nullptr) {
if (sscanf(line, "%zx-%zx", &start, &end) == 2) {
// Mapping line.
- strncpy(path, strrchr(line, ' ') + 1, sizeof(path));
+ strncpy(path, strrchr(line, ' ') + 1, sizeof(path) - 1);
int len = strlen(path);
if ((len > 0) && path[len - 1] == '\n') {
path[len - 1] = 0;
diff --git a/runtime/vm/stack_frame.h b/runtime/vm/stack_frame.h
index 2275811..e23d93b 100644
--- a/runtime/vm/stack_frame.h
+++ b/runtime/vm/stack_frame.h
@@ -210,7 +210,7 @@
// Windows- where it is needed for the profiler. It is the responsibility of
// users of StackFrameIterator to ensure that the thread given is not running
// concurrently.
-class StackFrameIterator : public ValueObject {
+class StackFrameIterator {
public:
enum CrossThreadPolicy {
kNoCrossThreadIteration = 0,
@@ -219,9 +219,9 @@
// Iterators for iterating over all frames from the last ExitFrame to the
// first EntryFrame.
- explicit StackFrameIterator(ValidationPolicy validation_policy,
- Thread* thread,
- CrossThreadPolicy cross_thread_policy);
+ StackFrameIterator(ValidationPolicy validation_policy,
+ Thread* thread,
+ CrossThreadPolicy cross_thread_policy);
StackFrameIterator(uword last_fp,
ValidationPolicy validation_policy,
Thread* thread,
@@ -236,7 +236,7 @@
Thread* thread,
CrossThreadPolicy cross_thread_policy);
- StackFrameIterator(const StackFrameIterator& orig);
+ explicit StackFrameIterator(const StackFrameIterator& orig);
// Checks if a next frame exists.
bool HasNextFrame() const { return frames_.fp_ != 0; }
@@ -311,7 +311,7 @@
// it is only allowed on Windows- where it is needed for the profiler.
// It is the responsibility of users of DartFrameIterator to ensure that the
// isolate given is not running concurrently on another thread.
-class DartFrameIterator : public ValueObject {
+class DartFrameIterator {
public:
explicit DartFrameIterator(
Thread* thread,
@@ -340,7 +340,8 @@
thread,
cross_thread_policy) {}
- DartFrameIterator(const DartFrameIterator& orig) : frames_(orig.frames_) {}
+ explicit DartFrameIterator(const DartFrameIterator& orig)
+ : frames_(orig.frames_) {}
// Get next dart frame.
StackFrame* NextFrame() {
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index a9ff835..0f74638 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -817,7 +817,7 @@
return (state & SafepointRequestedField::mask_in_place()) != 0;
case SafepointLevel::kGCAndDeopt:
return (state & DeoptSafepointRequestedField::mask_in_place()) != 0;
- case SafepointLevel::kNumLevels:
+ default:
UNREACHABLE();
}
}
@@ -1169,7 +1169,7 @@
case SafepointLevel::kGCAndDeopt:
return AtSafepointField::mask_in_place() |
AtDeoptSafepointField::mask_in_place();
- case SafepointLevel::kNumLevels:
+ default:
UNREACHABLE();
}
}
diff --git a/runtime/vm/type_testing_stubs.cc b/runtime/vm/type_testing_stubs.cc
index e8e68f6..879677c 100644
--- a/runtime/vm/type_testing_stubs.cc
+++ b/runtime/vm/type_testing_stubs.cc
@@ -207,7 +207,7 @@
static CodePtr RetryCompilationWithFarBranches(
Thread* thread,
std::function<CodePtr(compiler::Assembler&)> fun) {
- bool use_far_branches = false;
+ volatile bool use_far_branches = false;
while (true) {
LongJumpScope jump;
if (setjmp(*jump.Set()) == 0) {
diff --git a/runtime/vm/v8_snapshot_writer.cc b/runtime/vm/v8_snapshot_writer.cc
index 351c831..c6e061a 100644
--- a/runtime/vm/v8_snapshot_writer.cc
+++ b/runtime/vm/v8_snapshot_writer.cc
@@ -183,6 +183,8 @@
return "IsolateData";
case IdSpace::kArtificial:
return "Artificial";
+ default:
+ UNREACHABLE();
}
}
diff --git a/runtime/vm/v8_snapshot_writer.h b/runtime/vm/v8_snapshot_writer.h
index ea0a0e7..644a2e0 100644
--- a/runtime/vm/v8_snapshot_writer.h
+++ b/runtime/vm/v8_snapshot_writer.h
@@ -69,16 +69,14 @@
kElement,
kProperty,
} type;
- union {
- intptr_t offset; // kElement
- const char* name; // kProperty
- };
+ intptr_t offset; // kElement
+ const char* name; // kProperty
static Reference Element(intptr_t offset) {
- return {Type::kElement, {.offset = offset}};
+ return {Type::kElement, offset, nullptr};
}
static Reference Property(const char* name) {
- return {Type::kProperty, {.name = name}};
+ return {Type::kProperty, 0, name};
}
bool IsElement() const { return type == Type::kElement; }
diff --git a/tests/ffi/generator/structs_by_value_tests_generator.dart b/tests/ffi/generator/structs_by_value_tests_generator.dart
index 72f3585..9063cb2 100644
--- a/tests/ffi/generator/structs_by_value_tests_generator.dart
+++ b/tests/ffi/generator/structs_by_value_tests_generator.dart
@@ -318,9 +318,10 @@
String cAllocateStatements(String variableName) {
switch (this.runtimeType) {
case FundamentalType:
+ return "${cType} ${variableName};\n";
case StructType:
case UnionType:
- return "${cType} ${variableName};\n";
+ return "${cType} ${variableName} = {};\n";
}
throw Exception("Not implemented for ${this.runtimeType}");
@@ -743,7 +744,7 @@
break;
case TestType.structReturn:
body = """
- ${returnValue.cType} result;
+ ${returnValue.cType} result = {};
${arguments.copyValueStatements("", "result.")}
""";
diff --git a/tools/VERSION b/tools/VERSION
index 7b4cf9a..a1c0feb 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 222
+PRERELEASE 223
PRERELEASE_PATCH 0
\ No newline at end of file