Files
sdk/runtime/vm/gc_compactor.h
T
Ryan Macnak 62ae8cda0a Parallel compaction.
Divide the heap by pages into k tasks. Use ThreadBarrier to ensure
planning -> sliding and non-stack forwarding -> stack forwarding.

Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: I2c9fcec0a0794bfea96ca1a0fb509a9f93242b65
Reviewed-on: https://dart-review.googlesource.com/29444
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
2017-12-15 01:38:42 +00:00

56 lines
1.4 KiB
C++

// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_VM_GC_COMPACTOR_H_
#define RUNTIME_VM_GC_COMPACTOR_H_
#include "vm/allocation.h"
#include "vm/dart_api_state.h"
#include "vm/globals.h"
#include "vm/visitor.h"
namespace dart {
// Forward declarations.
class FreeList;
class Heap;
class HeapPage;
class RawObject;
// Implements a sliding compactor.
class GCCompactor : public ValueObject,
public HandleVisitor,
public ObjectPointerVisitor {
public:
GCCompactor(Thread* thread, Heap* heap)
: HandleVisitor(thread),
ObjectPointerVisitor(thread->isolate()),
heap_(heap) {}
~GCCompactor() {}
void Compact(HeapPage* pages, FreeList* freelist, Mutex* mutex);
private:
void SetupImagePageBoundaries();
void ForwardStackPointers();
void ForwardPointer(RawObject** ptr);
void VisitPointers(RawObject** first, RawObject** last);
void VisitHandle(uword addr);
Heap* heap_;
struct ImagePageRange {
uword base;
uword size;
};
// There are up to 4 images to consider:
// {instructions, data} x {vm isolate, current isolate}
static const intptr_t kMaxImagePages = 4;
ImagePageRange image_page_ranges_[kMaxImagePages];
};
} // namespace dart
#endif // RUNTIME_VM_GC_COMPACTOR_H_