Skip to content

Swift: extract types for patterns#14570

Merged
rdmarsh2 merged 8 commits intogithub:mainfrom
rdmarsh2:rdmarsh2/swift/extract-pattern-types
Dec 6, 2023
Merged

Swift: extract types for patterns#14570
rdmarsh2 merged 8 commits intogithub:mainfrom
rdmarsh2:rdmarsh2/swift/extract-pattern-types

Conversation

@rdmarsh2
Copy link
Copy Markdown
Contributor

No description provided.

@rdmarsh2 rdmarsh2 requested a review from a team as a code owner October 23, 2023 18:28
@github-actions github-actions Bot added the Swift label Oct 23, 2023
Copy link
Copy Markdown
Contributor

@AlexDenisov AlexDenisov left a comment

Choose a reason for hiding this comment

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

I'm not sure about the upgrade script, but overall LGTM.
Happy to approve once the formatting is fixed.

<dbstats>
<typesizes />
<stats />
</dbstats>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We didn't put stats in any other upgrade scripts, do we need this now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we do, no.

Comment thread swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/pattern_types.ql Outdated
Comment thread swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/upgrade.properties Outdated
Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

Results look good as far as I can see.

It would be good to understand the motivation for this and whether this change meets that need. I can certainly imagine these types being useful.

I also think we should have a DCA run on this.

@MathiasVP
Copy link
Copy Markdown
Contributor

MathiasVP commented Oct 24, 2023

It would be good to understand the motivation for this and whether this change meets that need. I can certainly imagine these types being useful.

The motivation for this is for type pruning, where we need to assign a meaningful type for dataflow nodes. Some time ago I talked to Robert about what we should do for the dataflow nodes representing patterns, and we agreed that we could probably assign it some notion of a Top type, but it looks like we might as well grab the real type off the patterns (which is what Robert is extracting here).

I also think we should have a DCA run on this.

Very much agree!

Comment thread swift/ql/lib/change-notes/2023-10-24-pattern-types.md Outdated
@rdmarsh2
Copy link
Copy Markdown
Contributor Author

DCA looks clean, only thing left is that question about the upgrade script - @AlexDenisov is there a better way to synthesize an empty table?

@AlexDenisov
Copy link
Copy Markdown
Contributor

AlexDenisov commented Oct 27, 2023

DCA looks clean, only thing left is that question about the upgrade script - @AlexDenisov is there a better way to synthesize an empty table?

I don't know, and I also don't know why we'd need to synthesize a new table 😅
I'm very far from being knowledgeable about the upgrade scripts.

@geoffw0
Copy link
Copy Markdown
Contributor

geoffw0 commented Oct 27, 2023

I think the .dbscheme defines what tables exist, the upgrade .ql scripts only need to populate the right rows in them. So to create an empty table no upgrade .ql script is required. Perhaps get confirmation from someone who works on upgrade scripts more often (maybe from the CPP side) or failing that the foundations team.

Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

To be clear, the upgrade itself is still required (to mark the change in .dbscheme), I just don't think it needs to run any .ql script inside if we want the new table empty.

Terminology is confusing.

Other than that question, this LGTM as well.

@rdmarsh2 rdmarsh2 force-pushed the rdmarsh2/swift/extract-pattern-types branch from dc278b8 to 0dc4a68 Compare November 29, 2023 21:04
Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 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 still a spurious swift.dbscheme.stats in the upgrade script.

Assuming the upgrade / downgrade scripts still connect to the right versions, this otherwise LGTM.

@geoffw0
Copy link
Copy Markdown
Contributor

geoffw0 commented Dec 4, 2023

I'm ready to approve this when the spurious swift.dbscheme.stats file is deleted. Notably the upgrade script hash (b83ff9c60c2bb4be2f3d1d4810268c557eb38f19) is still current. 👍

Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

👍

@rdmarsh2
Copy link
Copy Markdown
Contributor Author

rdmarsh2 commented Dec 6, 2023

Lots of noise in the DCA analysis timings, but mostly faster and all with high standard deviations. I don't see any red flags.

@rdmarsh2 rdmarsh2 merged commit 1087087 into github:main Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants