Skip to content

Refactor to include generic types info in VCs #372

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

Merged

Conversation

kyleheadley
Copy link
Member

Change the generic flag to an index, and have other functions rely on this index rather than regenerating it from decl itypes. This is in preparation for changing these indexes in TypeVariableAnalysis later, so that we can i.e. change void * to T *.

All other functionality remains unchanged. Regression tests are unaffected.

Copy link
Member

@mwhicks1 mwhicks1 left a comment

Choose a reason for hiding this comment

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

Looks fine to me. @jackastner is the expert though.

Copy link
Collaborator

@john-h-kastner john-h-kastner left a comment

Choose a reason for hiding this comment

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

There's one part in the FVConstraint constructor I don't understand. Looks good otherwise.

auto *ParamVar = new PVConstraint(QT, ParmVD, PName, I, Ctx, &N);
int GenericIdx = ParamVar->getGenericIndex();
if (GenericIdx >= 0)
TypeParams = std::max(TypeParams, GenericIdx + 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand this update to TypeParams

Copy link
Member Author

Choose a reason for hiding this comment

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

TypeParams represents the number of variables in Itype_for_any(...) for a function. Unfortunately, I was unable to read this information directly from the decl. But, each parameter and return var has an index attached, so the max index (+1) is the number of variables. Eventually the rewriter will need to know the location of that phrase in the code, so if you're aware of it let me know. I could make this code slightly more efficient or save the notes for later.

Copy link
Collaborator

@john-h-kastner john-h-kastner Jan 12, 2021

Choose a reason for hiding this comment

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

Makes sense. Changes all look good to me then.

Copy link
Member

@mwhicks1 mwhicks1 left a comment

Choose a reason for hiding this comment

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

Sounds like we are good to go.

@kyleheadley kyleheadley merged commit 7162656 into correctcomputation:main Jan 12, 2021
@kyleheadley kyleheadley deleted the rewrite_generic_review branch January 12, 2021 21:26
@kyleheadley kyleheadley mentioned this pull request Jan 12, 2021
11 tasks
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.

3 participants