Skip to content
  • John Hawthorn's avatar
    0608a9a0
    Optimize Marshal dump/load for large (> 31-bit) FIXNUM (#6229) · 0608a9a0
    John Hawthorn authored
    * Optimize Marshal dump of large fixnum
    
    Marshal's FIXNUM type only supports 31-bit fixnums, so on 64-bit
    platforms the 63-bit fixnums need to be represented in Marshal's
    BIGNUM.
    
    Previously this was done by converting to a bugnum and serializing the
    bignum object.
    
    This commit avoids allocating the intermediate bignum object, instead
    outputting the T_FIXNUM directly to a Marshal bignum. This maintains the
    same representation as the previous implementation, including not using
    LINKs for these large fixnums (an artifact of the previous
    implementation always allocating a new BIGNUM).
    
    This commit also avoids unnecessary st_lookups on immediate values,
    which we know will not be in that table.
    
    * Fastpath for loading FIXNUM from Marshal bignum
    
    * Run update-deps
    0608a9a0
    Optimize Marshal dump/load for large (> 31-bit) FIXNUM (#6229)
    John Hawthorn authored
    * Optimize Marshal dump of large fixnum
    
    Marshal's FIXNUM type only supports 31-bit fixnums, so on 64-bit
    platforms the 63-bit fixnums need to be represented in Marshal's
    BIGNUM.
    
    Previously this was done by converting to a bugnum and serializing the
    bignum object.
    
    This commit avoids allocating the intermediate bignum object, instead
    outputting the T_FIXNUM directly to a Marshal bignum. This maintains the
    same representation as the previous implementation, including not using
    LINKs for these large fixnums (an artifact of the previous
    implementation always allocating a new BIGNUM).
    
    This commit also avoids unnecessary st_lookups on immediate values,
    which we know will not be in that table.
    
    * Fastpath for loading FIXNUM from Marshal bignum
    
    * Run update-deps
Loading