[vm/concurrency] Share [Heap] and [SharedClassTable] between all isolates within one isolate group

This CL:

  * Moves [Heap]/[SharedClassTable] from [Isolate] to [IsolateGroup], which
    will make all isolates in the group use the same heap. The GC will use
    the shared class table for object size information.

  * Adds support for entering/leaving an isolate group as a helper thread
    (e.g. via [Thread::EnterIsolateGroupAsHelper]). The current active
    isolate group can be accessed via TLS `IsolateGroup::Current()` or
    `Thread::isolate_group_`. When entering as a helper thread there will be
    no current isolate.

  * Changes the GC to use the above mechanism and ensures GC works without
    a currently active isolate. The GC will use information purely available via
    [IsolateGroup]. The GC will iterate all isolates within an isolate
    group e.g. for scanning roots.

  * Makes spawning of new isolates start in their own isolate group.
    Once the isolate is fully functional it's heap will be merged into
    the original isolate group

  * Moves ApiState, containing persistent and weak persistent handles,
    from [Isolate] to [IsolateGroup], plus adds appropriate locking.

Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: Ia8e1d8aa78750e8400864200f4825395a182c004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126646
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Martin Kustermann
2020-02-20 21:08:35 +00:00
committed by commit-bot@chromium.org
parent f7a901751b
commit dae308461c
82 changed files with 1815 additions and 1139 deletions
+6 -2
View File
@@ -100,7 +100,10 @@ class StackFrame : public ValueObject {
//
// If the frame does not belong to a bare instructions snapshot, it will
// return nullptr.
Isolate* IsolateOfBareInstructionsFrame() const;
//
// [needed_for_gc] has to be set to `true` if the caller needs only GC
// relevant information.
Isolate* IsolateOfBareInstructionsFrame(bool needed_for_gc) const;
// Returns true iff the current frame is a bare instructions dart frame.
bool IsBareInstructionsDartFrame() const;
@@ -150,6 +153,7 @@ class StackFrame : public ValueObject {
}
Isolate* isolate() const { return thread_->isolate(); }
IsolateGroup* isolate_group() const { return thread_->isolate_group(); }
Thread* thread() const { return thread_; }
@@ -172,7 +176,7 @@ class StackFrame : public ValueObject {
kWordSize)));
ASSERT(raw_pc != StubCode::DeoptimizeLazyFromThrow().EntryPoint());
if (raw_pc == StubCode::DeoptimizeLazyFromReturn().EntryPoint()) {
return isolate()->FindPendingDeopt(GetCallerFp());
return isolate_group()->FindPendingDeoptAtSafepoint(GetCallerFp());
}
return raw_pc;
}