-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Towards Inlining Untyped Code #4589
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
Conversation
a791e52
to
9a69dbc
Compare
Introduce UntypedSplice and make TreeCopiers and TreeMaps more regular to take splices into account.
- extend scheme to accumulators - no need anymore to define special tpd versions of maps and accumulators - no extra `typeMap` field needed in typeMap; instead the UntypedSplice case is handled directly.
Some refactorings so that it will become easier to generate untyped trees
Use combination of Enum and Case instead.
It's useful to know something was an enum when it started, and it's necessary to pickle this when serializing untyped trees.
- Mark splices in code under -print-debug - Print owners of all definitions under -print-debug-owners
Allow UNTYPEDSPLICE roots with TYPEDSPLICE subtrees. Trees between them are untyped.
- need to maintain Type mode bit for correct desugaring - need to pickle PatDefs directly since desugaring requires too much context.
Everything should be reflected in flags and privateWithin already.
This was previously forgotten, even though unary operations such as `!` and `~` were folded later in FirstTransform. As a consequence, inlining simplifications involving constant expressions using these operations were not done. This affected in particular the trace macro, which was always expanded to an operation taking a closure argument.
Avoid creation of `op1` methods if tracing is not enabled.
Rely on call-by-name parameters instead. Fix "unused defs" logic so that referred-to cbn parameters are not eliminated.
Since all Mod values are now reflected in flags and privateWithin, there is no need anymore to test whether a Mod exists.
1375bf4
to
e8c96cb
Compare
test performance please |
performance test scheduled: 1 job(s) in queue, 1 running. |
I admit it would be better to split this into separate PRs. But my time-budget is already overdrawn as is, so I have chosen to push ahead and try to get the subsequent steps done instead. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/4589/ to see the changes. Benchmarks is based on merging with master (228b232) |
Replaced by #4620 for now. Putting decision to pickle untyped trees on hold. |
We would like inline code that is only typed at the leaves. This seems to be the best way to have an inlining scheme that can generate new types. This ability to generate new types gives us some of the power of whitebox macros. It is needed for most typelevel programming idioms.
This PR is preparatory. It contains
only as carriers of positions for syntactic analysis in IDE and elsewhere.
inline
as a modifier for function parameters, use by-name instead.reducing the amount of code that's generated.
The PR can be reviewed separately. It will be followed up with another PR, introducing
transparent
methods, which allow to inline untyped trees.