Skip to content

[WIP] [mypyc] Refactor name generation in Load/InitStatic #8987

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

Closed
wants to merge 1 commit into from
Closed

[WIP] [mypyc] Refactor name generation in Load/InitStatic #8987

wants to merge 1 commit into from

Conversation

TH3CHARLie
Copy link
Collaborator

@TH3CHARLie TH3CHARLie commented Jun 11, 2020

related mypyc/mypyc#737

This PR aims to refactor the name generation/mangling logic in LoadStatic and InitStatic from codegen to IR build.

  • prefix
  • lib_prefix
  • private names(suffix)

@TH3CHARLie
Copy link
Collaborator Author

TH3CHARLie commented Jun 11, 2020

Well, NameGenerator is the big issue here, it's related to the code generation context.

Also, what's the ideal granularity of a name generated by irbuild? For example, loading a static float will have an identifier of float_3 now. With the existing part of this PR, we'll have an identifier of float_3 and a prefix of CPyStatic_. Its final name would be CPyStatic_float_3 because its module and group would all be empty.

And also, it is a bit strange to me that a static variable is not marked with C keyword static but only with the prefix. I plan to introduce this modification in codegen in this PR. So eventually the code will be static PyObject *CPyStatic_float_7; when initializing the globals.

@TH3CHARLie TH3CHARLie changed the title [WIP] [mypyc] Refactor name generation/mangling [WIP] [mypyc] Refactor name generation in Load/InitStatic Jun 11, 2020
@TH3CHARLie TH3CHARLie marked this pull request as draft June 11, 2020 10:36
@TH3CHARLie
Copy link
Collaborator Author

a related PR merged: #8973, so close this

@TH3CHARLie TH3CHARLie closed this Jun 16, 2020
@TH3CHARLie TH3CHARLie deleted the refactor-name-gen branch June 20, 2020 10:37
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.

1 participant