1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 * GC-internal definition of relocation overlay used while moving cells.
11 #ifndef gc_RelocationOverlay_h
12 #define gc_RelocationOverlay_h
14 #include "mozilla/Assertions.h"
24 * This structure overlays a Cell that has been moved and provides a way to find
25 * its new location. It's used during generational and compacting GC.
27 class RelocationOverlay
: public Cell
{
29 /* The location the cell has been moved to, stored in the cell header. */
30 Cell
* forwardingAddress() const {
31 MOZ_ASSERT(isForwarded());
32 return reinterpret_cast<Cell
*>(header_
.getForwardingAddress());
36 /* A list entry to track all relocated things. */
37 RelocationOverlay
* next_
;
39 explicit RelocationOverlay(Cell
* dst
);
42 static const RelocationOverlay
* fromCell(const Cell
* cell
) {
43 return static_cast<const RelocationOverlay
*>(cell
);
46 static RelocationOverlay
* fromCell(Cell
* cell
) {
47 return static_cast<RelocationOverlay
*>(cell
);
50 static RelocationOverlay
* forwardCell(Cell
* src
, Cell
* dst
);
52 void setNext(RelocationOverlay
* next
) {
53 MOZ_ASSERT(isForwarded());
57 RelocationOverlay
* next() const {
58 MOZ_ASSERT(isForwarded());
66 #endif /* gc_RelocationOverlay_h */