Files
sdk/tests/language_2/vm/regress_flutter_23879_test.dart
T
Aart Bik a40fd6a976 [vm/compiler] Fix bug in unboxed constant spilling
Rationale:
Subtle but disastrous, spilling unboxed integers
in arm64 and x64 would store the value as smi,
detected as a nasty off by one error in flutter code.

https://github.com/flutter/flutter/issues/23879
https://github.com/dart-lang/sdk/issues/35091

Change-Id: I07d71727de8574ebd7d3ec3610d517d7903972f0
Reviewed-on: https://dart-review.googlesource.com/c/83565
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-08 19:03:22 +00:00

73 lines
1.3 KiB
Dart

// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Bug in unboxed int spilling (https://github.com/flutter/flutter/issues/23879).
//
// VMOptions=--deterministic
import "package:expect/expect.dart";
List<int> list = new List<int>(10);
List<int> expected_values = [null, 152, 168, 184, 200, 216, 232, 248, 264, 280];
int count = 0;
bool getNext() {
return ++count <= 9;
}
int foo() {
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int e = 5;
int f = 6;
int g = 7;
int h = 8;
int i = 9;
int j = 10;
int k = 11;
int l = 12;
int m = 13;
int n = 14;
int o = 15;
int p = 16;
count = 0;
int componentIndex = 1;
while (getNext()) {
// Make spilling likely.
a++;
b++;
c++;
d++;
e++;
f++;
g++;
h++;
i++;
j++;
k++;
l++;
m++;
n++;
o++;
p++;
list[componentIndex] =
a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p;
componentIndex++;
}
return componentIndex;
}
void main() {
int x = foo();
Expect.equals(10, x);
Expect.equals(10, count);
for (int i = 0; i < 10; i++) {
Expect.equals(expected_values[i], list[i]);
}
}