Skip to content

Conversation

TH3CHARLie
Copy link
Collaborator

@TH3CHARLie TH3CHARLie commented Jul 26, 2020

relates mypyc/mypyc#741

Introduce LoadMem IR to read a memory address and convert it into a designated-type value. (The address would mostly be in py_ssize_t for now)

Part of efforts to implement len primitives: *(Py_ssize_t*)(ob + size_offset)

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Looks good. Most of the comments about naming -- let's think about this carefully.

@TH3CHARLie TH3CHARLie changed the title [mypyc] Introduce PtrDeref [mypyc] Introduce LoadMem Jul 27, 2020
@TH3CHARLie
Copy link
Collaborator Author

Update:

I've added the assertion on src type and a codegen test.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Looks good now! Thanks for adding a test case. Just one tiny nit.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Thanks for the final updates, looks good now!

@JukkaL JukkaL merged commit 997b5f2 into python:master Jul 28, 2020
@TH3CHARLie TH3CHARLie deleted the ptr-deref branch July 28, 2020 07:00
JukkaL pushed a commit that referenced this pull request Jul 31, 2020
Related to #9211.

This PR introduces RStruct to represent C structs.

StructInfo is used to hold information about a unique struct-like type.

This PR also introduces several functions to compute aligned offsets and 
size of structure types.
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