summaryrefslogtreecommitdiff
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* preparations: always explicitly provide type tagsEugene Burmako2012-06-084-10/+38
| | | | | In our codebase we now explicitly provide type tags even if they can be materialized. This is necessary to ease the upcoming reflection refactoring (or refactorings :)).
* macros: refactoring of fast track infrastructureEugene Burmako2012-06-088-136/+281
| | | | | | | | | As a result, hardwired macros don't need implementation stubs. This is very important, because in a few commits scala.reflect.makro.Context will move out from scala-library.jar. Also adding fast track entries doesn't require jumping through hoops with PDTs. It's as simple as defining PartialFunction[Tree, Any].
* macros: now use Java reflectionEugene Burmako2012-06-081-81/+71
| | | | | | | | | Due to some voodoo magic creating a new instance of a compiler cake, immediately degrades performance of the compiler. Out guess is that it makes HotSpot treat calls to cake methods as polymorphic. However we didn't do any performance testing, it just works, and that's enough. Enough for now.
* macros: -Xmacros is now retiredEugene Burmako2012-06-082-3/+1
|
* improves traces and error messagesEugene Burmako2012-06-087-40/+51
|
* REPL bells and whistles: -Dscala.repl.maxprintstring=<Integer>Eugene Burmako2012-06-083-2/+5
| | | | | Makes `maxPrintString` configurable and fixes its treatment at zero. Quite useful for debugging elaborate classloaders with long classpaths.
* REPL bells and whistles: -Dscala.repl.vids=<Boolean>Eugene Burmako2012-06-082-1/+7
| | | | | | Displays identity hashcodes next to `res` values printed by REPL. This proved quite useful in detecting reflection artifacts that look the same, but are, in fact, different.
* REPL bells and whistles: -Dscala.repl.autoruncode=<JFile>Eugene Burmako2012-06-082-3/+11
| | | | | | Useful for the upcoming reflection refactoring. Previously it was more or less okay to type "import scala.reflect.mirror._", but soon we'll have multiple universes and mirrors.
* REPL no longer hangs after initialization crashesEugene Burmako2012-06-083-8/+27
|
* typers: simplifies original calculation in typedAnnotatedEugene Burmako2012-06-081-4/+3
|
* typers: dubious line in adaptTypeEugene Burmako2012-06-081-0/+4
|
* typers: fixes error handling in checkStableEugene Burmako2012-06-081-1/+3
|
* Merge pull request #654 from magarciaEPFL/ticket-SI-4804Adriaan Moors2012-06-081-21/+13
|\ | | | | GenASM-based fix for SI-4804. Fix of the same for GenJVM pending.
| * GenASM-based fix for SI-4804. Fix of the same for GenJVM pending.Miguel Garcia2012-06-011-21/+13
| |
* | counterpart in GenASM to 241c7606d0bf5f3209b9d549fb75Miguel Garcia2012-06-071-1/+5
| |
* | Generate abstract methods in scala.Byte and friends.Paul Phillips2012-06-063-19/+22
| | | | | | | | | | Rather than stub implementations. This saves over 50K of bytecode. I also added the necessary imports to silence the feature warnings.
* | Merge pull request #665 from retronym/ticket/5213Adriaan Moors2012-06-041-11/+10
|\ \ | | | | | | SI-5313 Revert to two traversals in substThisAndSym.
| * | SI-5313 Revert to two traversals in substThisAndSym.Jason Zaugg2012-06-031-11/+10
| | | | | | | | | | | | Partially reverts 334872e.
* | | Merge pull request #661 from retronym/ticket/5683Adriaan Moors2012-06-032-29/+38
|\ \ \ | | | | | | | | SI-5683 Fail gracefully when transposing a ragged type arg matrix.
| * | | SI-5683 Fail gracefully when transposing a ragged type arg matrix.Jason Zaugg2012-06-032-29/+38
| |/ / | | | | | | | | | | | | | | | | | | | | | The code used to do this, until `transpose` starting throwing IAE rather than AIOOBE. Symptomatic treatment only: The reported crasher now infers ill-kinded type args and reports an error.
* | | Revert "#653 -- no lub for statement exprs' types"Adriaan Moors2012-06-032-21/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | I should not have merged this pull request yet. I didn't notice we didn't have a full successful run of the test suite. It looks like it breaks test/files/continuations-neg/lazy.scala and given the pending amount of changes, I prefer to have a stable master. This reverts commit 037d3dcbc5896864aec0f9121eeda23fcc4cd610.
* | | Merge pull request #653 from dragos/issue/skip-lub-in-blocksAdriaan Moors2012-06-032-6/+21
|\ \ \ | | | | | | | | | | | | Don't compute least upper bounds for if-like exprs in statement position
| * | | Don't compute least upper bounds for expressions in statement positions ↵Iulian Dragos2012-06-032-6/+21
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | inside blocks. This may save huge amount of time (Fixes SI-5862) for complicated lubs. I had to remove the a check in adapt for the part that transforms <expr> into { <expr>; () } when the expected type is Unit. The reason is in the code. As a side effect, we get more warnings for pure expressions in statement positions (see the change in the test file).
* | | Merge pull request #650 from adriaanm/topic-virtpatmatAdriaan Moors2012-06-035-364/+841
|\ \ \ | | | | | | | | | | | | | | | | Unreachability analysis for pattern matches Thanks for reviewing, @retronym!
| * | | incorporate @retronym's review commentsAdriaan Moors2012-06-031-69/+39
| | | |
| * | | allow disabling patmat analyses: -Xno-patmat-analysisAdriaan Moors2012-06-014-8/+13
| | | |
| * | | fixing bug found by unreachabilityAdriaan Moors2012-06-011-3/+2
| | | |
| * | | Unreachability analysis for pattern matchesAdriaan Moors2012-06-012-248/+732
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Analyze matches for unreachable cases. A case is unreachable if it implies its preceding cases. Call `C` the formula that is satisfiable if the considered case matches. Call `P` the formula that is satisfiable if the cases preceding it match. The case is reachable if there is a model for `-P /\ C`. Thus, the case is unreachable if there is no model for `-(-P /\ C)`, or, equivalently, `P \/ -C`, or `C => P`. Unreachability needs a more precise model for type and value tests than exhaustivity. Before, `{case _: Int => case 1 =>}` would be modeled as `X = Int \/ X = 1.type`, and thus, the second case would be reachable if we can satisfy `X != Int /\ X = 1.type`. Of course, the case isn't reachable, yet the formula is satisfiable, so we must augment our model to take into account that `X = 1.type => X = Int`. This is done by `removeVarEq`, which models the following axioms about equality. It does so to retain the meaning of equality after replacing `V = C` (variable = constant) by a literal (fresh symbol). For each variable: 1. a sealed type test must result in exactly one of its partitions being chosen (the core of exhaustivity) 2. when a type test is true, tests of super types must also be true, and unrelated type tests must be false For example, `V : X ::= A | B | C`, and `A => B` (since `A extends B`). Coverage (1) is formulated as: `A \/ B \/ C`, and the implications of (2) are simply `V=A => V=B /\ V=X`, `V=B => V=X`, `V=C => V=X`. Exclusion for unrelated types typically results from matches such as `{case SomeConst => case OtherConst => }`. Here, `V=SomeConst.type => !V=OtherConst.type`. This is a conservative approximation. If these constants happen to be the same value dynamically (but the types don't tell us this), the last case is actually unreachable. Of course we must err on the safe side. We simplify the equality axioms as follows (in principle this could be done by the solver, but it's easy to do before solving). If we've already excluded a pair of assignments of constants to a certain variable at some point, say `(-A \/ -B)`, then don't exclude the symmetric one `(-B \/ -A)`. (Nor the positive implications `-B \/ A`, or `-A \/ B`, which would entail the equality axioms falsifying the whole formula.) TODO: We should also model dependencies between variables: if `V1` corresponds to `x: List[_]` and `V2` is `x.hd`, `V2` cannot be assigned at all when `V1 = null` or `V1 = Nil`. Right now this is implemented hackily by pruning counter-examples in exhaustivity. Unreachability would also benefit from a more faithful representation. I had to refactor some of the framework, but most of it is shared with exhaustivity. We must allow approximating tree makers twice, sharing variables, but using different approximations for values not statically known. When considering reachability of a case, we must assume, for example, that its unknown guard succeeds (otherwise it would wrongly be considered unreachable), whereas unknown guards in the preceding cases must be considered to fail (otherwise we could never get to those case, and again, it would falsely be considered unreachable). Since this analysis is relatively expensive, you may opt-out using `-Xno-patmat-analysis` (or annotating the selector with @unchecked). We hope to improve the performance in the near future. -Ystatistics has also been extended to provide some numbers on time spent in the equality-rewrite, solving and analyzing.
| * | | support for repeated approximation of treemakersAdriaan Moors2012-06-011-38/+47
| | | |
| * | | patmatdebugAdriaan Moors2012-06-011-60/+57
| | | |
| * | | construct typed trees in TypeTestTMAdriaan Moors2012-06-011-3/+6
| | | |
| * | | all treemakers need positions for unreachable errorAdriaan Moors2012-06-011-6/+16
| |/ /
* | | Merge pull request #648 from pvlugter/issue/5792Adriaan Moors2012-06-031-13/+8
|\ \ \ | | | | | | | | More robust findScalaHome in bash scripts
| * | | More robust findScalaHome in bash scripts. See SI-5792Peter Vlugter2012-06-011-13/+8
| |/ / | | | | | | | | | | | | Allows multiple absolute or relative symlinks by jumping through the directories while following the links.
* | | Merge pull request #657 from paulp/parser-booleansAdriaan Moors2012-06-031-56/+57
|\ \ \ | | | | | | | | Made parser less hostile to inspection.
| * | | Made parser less hostile to inspection.Paul Phillips2012-06-021-56/+57
| | |/ | |/| | | | | | | By annotating all the boolean method arguments.
* / | Closes t5399. Review by adriaanmMartin Odersky2012-06-021-1/+1
|/ /
* | Merge pull request #649 from magarciaEPFL/icodeAfterAnyOptimizPhaseJosh Suereth2012-06-011-11/+19
|\ \ | | | | | | allows printing .icode files after any optimiz phase
| * | allows printing .icode files after any optimiz phaseMiguel Garcia2012-06-011-11/+19
| |/
* / skipping unnecessary work in GenASM when emitting 1.5 classfilesMiguel Garcia2012-05-311-5/+6
|/
* Partial redesign of incremental compiler invalidation.Martin Odersky2012-05-306-81/+158
| | | | | | | | | | We now do the right thing when packages are either newly created or deleted. Previously there was a problem when a new package was created inside a system package (and, unofrtunately, root is a system package). That's fixed now. We also approximate more tightly now when packages are newly created (iei the newly created symbol gets rescanned, instead of its owner). Incremental class invalidation: dealing with empty package. The compiler can now also invalidate the empty package. Previously, no invalidation was done because empty was identified with root, which is considered a system package. (1) Fixed NPE when creating a new toplevel package in invalidation. (2) generalized interface to deal with multiple entries at a time.
* Merge pull request #640 from odersky/topic/inklingAdriaan Moors2012-05-287-6/+127
|\ | | | | Implemented functionality to invalidate classpath entries
| * Implemented functionality to invalidate classpath entries, to enable ↵Martin Odersky2012-05-287-6/+127
| | | | | | | | incremental compiles.
* | Merge pull request #636 from retronym/ticket/5845Adriaan Moors2012-05-281-1/+1
|\ \ | | | | | | SI-5845 Advances the example from a crasher to an inference failure.
| * | SI-5845 Advances the example from a crasher to an inference failure.Jason Zaugg2012-05-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The inference failure itself seems like an instance of of SI-3346. But dependent method types (which triggered the crash), can be employed to avoid inferring the type constructor CC. class Num[T] { def mkOps = new Ops class Ops { def +++(rhs: T) = () } } class A { implicit def infixOps[T](lhs: T)(implicit num: Num[T]): num.Ops = num.mkOps implicit val n1: Num[Int] = new Num[Int] { } 5 +++ 5 }
* | | Merge pull request #635 from adriaanm/topic/virtpatmatAdriaan Moors2012-05-281-1/+5
|\ \ \ | | | | | | | | fixes for exhaustivity
| * | | handle approximating alternative of empty patternAdriaan Moors2012-05-281-1/+4
| | | |
| * | | don't check exhaustivity involving user-defined unapplySeqAdriaan Moors2012-05-281-0/+1
| |/ /
* | | Merge pull request #633 from retronym/topic/value-class-bridgeAdriaan Moors2012-05-271-2/+13
|\ \ \ | |/ / |/| | Fix a NSDNHAO in extension methods.
| * | Fix a NSDNHAO in extension methods.Jason Zaugg2012-05-271-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A bridge method, created when we override a method from a superclass and refine the return type, was appearing as an overloaded alternative. (`erasure` doesn't create new scopes, so the bridges it builds are visible at earlier phases.) The problem was masked when compiling with specialization, which *does* create a new scope, shielding the code in question from the artefacts of erasure. To fix the problem, we filter out bridge methods from the overloaded alternatives returned by `.decl`, as would happen internally in `.member`.