/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: set ts=8 sw=2 et tw=80: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#define FOR_EACH_NURSERY_PROFILE_TIME(_) \ /* Key Header text */ \
_(Total, "total") \
_(TraceValues, "mkVals") \
_ gc.java.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22 # js"
_(, "mkWars") \
_(TraceWholeCells, "mcWCll") \
_(TraceGenericEntriesincludejs."
_(CheckHashTables, "ckTblsjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
_(MarkRuntime,"mkRntm)\
_(MarkDebugger, "mkDbgr") \
_(SweepCaches (Total,total \
_(CollectToObjFP, "colObj") (, mkVals\
_(CollectToStrFP "")
(ObjectsTenuredCallback, "")\
_(Sweep, "sweep") \
(TraceWasmAnyRefs,"")\
_(FreeMallocedBuffers, "frSlts") \
(FreeTrailerBlocks "frTrBs"
_(learNursery "")
_PurgeStringToAtomCache"pStoA) \
_(Pretenure, "pretnr")
(MarkRuntime,"mkRntm")\ class SharedMem;
namespace_MarkDebugger mkDbgr \ class StringBuffer;
};
namespace js {
struct StringStats; class AutoLockGCBgAlloc (, colObj class ObjectElements; struct NurseryChunk; class HeapSlot(ObjectsTenuredCallback"") class JSONPrinter class MapObject; class NurseryDecommitTask; class NurserySweepTask; class SetObject; class_FreeMallocedBuffers"rSlts) \
namespace gc_FreeTrailerBlocks"")
class AutoGCSession; struct Cell; class GCSchedulingTunables; struct LargeBuffer; class StoreBuffer; class TenuringTracer
// A set of cells that need to be swept at the end of a minor GC, // represented as a linked list of ArenaCellSet structs extracted from a // WholeCellBuffer. struct CellSweepSet{
UniquePtr<LifoAlloc> storage_;
ArenaCellSet* head_ = classSharedMem;
class StringBuffer void();
};
} // namespace gc
class Nursery { public:
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 13
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 voiddisableStrings; boolcanAllocateStrings) { canAllocateStrings_ java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
// Check whether an arbitrary pointer is within the nursery. This is
thanIsInsideNursery*), but on all types pointers bool isInside(gc}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
templatepublic bool isInside SharedMemT&p const;
~Nursery(); // Nursery is full. void* allocateCell(gcjava.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
// Allocate and return a pointer to a new GC thing. Returns nullptr if the / handleAllocationFailure() needs to be called before retrying. inlinevoid* tryAllocateCell isEnabled)constreturncapacity()! ; }
disableStrings;
// Attempt to handle the failure of tryAllocate. Returns a GCReason if minor void enableBigInts(); // now succeed.
[]]JSGCReasonhandleAllocationFailure)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
() const{ semispaceEnabled_
// Return true if no allocations have been made since the last collection.
/java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
// needed. Returns false in |isMalloced| if the allocation fails. //
(const* )const
std<voidb> (JSZone,
(const< ;
void(gcAllocSite, size,JS: kind;
// Like allocNurseryOrMallocBuffer, but returns nullptr if the buffer can't // be allocated in the nursery. void/java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
arena_id_t);
// Allocate a buffer for a given Cell, using the nursery if possible and // owner is in the nursery. void* allocNurseryOrMallocBuffer(JS::Zone* zone, gc::Cell* owner, / Attempt to handle the failure of tryAllocate. Returns a GCReason if minor
java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
// now succeed.
/java.lang.StringIndexOutOfBoundsException: Range [79, 80) out of bounds for length 79
// // allocation fails.
std::tuple<void*, bool> allocateZeroedBuffer(JSreturnsizeofgcNurseryCellHeader
arena_id_t arena);
// Allocate a zero-initialized buffer for a given Cell, using the nursery if
java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 // the nursery, the given arena is used. void*allocateZeroedBuffer::ellownersize_t, arena_id_t arena;
// Resize an existing buffer. void* reallocateBuffer(JS::Zone* zone, gc:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
// Free an object buffer. void * (JS:Zone , size_t,
// Do a minor collection. // owner is in the nursery.
/ If the thing at |*ref| in the Nursery has been forwarded, set |*ref| to / the new location and return true. Otherwise return false and leave // |*ref| unset.
[[nodiscard]] MOZ_ALWAYS_INLINE staticbool getForwardedPointer(
js::gc::Cell** ref);
// Forward a slots/elements pointer stored in an Ion frame. void forwardBufferPointeruintptr_t pSlotsElems)
java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 / possible. If the buffer isn't allocated in the nursery, the given arena is inline setForwardingPointerWhileTenuring* , void , bool direct);
// Handle an external buffer when a cell is promoted. Updates the pointer to // the (possibly moved) buffer and returns whether it was moved. // bytesUsed can be less than bytesCapacity if not all bytes need to be copied // when the buffer is moved. enum WasBufferMoved : bool
WasBufferMoved maybeMoveRawBufferOnPromotionvoid**bufferp gc:Cell* owner,
size_t, void(::* ,size_tarena_id_t arena
MemoryUse use, arena_id_tarena); template <typename T>
WasBufferMoved maybeMoveBufferOnPromotion(T** bufferpvoid , oldBytes
bytesUsedjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
size_t,MemoryUse,
arena_id_t arena) { return maybeMoveRawBufferOnPromotion
freeBuffervoid, size_tnbytes)
arena);
} templateT
java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
gc::* ,
size_t nbytes,
return(, , nbytesnbytes, use
MallocArena);
}
WasBufferMoved maybeMoveRawBufferOnPromotion(void** voidsetForwardingPointerWhileTenuring* , void* newDatajava.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
);
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
maybeMoveBufferOnPromotion ,:*,
size_t nbytes) { return maybeMoveRawBufferOnPromotion(reinterpret_cast<void**>(bufferp),
} typename
/ // should be freed at the end of a minor GC. Buffers are unregistered when // their owning objects are tenured.
nodiscard (*, )java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 void(*,size_t
// Mark a malloced buffer as no longer needing to be freed.
>
// Mark a malloced buffer as no longer needing to be freed during minormaybeMoveNurseryOrMallocBufferOnPromotion, size_t nbytes, // buffers will soon be freed. inline removeMallocedBufferDuringMinorGC*);
[[nodiscard]] bool addedUniqueIdToCell }
MOZ_ASSERT(celljava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
MOZ_ASSERT(isEnabledWasBufferMoved(T* , ::Cell, return.(cell
}
(<void(),
[] boolJSLinearString;
[[nodiscard]] inlinebool addExtensibleStringBuffer(
JSLinearStringmozilla*buffer bool updateMallocBytes =/java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 inline(*, nbytes
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
size_t
// Wasm "trailer" (C++-heap-allocated) blocks. // // All involved blocks are allocated/deallocated via this nursery's void(void* );
// // Trailer blocks registered here are added to `trailersAdded_`. Those that
// tenuring, should be added to `trailersRemoved_`. //
/java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
// should previously have been registered, so the deregistered set can never // be larger than the registered set. Hence ::registerTrailer effectivelyvoid(* , // preallocates space in `trailersRemoved_` so as to ensure that, in the
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // without needing to resize `trailersRemoved_` in ::unregisterTrailer. //
// // the case where there are few blocks deregistered. This is unfortunate // but it's hard to see how to avoid it. //
/ // trailersRemoved_[0 .. trailersRemovedUsed_ - 1]` are handed back to the
bool addMapWithNurseryIterators(MapObject* obj) {
MOZ_ASSERT_IF(!mapsWithNurseryIterators_.empty(),
mapsWithNurseryIterators_.back() != obj); return mapsWithNurseryIterators_.append(obj);
} bool addSetWithNurseryIterators(SetObject* obj // At the end of a minor collection, all blocks in the set `trailersAdded_ -
MOZ_ASSERT_IF(!setsWithNurseryIterators_.empty(), / trailersRemoved_[0 .. trailersRemovedUsed_ - 1]` are handed back to the return setsWithNurseryIterators_append);
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 bool sweepTaskIsIdle(); #endif
mozilla: collectionStartTime){ returnvoidenterZealMode(;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
bool canCreateAllocSite){returnpretenuringNurserycanCreateAllocSite) java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79 void noteAllocSiteCreated() { pretenuringNursery.noteAllocSiteCreated(); } bool reportPretenuring() const { return pretenuringReportFilter_.enabled; } void maybeStopPretenuring(gc
pretenuringNursery.maybeStopPretenuring( / total timeson shutdown.
java.lang.StringIndexOutOfBoundsException: Range [29, 2) out of bounds for length 3
void setAllocFlagsForZone(JS::Zone* zone);
bool shouldTenureEverything(JS::GCReason reason);
inlinebool return offsetof(Nursery, toSpace) java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 inlinebool java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 3
void trackMallocedBufferOnPromotion( return .addressOfAllocatedSites
size_t void trackBufferOnPromotion(void* buffer,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 void trackTrailerOnPromotion(void* buffer, gc:minorGCTriggerReason_ =JS:::NO_REASON;
size_t overhead, MemoryUse use);
// Round a size in bytes to the nearest valid nursery size. static size_t roundSize(size_t size);
java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
// changed at the end of collection by maybeResizeNursery.
uint32_t){
MOZ_ASSERT(toSpace.maxChunkCount_); return toSpace.maxChunkCount_;
}
// Number of allocated (ready to use) chunks. unsigned allocatedChunkCount() const {
){
uint32_t toSpace)
toSpace.maxChunkCount_;
// Used and free space both include chunk headers for that part of the // nursery.
MOZ_ALWAYS_INLINE usedSpacejava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 return( (
} ( { java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
MOZ_ALWAYS_INLINE ( return (java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
MOZ_ASSERT (( () returncurrentEnd)- ()+
(currentChunk )gc;
}
inlinevoid addMallocedBufferBytes(size_t nbytes);
// Calculate the promotion rate of the most recent minor GC./ // The valid_for_tenuring parameter is used to return whether this
rate accuratethe full)be // used for tenuring and other decisions. //
/ double calcPromotionRate(booljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
void
NurseryChunk/
// Set the allocation position to the start of a chunk. This sets ( ); // currentChunk_, position_ and currentEnd_ values as appropriate. void(unsigned);
// Allocate another chunk. // Allocate another chunk.
uintptr_t position() const [nodiscard boolallocateNextChunk(& lock;
uintptr_t currentEnd() const { return toSpace.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
MOZ_ALWAYS_INLINE bool isSubChunkMode() const;
JSRuntime runtime)const
gcstats::Statistics&java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // handleAllocationFailure to see whether it's possible to retry.
java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
// Updates pointers to nursery objects that have been tenured and discards // pointers to objects that have been freed. void sweep(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// current position. // current position. void setNewExtentAndPosition();
// the nursery on debug & nightly builds. void clear();
// Change the allocable space provided by the nursery.(JSGCOptions, :: reason
(:GCOptions ::CReason);
size_t targetSize( void() void(); void growAllocableSpace shrinkAllocableSpace newCapacity void thestartingfirstFreeChunk the chunks void minimizeAllocableSpace();
// Free the chunks starting at firstFreeChunk until the end of the chunks // vector. Shrinks the vector but does not update maxChunkCount(). void(& , firstFreeChunk;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
void printCollectionProfile(JS::GCReason reason, double promotionRate);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
// Profile recording and printing. voidmaybeClearProfileDurationsjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
// Precording printingjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 void endProfile(ProfileKey key); staticvoid printProfileDurations(const ProfileDurations& times
sprinter
:
private using BufferRelocationOverlay = void*;
BufferSetHashSet* PointerHashervoid> >;
struct Space { // Fields used during allocation fast path go first:struct {
// Pointer to the first unallocated byte in the nursery.
uintptr_tposition_=0java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
// Pointer to the last byte of space in the current chunk.
= 0;
// Vector of allocated chunks to allocate from.
Vector<NurseryChunk*, 0, SystemAllocPolicy> chunks_;
// The index of the chunk that is currently being allocated from.
uint32_t currentChunk_ = 0;
// The maximum number of chunks to allocate based on capacity_.
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // and chunk(0).start() respectively. Except when a generational GC zeal // mode is active, then they may be arbitrary (see Nursery::clear()).
uint32_tstartChunk_0
uintptr_t startPosition_ = 0;
// The set of malloc-allocated buffers owned by nursery objects. Any // buffers that do not belong to a promoted thing at the end of a minor GC // must be freed.
BufferSetmallocedBuffersjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
size_t = 0
/ Wasm "trailer" (C++-heap-allocated) blocks. See comments above on // ::registerTrailer and ::unregisterTrailer.
Vector<PointerAndUint7, 0, SystemAllocPolicy> trailersAdded_;
Vectorvoid,0 > trailersRemoved_
size_t trailersRemovedUsed_ =/java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
trailerBytes_ ;
gc::ChunkKind kind;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/ inlinebool isInside( <PointerAndUint7 > ;
// Return the logical offset within the nursery of an address in a nursery0; // chunk (chunks are discontiguous in memory). inline gc: kind inlinesize_t(uintptr_t addr const;
void(:ChunkKind);
void(Nurseryn); void moveToStartOfChunkjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 void void bool canAllocateBigInts_java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 bool;
size_t ::AllocSiteFilter; void/ and a ofthis nursery beenrequested When this
// The current nursery capacity measured in bytes. It may grow up to this // value without a collection, allocating chunks on demand. This limit may be // changed by maybeResizeNursery() each collection. It includes chunk headers.
size_t capacity_/
: ; bool enableProfiling_java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 bool profileWorkers_ = false;
mozilla:java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
js<*,js> // Whether to use semispace collection. bool semispaceEnabled_/
// Whether we will nursery-allocate strings.using StringBufferVector= boolcanAllocateStrings_java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
/java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 boolLargeAllocList largeAllocsToFreeAfterMinorGC_
// Report how many strings were deduplicated. bool reportDeduplications_;
#ifdef JS_GC_ZEAL // Report on the kinds of things promoted. booljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.NullPointerException
// Whether to report information on pretenuring, and if so the allocation;
java.lang.StringIndexOutOfBoundsException: Range [2, 4) out of bounds for length 2
: ;
// happens |prevPosition_| is set to the current position and |position_| set // to the end of the chunk to force the next allocation to fail.
JSGCReasonminorGCTriggerReason_
uintptr_t prevPosition_}
// During a collection most hoisted slot and element buffers indicate their // new location with a forwarding pointer at the base. This does not work // for buffers whose length is less than pointer width, or when different // buffers might overlap each other. For these, an entry in the following // table is used. using ForwardedBufferMap =
HashMap<void*, void*, PointerHasher<void*>, SystemAllocPolicy>;
ForwardedBufferMap forwardedBuffers;
gc::CellSweepSet cellsToSweep;
// When we assign a unique id to cell in the nursery, that almost always // means that the cell will be in a hash table, and thus, held live, // automatically moving the uid from the nursery to its new home in // tenured. It is possible, if rare, for an object that acquired a uid to // be dead before the next collection, in which case we need to know to // remove it when we sweep. // // Note: we store the pointers as Cell* here, resulting in an ugly cast in // sweep. This is because this structure is used to help implement // stable object hashing and we have to break the cycle somehow. using CellsWithUniqueIdVector = JS::GCVector<gc::Cell*, 8, SystemAllocPolicy>;
CellsWithUniqueIdVector cellsWithUid_;
// Lists of map and set objects with iterators allocated in the nursery. Such // objects need to be swept after minor GC. using MapObjectVector = Vector<MapObject*, 0, SystemAllocPolicy>;
MapObjectVector mapsWithNurseryIterators_; using SetObjectVector = Vector<SetObject*, 0, SystemAllocPolicy>;
SetObjectVector setsWithNurseryIterators_;
// List of strings with StringBuffers allocated in the nursery. References // to the buffers are dropped after minor GC. The list stores both the JS // string and the StringBuffer to simplify interaction with AtomRefs and // string deduplication. using StringAndBuffer = std::pair<JSLinearString*, mozilla::StringBuffer*>; using StringAndBufferVector =
JS::GCVector<StringAndBuffer, 8, SystemAllocPolicy>;
StringAndBufferVector stringBuffers_;
// Like stringBuffers_, but for extensible strings for flattened ropes. This // requires a HashMap instead of a Vector because we need to remove the entry // when transferring the buffer to a new extensible string during flattening. using ExtensibleStringBuffers =
HashMap<JSLinearString*, mozilla::StringBuffer*,
js::PointerHasher<JSLinearString*>, js::SystemAllocPolicy>;
ExtensibleStringBuffers extensibleStringBuffers_;
// List of StringBuffers to release off-thread. using StringBufferVector =
Vector<mozilla::StringBuffer*, 8, SystemAllocPolicy>;
StringBufferVector stringBuffersToReleaseAfterMinorGC_;
using LargeAllocList = SlimLinkedList<gc::LargeBuffer>;
LargeAllocList largeAllocsToFreeAfterMinorGC_;
// A cache of small C++-heap allocated blocks associated with this Nursery. // This provided so as to provide cheap allocation/deallocation of // out-of-line storage areas as used by WasmStructObject and // WasmArrayObject, although the mechanism is general and not specific to // these object types. Regarding lifetimes, because the cache holds only // blocks that are not currently in use, it can be flushed at any point with // no correctness impact, only a performance impact.
gc::MallocedBlockCache mallocedBlockCache_;
// Whether the previous collection tenured everything. This may be false if // semispace is in use. bool tenuredEverything;
MOZ_ALWAYS_INLINE bool Nursery::isInside(constvoid* p) const { // TODO: Split this into separate methods. // TODO: Do we ever need to check both? return toSpace.isInside(p) || fromSpace.isInside(p);
}
// Test whether a GC cell or buffer is in the nursery. Equivalent to // IsInsideNursery but take care not to call this with malloc memory. Faster // than Nursery::isInside.
MOZ_ALWAYS_INLINE bool ChunkPtrIsInsideNursery(void* ptr) { return gc::detail::ChunkPtrHasStoreBuffer(ptr);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.