From fae934c4b181d403625a08831eec291f4329253f Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Fri, 10 Feb 2023 20:25:59 +0000 Subject: [PATCH] Revert part of "[vm] Allow sharing of deeply immutable lists across isolates" It did have noticable xx% performance regression on ListCopy.List.int.unmodifiable.100 TEST=ci Issue https://github.com/dart-lang/sdk/issues/51334 Change-Id: I160d7cc98aee2e064b1767519f4b5033656ee115 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282400 Commit-Queue: Martin Kustermann Reviewed-by: Alexander Aprelev --- runtime/lib/growable_array.cc | 11 ------- .../dart/isolates/fast_object_copy2_test.dart | 30 ------------------- .../isolates/fast_object_copy2_test.dart | 30 ------------------- 3 files changed, 71 deletions(-) diff --git a/runtime/lib/growable_array.cc b/runtime/lib/growable_array.cc index ff511312a79..02e40cbdf83 100644 --- a/runtime/lib/growable_array.cc +++ b/runtime/lib/growable_array.cc @@ -90,17 +90,6 @@ DEFINE_NATIVE_ENTRY(Internal_makeListFixedLength, 0, 1) { DEFINE_NATIVE_ENTRY(Internal_makeFixedListUnmodifiable, 0, 1) { GET_NON_NULL_NATIVE_ARGUMENT(Array, array, arguments->NativeArgAt(0)); array.MakeImmutable(); - const intptr_t len = array.Length(); - bool is_deeply_immutable = true; - for (intptr_t i = 0; i < len; ++i) { - if (!CanShareObjectAcrossIsolates(array.At(i))) { - is_deeply_immutable = false; - break; - } - } - if (is_deeply_immutable) { - array.SetImmutable(); - } return array.ptr(); } diff --git a/runtime/tests/vm/dart/isolates/fast_object_copy2_test.dart b/runtime/tests/vm/dart/isolates/fast_object_copy2_test.dart index adc2661a659..9a3f1b714d3 100644 --- a/runtime/tests/vm/dart/isolates/fast_object_copy2_test.dart +++ b/runtime/tests/vm/dart/isolates/fast_object_copy2_test.dart @@ -111,7 +111,6 @@ class SendReceiveTest extends SendReceiveTestBase { await testSharable2(); await testCopyableClosures(); await testSharableTypedData(); - await testUnmodifiableList(); } Future testSharable() async { @@ -177,35 +176,6 @@ class SendReceiveTest extends SendReceiveTestBase { malloc.free(bytes); } - - Future testUnmodifiableList() async { - print('testUnmodifiableList'); - - // Sharable. - for (final sharable in [ - 1, - const Object(), - 'foo', - List.unmodifiable([const Object()]) - ]) { - final list = List.unmodifiable([sharable]); - final listCopy = await sendReceive(list); - Expect.identical(list, listCopy); - } - - // Non-Sharable. - for (final nonSharable in [ - Object(), - [], - {}, - List.unmodifiable([Object()]) - ]) { - final list = List.unmodifiable([nonSharable]); - final listCopy = await sendReceive(list); - Expect.notIdentical(list, listCopy); - Expect.notIdentical(list[0], listCopy[0]); - } - } } main() async { diff --git a/runtime/tests/vm/dart_2/isolates/fast_object_copy2_test.dart b/runtime/tests/vm/dart_2/isolates/fast_object_copy2_test.dart index 6d41f1a2b7d..b26863d22b8 100644 --- a/runtime/tests/vm/dart_2/isolates/fast_object_copy2_test.dart +++ b/runtime/tests/vm/dart_2/isolates/fast_object_copy2_test.dart @@ -111,7 +111,6 @@ class SendReceiveTest extends SendReceiveTestBase { await testSharable(); await testSharable2(); await testCopyableClosures(); - await testUnmodifiableList(); } Future testSharable() async { @@ -159,35 +158,6 @@ class SendReceiveTest extends SendReceiveTestBase { Expect.equals(copyableClosures[i].runtimeType, copy2[i].runtimeType); } } - - Future testUnmodifiableList() async { - print('testUnmodifiableList'); - - // Sharable. - for (final sharable in [ - 1, - const Object(), - 'foo', - List.unmodifiable([const Object()]) - ]) { - final list = List.unmodifiable([sharable]); - final listCopy = await sendReceive(list); - Expect.identical(list, listCopy); - } - - // Non-Sharable. - for (final nonSharable in [ - Object(), - [], - {}, - List.unmodifiable([Object()]) - ]) { - final list = List.unmodifiable([nonSharable]); - final listCopy = await sendReceive(list); - Expect.notIdentical(list, listCopy); - Expect.notIdentical(list[0], listCopy[0]); - } - } } main() async {