-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop Code objects in AOT (PRODUCT && dwarf_stack_traces) #44852
Labels
area-vm
Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.
vm-aot-code-size
Related to improvements in AOT code size
vm-aot-memory-footprint
Related to improvements of VM memory footprint for AOT deployments
Projects
Comments
dart-bot
pushed a commit
that referenced
this issue
Feb 4, 2021
This is a preparation for removal of Code objects. Issue: #44852 TEST=ci Change-Id: I9765945731c91fbdac647cc448d021238f129880 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182361 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
dart-bot
pushed a commit
that referenced
this issue
Feb 17, 2021
…tack-traces The following changes are done in preparation for the removal of Code objects in AOT with --dwarf-stack-traces: * Stack trace objects are extended to hold uword PCs (which may not fit into Smi range). * Scanning stack frames in GC (StackFrame::VisitObjectPointers) now avoids using Code objects. In order to find CompressedStackMaps it now calls ReversePc::FindCompressedStackMaps. * Singleton Code object (StubCode::UnknownDartCode()) is prepared as a replacement for Code objects in stack traces. It has PayloadStart() == 0 and Size() == kUwordMax so it includes arbitrary PCs. * In --dwarf-stack-traces mode, most Code objects obtained from stack frames are replaced with StubCode::UnknownDartCode(). This simulates future behavior of ReversePc::Lookup when Code objects will be removed. Issue: #44852 Change-Id: I7cec7b8b9396c9cfeca3c256a412ba4e82a7e0c4 TEST=ci Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182720 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Tess Strickland <sstrickl@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
dart-bot
pushed a commit
that referenced
this issue
Feb 18, 2021
…-dwarf-stack-traces" This reverts commit b6dc4da. Reason for revert: broke package:vm_snapshot_analysis in Flutter (flutter/flutter#76313). Original change's description: > [vm/aot] Avoid using most Code objects in stack traces with --dwarf-stack-traces > > The following changes are done in preparation for the removal of Code > objects in AOT with --dwarf-stack-traces: > > * Stack trace objects are extended to hold uword PCs (which may not > fit into Smi range). > > * Scanning stack frames in GC (StackFrame::VisitObjectPointers) > now avoids using Code objects. > In order to find CompressedStackMaps it now calls > ReversePc::FindCompressedStackMaps. > > * Singleton Code object (StubCode::UnknownDartCode()) is prepared as > a replacement for Code objects in stack traces. It has > PayloadStart() == 0 and Size() == kUwordMax so it includes > arbitrary PCs. > > * In --dwarf-stack-traces mode, most Code objects obtained from stack > frames are replaced with StubCode::UnknownDartCode(). > This simulates future behavior of ReversePc::Lookup when Code objects > will be removed. > > Issue: #44852 > Change-Id: I7cec7b8b9396c9cfeca3c256a412ba4e82a7e0c4 > TEST=ci > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182720 > Commit-Queue: Alexander Markov <alexmarkov@google.com> > Reviewed-by: Tess Strickland <sstrickl@google.com> > Reviewed-by: Martin Kustermann <kustermann@google.com> Issue: #44852 Change-Id: I6f66171eecf1133363a7ce56193e782e43a20baf No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185488 Reviewed-by: Zach Anderson <zra@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
dart-bot
pushed a commit
that referenced
this issue
Feb 22, 2021
…-dwarf-stack-traces" This is a reland of b6dc4da TEST=ci Original change's description: > [vm/aot] Avoid using most Code objects in stack traces with --dwarf-stack-traces > > The following changes are done in preparation for the removal of Code > objects in AOT with --dwarf-stack-traces: > > * Stack trace objects are extended to hold uword PCs (which may not > fit into Smi range). > > * Scanning stack frames in GC (StackFrame::VisitObjectPointers) > now avoids using Code objects. > In order to find CompressedStackMaps it now calls > ReversePc::FindCompressedStackMaps. > > * Singleton Code object (StubCode::UnknownDartCode()) is prepared as > a replacement for Code objects in stack traces. It has > PayloadStart() == 0 and Size() == kUwordMax so it includes > arbitrary PCs. > > * In --dwarf-stack-traces mode, most Code objects obtained from stack > frames are replaced with StubCode::UnknownDartCode(). > This simulates future behavior of ReversePc::Lookup when Code objects > will be removed. > > Issue: #44852 > Change-Id: I7cec7b8b9396c9cfeca3c256a412ba4e82a7e0c4 > TEST=ci > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182720 > Commit-Queue: Alexander Markov <alexmarkov@google.com> > Reviewed-by: Tess Strickland <sstrickl@google.com> > Reviewed-by: Martin Kustermann <kustermann@google.com> Change-Id: Ia2fc4672a085cd963b7fc103369851df3603590c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186202 Commit-Queue: Vyacheslav Egorov <vegorov@google.com> Reviewed-by: Tess Strickland <sstrickl@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
dart-bot
pushed a commit
that referenced
this issue
Feb 27, 2021
Code objects which do not carry useful information are marked as 'discarded' during precompilation. Snapshot serializer only writes instructions, compressed stack maps and state bits for discarded Code objects. This is a preliminary step before deserializer would be able to omit creating instances for discarded Code objects at runtime. On a large app, AOT-compiled in PRODUCT mode with --dwarf-stack-traces on arm64: Discarded: 77% of all Code objects in snapshot. Uncompressed AOT snapshot size -1.9%. AOT snapshot size of Flutter gallery in release-sizeopt mode: arm64 uncompressed -2.1% (gzip -0.6%, brotli -0.7%) arm32 uncompressed -1.9% (gzip -0.6%, brotli -0.7%) TEST=ci Issue: #44852 Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,pkg-mac-release-try Change-Id: I159cfebbdac76cc60060fedb1d22ed86672a68a1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187600 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
dart-bot
pushed a commit
that referenced
this issue
Mar 13, 2021
There are two fixes: 1) If a function was compiled but not retained, precompiler should still trace through types used in exception handlers. 2) Certain auxiliary functions such as implicit closure functions and field initializers were added to 'possibly_retained_functions_' set but were not traced through AddTypesOf and were not added to 'functions_to_retain_' set. Flutter gallery AOT snapshot size release - no changes release-sizeopt arm +0.13%, arm64 +0.14% TEST=ci Fixes #45179 Issue #44852 Change-Id: Ide9a7e82a7bb9098dc90bc41a76e527e7a5cb603 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190781 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Tess Strickland <sstrickl@google.com>
dart-bot
pushed a commit
that referenced
this issue
Mar 15, 2021
…piler Flutter gallery AOT snapshot size release: no change; release-sizeopt: arm -0.24%, arm64 -0.25%. TEST=ci Issue: #44852 Change-Id: I847bfc311552bb4e80222e0040b50b4766a18dbe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190783 Reviewed-by: Tess Strickland <sstrickl@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
dart-bot
pushed a commit
that referenced
this issue
Mar 31, 2021
This change extends EqualityCompare IL instruction to handle case when operands are nullable ints. Unlike CheckedSmiComparison, EqualityCompare performs comparison without making a dynamic call on a slow path. Dynamic call in CheckedSmiComparison is a problem because it is not present in the original program and not properly tracked in TFA and precompiler, so precompiler is not able to drop Code objects (needed for dynamic calls) reliably. This change removes the remaining case when CheckedSmiComparison instruction was used. The cleanup will follow in a separate CL. TEST=ci Issue: #32166 Issue: #44852 Change-Id: I8114a2616becf632462d4cb3bfc255691f24e1ef Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193447 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
dart-bot
pushed a commit
that referenced
this issue
Mar 31, 2021
This is a final cleanup of CheckedSmiOpInstr and CheckedSmiComparisonInstr instructions. Their uses were removed in the following changes: https://dart-review.googlesource.com/c/sdk/+/191761 https://dart-review.googlesource.com/c/sdk/+/191760 https://dart-review.googlesource.com/c/sdk/+/193447 TEST=ci Issue: #44852 Change-Id: Ica52ab9e2fcabab1913228818642a27a8d842f92 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193449 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
dart-bot
pushed a commit
that referenced
this issue
Apr 13, 2021
While deserializing AOT snapshot, Code objects which do not contain valuable information besides entry point and stack maps are discarded and not allocated on the heap (they are replaced with StubCode::UnknownDartCode()). PC -> Code/CompressedStackMaps lookup is implemented using a separate table (InstructionsTable). Flutter gallery in release-sizeopt mode: Heap size of snapshot objects: arm -26.89%, arm64 -27.68% Large Flutter application in release mode with --dwarf-stack-traces: Heap size of snapshot objects: -24.3%. Discarded Code objects: 72.5% of all Code objects. Issue: #44852. TEST=existing tests; "--dwarf_stack_traces --no-retain_function_objects --no-retain_code_objects" mode is enabled for a few tests. Change-Id: I5fe3e283630c8e8f4442319d5dcae38d174dd0d8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189560 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
dart-bot
pushed a commit
that referenced
this issue
Apr 26, 2021
Calls from C++ to Dart entry points are currently performed by calling via Function::entry_point() in AOT mode (with --use_bare_instructions). Such calls no longer use Code objects, so Code objects can be discarded even if they belong to a Function which is used as an entry point. TEST=ci Issue: #44852 Change-Id: Iaf9dd67392780ef4344fc518865ffbe30648762e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196720 Reviewed-by: Tess Strickland <sstrickl@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
dart-bot
pushed a commit
that referenced
this issue
Apr 27, 2021
Previously, Code objects of invisible functions were retained in order to omit frames corresponding to such functions from stack traces when stack trace is printed. This change drops Code objects of invisible functions. That also means that frames corresponding to such functions are no longer skipped in binary DWARF stack traces. In order to account for that, DW_AT_artificial attribute is added to generated DWARF debug information to mark invisible functions. Stack trace decoding now looks at this attribute and skips those frames when symbolizing stack trace. Flutter gallery in release-sizeopt mode: Heap size of snapshot objects -4.2% (arm), -4.4% (arm64). A large application in --dwarf_stack_traces mode: Number of discarded Code objects increased from 72.4% to 83.7% (out of all Code objects). Heap size of Code objects -37.4%. Heap size of all snapshot objects -5%. TEST=tests/standalone/dwarf_stack_trace_invisible_functions_test.dart Issue: #44852 Change-Id: Ib804852aba1e083670f1d9b9d66cbaab7dcdcff9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196583 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Tess Strickland <sstrickl@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
Currently, about 83% of Code objects are removed on a large application in Remaining Code objects which can be potentially discarded:
The rest of the Code objects have exception handlers / pc descriptors / native functions etc and are not feasible to discard. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-vm
Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.
vm-aot-code-size
Related to improvements in AOT code size
vm-aot-memory-footprint
Related to improvements of VM memory footprint for AOT deployments
In AOT mode, when vm_service/profiler is not present (PRODUCT/flutter-release build) and
--dwarf-stack-traces
is used, there is a little need forCode
objects. Currently,Code
objects occupy significant portion of heap size of objects in the snapshot, so removing them would decrease memory usage and would also reduce AOT snapshot size.In order to remove most
Code
objects we need:CompressedStackMaps
corresponding to a given PC.Code
from stack traces in--dwarf-stack-traces
mode.ReversePc::Lookup
.For now, we can keep
Code
objects for exception handling as there is only a small number of codes with exception handlers.The text was updated successfully, but these errors were encountered: