mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 23:49:45 +00:00
13d27d669d
This change bakes binary search table which maps PC ranges to corresponding stack maps and Code objects (if still present in the snapshot) into RO data section of the snapshot - instead of constructing it at load time. This allows to considerably reduce amount of work done when loading Code cluster for programs which have majority of their Code objects discarded (i.e. in DWARF stack traces mode): as we no longer write / read any information for discarded Code objects. This CL also changes program visitor to deduplicate Code objects if their instructions are deduplicated in AOT mode. Only a single Code object can be choose as a representative for the given PC range so it does not make sense to write multiple Code objects into the snapshot which refer to the same Instructions. The overall improvement is hard to quantify but ReadProgramSnapshot shows the following improvement when starting a large Flutter application on a slow Android device: before 223.55±59.94 (192.02 .. 391.74) ms after 178.06±47.03 (151.31 .. 291.34) ms This CL packs CompressedStackMaps next to the binary search table itself allowing us to address them via offsets instead of pointers. Snapshot sizes are actually affected positively by this change. On the same large Flutter application I see DWARF stack traces on: -1.34% total SO size DWARF stack traces off: -1.63% total SO size Issue https://github.com/dart-lang/sdk/issues/46116 TEST=ci Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-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-linux-release-x64-try Change-Id: Ic997045a33daa81ec68df462a0792915885df66b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220766 Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Slava Egorov <vegorov@google.com>
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
// 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.
|
|
|
|
#ifndef RUNTIME_VM_REVERSE_PC_LOOKUP_CACHE_H_
|
|
#define RUNTIME_VM_REVERSE_PC_LOOKUP_CACHE_H_
|
|
|
|
#include "vm/allocation.h"
|
|
#include "vm/globals.h"
|
|
#include "vm/raw_object.h"
|
|
#include "vm/tagged_pointer.h"
|
|
|
|
namespace dart {
|
|
|
|
class IsolateGroup;
|
|
|
|
// This class provides mechanism to find Code and CompressedStackMaps
|
|
// objects corresponding to the given PC.
|
|
// Can only be used in AOT runtime with bare instructions.
|
|
class ReversePc : public AllStatic {
|
|
public:
|
|
// Looks for Code object corresponding to |pc| in the
|
|
// given isolate |group| and vm isolate group.
|
|
static CodePtr Lookup(IsolateGroup* group, uword pc, bool is_return_address);
|
|
|
|
static const UntaggedCompressedStackMaps::Payload* FindStackMap(
|
|
IsolateGroup* group,
|
|
uword pc,
|
|
bool is_return_address,
|
|
uword* code_start,
|
|
const UntaggedCompressedStackMaps::Payload** global_table);
|
|
|
|
private:
|
|
static const UntaggedCompressedStackMaps::Payload* FindStackMapInGroup(
|
|
IsolateGroup* group,
|
|
uword pc,
|
|
bool is_return_address,
|
|
uword* code_start,
|
|
const UntaggedCompressedStackMaps::Payload** global_table);
|
|
|
|
static CodePtr FindCodeInGroup(IsolateGroup* group,
|
|
uword pc,
|
|
bool is_return_address);
|
|
static CodePtr FindCode(IsolateGroup* group,
|
|
uword pc,
|
|
bool is_return_address);
|
|
};
|
|
|
|
} // namespace dart
|
|
|
|
#endif // RUNTIME_VM_REVERSE_PC_LOOKUP_CACHE_H_
|