summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/TailCalls.scala
Commit message (Collapse)AuthorAgeFilesLines
* Fields phase expands lazy vals like modulesAdriaan Moors2016-08-291-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They remain ValDefs until then. - remove lazy accessor logic now that we have a single ValDef for lazy vals, with the underlying machinery being hidden until the fields phase leave a `@deprecated def lazyAccessor` for scala-refactoring - don't skolemize in purely synthetic getters, but *do* skolemize in lazy accessor during typers Lazy accessors have arbitrary user code, so have to skolemize. We exempt the purely synthetic accessors (`isSyntheticAccessor`) for strict vals, and lazy accessors emitted by the fields phase to avoid spurious type mismatches due to issues with existentials (That bug is tracked as https://github.com/scala/scala-dev/issues/165) When we're past typer, lazy accessors are synthetic, but before they are user-defined to make this hack less hacky, we could rework our flag usage to allow for requiring both the ACCESSOR and the SYNTHETIC bits to identify synthetic accessors and trigger the exemption. see also https://github.com/scala/scala-dev/issues/165 ok 7 - pos/existentials-harmful.scala ok 8 - pos/t2435.scala ok 9 - pos/existentials.scala previous attempt: skolemize type of val inside the private[this] val because its type is only observed from inside the accessor methods (inside the method scope its existentials are skolemized) - bean accessors have regular method types, not nullary method types - must re-infer type for param accessor some weirdness with scoping of param accessor vals and defs? - tailcalls detect lazy vals, which are defdefs after fields - can inline constant lazy val from trait - don't mix in fields etc for an overridden lazy val - need try-lift in lazy vals: the assign is not seen in uncurry because fields does the transform (see run/t2333.scala) - ensure field members end up final in bytecode - implicit class companion method: annot filter in completer - update check: previous error message was tangled up with unrelated field definitions (`var s` and `val s_scope`), now it behaves consistently whether those are val/vars or defs - analyzer plugin check update seems benign, but no way to know... - error message gen: there is no underlying symbol for a deferred var look for missing getter/setter instead - avoid retypechecking valdefs while duplicating for specialize see pos/spec-private - Scaladoc uniformly looks to field/accessor symbol - test updates to innerClassAttribute by Lukas
* Fix some typos in `spec` documents and comments.Dongjoon Hyun2016-03-151-1/+1
|
* SI-8893 Restore linear perf in TailCalls with nested matchesJason Zaugg2014-10-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compilation perfomance of the enclosed test regressed when the new pattern matcher was introduced, specifically when the tail call elimination phase was made aware of its tree shapes in cd3d34203. The code added in that commit detects an application to a tail label in order to treat recursive calls in the argument as in tail position. If the transform of that argument makes no change, it falls back to `rewriteApply`, which transforms the argument again (although this time on a non-tail-position context.) This commit avoids the second transform by introducing a flag to `rewriteApply` to mark the arguments are pre-transformed. I don't yet see how that fixes the exponential performance, as on the surface it seems like a constant factor improvement. But the numbers don't lie, and we can now compile the test case in seconds, rather than before when it was running for > 10 minutes. This test case was based on a code pattern generated by the Avro serializer macro in: https://github.com/paytronix/utils-open/tree/release/2014/ernststavrosgrouper The exponential performance in that context is visualed here: https://twitter.com/dridus/status/519544110173007872 Thanks for @rmacleod2 for minimizing the problem.
* Wider use of mapConserve and the like in TailCallsJason Zaugg2014-10-101-1/+6
| | | | | | | | | Save the Trees! When a subtransform is an identity, we must strive to return the identical tree to enable the lazy part of LazyTreeCopier. If we get this wrong in a leaf, all parents are wastefully copied.
* Avoid needlessly deep chains of ClonedTailContextJason Zaugg2014-10-101-8/+12
| | | | | | | | | | I believe ClonedTailContext was added to avoid the need to mutate the Boolean `ctx.tailPos`. All other calls are forwarded to a delegate context. This commit tries to find a delegate context with the right value of `tailPos` to reuse that, rather than creating a wrapper each time we need to flip that bit.
* Optimize tail calls to avoid findMember callsJason Zaugg2014-10-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cache the member symbols for `Boolean.{||, &&}` per-run, rather than look them up repeatedly. Based on profiling the tail calls phase in the program below, which was distilled by @rmacleod2 from the code generated by macros in https://github.com/paytronix/utils-open/tree/release/2014/ernststavrosgrouper Wall clock time went from 12s to 6.5s. ```scala object Test { def a(): Option[String] = Some("a") def main(args: Array[String]) { a() match { case Some(b1) => a() match { case Some(b2) => a() match { case Some(b3) => a() match { case Some(b4) => a() match { case Some(b5) => a() match { case Some(b6) => a() match { case Some(b7) => a() match { case Some(b8) => a() match { case Some(b9) => a() match { case Some(b10) => a() match { case Some(b11) => a() match { case Some(b12) => a() match { case Some(b13) => a() match { case Some(b14) => a() match { case Some(b15) => a() match { case Some(b16) => a() match { case Some(b17) => a() match { case Some(b18) => a() match { case Some(b19) => a() match { case Some(b20) => println("yay") case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } } } ```
* Rip out reporting indirection from CompilationUnitAdriaan Moors2014-07-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inline the forwarders from CompilationUnit, which should not affect behavior. Since all forwarders lead to global.reporter, don't first navigate to a compilation unit, only to then forward back to global.reporter. The cleanup in the previous commits revealed a ton of confusion regarding how to report an error. This was a mechanical search/replace, which has low potential for messing things up, since the list of available methods are disjoint between `reporter` and `currentRun.reporting`. The changes involving `typer.context` were done previously. Essentially, there are three ways to report: - via typer.context, so that reporting can be silenced (buffered) - via global.currentRun.reporting, which summarizes (e.g., deprecation) - via global.reporter, which is (mostly) stateless and straightforward. Ideally, these should all just go through `global.currentRun.reporting`, with the typing context changing that reporter to buffer where necessary. After the refactor, these are the ways in which we report (outside of typer): - reporter.comment - reporter.echo - reporter.error - reporter.warning - currentRun.reporting.deprecationWarning - currentRun.reporting.incompleteHandled - currentRun.reporting.incompleteInputError - currentRun.reporting.inlinerWarning - currentRun.reporting.uncheckedWarning Before: - c.cunit.error - c.enclosingUnit.deprecationWarning - context.unit.error - context.unit.warning - csymCompUnit.warning - cunit.error - cunit.warning - currentClass.cunit.warning - currentIClazz.cunit.inlinerWarning - currentRun.currentUnit.error - currentRun.reporting - currentUnit.deprecationWarning - currentUnit.error - currentUnit.warning - getContext.unit.warning - getCurrentCUnit.error - global.currentUnit.uncheckedWarning - global.currentUnit.warning - global.reporter - icls.cunit.warning - item.cunit.warning - reporter.comment - reporter.echo - reporter.error - reporter.warning - reporting.deprecationWarning - reporting.incompleteHandled - reporting.incompleteInputError - reporting.inlinerWarning - reporting.uncheckedWarning - typer.context.unit.warning - unit.deprecationWarning - unit.echo - unit.error - unit.incompleteHandled - unit.incompleteInputError - unit.uncheckedWarning - unit.warning - v1.cunit.warning All these methods ended up calling a method on `global.reporter` or on `global.currentRun.reporting` (their interfaces are disjoint). Also clean up `TypeDiagnostics`: inline nearly-single-use private methods.
* SI-8657 don't miss tailrec defs in more positionsJohannes Rudolph2014-06-251-2/+5
| | | | | | | 1) First operand of boolean expression using `&&` or `||`. Second operands of those boolean exprs were already treated specially here but handling for first operands was missing. 2) Condition of `If`. Also added a test for guards.
* SI-8324 Fix regression in override checks for sealed classesJason Zaugg2014-02-221-1/+1
| | | | | | | | | | | | adeffda25 changed `Symbol#isEffectivelyFinal` to help the optimizer by inferring finality within sealed class hierarchies. However, this change wasn't neccesarily welcome for other clients of that method. In the enclosed test case, we see that overriding checks in `RefChecks` regressed. This commit moves the enhanced version into a new method and selectively uses it in the optimizer (and the tail call optimizer).
* Optimization in TailCallsJason Zaugg2014-01-311-2/+15
| | | | | | | | | | | | | | Only store the position and reason for a failure to tailcall transform a method if we ever need to report it, ie, if the method was annotated with @tailrec. Saves object hashing and map updates, profiling suggests that this reduces the tailcalls phase from about 2% of compilation time to about 1%. Also, clear the maps eagerly after each compilation unit, rather than letting them accumulate entries for the entire run. Working with smaller maps can't hurt.
* Optimize tailcall eliminationJason Zaugg2014-01-311-1/+2
| | | | | | From the "if a tree falls" department: don't bother create a finely distinguished error messages about why the transform is inapplicable if the current context doesn't demand it.
* Don't try to eliminate tail calls in constructors.Jason Zaugg2014-01-311-1/+6
|
* Corrects behavior of finalResultType.Paul Phillips2013-09-131-1/+1
| | | | | | | | | | | | The implementation had come to depend on finalResultType accidentally doing things beyond its charter - in particular, widening types. After hunting down and fixing the call sites depending on the bugs, I was able to rewrite the method to do only what it's supposed to do. I threw in a different way of writing it entirely to suggest how some correctness might be obtained in the future. It's a lot harder for a method written like this to break.
* Limit unnecessary calls to Type#toString.Paul Phillips2013-05-081-6/+6
| | | | | | | | | | | | | Logging revealed a few thousand calls to the often expensive Type#toString emerging from tailcalls. The error message was being generated for all methods even though it was only issued in rare cases (and for the particular tailrec failure which made the call, extremely rare.) The remaining boatload of unnecessary Type#toString calls are much harder to fix due to the design of "AbsTypeError" and the fact that the compiler approaches mutability like a cat approaches a loaded gun. See SI-6149.
* Absolutized paths involving the scala package.Paul Phillips2013-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confusing, now-it-happens now-it-doesn't mysteries lurk in the darkness. When scala packages are declared like this: package scala.collection.mutable Then paths relative to scala can easily be broken via the unlucky presence of an empty (or nonempty) directory. Example: // a.scala package scala.foo class Bar { new util.Random } % scalac ./a.scala % mkdir util % scalac ./a.scala ./a.scala:4: error: type Random is not a member of package util new util.Random ^ one error found There are two ways to play defense against this: - don't use relative paths; okay sometimes, less so others - don't "opt out" of the scala package This commit mostly pursues the latter, with occasional doses of the former. I created a scratch directory containing these empty directories: actors annotation ant api asm beans cmd collection compat concurrent control convert docutil dtd duration event factory forkjoin generic hashing immutable impl include internal io logging macros man1 matching math meta model mutable nsc parallel parsing partest persistent process pull ref reflect reify remote runtime scalap scheduler script swing sys text threadpool tools transform unchecked util xml I stopped when I could compile the main src directories even with all those empties on my classpath.
* Rewrite TailCalls for performance and immutability.Paul Phillips2013-04-171-116/+111
| | | | | | | | | | | While logging symbols created after typer, I discovered that TailCalls was far and away the largest creator. It turns out this was due to a bug where thousands of labels were eagerly created during tail call analysis, even if the method weren't tail recursive and no label would ever be required. This commit shaves 10% off the total number of method symbol creations (compiling quick.lib drops from 88K to 80K.)
* Merge remote-tracking branch 'origin/2.10.x' into merge-2.10.xPaul Phillips2013-04-081-2/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/2.10.x: if starr.use.released fetch Scala ${starr.version} for STARR assume build.release when maven.version.suffix is set make quick.done depend on quick.bin again SI-7321 Memory leak in specialize on multiple compiler runs. Take the N^2 out of the compiler's TreeSet. SI-6900 Fix tailrec for dependent method types Simplify interplay between Uncurry Info- and Tree-Transformers Refactor existential related code out of types. Add a cautionary comment to TreeSymSubstitutor. SI-6715 Shouldn't return "" from TermNames.originalName Backport #2289's TermNames.unexpandedName as TermNames.originalName SI-7147 Diagnostic for unexplained assertion in presentation compiler. SI-6793 Don't use super param accessors if inaccessible. Correct sorting example for Ordering in scaladoc Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf build.xml src/compiler/scala/tools/nsc/transform/UnCurry.scala src/reflect/scala/reflect/internal/StdNames.scala
| * SI-6900 Fix tailrec for dependent method typesJason Zaugg2013-04-021-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Uncurry's info transformer could generate a MethodType with cloned parameter symbols. This type was used for the LabelDef generated in the TailCalls phase. But, the RHS of the method still contains types that refer to the original parmameter symbol. Spurious type errors ensued. I've spent a good chunk of time pursuing a more principled fix, in which we keep the symbols in the tree in sync with those in the MethodType. You can relive the procession of false dawns: https://github.com/scala/scala/pull/2248 Ultimately that scheme was derailed by a mismatch between the type parameter `T` and the skolem `T&` in the example below. trait Endo[A] { def apply(a: => A): A } class Test { def foo[T] = new Endo[(T, Unit)] { def apply(v1: => (T, Unit)) = v1 // no bridge created } } Interestingly, by removing the caching in SingleType, I got past that problem. But I didn't characterize it further. This commit sets asides the noble goal of operating in the world of types, and sledgehammers past the crash by casting the arguments to and the result of the label jump generated in TailCalls.
* | Doc -> C-style comments for local symbols to avoid "discardingEugene Vigdorchik2013-03-211-11/+9
| | | | | | | | | | unmoored doc comment" warning when building distribution for scala itself.
* | Name boolean arguments in src/compiler.Jason Zaugg2013-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | What would you prefer? adaptToMemberWithArgs(tree, qual, name, mode, false, false) Or: adaptToMemberWithArgs(tree, qual, name, mode, reportAmbiguous = false, saveErrors = false)
* | Banish needless semicolons.Jason Zaugg2013-02-241-1/+1
| |
* | Merge branch 'merge-wip-into-2.10.x' into merge-2.10-into-masterPaul Phillips2012-12-111-1/+9
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * merge-wip-into-2.10.x: (44 commits) Cleanups of reifyBoundTerm and reifyBoundType SI-5841 reification of renamed imports Share the empty LinkedList between first0/last0. SI-4922 Show default in Scaladoc for generic methods. SI-6614 Test case for fixed ArrayStack misconduct. SI-6690 Release reference to last dequeued element. SI-5789 Use the ReplTest framework in the test SI-5789 Checks in the right version of the test SI-5789 Removes assertion about implclass flag in Mixin.scala SI-6766 Makes the -Pcontinuations:enable flag a project specific preference more ListOfNil => Nil DummyTree => CannotHaveAttrs evicts assert(false) from the compiler introduces global.pendingSuperCall refactors handling of parent types unifies approaches to call analysis in TreeInfo TypeApply + Select and their type-level twins SI-6696 removes "helper" tree factory methods SI-6766 Create a continuations project in eclipse Now the test suite runs MIMA for compatibility testing. ... Conflicts: src/compiler/scala/reflect/reify/codegen/GenUtils.scala src/compiler/scala/tools/nsc/ast/Trees.scala src/compiler/scala/tools/nsc/backend/icode/GenICode.scala src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/eclipse/scala-compiler/.classpath src/eclipse/scalap/.classpath src/reflect/scala/reflect/internal/StdNames.scala src/reflect/scala/reflect/internal/TreeInfo.scala
| * SI-1672 Catches are in tail position without finally.Jason Zaugg2012-12-051-1/+9
| | | | | | | | So we can eliminate tail calls within.
* | Expunged the .net backend.Paul Phillips2012-12-051-2/+1
| | | | | | | | | | | | | | | | It lives on in a branch born from this commit's parent. It's abrupt; no attempt is made to offer a "smooth transition" for the serious msil userbase, population zero. If anyone feels very strongly that such a transition is necessary, I will be happy to talk you into feeling differently.
* | Remove code from compiler central.Paul Phillips2012-11-201-1/+0
| | | | | | | | | | All those old-timey methods whose melodies have become unfashionable.
* | Removing ancient comments and pointless comments.Paul Phillips2012-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | Translating <code></code> into backticks. Removed the "@param tree ..." blocks which have been taunting me for half a decade now. Removed commented-out blocks of code which had been sitting there for two years or more.
* | Revert "Commenting out unused members."Paul Phillips2012-11-191-1/+1
| | | | | | | | This reverts commit 951fc3a486.
* | Commenting out unused members.Paul Phillips2012-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I want to get this commit into the history because the tests pass here, which demonstrates that every commented out method is not only unnecessary internally but has zero test coverage. Since I know (based on the occasional source code comment, or more often based on knowing something about other source bases) that some of these can't be removed without breaking other things, I want to at least record a snapshot of the identities of all these unused and untested methods. This commit will be reverted; then there will be another commit which removes the subset of these methods which I believe to be removable. The remainder are in great need of tests which exercise the interfaces upon which other repositories depend.
* | Removed unused imports.Paul Phillips2012-11-061-1/+1
|/ | | | | | | | | A dizzying number of unused imports, limited to files in src/compiler. I especially like that the unused import option (not quite ready for checkin itself) finds places where feature implicits have been imported which are no longer necessary, e.g. this commit includes half a dozen removals of "import scala.language.implicitConversions".
* Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
|
* SI-6526 Tail call elimination should descend deeper.Jason Zaugg2012-10-171-3/+5
| | | | | It wasn't traversing into Select nodes nor into the receiver of a tail call.
* More relative path elimination.Paul Phillips2012-09-151-2/+2
| | | | | | | | | | | | | | | | Some names I missed in 55b609458fd . How one might know when one is done: mkdir scratch && cd scratch mkdir annotation beans collection compat concurrent io \ math parallel ref reflect runtime scala sys testing \ text tools util xml scalac $(find ../src/library -name '*.scala') Until recently that would fail with about a billion errors. When it compiles, that's when you're done. And that's where this commit takes us, for src/library at least.
* update and normalize copyright noticeAdriaan Moors2012-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are the regexp replacements performed: Sxcala -> Scala Copyright (\d*) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*)(,?) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*) Scala Solutions and LAMP/EPFL -> Copyright $1-2012 Scala Solutions and LAMP/EPFL \(C\) (\d*)-(\d*) LAMP/EPFL -> (C) $1-2012 LAMP/EPFL Copyright \(c\) (\d*)-(\d*)(.*?)EPFL -> Copyright (c) $1-2012$3EPFL The last one was needed for two HTML-ified copyright notices. Here's the summarized diff: Created using ``` git diff -w | grep ^- | sort | uniq | mate git diff -w | grep ^+ | sort | uniq | mate ``` ``` - <div id="footer">Scala programming documentation. Copyright (c) 2003-2011 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> - copyright.string=Copyright 2002-2011, LAMP/EPFL - <meta name="Copyright" content="(C) 2002-2011 LAMP/EPFL"/> - * Copyright 2002-2011 LAMP/EPFL - * Copyright 2004-2011 LAMP/EPFL - * Copyright 2005 LAMP/EPFL - * Copyright 2005-2011 LAMP/EPFL - * Copyright 2006-2011 LAMP/EPFL - * Copyright 2007 LAMP/EPFL - * Copyright 2007-2011 LAMP/EPFL - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL - * Copyright 2009-2011 Scxala Solutions and LAMP/EPFL - * Copyright 2010-2011 LAMP/EPFL - * Copyright 2012 LAMP/EPFL -# Copyright 2002-2011, LAMP/EPFL -* Copyright 2005-2011 LAMP/EPFL -/* NSC -- new Scala compiler -- Copyright 2007-2011 LAMP/EPFL */ -rem # Copyright 2002-2011, LAMP/EPFL ``` ``` + <div id="footer">Scala programming documentation. Copyright (c) 2003-2012 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> + copyright.string=Copyright 2002-2012 LAMP/EPFL + <meta name="Copyright" content="(C) 2002-2012 LAMP/EPFL"/> + * Copyright 2002-2012 LAMP/EPFL + * Copyright 2004-2012 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL + * Copyright 2010-2012 LAMP/EPFL + * Copyright 2011-2012 LAMP/EPFL +# Copyright 2002-2012 LAMP/EPFL +* Copyright 2005-2012 LAMP/EPFL +/* NSC -- new Scala compiler -- Copyright 2007-2012 LAMP/EPFL */ +rem # Copyright 2002-2012 LAMP/EPFL ```
* move synthetic case symbol detection to treeInfoAdriaan Moors2012-07-241-1/+1
| | | | encapsulate creating synthetic case labels while we're at it
* SI-6089 pt2: _ is tailpos in `_ || _` and `_ && _`Adriaan Moors2012-07-211-0/+3
| | | | | pull #939 made tail position detection for matches more strict to fix SI-6089, but became too strict: need to include the tail positions `_` in `_ || _` and `_ && _`.
* SI-6089 better tail position analysis for matchesAdriaan Moors2012-07-181-5/+11
| | | | | | we mistakenly went into apply nodes to look for matchEnd-labeldefs in tail positions -- only apply nodes that jump to labels in tailpos should be traversed (this arises for nested matches)
* Debugging output tweaks.Paul Phillips2012-05-141-2/+5
| | | | And undeprecated Positional.
* [vpm] avoid verifyerror: leave jump to tail-pos labelAdriaan Moors2012-03-231-2/+7
| | | | | the following commit deals with the fall-out in basicblocks (double closing of blocks in ignore mode)
* [vpm] typeMatchAnonFun improvementsAdriaan Moors2012-03-231-1/+1
| | | | | | | | | | need to set up symbols with approximated info for the method and its owner before typing the method's body; when the body has been typed, we know what its result type will be, so update info of class and method to reflect that better detection of synthesized matches: annotate selector rather than relying on symbol info encapsulate CASE | SYNTHETIC flags (setting and querying)
* [vpm] tailcalls support for jumpy vpmAdriaan Moors2012-03-201-12/+114
|
* Fix for tailcall transform/recognition bugs.Paul Phillips2012-03-111-2/+19
| | | | Closes SI-3275, SI-5455.
* Whitespace commit.Paul Phillips2012-02-291-1/+1
| | | | | | | Removed all the trailing whitespace to make eugene happier. Will try to keep it that way by protecting at the merge level. Left the tabs in place because they can't be uniformly changed to spaces, some are 2, some are 4, some are 8, whee.
* Reworking synchronized patch.Paul Phillips2012-02-281-25/+2
| | | | Eliminated annotation and custom phase. Kept SYNCHRONIZED flag.
* Merge remote-tracking branch 'szabolcsberecz/SI-64' into SI-64-freshPaul Phillips2012-02-281-2/+25
|\
| * replace methods containing a synchronized body with synchronized methodsSzabolcs Berecz2012-02-161-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following: def f = synchronized { ... } will be rewritten to: <synchronized> def f = ... which is then emitted to the classfile with the synchronized flag set. Inlining of such transformed methods are disabled for now This transformation is not done on methods defined in a trait.
* | Some logging cleanup.Paul Phillips2012-02-261-1/+1
| | | | | | | | | | Quieting things down. Fixed some things revealed by quieter logs, like forwarders being generated for superaccessors.
* | One more to derive trees.Paul Phillips2012-02-231-5/+1
| | | | | | | | | | | | ClassDefs, CaseDefs, and LabelDefs. Dotting eyes, crossing tees. Point of diminishing returns is reached, declare victory and withdraw.
* | Methods to derive new DefDefs.Paul Phillips2012-02-231-7/+6
|/ | | | | | | | | | | I guess I'd seen DefDef(mods, name, tparams, vparamss, tpt, rhs) one too many times and went a little crazy. What do you prefer: - val DefDef(mods, name, tparams, vparamss, tpt, rhs) = tree1 - treeCopy.DefDef(tree1, mods, name, tparams, vparamss, tpt, transform(rhs)) + deriveDefDef(tree1)(transform) Me too.
* Symbol creation followup.Paul Phillips2012-01-161-1/+1
| | | | | | Changed most symbol creations to be consistent with all the others. Opportunistically streamlined various call sites. Moved some phase-specific methods out of Symbol to somewhere more appropriate (like that phase.)
* Optimizing TypeRef, starting with Symbols.Paul Phillips2012-01-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are too many potential optimizations unavailable to us due to the lack of bright lines among different kinds of symbols. For instance the difference between a TypeSymbol which represents a type alias and one which represents an abstract type is only whether the DEFERRED flag is set. This creates issues. 1) There are many (many) places where tests are performed on every symbol which could be done more efficiently and (especially) more verifiably correctly with polymorphism. 2) TypeRefs based on those symbols are also checking that flag constantly, in perpetuity. A symbol created as an alias is never (to the best of my knowledge) going to intentionally morph into one representing an abstract type, nor vice versa. 3) One has no guarantees, because anyone can set or reset the DEFERRED flag at any time. So tackling more than one problem at once herein: 1) I created canonical symbol creation points which take the flags as an argument, so that there can be a difference between initializing a symbol's flags and setting/resetting them at arbitrary times. 2) I structured all the symbol creators to take arguments in the same order, which is: def newXXX(name: Name, ..., pos: Position = NoPosition, flags: Long = 0L) (Where "..." is for those symbols which require something beyond the name to create, such as a TypeSkolem's origin.) The name is first because it's the only always required argument. I left but deprecated the variations which take (pos, name). 3) I created subclasses of TypeRef based on the information which should be stable from creation time onward: - args or no args? - abstract type, type alias, or class? 2x3 == 6 and that's how many subclasses of TypeRef there are now. So now, for example, every TypeRef doesn't have to carry null symInfoCache and thisInfoCache fields for the benefit of the minority which use them. I still intend to realize the gain possible once we can evade the fields for pre and args without losing pattern matcher efficiency.