Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the pointer of owning object in ctor of GCHermesValueBase #1508

Open
wants to merge 14 commits into
base: static_h
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
556 changes: 314 additions & 242 deletions include/hermes/VM/AlignedHeapSegment.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/hermes/VM/ArrayStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class ArrayStorageBase final
auto *fromStart = other->data();
auto *fromEnd = fromStart + otherSz;
GCHVType::uninitialized_copy(
fromStart, fromEnd, data() + sz, runtime.getHeap());
fromStart, fromEnd, data() + sz, runtime.getHeap(), this);
size_.store(sz + otherSz, std::memory_order_release);
}

Expand Down
215 changes: 167 additions & 48 deletions include/hermes/VM/CardTableNC.h

Large diffs are not rendered by default.

34 changes: 33 additions & 1 deletion include/hermes/VM/GCBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ enum XorPtrKeyID {
/// const GCSmallHermesValue *start,
/// uint32_t numHVs);
///
/// The above barriers may have a variant with "ForLargeObj" suffix, which is
/// used when the heap location may be from a GCCell that supports large
/// allocation. This variant is less efficient since it has to load the cards
/// array through pointer in SHSegmentInfo, instead of the inline array field
/// in CardTable structure.
///
/// In debug builds: is a write barrier necessary for a write of the given
/// GC pointer \p value to the given \p loc?
/// bool needsWriteBarrier(void *loc, void *value);
Expand All @@ -226,7 +232,7 @@ enum XorPtrKeyID {
/// Return the maximum amount of bytes holdable by this heap.
/// gcheapsize_t max() const;
/// Return the total amount of bytes of storage this GC will require.
/// This will be a multiple of AlignedHeapSegment::storageSize().
/// This will be a multiple of FixedSizeHeapSegment::storageSize().
/// gcheapsize_t storageFootprint() const;
///
class GCBase {
Expand Down Expand Up @@ -1154,18 +1160,44 @@ class GCBase {
/// Default implementations for read and write barriers: do nothing.
void writeBarrier(const GCHermesValue *loc, HermesValue value);
void writeBarrier(const GCSmallHermesValue *loc, SmallHermesValue value);
void writeBarrierForLargeObj(
const GCCell *owningObj,
const GCHermesValue *loc,
HermesValue value);
void writeBarrierForLargeObj(
const GCCell *owningObj,
const GCSmallHermesValue *loc,
SmallHermesValue value);
void writeBarrier(const GCPointerBase *loc, const GCCell *value);
void writeBarrierForLargeObj(
const GCCell *owningObj,
const GCPointerBase *loc,
const GCCell *value);
void constructorWriteBarrier(const GCHermesValue *loc, HermesValue value);
void constructorWriteBarrier(
const GCSmallHermesValue *loc,
SmallHermesValue value);
void constructorWriteBarrierForLargeObj(
const GCCell *owningObj,
const GCHermesValue *loc,
HermesValue value);
void constructorWriteBarrierForLargeObj(
const GCCell *owningObj,
const GCSmallHermesValue *loc,
SmallHermesValue value);
void constructorWriteBarrier(const GCPointerBase *loc, const GCCell *value);
void constructorWriteBarrierForLargeObj(
const GCCell *owningObj,
const GCPointerBase *loc,
const GCCell *value);
void writeBarrierRange(const GCHermesValue *start, uint32_t numHVs);
void writeBarrierRange(const GCSmallHermesValue *start, uint32_t numHVs);
void constructorWriteBarrierRange(
const GCCell *owningObj,
const GCHermesValue *start,
uint32_t numHVs);
void constructorWriteBarrierRange(
const GCCell *owningObj,
const GCSmallHermesValue *start,
uint32_t numHVs);
void snapshotWriteBarrier(const GCHermesValue *loc);
Expand Down
Loading
Loading