-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #3853 and #4151: Compile code in the macro definition and remove interpreter #4155
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
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
performance test failed: Error line number: 24 [check /data/workspace/bench/logs/pull-4155-03-22-15.36.out for more information] |
1d9006a
to
2685ecb
Compare
06ade09
to
5e0b55a
Compare
5e0b55a
to
9db3047
Compare
@liufengyun do you know what failed in the benchmark server? |
Sorry, I have no access to computer now, but you should be able to login
into lamppc37 with your account and check the log file. Or, I can check in
one hour.
Le ven. 23 mars 2018 17:22, Nicolas Stucki <[email protected]> a
écrit :
… @liufengyun <https://github.com/liufengyun> do you know what failed in
the benchmark server?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4155 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAuDyfk94KClMJ8U2FbFbNIMl0YPt4KJks5thSEsgaJpZM4S3KY9>
.
|
9db3047
to
352dd99
Compare
Cause diagnosed: in #4149 , an empty file That error should not cause the benchmarks to fail, but the following find /data/workspace/bench/tests/scala-library -name *.scala |
@liufengyun thanks :) |
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/4155/ to see the changes. Benchmarks is based on merging with master (c89f8fa) |
As a rule, it seems good to prevent such issues by adding quotes around |
b8f3b04
to
47f3340
Compare
…preter The only interpreted code remaining is a call to a static method containing a lambda which can compute the resulting inlined quoted expression. Arguments to the macro are trivially computed from the inlined call and bindings.
47f3340
to
54a1dcd
Compare
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 think it's a pity that we do not allow general interpretation in an inline macro. Why do we have to remove that possibility?
@@ -231,7 +231,9 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase | |||
// be duplicated | |||
// 2. To enable correct pickling (calls can share symbols with the inlined code, which | |||
// would trigger an assertion when pickling). | |||
val callTrace = Ident(call.symbol.topLevelClass.typeRef).withPos(call.pos) | |||
val callTrace = | |||
if (call.symbol.is(Macro)) call |
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 make the exception for macros? Since there is a reasoning in the comment above why we rewrite calls to callTraces, we need to add to the comment a reasoning why the same does not apply to macro calls.
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 will add a comment
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.
Added the comment and making this optimization at ReifyQuotes
when the call
is processed.
Removing the interpreter does not really limit what we could already write in terms of macros. @odersky do you have some precise examples where we would need interpretation? This transformation can also be extended to support multiple spliced in a single macro by making the macro return a list of lambdas. We would only need to find the additional definitions in the body of the inline method (such as
This could also be performed by the interpreter, but is currently not supported as well. One thing is not possible anymore with the changes in this PR. We cannot write inline macros as extension methods in implicit classes. Those were only working by an abuse of the inline bindings which were wrongly moved to be interpreted to allow this to work. The failed if the implicit class was instantiated explicitly. The correct way to would be using the new extension methods, where we might additionally need to require the |
Apply the simplification later in ReifyQuotes when call has been processed.
71d40d2
to
da8bbea
Compare
This was performed to allow some inlined `this` bindings to be evaluated. It was not always possible and hence inconsistent.
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 think I get it now after @nicolasstucki explained it to me. LGTM.
The only interpreted code remaining is a call to a static method
containing a lambda which can compute the resulting inlined quoted
expression. Arguments to the macro are trivially computed from the
inlined call and bindings.