Skip to content

If a Go compiler reorders struct fields all the padded structs will not offer good cache line protection. #10

@fmstephe

Description

@fmstephe

Currently values in the padded package isolate an inner field by putting enough data before and after to separate that field from any other memory locations. However, this only works if the Go compiler places struct fields in the same order as found in the source code. This is definitely not guaranteed.

An alternative approach would be to make the entire struct a byte array and use unsafe to interpret some inner bytes as a particular value. We could have a function which returns a pointer to this value - for easy use with the stdlib atomic package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions