Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unnecessarily clearing clean memory in codegen #14710

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BlobCodes
Copy link
Contributor

@BlobCodes BlobCodes commented Jun 13, 2024

Closes #14677
Closes #14678
Alternative to / closes #14679

Since #14679 doesn't seem to be received as well as I'd hoped, this is a very condensed version of it, which only does what's necessary to remove the double-clearing of memory.

With this PR, both __crystal_malloc64 and __crystal_malloc_atomic64 are expected to return cleared memory.
To make the change as simple as possible, GC.malloc_atomic is now also required to return cleared memory.
This could break compatibility with other/older stdlibs.

The performance benefits are the same as shown in #14679.

Copy link
Contributor

@ysbaddaden ysbaddaden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @BlobCodes!

Having the allocating functions always initialize the memory feels more like Crystal. Then we can introduce "unsafe" or "uninitialized" alternatives for #14687 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GC.malloc doesn't clear memory (as specified) for gc_none Non-atomic memory is cleared twice
3 participants