Ignore:
Timestamp:
May 2, 2022, 8:02:04 PM (3 years ago)
Author:
[email protected]
Message:

[JSC] Introduce shifting Structure encoding
https://bugs.webkit.org/show_bug.cgi?id=239957

Reviewed by Mark Lam.

For platforms which have limited amount of virtual address space (<= 36 bits), this patch introduces
shifting Structure encoding. We align Structure on a 32-bytes boundary instead of 16 bytes so that
we can ensure that lower 5 bits are zero. Then, we can use 1 bit for nuke, and shifting 4 bits to
convert 36 bit address to 32 bit StructureID. By using this mechanism, we do not need to allocate
large virtual address space for these platforms. If we an address can have more than 36 bits, then
we should just reserve a larger address region since we have enough address space. Current Structure
size is 112 bytes, which is 3.5 atoms at 32 bytes / atom. Hence, this alignment costs us 16 bytes per
Structure.
Relanding with debug build failure & crash on static atomSize assumption in IsoSubspace.

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):

  • heap/Heap.cpp:
  • heap/IsoSubspace.h:

(JSC::GCClient::IsoSubspace::allocatorFor):

  • heap/IsoSubspaceInlines.h:

(JSC::GCClient::IsoSubspace::allocate):

  • heap/StructureAlignedMemoryAllocator.cpp:

(JSC::StructureMemoryManager::StructureMemoryManager):

  • jit/AssemblyHelpers.cpp:

(JSC::AssemblyHelpers::emitNonNullDecodeStructureID):

  • llint/LLIntOfflineAsmConfig.h:
  • llint/LowLevelInterpreter64.asm:
  • runtime/JSCell.h:
  • runtime/JSCellInlines.h:

(JSC::JSCell::JSCell):

  • runtime/Structure.cpp:

(JSC::Structure::Structure):

  • runtime/Structure.h:
  • runtime/StructureID.h:

(JSC::StructureID::decode const):
(JSC::StructureID::tryDecode const):
(JSC::StructureID::encode):

  • tools/IntegrityInlines.h:

(JSC::Integrity::auditStructureID):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Structure.h

    r293685 r293710  
    175175    static constexpr unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
    176176    static constexpr uint8_t numberOfLowerTierCells = 0;
    177    
     177
     178#if ENABLE(STRUCTURE_ID_WITH_SHIFT)
     179    static constexpr size_t atomSize = 32;
     180#endif
     181    static_assert(JSCell::atomSize >= MarkedBlock::atomSize);
     182
    178183    enum PolyProtoTag { PolyProto };
    179184    static Structure* create(VM&, JSGlobalObject*, JSValue prototype, const TypeInfo&, const ClassInfo*, IndexingType = NonArray, unsigned inlineCapacity = 0);
Note: See TracChangeset for help on using the changeset viewer.