Files
sdk/runtime/vm/roots.cc
T
Ryan Macnak e98e6a1198 [vm] Per isolate group roots accessed via TLS.
Remove special case for null in message snapshots; snapshots are sometimes read or written with no current isolate group.

Currently still all copies pointing into the VM isolate.

TEST=ci
Change-Id: I4d2e35a01880885d4e92e1c623c0f39a35e06065
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493866
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-08 15:26:06 -07:00

37 lines
1.3 KiB
C++

// Copyright (c) 2026, 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.
#include "vm/roots.h"
#include "vm/dart_api_state.h"
#include "vm/dart_entry.h"
#include "vm/handles.h"
#include "vm/object.h"
#include "vm/visitor.h"
namespace dart {
void Roots::VisitObjectPointers(ObjectPointerVisitor* visitor) {
COMPILE_ASSERT(ARRAY_SIZE(raw_.cached_args_descriptors_) ==
ArgumentsDescriptor::kCachedDescriptorCount);
COMPILE_ASSERT(ARRAY_SIZE(raw_.cached_icdata_arrays_) ==
ICData::kCachedICDataArrayCount);
COMPILE_ASSERT(sizeof(Roots::ApiHandle) == sizeof(LocalHandle));
COMPILE_ASSERT(sizeof(Roots::VMHandle) == kVMHandleSizeInWords * kWordSize);
ObjectPtr* from = reinterpret_cast<ObjectPtr*>(&raw_);
visitor->VisitPointers(from, from + sizeof(Raw) / sizeof(ObjectPtr) - 1);
from = reinterpret_cast<ObjectPtr*>(&api_);
visitor->VisitPointers(from, from + sizeof(Api) / sizeof(ObjectPtr) - 1);
VMHandle* fromh = reinterpret_cast<VMHandle*>(&internal_);
VMHandle* toh = fromh + sizeof(Internal) / sizeof(VMHandle) - 1;
for (VMHandle* h = fromh; h <= toh; h++) {
visitor->VisitPointer(&(h->ptr));
}
}
} // namespace dart