Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Sep 21, 2018

This PR removes functionality to inline typed trees, and also provides better help to tracking arguments for staging.

@allanrenucci
Copy link
Contributor

test performance please

@scala scala deleted a comment from odersky Sep 21, 2018
@dottybot
Copy link
Member

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

@dottybot
Copy link
Member

Performance test finished successfully:

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

Benchmarks is based on merging with master (20ad4a0)

@odersky
Copy link
Contributor Author

odersky commented Sep 23, 2018

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/5138/ to see the changes.

Benchmarks is based on merging with master (a0b429b)

Rename `tree`, `trees` and associated methods in `ClassSymbol` to `rootTree`, `rootTrees`.

We want to add another tree field to symbols that points directly to the symbol's definition tree.
So we should be more specific about `rootTree`.
Previous scheme did not work if fixed completer was subsequently overridden
by another completer.

The new scheme goes directly to the places where parents are computed
in various completers.
Normalizing via simplification is not enough since sometimes we need to
"reach into" a pre-simplified type via the `isMatchedBy` method of a SelectionProto.
Match-pattern bound variables should not assume to match all other types,
even if TypeVarsMissContext is true.
While we transition from rewrite matches to staging, we should not be
dependent on rewrite methods for tuples. So for now, all tuple operations
are dynamic.
 - Fix isUptoDate conditon
 - Include TypeVars in footprint
Since we don't support rewrite matches and implicit matches in their current form,
some tests need to be reclassified. They are moved to invalid. Maybe we can bring
them back later as staging tests.
XmlQuote broke since proxies work now differently.
Analyzing tuples2 has shown that there's a quadratic blowup due to the occursIn check
in ConstraintHandling#approximate. This change avoids traversing types for occursIn as
long as they are ground.
Track proxies of inline arguments with a flag.

Note: Some of the optimizations of the inliner don't update the
defTree of the argument symbol even if they change the definition.
But most of these optimizations will go away anyway. We should
review once the inliner stabilizes.
- Remove unnecessary inline implicit conversion to `SCOps`
- Use Symbol::fullName instead of tree extractors
The optimization was to disregard a prefix of a named type if its symbol is static
and none of the mapped symbols in `from` is static. This is incorrect, since the
prefix might be a non-static reference to a static object. In that case the prefix
still has to be considered. i2895a.scala contains code that failed when running
with the cbn implementation of `assert` in the next commit.
This generates more efficient code by inlining the argument expression into
the if-then-else.
Align position of binding and position of its defined symbol. This avoids some test-pickler
errors observed with the new inliner.
@odersky
Copy link
Contributor Author

odersky commented Sep 25, 2018

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/5138/ to see the changes.

Benchmarks is based on merging with master (a4b60c4)

The change accidentally part of a previous commit
@nicolasstucki nicolasstucki self-requested a review September 26, 2018 11:59
@nicolasstucki
Copy link
Contributor

So far it looks good. Are there more things that will go into this PR? I would suggest merging as is as would unblock a couple of other PRs (the retaining tree part).

def TermDeco(term: Term): TermAPI = new TermAPI {
def pos(implicit ctx: Context): Position = term.pos
def tpe(implicit ctx: Context): Types.Type = term.tpe
def underlyingArgument(implicit ctx: Context): Term = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe make this part of the scala.quoted.Expr API as suggested by @nicolasstucki initially

Copy link
Contributor

Choose a reason for hiding this comment

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

No, this is the correct way to do it. If you do not inspect the tree, you should not know about the implementation details. I mean when using purely generative macros.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I meant as an extension method like toTasty:
https://github.com/lampepfl/dotty/blob/06738295d54f1e945becf89dc809b3ff923dc57a/compiler/src/dotty/tools/dotc/tastyreflect/QuotedOpsImpl.scala#L11

So not visible when doing only purely generative macros

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yes. This way is more flexible as it does not only work for the parameters but for any term you might have inside the tree.

@odersky odersky merged commit 90671f0 into scala:master Sep 26, 2018
@allanrenucci allanrenucci deleted the revert-inliner branch September 26, 2018 14:27
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