Files
sdk/runtime/vm/gc_compactor.h
T
Ryan Macnak 32a02404c9 [vm, gc] Bitvector-based sliding compactor.
With the current block size, this reduces space for forwarding information from two words per moved object to two words per (kObjectAlignment * kBitsPerWord) bytes of heap (1.6% on 64-bit, 3.1% on 32-bit).

dart2js compiling dart2js:
Compactor/Sweeper             Runtime  Max RSS
Sliding (binary search table) 105   s  1.085 GB
Sliding (bitvector)            57.8 s  998.566 MB
Evacuating                     66.2 s  1.714 GB
Concurrent sweep               53.8 s  1.183 GB
Blocking sweep                 55.0 s  1.181 GB

Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: Ia6eec4f0162c3959154c5155df24cc06694ecac7
Reviewed-on: https://dart-review.googlesource.com/17721
Reviewed-by: Erik Corry <erikcorry@google.com>
2017-11-03 19:38:55 +00:00

57 lines
1.5 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 an evacuating compactor and a sliding compactor.
class GCCompactor : public ValueObject,
private HandleVisitor,
private ObjectPointerVisitor {
public:
GCCompactor(Thread* thread, Heap* heap)
: HandleVisitor(thread),
ObjectPointerVisitor(thread->isolate()),
heap_(heap) {}
~GCCompactor() {}
void CompactBySliding(HeapPage* pages, FreeList* freelist, Mutex* mutex);
intptr_t EvacuatePages(HeapPage* page);
private:
void SlidePage(HeapPage* page);
uword SlideBlock(uword first_object, ForwardingPage* forwarding_page);
void MoveToExactAddress(uword addr);
void MoveToContiguousSize(intptr_t size);
void ForwardPointersForSliding();
void VisitPointers(RawObject** first, RawObject** last);
void VisitHandle(uword addr);
Heap* heap_;
HeapPage* free_page_;
uword free_current_;
uword free_end_;
FreeList* freelist_;
};
} // namespace dart
#endif // RUNTIME_VM_GC_COMPACTOR_H_