Skip to content

Commit d2923b2

Browse files
alexmarkovCommit Queue
authored andcommitted
[vm,dyn_modules] Do not share bytecode between field getter and field initializer
Profiler does not allow 2 distinct Bytecode objects to use the same range of bytecode, as it needs to map PC to a Bytecode unambiguously. So this change removes reuse of the field initializer bytecodes for a field getter (in case of const fields). TEST=pkg/vm_service/test/get_perfetto_cpu_samples_rpc_test Change-Id: I758286f6f4fcfe2e2169bbc19ae233594e263522 Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436740 Commit-Queue: Alexander Markov <[email protected]> Reviewed-by: Slava Egorov <[email protected]>
1 parent 1164ea7 commit d2923b2

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

runtime/vm/bytecode_reader.cc

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,16 +1684,10 @@ void BytecodeReaderHelper::ReadFieldDeclarations(const Class& cls,
16841684
function.set_accessor_field(field);
16851685
function.set_is_extension_member(is_extension_member);
16861686
SetupFieldAccessorFunction(cls, function, type);
1687-
if (is_const && has_nontrivial_initializer) {
1688-
BytecodeLoader* loader = thread_->bytecode_loader();
1689-
ASSERT(loader != nullptr);
1690-
loader->SetOffset(function, loader->GetOffset(field));
1687+
if (is_static) {
1688+
function.AttachBytecode(Object::implicit_static_getter_bytecode());
16911689
} else {
1692-
if (is_static) {
1693-
function.AttachBytecode(Object::implicit_static_getter_bytecode());
1694-
} else {
1695-
function.AttachBytecode(Object::implicit_getter_bytecode());
1696-
}
1690+
function.AttachBytecode(Object::implicit_getter_bytecode());
16971691
}
16981692
functions_->SetAt(function_index_++, function);
16991693
}

0 commit comments

Comments
 (0)