mirror of
https://github.com/dart-lang/sdk
synced 2024-09-20 04:01:29 +00:00
2195c3282a
These changes were originally submitted separately on different days, and a major performance regression was seen after the first change when creating snapshots that led to both being reverted. However, that performance regression should be addressed by the followup. First change: "[vm] Treat the dispatch table as a root in the snapshot. Additional changes: * Only serialize a dispatch table in precompiled snapshots. * Add information in v8 snapshot profiles for the dispatch table. * Fix a typo in a field name. * Print the number of Instructions objects (or payloads, for precompiled bare instructions mode) in the fake cluster for the data section. * Fix v8 snapshots profiles so objects in memory mapped segments and only those are prefixed with "(RO) ". * Add names for Instructions objects in v8 snapshot profiles when we can use the assembly namer. * Add command line flag for old #define'd false flag." Second change: "[vm/aot] Keep GC-visible references to dispatch table Code entries. This change splits dispatch table handling into four distinct parts: * The dispatch table generator does not make a dispatch table directly, but rather creates an Array that contains the Code objects for dispatch table entries. * The precompiler takes this Array and puts it in the object store, which makes it a new GC root. * The serializer takes this information and serializes the dispatch table information in the same form as before. * The deserializer creates a DispatchTable object and populates it using the serialized information. The change in the precompiler ensures that the Code objects used in the dispatch table have GC-visible references. Thus, even if all other references to them from the other GC roots were removed, they would be accessible in the serializer in the case of a GC pass between the precompiler and serializer. This change also means that the serializer can retrieve and trace the Code objects directly rather than first looking up the Code objects by their entry point." Bug: https://github.com/dart-lang/sdk/issues/41022 Change-Id: I52c83b0536fc588da0bef9aed1f0c72e8ee4663f Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139285 Commit-Queue: Teagan Strickland <sstrickl@google.com> Reviewed-by: Alexander Aprelev <aam@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
// Copyright (c) 2020, 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/dispatch_table.h"
|
|
|
|
#include "platform/assert.h"
|
|
|
|
namespace dart {
|
|
|
|
intptr_t DispatchTable::OriginElement() {
|
|
#if defined(TARGET_ARCH_X64)
|
|
// Max negative byte offset / 8
|
|
return 16;
|
|
#elif defined(TARGET_ARCH_ARM)
|
|
// Max negative load offset / 4
|
|
return 1023;
|
|
#elif defined(TARGET_ARCH_ARM64)
|
|
// Max consecutive sub immediate value
|
|
return 4096;
|
|
#else
|
|
// No AOT on IA32
|
|
UNREACHABLE();
|
|
return 0;
|
|
#endif
|
|
}
|
|
|
|
intptr_t DispatchTable::LargestSmallOffset() {
|
|
#if defined(TARGET_ARCH_X64)
|
|
// Origin + Max positive byte offset / 8
|
|
return 31;
|
|
#elif defined(TARGET_ARCH_ARM)
|
|
// Origin + Max positive load offset / 4
|
|
return 2046;
|
|
#elif defined(TARGET_ARCH_ARM64)
|
|
// Origin + Max consecutive add immediate value
|
|
return 8192;
|
|
#else
|
|
// No AOT on IA32
|
|
UNREACHABLE();
|
|
return 0;
|
|
#endif
|
|
}
|
|
|
|
const uword* DispatchTable::ArrayOrigin() const {
|
|
return &array_.get()[OriginElement()];
|
|
}
|
|
|
|
} // namespace dart
|