-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Local optimisations #2513
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
Local optimisations #2513
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your commit messages.
I've just played with the current state of this branch. After fixed by @OlivierBlanvillain some of very important optimizations are not trigerring. For this input:
Linker(with global opts disabled) generates this bytecode:
While dotty -optimise generates this:
It seems that at least two optimizations did not trigger:
In any case, getting this in is an improvement as without this dotty generates even worse code:
|
after discussion with @OlivierBlanvillain: Dotty currently has an important optimization disable(inlineLocalObjects) and this is why Dotty-generated bytecode is worse. |
cb362f9
to
befa11f
Compare
This is ready for review |
For the record: a lot of discussion happened here: #2545 |
Applies need to have same receiver :-)
They may have side-effects, unlike reading other arguments.
note that commits are in wrong order due to https://help.github.com/articles/why-are-my-commits-in-the-wrong-order/ |
@@ -3,6 +3,8 @@ object O { | |||
object P | |||
} | |||
|
|||
// We assume module initialisation to be pure, running this test under |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test is in the PR twice and it's broken. I'm working on a fix for it.
Enable all tests under optimise.
I have fixed Simplify to perfrom correct transformation of all tests that were in |
bc09c8b
to
8a66a25
Compare
I started reviewing this PR. A lot of other optimizations didn't trigger. I've enabled them and here's the code generated by dotty now:
It is a least readable, unlike previous ones. |
@@ -34,6 +34,9 @@ class Simplify extends MiniPhaseTransform with IdentityDenotTransformer { | |||
private var symmetricOperations: Set[Symbol] = null | |||
var optimize = false | |||
|
|||
|
|||
override val cpy = tpd.cpy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need both this val and an explicitly tpd.cpy
everywhere?
We don't really, but I made the change just to be sure.
…On 30 May 2017 09:51:33 Olivier Blanvillain ***@***.***> wrote:
OlivierBlanvillain commented on this pull request.
> @@ -34,6 +34,9 @@ class Simplify extends MiniPhaseTransform with
> IdentityDenotTransformer {
private var symmetricOperations: Set[Symbol] = null
var optimize = false
+
+ override val cpy = tpd.cpy
Why do we need both this val and an explicitly `tpd.cpy` everywhere?
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#2513 (review)
|
Something is strange with the CI. |
This is a known issue with Vulpix swallowing exceptions that I reported to @felixmulder. The workaround is to run it locally, the exception will be present in the log file. |
07a5d89
to
fba0d51
Compare
@DarkDimius Latest commit (b7149c9) got lost in a |
@OlivierBlanvillain, I dropped it intentionally. Do we still need it after #2557 ? |
I don't know (not sure if the PR is rebased on top of 2557), but I think it's better like this anyway |
All tests passed! |
This RP implements a subset of the optimisation done by linker that can be done with local knowledge. This is a first iteration and many things still need to be polished.
@DarkDimius your last 3 commits didn't completely solve the issue with
testPickling
, after cherry-picking them on top of the rebased branch still results in<notype>
popping up in unpickling. To be investigated tomorrow 😄