Skip to content

Memory allocation intrinsics#163

Closed
JTrenerry wants to merge 10 commits into
mainfrom
memory-allocation-intrinsics
Closed

Memory allocation intrinsics#163
JTrenerry wants to merge 10 commits into
mainfrom
memory-allocation-intrinsics

Conversation

@JTrenerry

Copy link
Copy Markdown
Collaborator

Adds memory allocation intrinsics.

I am unsure what to do with free_alloca, should this be called on the exit of a proc when it contains an alloca?

Also unsure what names should be accepted to be transformed.

Also unsure why the attribs are not updating for the calls.

@JTrenerry JTrenerry self-assigned this May 25, 2026
@JTrenerry JTrenerry requested review from agle and katrinafyi as code owners May 25, 2026 05:21
@JTrenerry JTrenerry added the enhancement New feature or request label May 25, 2026
@JTrenerry JTrenerry linked an issue May 25, 2026 that may be closed by this pull request
| "@calloc" | "@_calloc" | "@zmalloc" -> Calloc
| "@alloca" | "@_alloca" -> AllocStack
| "@free" | "@#free" | "@_free" -> Free
| _ -> failwith "Unreachable")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could this return an option and have replace_call match on the result of this function? that way there isn't duplication of function name strings (though they are also duplicated in lang/stmt.ml so perhaps a better solution exists).

[
TypeError
{ text = "Wrong type of arg in " ^ to_string intrin_call };
]

@b-paul b-paul Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could you put this if-then-else into a function, since it's quite big and repeated

@agle agle closed this Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory Allocation Intrinsics

3 participants