aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/LambdaLift.scala
Commit message (Collapse)AuthorAgeFilesLines
* Fix non-sensical codeMartin Odersky2016-10-111-1/+4
| | | | | | Replacing or types by their dominators and implicit conversions caused the code to do the right thing anyway, but with the arrival of true or-types, this became a static error.
* Fix problem related to cbn parameters in supercallsMartin Odersky2016-07-271-7/+9
| | | | | | | | | | | The closures generated by elimByName did not get the InSuperCall flag set. This caused problems in lambda lift which led to a verify error for the new version CollectionStrawMan6. That version replaces explicit function parameters in class LazyList by by-name parameters. Also: Clarify logic for liftLocals in LambdaLift (liftLocals caused the immediate problem but was in the end not to blame).
* LambdaLift: do not close over members that are static.Dmitry Petrashko2016-05-271-2/+2
|
* Fix deadlock in t5375 and similar tests.Dmitry Petrashko2016-05-261-2/+3
| | | | See t5375.scala for details.
* Backport from Linker: Fix to lambda lift. Fixes #1280.Dmitry Petrashko2016-05-261-2/+9
| | | | | | | | | | | CollectDependencies had incorrect handling of `Ident`s. If it had ever met an `Ident` to a symbol defined outside of current owner-chain(e.g. Predef.println) it would issue narrowTo(enclosingClass). This is very conservative and leads to memory leaks even in trivial lambdas. My lambda-lift-foo groes stronger :-)
* Address reviewer comments.Martin Odersky2016-03-071-5/+2
|
* Drop accidentally left-in inhibitor switchMartin Odersky2016-03-031-1/+1
|
* Cleanup lambda liftMartin Odersky2016-03-031-19/+26
| | | | | | | 1. Make clearer what markFree is supposed to do and get rid of `propagated` mode bit. 2. Harden copyParams so that we make sure corresponding parameters and fields are copied.
* Fix call propagation from constructor to classMartin Odersky2016-03-021-3/+3
|
* LambdaLift redesignMartin Odersky2016-03-021-42/+33
| | | | | | | Simplifications in order to avoid the freqent special casing of constructors and prepare the way for proper handling of trait constructors (which cause problems; see pending/pos/llift.scala.
* Simplification: get rid of local trait methodsMartin Odersky2016-03-021-24/+10
|
* Handle local traits in lambda liftMartin Odersky2016-03-011-24/+99
|
* Fix outer paths generated during lambda lift from constructors.Martin Odersky2016-03-011-1/+7
| | | | | | If lambda lift needs to create an outer path from a constructor, the path needs to start from the $outer parameter of the constructor, not the this of the enclosing class, which is not yet available.
* Make use of freshened in LambdaLift.newNameMartin Odersky2015-07-091-11/+3
|
* Drop Module flag from lifted symbols.Martin Odersky2015-06-261-1/+2
| | | | | | | Reason: A lifted module is no longer a module (i.e. singleton object) in the scope to which it is lifted. Fixes #689.
* Fix typoMartin Odersky2015-06-221-2/+2
|
* Map proxy references in constructors to parametersMartin Odersky2015-06-201-2/+15
| | | | | Proxy references in constructors can't be left as fields because they can happen before the supercall.
* Add initializers for lambdalift proxy fieldsMartin Odersky2015-06-191-3/+12
| | | | | | | | If an inner class has proxy fields, we missed so far the assignment sfrom the proxy parameters in the primary constructor of the class to the proxy fields. Test case tries several variations of this.
* Compute outer.path in lambdaLift at correct phase.Martin Odersky2015-06-031-2/+2
| | | | | | | | | | LambdaLift needs to compute outer.path at the phase in which the results are constructed, i.e. phase lambdaLift.next. Or else we get an error in outer.path for lost fo files, including pos/Fileish.scala as a minimized test case. Previously outer as computed at phase lambdaLift. The reason for this is that lambdaLift name mangles inner classes, which causes outer acessors to be not found. We now correct for the problem in outer.path itself, by calling outerAccessor only at a safe phase.
* Narrow liftedOwner also for static objectsMartin Odersky2015-06-031-4/+3
| | | | | Lambdas should stay inside static objects if they reference to them with a This or Ident. Fixes test case `llist.scala` but demonstrates another problem.
* Avoid static initialization deadlock in run tests (2).Martin Odersky2015-06-011-2/+9
| | | | | | | | See https://github.com/lampepfl/dotty/pull/624#issuecomment-107064519 for a lengthy explanation. We now solve the problem in LambdaLift. The formerly failing tests are all reverted to theor original, failing, version.
* Revert "Fix #580: use isContainedIn to support cases where the enclosing ↵Martin Odersky2015-05-291-1/+1
| | | | | | class is also the top-level class" This reverts commit 6898d2c296326779d373ef0e0b84e4451550120a.
* Fix #580: use isContainedIn to support cases where the enclosing class is ↵Guillaume Martres2015-05-211-1/+1
| | | | also the top-level class
* Compute enclosingClass and topLevelClass once in LambdaLift.liftLocalsDmitry Petrashko2015-05-131-3/+5
|
* Guard agains lifting symbols defined in super-calls to non-static members of ↵Dmitry Petrashko2015-05-131-2/+5
| | | | package.
* Update comment on liftedOwner.Dmitry Petrashko2015-05-081-2/+1
|
* Fix #545: no need to make members of static classes static.Dmitry Petrashko2015-05-081-1/+7
| | | | | | Otherwise we will need to rewrite references to `This` of class be references on ModuleVal. This is less efficient(instead of calling method statically known to be final, you have virtual call) and less jvm-friendly, as needs additional instructions to get to ModuleVal.
* Get rid of NotPrivate flag.Martin Odersky2015-05-011-2/+1
| | | | It is now redundant.
* Remove trailing whitespaceMartin Odersky2015-04-231-11/+11
| | | | | I have figured out how to make this the default in Eclipse, so hopefully we won't see many repeats of this.
* Fix #342 Lambda lift idents need to get new prefixMartin Odersky2015-04-171-2/+7
| | | | | Idents of lifted symbols become class members, need to carry the right reference with the right prefix as type.
* Reset inSuperCall when lifting methodsMartin Odersky2015-04-171-1/+1
| | | | | After lambdaLift, methods are no longer local to cosntructors, so their inSuperCall flag is reset.
* Improve documentation and minimze testMartin Odersky2015-04-171-5/+20
| | | | | | | Documentation around markFree and narrowLiftedOwner was added. i480 was minimzed and dependencies on dotc were removed. (+1 squashed commit) Squashed commits: [1a84054] Test cases for #480
* Fix #480 in LambdaLiftMartin Odersky2015-04-171-10/+17
| | | | | | | | | | | | | | Fix two errors, where the first masked the second: 1) Variables defined in a method are not free variables of that method. This was mispredicated before and caused liftedOwner to be updated to the class enclosing the method, thereby preventing any method that refers to a local parameter or symbol to be hoisted. Once this was fixed, methods were hoisted too far out. Test case in #480a, which takes code from Definitions. This was fixed by 2) markFree is updated to do an additional narrowLiftedOwner so that, if a free variable gets a proxy in an enclosing class, any inner classes and methods are kept within that class.
* Avoid capturing context in lazy treesMartin Odersky2015-03-181-2/+2
| | | | | | | | | | | | | | | | | | Lazy trees can live longer than runs, so it is important that they capture as little as possible. In particular they should not capture contexts. This change led with a ripple through effect to many changes where operations now have to parameterzied with contexts, in particular in what concerns tree folding. The changes in turn uncovered some areas where dotc was incompatible with scalac, and flagged correct things as errors. These will be fixed in the next commits. Another small twist: EmptyTrees will not be read in delayed mode, so that one can check for lacking definitions without deserializing the rhs.
* More careful usage of unforced decls in classes.Martin Odersky2014-12-181-1/+1
| | | | | | | | | | 1) Rename `decls` to `unforcedDecls` to make it clear that it is danegrous to use. 2) Prefer `info.decls` over `unforcedDecls`. This fixes the problem reported in #305 where the primary constructor was not found.
* Make LambdaLifted methods follow JVM8 lambda parameters order.Dmitry Petrashko2014-12-161-5/+5
| | | | LambdaMetafactory expects environment to go first.
* Merge pull request #275 from dotty-staging/fix/#266-lambdaLiftDmitry Petrashko2014-12-151-11/+15
|\ | | | | Fix/#266 lambda lift
| * Fixed narrowLiftedOwner in LambdaLiftMartin Odersky2014-12-121-11/+15
| | | | | | | | | | | | | | | | A lot of cases were missing before and caused failures in the newly added test in TreeChecker#typedThis. Now we assure that all this references appear inside the referenced class.
* | Remove fruitless overrides of treeTransformPhaseMartin Odersky2014-12-141-1/+0
|/ | | | | Now the default phase of treeTransformPhase is phase.next, we can remove all overrides that specify the same phase.
* Eliminate global state in LambdaLiftMartin Odersky2014-11-121-314/+311
| | | | | State moved into local transforms which are allocated one per unit. Thsi allows lambda lifters on different units to run in parallel.
* Replaced overridden init methods with prepareForUnit.Martin Odersky2014-11-121-7/+13
| | | | | | | This allows to move to a functional implementation later. Only exception: CapturedVars still uses init() because it contains a (dubious!) interaction with intialization and transformSym. Looking at this next.
* Drop modifiers as separate data from MemberDef treesMartin Odersky2014-11-101-3/+1
| | | | Typed MemberDef trees now take the modifiers from their symbol's data.
* Generalize lift behavior between Flatten and LambdaLiftMartin Odersky2014-11-091-4/+1
| | | | | To be combinable with follow-up mini-phases the lift operation needs to handle Thickets specially. This commit factors out the behavior from LambdaLift, so that Flatten can do the same thing.
* Made LambdaLift capable of having minitransforms run after it.Martin Odersky2014-11-091-16/+20
| | | | Some changes needed so that Flatten can run after LambdaLift
* Dropped comment.Martin Odersky2014-10-271-13/+1
|
* Make LambdaLift diagnostics log messages instead of printing them directly.Martin Odersky2014-10-261-3/+2
|
* Replace some idents by selects in LambdaLiftMartin Odersky2014-10-261-2/+5
| | | | | If a symbol becomes a class field, references to it need to be selections, or else we get a "bad type" assertion violation in TreeChecker.
* Initialize lambda lift mapsMartin Odersky2014-10-261-0/+6
| | | | | | ... so that they do not spill over between compilation units. It would be better to wipe the maps after processing a compilation unit, but right now we do not have a hook for that. A better solution should be possible once we replace init by "prepareUnit/transformUnit".
* LambdaLift checks now explicitly for references to labels outside scope.Martin Odersky2014-10-261-3/+7
| | | | | Nested methods cannot refer to labels in theior environment. Needs a fix in TailCalls. Moved failing test to pending.
* Fixes to LambdaLiftMartin Odersky2014-10-261-8/+15
| | | | Several fixes to LambdaLift. The test suite now succeeds with LambdaLift enabled.