pykinos-core
Safe HaskellNone
LanguageGHC2024

Pykinos.Mutable.SwissTable

Description

Maps 128-bit unboxed keys (Word64, Word64) to 32-bit unboxed IDs (Int32) with 8-slot SWAR parallel control probing and zero boxed heap pointers.

Synopsis

Documentation

data SwissTable128 s Source #

Open-addressed SwissTable with mutable unboxed slabs wrapped in a 4-slot descriptor. Because all slabs are MutableByteArray, GHC's GC never scans the table entries.

Constructors

SwissTable128 

Fields

newSwissTable128 :: Int -> ST s (SwissTable128 s) Source #

Allocate a power-of-two SwissTable128 (minimum capacity 16).

lookupOrInsert128 :: SwissTable128 s -> Word64 -> Word64 -> ST s Int32 Source #

Lookup or insert a 128-bit key, returning its dense monotonic Int32 ID.

packNfNode128 :: Word8 -> Word32 -> Int32 -> Int32 -> Int32 -> (Word64, Word64) Source #

Pack a fixed-arity normal-form DAG node into a 128-bit SwissTable key.

matchH2Swar64 :: Word64 -> Word8 -> Word64 Source #

Borrow-free SWAR match returning bit (8*i + 7) == 1 iff byte i equals h2.