[vm] Always share double/float32x4/float64x2/int32x4 in inter-isolate messages

The JIT support for dynamically unboxing has been removed in [0]. As
such all double/float32x4/float64x2/int32x4 objects are immutable and
can therefore be shared across isolates.

[0] https://dart-review.googlesource.com/c/sdk/+/256211

TEST=ci

Change-Id: Ifd4e7c2444415b2e3b5269d9fbeb6570cc5d6768
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273680
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
Martin Kustermann 2022-12-07 00:48:28 +00:00 committed by Commit Queue
parent e70e2bc1b7
commit 896675c462
3 changed files with 6 additions and 20 deletions

View file

@ -7,9 +7,6 @@
// VMOptions=--no-enable-fast-object-copy --gc-on-foc-slow-path --force-evacuation
// VMOptions=--enable-fast-object-copy --gc-on-foc-slow-path --force-evacuation
// The tests in this file will only succeed when isolate groups are enabled
// (hence the VMOptions above).
import 'dart:async';
import 'dart:isolate';
import 'dart:typed_data';
@ -75,6 +72,8 @@ final sharableObjects = [
const {1, 2, 3},
Isolate.current.pauseCapability,
Int32x4(1, 2, 3, 4),
Float32x4(1.0, 2.0, 3.0, 4.0),
Float64x2(1.0, 2.0),
StackTrace.current,
];

View file

@ -9,9 +9,6 @@
// VMOptions=--no-enable-fast-object-copy --gc-on-foc-slow-path --force-evacuation
// VMOptions=--enable-fast-object-copy --gc-on-foc-slow-path --force-evacuation
// The tests in this file will only succeed when isolate groups are enabled
// (hence the VMOptions above).
import 'dart:async';
import 'dart:isolate';
import 'dart:typed_data';
@ -76,6 +73,8 @@ final sharableObjects = [
const {1, 2, 3},
Isolate.current.pauseCapability,
Int32x4(1, 2, 3, 4),
Float32x4(1.0, 2.0, 3.0, 4.0),
Float64x2(1.0, 2.0),
StackTrace.current,
];

View file

@ -159,15 +159,10 @@ static bool CanShareObject(ObjectPtr obj, uword tags) {
if (cid == kNeverCid) return true;
if (cid == kSentinelCid) return true;
if (cid == kStackTraceCid) return true;
#if defined(DART_PRECOMPILED_RUNTIME)
// In JIT mode we have field guards enabled which means
// double/float32x4/float64x2 boxes can be mutable and we therefore cannot
// share them.
if (cid == kDoubleCid || cid == kFloat32x4Cid || cid == kFloat64x2Cid) {
if (cid == kDoubleCid || cid == kFloat32x4Cid || cid == kFloat64x2Cid ||
cid == kInt32x4Cid) {
return true;
}
#endif
if (cid == kInt32x4Cid) return true; // No field guards here.
if (cid == kSendPortCid) return true;
if (cid == kCapabilityCid) return true;
@ -227,13 +222,6 @@ static bool MightNeedReHashing(ObjectPtr object) {
#endif
if (cid == kInt32x4Cid) return false;
// We copy those (instead of sharing them) - see [CanShareObjct]. They rely
// on the default hashCode implementation which uses identity hash codes
// (instead of structural hash code).
if (cid == kFloat32x4Cid || cid == kFloat64x2Cid) {
return !kDartPrecompiledRuntime;
}
// If the [tags] indicates this is a canonical object we'll share it instead
// of copying it. That would suggest we don't have to re-hash maps/sets
// containing this object on the receiver side.