RegExp compiler produces bytecode which might issue PushRegister
before SetRegister - which leads to a use of uninitialized value
under MSAN if these registers are not initialized.
TEST=ci
Change-Id: I011545cf05de62490d71503ea5a60a656a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/485000
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
When using the --dump-kernel-bytecode flag, also print the line and
number of the source position encoded by a synthetic token position.
Also use the decoded value for a synthetic token position when
converting it as a C string for printing, which also makes it easier to
correlate real and synthetic token positions encoding the same source
position.
Also change the long outdated comment about synthetic token positions
not encoding a real source offset, as most if not all uses of them
do actually encode a real source offset.
TEST=manual use during debugging
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: Ic16e320e9a10d8343e8a37c8270c7076bb7052c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484943
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
The unique IDs are assigned during VM-specific lowering transformation
and recomputed during TFA tree shaking.
The IDs are not assigned when local function AST nodes are created
as it makes certain AST transformations very fragile (e.g. moving
a sub-tree to another parent, cloning a tree to insert into another
member).
The IDs will be used to identify local functions within a member by
the VM and different compilers (dart2bytecode, modular AOT).
TEST=ci
Change-Id: Ifa5dc007322a0137776961d364bbf8565137b318
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Add __VA_OPT__ to guard the trailing comma, since we use
the /Zc:preprocessor flag.
Remove the conditional guard, since __VA_OPT__ is the
portable way of doing this in C++20, and we target that
version of the language standard when compiling.
TEST=build on vm-msvc-win-x64,vm-msvc-win-arm64
Cq-Include-Trybots: luci.dart.try:vm-msvc-win-arm64-try,vm-msvc-win-x64-try
Change-Id: I5b718858300d72679e9c8bced5f1419e206a2e94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484621
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Simplify isolate group enter-exit logic in EmitModuleSymbolsFor: always
call it without an active isolate group. Make sure that we
destroy StackZone before trying to exit the isolate.
Skip unit test with deferred units on Mac OS: as we don't support
deferred units when writing out Mach-O files currently.
TEST=ci
Change-Id: I8a8615f045781f263c92c45eecf955366a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483760
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Current implementation of profile data streaming inherited its
approach to symbolization from the implementation of vm-service's
get{,Perfetto}CpuSamples methods. These methods rather expensive
as they rely on CodeLookupTable to symbolize collected samples, and
constructing CodeLookupTable requires bringing all threads to safepoint
and iterating over old-space to collect code objects. This can take
significant amount of time - especially when old-space is large (e.g.
consider 1Gb+ heaps of Dart Analysis Server).
This CL rewrites profile data streaming to use a completely different
approach in AOT mode where Dart frames are not symbolized eagerly
and instead stored in the timeline in their raw form: a pair of
an isolate group specific Mapping and a PC value relative to the start
of that mapping. At the end of streaming (or when isolate group
exits) an additional ModuleSymbols packet is emitted which provides
symbolization information for all collected frames. ModuleSymbols
mappings can be cheaply constructed from collected PCs using
ReversePc lookup tables.
TEST=expanded existing tests
Change-Id: I56ef1dd4c9a17fb0d2e9c24e51f2e4656a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482782
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This allows a great deal of linker GC resulting in a much smaller binary. The benefit multiplies for Flutter development because the Flutter tool downloads many variant copies of gen_snapshot.
out/ReleaseX64/exe.stripped/gen_snapshot -1.55M (-23.4%)
TEST=ci
Change-Id: I9f6e650f78ea52c9c6953320a669b71019403236
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482965
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Drop libprotobuf dependency and update compile_perfetto_protos
to rely on externally provided protoc and protozero_plugin.
This is done because protoc does not build with our current
toolchain and fixing this build requires rolling new protobuf,
protobuf_gn and perfetto. Which also pulls more external dependencies
like abseil.
Regenerate Perfetto *.pbzero{.cc,.h}, *.dart files
TEST=ci
Change-Id: I11a32aa07e810b48ac12502e526bbaee6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482781
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
If we have Dart stack frame information don't give up on profiler
sample if C frame is malformed due to invalid FP. We are not
going to use C frame information anyway.
TEST=ci
Change-Id: I8da05d1397f805543b7721fa9d861a996a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482780
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Also:
* Support arguments descriptors.
* Fix order of ClosureCall inputs in local function invocations.
* Fix order of passing arguments in all Dart calls.
* Fix handling of fields in InstanceSerializationCluster.
* Do not compile abstract methods and fields.
* Do not generate initializer functions for fields with trivial
initializers.
* Initialize Code::code_source_map to an empty CodeSourceMap
(in order to avoid failed assertions).
TEST=tools/test.py -n vm-modaot-mac-debug-arm64 language
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I40ff1b8234c32c41e08f3288a23e4abc173efcfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480020
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
A forwarding stub can have a covariant type parameter while the same
type parameter in its forwarding stub target is non-covariant.
We should still check bounds of such type parameters
(the bound to check is taken from the forwarding stub target).
TEST=tests/language/regress/regress62664_test.dart
Fixes https://github.com/dart-lang/sdk/issues/62664
Change-Id: I86eeb9f8a537c22fb473388f9b17f55084af6366
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482480
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
https://dart-review.googlesource.com/c/sdk/+/481782 removed the tracing
of the original instruction for breakpoints. This CL adds it back.
Also increments icount_ before calling TraceInstruction in the dispatch
loop instead of afterwards so that breakpoint/single step tracing can
just use icount_ without adjusting it. In particular, this means tracing
the original instruction at a breakpoint can just use TraceInstruction
instead of duplicating it.
Also, now both the breakpoint instruction and the original instruction
are written to the instruction trace if requested, instead of only the
breakpoint instruction.
TEST=debugging only changes, so manually tested.
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: I1999f1d9e7ba55b950c508e848ff12db0c8d5cab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482320
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
In compiled code, a block of instructions that calls the single step
handler in the runtime is generated for any pause points. Enabling a
breakpoint at a pause point then patches those instructions to instead
call a stub. The stub first calls the breakpoint handler in the runtime.
The runtime's breakpoint handler returns the original call target for
the breakpoint, which the stub then calls.
Since the debugger ignores any pause points with the same source
location after hitting a breakpoint, this means that setting a
breakpoint at a pause point only generates a breakpoint hit event,
ensuring that a request to single step after hitting a breakpoint steps
to the next location, not the breakpoint location.
Similar to compiled code, enabling a breakpoint in interpreted code
replaces the original instruction with a special instruction that first
calls the breakpoint handler and then performs the original
instruction's implementation.
However, there is no specific instruction for pause points in
interpreted code. Instead, the dispatch loop in the interpreter has two
labels for each instruction: one for the instruction's implementation,
and another that is used instead when single stepping is enabled. All
the single step labels point at the same code block, which first calls
the single step handler and then dispatches to the code for the
instruction's implementation.
This difference in handling breakpoints and single step checks means
that pause events are prioritized, not breakpoint hit events, which
means single stepping into a breakpoint generates first a pause event
and then a breakpoint hit event, which differs from the behavior
for compiled code.
To fix this, refactor single step handling in the interpreter so that
the single step label for breakpoint instructions point to a different
code block which first calls the breakpoint handler and then calls the
single step handler before dispatching to the original instruction's
implementation.
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: Id33132bbecc5d0cbd9e92bc5a13d8d8a80155344
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481782
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
Normally, bytecodes no longer in use would be renamed to Unused<X>.
However, in the case of DebugCheck, its only use was to call the
debugger when single stepping, and since its original creation, the
interpreter has been changed to call the debugger when single stepping
on every instruction. Thus, DebugCheck instructions are effectively
no-ops, only used as a distinct PC offset for source positions, and this
CL changes their name to reflect this.
This CL also changes the bytecode generator to detect uses of debugger()
from dart:developer and to add a Nop after it, mimicking how
StreamingFlowGraphBuilder recognizes uses of debugger() and adds a
DebugStepCheck instruction afterwards. Doing this instead of just
using asm.emitSourcePosition() at the end of visitStaticInvocation
ensures that the source position isn't overwritten by the next emitted
instruction.
TEST=pkg/vm_service/test/set_sdk_library_debuggable_test
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: Ie24bcea0b5aeb9e41d7765f25b1cd123bb2565b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480203
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Removed from `benchmarks/`, `runtime/`, `sdk/`, `tools/` and `utils/`.
(Leaving `tests/`, `pkg/` and `third_party/`.)
CoreLibraryReviewExempt: No real change.
Tested: No test changes for no real code changes.
Change-Id: Ieb42441457ca3d0ea4443dd153ee902ea33b28de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480241
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Inc/dec instructions partially update flags register,
which creates false dependencies between instructions,
so they should be only used when optimizing for size.
TEST=ci
Change-Id: I0be2a00044820592689884037dd4784ee4765e4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/479700
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Add support for constant lists, maps, sets, ints, doubles,
symbols, type literals and user-defined instances.
Also add initial support for function types (without
type parameters), extension types, nullable Never.
TEST=tools/test.py -n vm-modaot-mac-debug-arm64 language
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I9f73925759b44ac33515895c06ef2a3fcb97e04b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/479066
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Adds a new code path for NativeCallable.isolateLocal invocations. If
the current thread is not entered into any isolate, but owns the
target isolate, then it enters the target isolate, invokes, then exits
the isolate.
Fixes: https://github.com/dart-lang/sdk/issues/61623
TEST=tests/ffi/function_callbacks_isolate_ownership_test.dart
Change-Id: I401f185fadf7d2a55190dafd15387e1c418c67c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452380
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Although the data races on patchable object pool entries are benign,
without proper release-acquire ordering there is no happens-before
relationship between store and load and there is a data race as defined
by the C++ standard (and detected by TSAN), which is an undefined
behavior.
It seems like additional memory_order_acquire loads only happen in
runtime entries when we need to patch calls, which is rather
infrequent. Unless additional barriers measurably affect
performance, we should prefer to avoid UB.
TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/62236
Change-Id: I3a4d8c3dca7ce1ee1a75efd1ea8ba4e9c06c9dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476500
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Previously there were two separate implementations of the same
initialization code, one in object.cc and one in interpreter.cc.
Now they both use Object::InitializeHeader.
Make TryAllocate a static method of Interpreter instead of a file-local
function in interpreter.cc so that it gets access to the private method
Object::InitializeHeader.
TEST=ci (just code refactoring)
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try
Change-Id: I4e042fbf0db84e02c88f7ca0f3e025723660001b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476120
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
AddTrackMetadataBasedOnThread was looking at FLAG_timeline_recorder
to determine if it can skip recording metadata. However the flag
value is not necessary in sync with the current recorder because
NativeRuntime.streamTimelineTo can reconfigure recorder itself
without changing flag value.
It seems strange to be checking the flag instead of using proper OOP
anyway - the function is already virtual. This CL removes code
which was checking the FLAG and instead overrides the method in
subclasses which don't care about track metadata.
TEST=existing tests were updated to cover this case
Change-Id: I2a2859ab5ef28d8d6d2358259cc9ed8d6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476400
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Moving these constants from global namespace to Page class prevents
possible conflicts with other kPageSize/kPageMask/kBlockSize constants
and allows us to export value of Page::kPageMask constant into runtime
offsets via runtime/vm/compiler/runtime_offsets_list.h.
TEST=ci
Change-Id: I4357f4644f0f5f7beba50184231fef55dd86b124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476147
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This function is used from two different places: when preparing for
allocation and during the allocation process itself. In the former
case linear search is better (because we build ranges backwards and
their start positions are monotonically decreasing), in the later
case we perform splits at arbitrary positions and as such binary
search is likely better.
Significantly improves performance of register allocator with large
number of live-ranges: compilation time goes to 3.5s from ~30s on
tests/co19/src/LibTest/core/List/List_all_t04.dart (measured prior
to 1d91605c25 which removed most
of constant live-ranges in this test by allowing constant to
be used directly by indexing operation).
Fixes https://github.com/dart-lang/sdk/issues/62411
TEST=ci
Change-Id: Ia8f502ff08085ae66b50c4f334bfd22b6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476161
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>