Skip to content
  • raila's avatar
    141ee10f
    Fixed alignment issue that caused bus errors on platforms like sparc which · 141ee10f
    raila authored
    require all memory reads to be aligned.  Specifically, it turns out that
    sizeof(RepeatedField<bool>) is 20 on 64-bit sparc with GCC 3.4.6.  This is
    strange, since one of RepeatedField's members is a pointer, which I thought
    meant that it had to be 64-bit aligned, which means its size should be a
    multiple of 64 bits.  But, 20 is not a multiple of 8.  I don't understand why
    this is the case, but if this is possible, then DynamicMessage's strategy of
    sorting fields in descending order by size and then tightly packing doesn't
    work.  To fix this, I got rid of the sort step and instead added code that
    aligns each field's offset appropriately based on the field's size.
    
    Also in this revision:  Fix an error message that named a flag incorrectly.
    
    141ee10f
    Fixed alignment issue that caused bus errors on platforms like sparc which
    raila authored
    require all memory reads to be aligned.  Specifically, it turns out that
    sizeof(RepeatedField<bool>) is 20 on 64-bit sparc with GCC 3.4.6.  This is
    strange, since one of RepeatedField's members is a pointer, which I thought
    meant that it had to be 64-bit aligned, which means its size should be a
    multiple of 64 bits.  But, 20 is not a multiple of 8.  I don't understand why
    this is the case, but if this is possible, then DynamicMessage's strategy of
    sorting fields in descending order by size and then tightly packing doesn't
    work.  To fix this, I got rid of the sort step and instead added code that
    aligns each field's offset appropriately based on the field's size.
    
    Also in this revision:  Fix an error message that named a flag incorrectly.
    
Loading