dart-sdk/runtime
Martin Kustermann 3669086a40 [vm] Fix field index information in heap snapshots in AOT
In AOT we can have unboxed fields that will not be visited by GC
visitors and as such are also not reported as <obj>.references when
producing heap snapshots.

Though the heapsnapshot's <class>.fields will contain entries
for unboxed fields, which causes the fields index calculation to be
incorrect.

This can cause various confusing things, e.g. incorrectly caluclated
retaining paths, since the <class>.fields.index doesn't match the
index in <obj>.references.

To fix this this CL will change the visiting code to emit dummy
references for unboxed fields.

The written test uncovered a few other issues:

  - report type_arguments and native_fields in <class>.fields
    => the visitors already visit those fields

  - fix `Class::next_{host,target}_field_offset` for classes
    with native fields
    => this will also shrink size of `NativeWrapperClass` subclasses

  - ensure classes with vm-defined layout are finalized
    => we assume objects should only exist in heap if their class
       is finalized

  - fix `FfiNativeFunction` type_argument offset

  - fixes for object fields list
    => add missing entries, fix existing entries

Fixes https://github.com/dart-lang/sdk/issues/49711

TEST=vm/dart{,_2}/heap_snapshot_regress_49711_test

Change-Id: I8e25680b2c0c8c49caafbb8da57b0b6419e89c4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255814
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-08-23 05:17:49 +00:00
..
bin [vm/test] Remove checked-in binaries from MachO test. 2022-08-17 16:18:35 +00:00
docs [vm/inliner] Tweak inlining heuristic, improve List.of inlining. 2022-08-15 21:14:36 +00:00
include [vm, gc] Very basic RAIL. 2022-07-27 16:40:38 +00:00
lib [vm] Prevent Dart_NewSendPort from bypassing the arbitrary object checks. 2022-08-19 18:10:15 +00:00
observatory Fixed various typos in a lot of files 2022-07-25 12:21:59 +00:00
observatory_2 Fixed various typos in a lot of files 2022-07-25 12:21:59 +00:00
platform [vm] Fix kNumberOfReservedCpuRegisters on ARM64 2022-08-10 18:04:09 +00:00
tests [vm] Fix field index information in heap snapshots in AOT 2022-08-23 05:17:49 +00:00
third_party [vm] More pieces of Windows ARM support. 2022-04-07 23:15:48 +00:00
tools Use DartType.element2 instead of 'element'. 2022-08-18 15:56:14 +00:00
vm [vm] Fix field index information in heap snapshots in AOT 2022-08-23 05:17:49 +00:00
.clang-tidy
.gitignore
BUILD.gn [build] -fno-strict-vtable-pointers is a Clang-only flag. 2022-03-30 17:34:20 +00:00
codereview.settings
configs.gni
CPPLINT.cfg
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
PRESUBMIT.py [python3] Migrate PRESUBMIT.py files 2021-08-16 08:29:54 +00:00
runtime_args.gni [VM] error: ‘mallinfo mallinfo()’ is deprecated 2021-12-08 00:25:10 +00:00