ponylang / ponyc

Pony is an open-source, actor-model, capabilities-secure, high performance programming language
http://www.ponylang.io
BSD 2-Clause "Simplified" License
5.73k stars 415 forks source link

Make heap small chunk size setting logic more precise/correct #4527

Closed dipinhora closed 1 month ago

dipinhora commented 1 month ago

Prior to this commit, the heap small chunk size setting logic would bitwise-or in the size into the appropriate bits of the small chunk but this is technically incorrect as it doesn't clear out the bits first.

This commit changes the logic to ensure the relevant bits are cleared first before the new size is bitwise-or'd in.

SeanTAllen commented 1 month ago

@dipinhora I believe this would count as a bug fix, yes? And I think, should get a changelog entry and release notes. Do you agree?

dipinhora commented 1 month ago

@dipinhora I believe this would count as a bug fix, yes? And I think, should get a changelog entry and release notes. Do you agree?

@SeanTAllen probably, yes.. in the current implementation the size is only ever set once on a newly allocated small_chunk_t which i believe wouldn't be an issue unless the pool is recycling previously used memory that has those bits already set (unsure how likely that is or if it has already caused issues in the wild)..

ponylang-main commented 1 month ago

Hi @dipinhora,

The changelog - fixed label was added to this pull request; all PRs with a changelog label need to have release notes included as part of the PR. If you haven't added release notes already, please do.

Release notes are added by creating a uniquely named file in the .release-notes directory. We suggest you call the file 4527.md to match the number of this pull request.

The basic format of the release notes (using markdown) should be:

## Title

End user description of changes, why it's important,
problems it solves etc.

If a breaking change, make sure to include 1 or more
examples what code would look like prior to this change
and how to update it to work after this change.

Thanks.

dipinhora commented 1 month ago

release notes added.. feel free to tweak them as needed (or let me know what needs tweaking)..