Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/js/src/gc/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 30 kB image not shown  

SSL Nursery.h   Sprache: C

 
/* -*- 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/. */


#fndef gc_Nursery_h
gc_Nursery_h

"/numeratedArray.""/TimeStamph"
#include "mozilla/TimeStamp.h"

#include <tuple>

#include "ds/LifoAlloc.h"
#include "ds/SlimLinkedList.h"
#include "gc/Allocator.h"
#include "gc/GCEnum.h"
#include "gc/GCProbes.h"
#include "gc/Heap.h"
#include "gc/MallocedBlockCache.h"
#include "gc/Pretenuring.h"
#include "js/AllocPolicy.h"
#include "js/Class.h"
#include "js/GCAPI.h"
#include "js/GCVector.h"
#include "js/HeapAPI.h"
#include "js/TypeDecls.h"
#include "js/UniquePtr.h"
#include "js/Utility.h"
#include "js/Vector.h"

#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

   NurseryDecommitTask

  void();
  voidclass ;
boolisEnabled)const{returncapacity( ! 0 }

  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

  void enableBigInts();
  void disableBigInts();
  bool TenuringTracer

  void setSemispaceEnabled(bool enabled);
  bool semispaceEnabled() const { return semispaceEnabled_; }

  UniquePtrLifoAlloc storage_
  boolisEmpty)const

  // 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

  template public
   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.
  inline void* tryAllocateCell   isEnabled)const returncapacity()! ; }
                               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*                                                     nbytes,
                                     void* oldBuffer, size_t oldBytes,
 newBytes, 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,

                                   arena_id_t arenaId);
  static size_tMaxNurseryBufferSize =12;

  // 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 static bool 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]] inline bool 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 effectively void(* ,
  // 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
  
  [[nodiscard]] inline
                                            ;
  inline void unregisterTrailer(void* block);
  


  size_t /

#ifdef JS_GC_ZEAL
  void
  void leaveZealMode();
#endif

  // Write profile time JSON on JSONPrinter.
  void renderProfileJSON(JSONPrinter& json) const;

  // Print header line for profile times.
  void printProfileHeader();

  // Print total profile times on shutdown.
  void printTotalProfileTimes();

  void* addressOfPosition() const { return (void**)&toSpace.position_; }
  static constexpr int32_t offsetOfCurrentEndFromPosition() {
    return offsetof(Nursery, toSpace.currentEnd_) -
           offsetof(Nursery, toSpace.position_);
  }

  void* addressOfNurseryAllocatedSites() {
    return pretenuringNursery.addressOfAllocatedSites();
  }

  void requestMinorGC(JS::GCReason reason);

  bool minorGCRequested() const {
    return minorGCTriggerReason_ != JS::GCReason::NO_REASON;
  }
  JS::GCReason minorGCTriggerReason() const { return minorGCTriggerReason_; }

  bool wantEagerCollection() const;

  bool enableProfiling() const { return enableProfiling_; }

  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);
  }

  void joinSweepTask();
  void  inline voidunregisterTrailer* block;

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  bool sweepTaskIsIdle();
#endif

  mozilla: collectionStartTime){
    return  voidenterZealMode(;
  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);

  inline bool     return offsetof(Nursery, toSpace) java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  inline bool 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);

  // The malloc'd block cache.
  gc::MallocedBlockCache& mallocedBlockCache() { return mallocedBlockCache_; }
  size_t sizeOfMallocedBlockCache(mozilla::MallocSizeOf mallocSizeOf) const {
    return mallocedBlockCache_.sizeOfExcludingThis(mallocSizeOf);
  }

  mozilla::TimeStamp lastCollectionEndTime() const;

 private:
  struct Space;

  enum class ProfileKey {
#define DEFINE_TIME_KEY(name, text) name,
      size_t(mozilla: mallocSizeOfconst
#undef DEFINE_TIME_KEY
        KeyCount
  };

  using ProfileTimes = mozilla::EnumeratedArray<ProfileKey, mozilla::TimeStamp,
                                                
  =
      mozilla::EnumeratedArray<ProfileKeydefinenametext,
                               (:)>

KeyCount


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;
  }

  inline void 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);

  boolinitFirstChunk(& lock);
  void setCapacity(size_t

  void

   setCurrentEnd;
  void setStartToCurrentPosition();

  // 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

ulingTunables&tunables) const

  void getAllocFlagsForZoneconstjsgc:& tunables const
                            bool*  void getAllocFlagsForZone(JS::Zo zone, bool* allocObjectsOut
  void updateAllZoneAllocFlags();
  void updateAllocFlagsForZone(JS::Zone* zone);
  void discardCodeAndSetJitFlagsForZone(JS::Zone   updateAllocFlagsForZoneJS:Zone );

  void* allocate(size_t size);

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

  [[nodiscard]] bool moveToNextChunkinline*tryAllocate( size

  bool freeSpaceIsBelowEagerThreshold() const;
 (const

  struct ;
    size_t tenuredBytesCollectionResult(gc:& ,
    size_tJS::GCOptionsoptionsJS: reason
  };
  CollectionResult   swapSpaces;
                                   traceRoots(::AutoGCSession session ::TenuringTracermover
  voidswapSpaces)
  void traceRoots                        validPromotionRate,doublepromotionRate);

  size_t doPretenuring(JSRuntime*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 validPromotionRate,doublepromotionRate);

  // Handle relocation of slots/elements pointers stored in Ion frames.
    inline

  inline void setDirectForwardingPointer(void* oldData, void* newData);
  void setIndirectForwardingPointer(void* oldData, void* newData);

  inline void uint32_tnslots;
                                          inlinevoidsetElementsForwardingPointer(* oldHeader,
  inline void setElementsForwardingPointer(ObjectElements* oldHeader,
                                           ObjectElements* newHeader,
                                capacity

ifdefDEBUG
  bool checkForwardingPointerInsideNursery(void* ptr);
#endif

  // 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();

  void clearMapAndSetNurseryIterators();
  void

  void sweepStringsWithBuffer();

  void   voidsweepBuffers

  // Get per-space size limits.
  size_t maxSpaceSize() const minSpaceSize);
  size_t ;

  // 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  voidsendTelemetry(:: reason ::TimeDuration,
 wasEmptydouble,
                     size_t sitesPretenured);

  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);
  static void 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

     /
    inline bool 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

#ifdef DEBUG
    void checkKind(gc::ChunkKind expected) const;
    size_t findChunkIndex(uintptr_t chunkAddr) const;
#endif
  };

  Space ;
  Space

  gc::GCRuntime* const gc;

  // 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_/

  uintptr_t tenureThreshold_

  gc::PretenuringNurseryHashMap*,*,PointerHasher*> SystemAllocPolicy

  mozilla::   forwardedBuffers

: ;
  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_}

  // Profiling data.

  ProfileTimes startTimes_;
  ProfileDurations profileDurations_;
  ProfileDurations totalDurations_;

  // Data about the previous collection.
  struct PreviousGC {
    JS::GCReason reason = JS::GCReason::NO_REASON;
    size_t nurseryCapacity = 0;
    size_t nurseryCommitted = 0;
    size_t nurseryUsedBytes = 0;
    size_t nurseryUsedChunkCount = 0;
    size_t tenuredBytes = 0;
    size_t tenuredCells = 0;
    mozilla::TimeStamp endTime;
  };
  PreviousGC previousGC;

  bool hasRecentGrowthData;
  double smoothedTargetSize;

  // 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_;

  UniquePtr<NurserySweepTask> sweepTask;
  UniquePtr<NurseryDecommitTask> decommitTask;

  // 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;

  friend class gc::GCRuntime;
  friend class gc::TenuringTracer;
  friend struct NurseryChunk;
};

MOZ_ALWAYS_INLINE bool Nursery::isInside(const void* p) const {
  // TODO: Split this into separate methods.
  // TODO: Do we ever need to check both?
  return toSpace.isInside(p) || fromSpace.isInside(p);
}

MOZ_ALWAYS_INLINE bool Nursery::Space::isInside(const void* p) const {
  for (auto* chunk : chunks_) {
    if (uintptr_t(p) - uintptr_t(chunk) < gc::ChunkSize) {
      return true;
    }
  }
  return false;
}

// 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);
}

}  // namespace js

#endif  // gc_Nursery_h

Messung V0.5
C=64 H=100 G=83

¤ Dauer der Verarbeitung: 0.15 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.