aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/scala/async/internal/AsyncId.scala
Commit message (Collapse)AuthorAgeFilesLines
* Reduce logging overhead and minor cleanupsRory Graves2017-06-211-2/+2
|
* Enable a compiler plugin to use the async transform after patmatJason Zaugg2015-09-221-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the async transformation is performed during the typer phase, like all other macros. We have to levy a few artificial restrictions on whern an async boundary may be: for instance we don't support await within a pattern guard. A more natural home for the transform would be after patterns have been translated. The test case in this commit shows how to use the async transform from a custom compiler phase after patmat. The remainder of the commit updates the implementation to handle the new tree shapes. For states that correspond to a label definition, we use `-symbol.id` as the state ID. This made it easier to emit the forward jumps to when processing the label application before we had seen the label definition. I've also made the transformation more efficient in the way it checks whether a given tree encloses an `await` call: we traverse the input tree at the start of the macro, and decorate it with tree attachments containig the answer to this question. Even after the ANF and state machine transforms introduce new layers of synthetic trees, the `containsAwait` code need only traverse shallowly through those trees to find a child that has the cached answer from the original traversal. I had to special case the ANF transform for expressions that always lead to a label jump: we avoids trying to push an assignment to a result variable into `if (cond) jump1() else jump2()`, in trees of the form: ``` % cat sandbox/jump.scala class Test { def test = { (null: Any) match { case _: String => "" case _ => "" } } } % qscalac -Xprint:patmat -Xprint-types sandbox/jump.scala def test: String = { case <synthetic> val x1: Any = (null{Null(null)}: Any){Any}; case5(){ if (x1.isInstanceOf{[T0]=> Boolean}[String]{Boolean}) matchEnd4{(x: String)String}(""{String("")}){String} else case6{()String}(){String}{String} }{String}; case6(){ matchEnd4{(x: String)String}(""{String("")}){String} }{String}; matchEnd4(x: String){ x{String} }{String} }{String} ```
* Avoid dead code warning with async(throw T)Jason Zaugg2015-07-291-1/+1
| | | | | | By declararing the parameter of `async` as by-name. Fixes #150 (the bug in the original ticket.)
* cleans up FutureSystemEugene Burmako2014-02-151-8/+6
|
* Update copyright years.Jason Zaugg2014-01-141-1/+1
| | | | 2013 must have been unlucky.
* Abstract over use of scala.util.TryJason Zaugg2013-11-131-2/+18
| | | | | Custom implementation of the async macro may choose to use a different data type to represent `Throwable | A`.
* Don't aggressively null out captured varsJason Zaugg2013-11-121-0/+3
| | | | | Once they escape, we leave the references in the state machines fields untouched.
* Minimize the public APIJason Zaugg2013-11-071-2/+0
| | | | | | | | | | - Remove the CPS fallback version of async. That was not intended to be part of 1.0. - Lookup the await method beside the macro, rather than requiring all calls to go to AsyncBase.await. - Create a minimal version of Async that just contains await/async and delegates to the macro implementation in internal._ - Add scaladoc.
* Enables testing the resetting of lifted local variablesPhilipp Haller2013-10-221-0/+18
| | | | | | | - Adds a hook that lets a derived macro insert additional code when zero-ing out a lifted field. - Adds a variant of the `AsyncId` macro that logs zeroed-out fields. - Adds a test using this mechanism
* Use @uncheckedBounds to avoid introducing refchecks errorsJason Zaugg2013-08-221-1/+1
| | | | | | | | | ... in code that would otherwise have smuggled through these slack LUBs in the types of trees but never in a TypeTree. More details in SI-7694. Fixes #29
* Support await in throws.Jason Zaugg2013-07-241-2/+4
| | | | | Also support AsyncId.async[Nothing], which was triggering a NPE in the generated `null.asInstanceOf[Nothing]`.
* Move implementation details to scala.async.internal._.Jason Zaugg2013-07-071-0/+64
If we intend to keep CPS fallback around for any length of time it should probably move there too.