Skip to content

Cleanup LabelDefs #3365

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
merged 7 commits into from
Oct 29, 2017
Merged

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@@ -117,12 +114,12 @@ class LabelDefs extends MiniPhaseTransform {
}
}

object collectLabelDefs extends TreeMap() {
private object collectLabelDefs extends TreeMap() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it for performance reason that this is an object and we call clear() before using it, instead of making it a class, and creating a new instance when we use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not yet, I am exploring what can be simplified step by step. My intention is to fix a stack overflow. My previous attempt (#3362) modified the whole code in one go an something made the bootstrapped compiler buggy. I this PR I intend to change small details at a time and run the full test suite on each change. This is just step 0 of my changes.

@nicolasstucki nicolasstucki force-pushed the cleanup-LabelDefs branch 2 times, most recently from 1499814 to 508d65f Compare October 23, 2017 14:14
@nicolasstucki nicolasstucki requested a review from smarter October 23, 2017 15:45
override def transform(tree: tpd.Tree)(implicit ctx: Context): tpd.Tree = {
tree match {
case t: Template => t
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this case will ever be hit since we're after LambdaLift, same for the case _: Template below.

@smarter
Copy link
Member

smarter commented Oct 23, 2017

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 0 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/3365/ to see the changes.

Benchmarks is based on merging with master (e1365d9)

@allanrenucci
Copy link
Contributor

I think you can also remove all the tpd prefixes

@nicolasstucki nicolasstucki self-assigned this Oct 27, 2017
@nicolasstucki
Copy link
Contributor Author

Rebased

collectLabelDefs.clear
val newRhs = collectLabelDefs.transform(tree.rhs)
var labelDefs = collectLabelDefs.labelDefs
val labelDefs = collectLabelDefs(tree.rhs)

def putLabelDefsNearCallees = new TreeMap() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this can be a val

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but I added a small optimization to not create the transformer if labelDefs is empty. Therefore it will be kept as a def.

@allanrenucci allanrenucci merged commit 0d22181 into scala:master Oct 29, 2017
@allanrenucci allanrenucci deleted the cleanup-LabelDefs branch October 29, 2017 19:17
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.

4 participants