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

feat: rework cheerp_allocate & co #273

Merged
merged 2 commits into from
Dec 16, 2024
Merged

feat: rework cheerp_allocate & co #273

merged 2 commits into from
Dec 16, 2024

Conversation

yuri91
Copy link
Member

@yuri91 yuri91 commented Dec 12, 2024

cheerp_allocate and related functions had a few issues, in particular they were not used consistently and so a lot of edge cases existed.

On top of that, for Wasm we would lose the information about the original allocation/deallocation function called, and we defaulted to malloc/free. This meant that, for example, overriding the global new/delete would not have any effect.

The new rules are: we ALWAYS use cheerp_allocate & co. For Wasm, we also include as first parameter the original function. We also do it for deallocation in genericjs when the argument might have come from linear memory.

Then in GDA in llc we replace with the original function, is present.

All the other changes are just minor consequences of this new system.

yuri91 and others added 2 commits December 16, 2024 13:57
cheerp_allocate and related functions had a few issues, in particular
they were not used consistently and so a lot of edge cases existed.

On top of that, for Wasm we would lose the information about the
original allocation/deallocation function called, and we defaulted to
malloc/free. This meant that, for example, overriding the global
new/delete would not have any effect.

The new rules are: we ALWAYS use cheerp_allocate & co. For Wasm, we also
include as first parameter the original function. We also do it for
deallocation in genericjs when the argument might have come from linear
memory.

Then in GDA in llc we replace with the original function, is present.

All the other changes are just minor consequences of this new system.
@yuri91 yuri91 merged commit 465ac16 into master Dec 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants