Checking if an interpreted frame is marked for lazy deopt while
preparing to handle an exception was causing an assert to be hit. We
can skip this check for interpreted frames.
Fixes https://github.com/dart-lang/sdk/issues/38003.
Change-Id: Icea65868c6291864df93920fa25236bcc36fded5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115268
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
The CheckStack bytecode does not denote a debug point anymore after the
introduction of the DebugCheck bytecode.
Fix caller/callee determination in mixed mode.
Factorize some code.
Change-Id: Ide1e0bbad022a83e6113243dc996396f9f5d2f3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108565
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
There are minor fixes for dartkb and windows.
The original revision is in patchset 1.
Change-Id: I9ab6e5fdb33fb4e84ea520c283fe94323616a8ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103129
Commit-Queue: Samir Jindel <sjindel@google.com>
Auto-Submit: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
This is the next step towards preventing compiler from directly peeking
into runtime and instead interact with runtime through a well defined
surface. The goal of the refactoring to locate all places where compiler
accesses some runtime information and partion those accesses into two
categories:
- creating objects in the host runtime (e.g. allocating strings, numbers, etc)
during compilation;
- accessing properties of the target runtime (e.g. offsets of fields) to
embed those into the generated code;
This change introduces dart::compiler and dart::compiler::target namespaces.
All code in the compiler will gradually be moved into dart::compiler namespace.
One of the motivations for this change is to be able to prevent access to
globally defined host constants like kWordSize by shadowing them in the
dart::compiler namespace.
The nested namespace dart::compiler::target hosts all information about
target runtime that compiler could access, e.g. compiler::target::kWordSize
defines word size of the target which will eventually be made different
from the host kWordSize (defined by dart::kWordSize).
The API for compiler to runtime interaction is placed into compiler_api.h.
Note that we still permit runtime to access compiler internals directly -
this is not going to be decoupled as part of this work.
Issue https://github.com/dart-lang/sdk/issues/31709
Change-Id: If4396d295879391becfa6c38d4802bbff81f5b20
Reviewed-on: https://dart-review.googlesource.com/c/90242
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The megamorphic miss stub might not be initialized at the point in time
when we access it.
Fixes https://github.com/dart-lang/sdk/issues/35405
Change-Id: If20622bd4f3b14d6ece5a8de6f006d7081d6cf76
Reviewed-on: https://dart-review.googlesource.com/c/87322
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This CL adds a [ReversePcLookupCache] which, based on a list of code
objects, builds up a binary searchable table for mapping PCs to Code
objects (where all the metadata is available, like stackmaps, ...).
This CL also adds stack walking support for "bare instruction" frames.
In a later part we will start emitting the sorted list of code objects
(via the new field in the object store) under a flag.
Issue https://github.com/dart-lang/sdk/issues/33274
Change-Id: I3c06c12bc0fb266dc1bd843a4a11b5208773151d
Reviewed-on: https://dart-review.googlesource.com/c/85746
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Allow pc_marker slot to hold a Code object or a new Bytecode object.
Change-Id: If11c1df6dafc5b1cfcce6f0322c36d1d68e86df9
Reviewed-on: https://dart-review.googlesource.com/c/82526
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Change-Id: I6dc02b3d9de16cc176eb97613bc0c7f0bb9b16eb
Reviewed-on: https://dart-review.googlesource.com/77013
Commit-Queue: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
After this CL, the interpreter is included by default in the
JIT VM under the flag --enable-interpreter.
Reland with fix to NativeArgument setup in simulator_arm.cc
Change-Id: Ib9b4df6eb4d997dfbe361188b8a127828c1d9c6f
Reviewed-on: https://dart-review.googlesource.com/74003
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
This reverts commit 715ab7b30b.
Reason for revert: simarm and kernel precomp builds failing
Original change's description:
> [vm] Move the interpreter under a flag.
>
> After this CL, the interpreter is included by default in the
> JIT VM under the flag --enable-interpreter.
>
> Change-Id: I06458f20288d67981822788ee6e867c2127ebdd3
> Reviewed-on: https://dart-review.googlesource.com/71800
> Commit-Queue: Zach Anderson <zra@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
TBR=rmacnak@google.com,alexmarkov@google.com,zra@google.com,asiva@google.com,regis@google.com
Change-Id: I3622f4dbe53288d07fc21b34ee5ff68f2682b36d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/74001
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
After this CL, the interpreter is included by default in the
JIT VM under the flag --enable-interpreter.
Change-Id: I06458f20288d67981822788ee6e867c2127ebdd3
Reviewed-on: https://dart-review.googlesource.com/71800
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This will allow us to have configurable frame layouts during
gen_snapshot/dart_bootstrap.
Issue https://github.com/dart-lang/sdk/issues/33274
Change-Id: I18945189034be1a585c1e2edcf53a4b7537204c2
Reviewed-on: https://dart-review.googlesource.com/59880
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
So far the frontend (parser, flow graph builder, ssa construction) were
aware of the actual frame layout.
This CL makes the indices we assign to [LocalVariable]s logical
indices, assigning:
* M parameters the indices 1 ... M
* N local variables the indices 0 -1 ... -(N-1)
The scope building, flow graph builder and ssa construction operate on
those logical indices.
When emitting actual code, the backend will translate those indices into
actual FP relative indices. This allows us to be more flexible in the
backend which frame layout we choose.
Issue https://github.com/dart-lang/sdk/issues/33274
Change-Id: I9a504bf97821c257aafd2b3430df9f4c9da4b442
Reviewed-on: https://dart-review.googlesource.com/57321
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Previously there were places in the code where an API accepted a
`bool validate_frames` and call sites passed an enum value (which
implicitly got converted to a bool).
By changing the APIs to require an enum, the compiler will tell us if a
caller doesn't pass one.
Change-Id: I29fcd0b018e6cdd7e00b5bb03e83b9636d1345d4
Reviewed-on: https://dart-review.googlesource.com/57823
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Improves the space overhead of compaction from O(size of live objects) to O(number of live objects).
Future work includes:
- a smaller, faster representation the forwarding table via a bitmap of used allocation units
- sorting class sizes off-heap to allow sliding classes
- running forwarding in parallel
Removes unnecessary sweep from evacuating compactor.
Change-Id: If0991bfb75573201c6e8feed142ca0cc69fccab4
Bug: https://github.com/dart-lang/sdk/issues/30978
Reviewed-on: https://dart-review.googlesource.com/15988
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
The assertions which tried to assert that we only use
StackFrameIterator to walk frames of the current thread was incorrect.
We already have cases where other threads will walk the stack of the
mutator thread, see below for an example where this can happen.
Thread::VisitObjectPointers was incorrectly passing Thread::Current() to
the StackFrameIterator instead of 'this'. (Code in thread_registry.cc will
loop over a number of threads and calls VisitObjectPointers on them)
Mutator thread:
0 pthread_cond_wait@@GLIBC_2.3.2
1 dart::Monitor::WaitMicros
2 dart::Monitor::Wait
3 dart::MonitorLocker::Wait
4 dart::ThreadBarrier::Sync
5 dart::GCMarker::MarkObjects
6 dart::PageSpace::MarkSweep
7 dart::Heap::CollectOldSpaceGarbage
8 dart::Heap::CollectNewSpaceGarbage
9 dart::Heap::CollectGarbage
10 dart::DN_HelperObject_<native>
11 dart::BootstrapNatives::<native>
<dart frames>
MarkTask thread:
1 dart::EntryFrame::VisitObjectPointers
2 dart::Thread::VisitObjectPointers <---- Walks mutator thread stack
3 dart::ThreadRegistry::VisitObjectPointers <---- Iterates over a number of threads
4 dart::Isolate::VisitStackPointers
5 dart::Isolate::VisitObjectPointers
6 dart::GCMarker::IterateRoots
7 dart::MarkTask::Run
8 dart::ThreadPool::Worker::Loop
9 dart::ThreadPool::Worker::Main
10 dart::ThreadStart
R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2845053003 .
Use that to sync variables to predefined stack
slots inside of exception handler, not before
each MayThrow() instruction.
In JIT mode we can avoid storing extra metadata
by using deopt info instead.
Introduce caching of metadata and
exception handler based on PC.
R=fschneider@google.com, vegorov@google.com
Review-Url: https://codereview.chromium.org/2734323003 .
Use that to sync variables to predefined stack
slots inside of exception handler, not before
each MayThrow() instruction.
In JIT mode we can avoid storing extra metadata
by using deopt info instead.
Introduce caching of metadata and
exception handler based on PC.
R=fschneider@google.com
Review-Url: https://codereview.chromium.org/2640853002 .
We have a racy read of the object header in the stack frame walker
called from the profiler (in this case the gc marker is running at
the same time).
It is appropriate to avoid this even though we think the access is
safe as the objects are in old space and never forwarded and only
the mark bits are manipulated while marking
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/2517473002 .
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER
This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.
R=asiva@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/2450713004 .
When throwing to a frame scheduled for lazy deopt, update the continuation pc for that frame to be the catch handler.
Weaken new assert that the deopt pc belongs to the frame's code as the deopt pc for the last eager deopt in a function lies outside the code, after the call to the deopt stub.
R=fschneider@google.com
Review URL: https://codereview.chromium.org/2392613002 .
- Use TokenDescriptor instead of intptr_t for all token positions.
- Use TokenDescriptor in raw_object instead of int32_t.
- TokenDescriptor is a POD with an int32_t (this shrinks the size of AST and IR nodes by 32-bits on 64-bit architectures).
There are some cleanups I plan on doing as a follow up CL:
- Replace TokenDescriptor::value() with TokenDescriptor::TokenPos()
R=iposva@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/1644793002 .
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.
All non-ia32 platforms:
No entry patching.
ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.
BUG=
R=koda@google.com, rmacnak@google.com
Committed: 1d343e5a7b
Review URL: https://codereview.chromium.org//1192103004 .
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.
All non-ia32 platforms:
No entry patching.
ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org//1192103004 .
This allows to make the last explicitly named stubs shared between isolates.
When sharing code stubs, we can't do patching at their entry anymore.
Therefore, I had to remove patching support of the array allocation stub.
Is this a functionality we want to keep?
The change is mostly performance-neutral because optimized code has an inlined fast
path for array allocation and only uses the stub for the slow-case.
The only isolate-specific stubs left are object allocation stubs which are
associated with their Class are per-isolate.
Since this CL removes any isolate-specific stubs from StubCode, it becomes AllStatic.
BUG=
R=koda@google.com
Review URL: https://codereview.chromium.org//1247783002 .