summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | Optimization/robustness in the backend.Paul Phillips2012-01-0318-198/+279
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying to help icode/jvm get through their business a bit faster, and also make things more robust. Less null, more distinguished objects. More encapsulation, fewer public vars. Helping updateSuccessorList() to avoid assembling a list of successors on every call only to find most of the time that it's the same list it already had (e.g. compiling quick.lib it says "59076 calls, 690 requiring allocation" rather than 59076 calls, 59076 requiring allocation.)
| | * | updated gitignore.SAMPLE, moved removed . from .project.SAMPLE to be in line ↵Lukas Rytz2012-01-033-13/+15
| | | | | | | | | | | | | | | | with the other files.
| | * | Added option -Xlog-reflective-calls.Paul Phillips2012-01-023-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A message is emitted when a reflective call is generated. We can now be eager consumers of this since we purged all the reflective calls at some point -- but without a backstop, they have been slipping back in.
| | * | Added -Xlog-implicit-conversions.Paul Phillips2012-01-0214-25/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New command line option prints a message whenever the compiler inserts an implicit conversion. Implicit parameters are not under consideration here, since the primary motivation is to make it easy to inspect your code for unintentional conversions, since they can have dramatic performance implications. class A { def f(xs: Array[Byte]) = xs.size def g(xs: Array[Byte]) = xs.length } % scalac -Xlog-implicit-conversions logImplicits.scala logImplicits.scala:2: applied implicit conversion from xs.type to ?{val size: ?} = implicit def byteArrayOps(xs: Array[Byte]): scala.collection.mutable.ArrayOps[Byte] def f(xs: Array[Byte]) = xs.size ^
| | * | Changed boxing of free mutable variables to be flexible wrt when liftcode ↵Martin Odersky2012-01-028-122/+105
| | | | | | | | | | | | | | | | | | | | | | | | takes place. A major redesign that unifies the various different approaches to boxing of free variables. Free variables are marked with CAPTURED and eliminated by LambdaLift. I also added some hooks in MacroContext that a reifier needs to use.
| | * | Hardening of adaptoNewRun to survive issues in presentation compiler.Martin Odersky2012-01-021-4/+8
| | | | | | | | | | | | | | | | Previously, adaptToNewRun crashed when an object declaration got replaced by a value with the same name, because the module class no longer existed. This caused crashes in the presentation compiler when class files disappeared because of a clean build. The new behavior avoids assertion errors.
| | * | More uniformity for the parser.Paul Phillips2011-12-312-4/+17
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixing consecutive type application made it more obvious there was another missing bit of the parser, type application following function application. This should (and now does) work: object F { def apply[T] = List[T]() } def g() = F g()[String]
| | * More performance work.Paul Phillips2011-12-3018-480/+705
| | | | | | | | | | | | | | | | | | | | | Custom versions of collections which methods which operate on 2 or 3 collections. Eliminated most users of zip/zipped. Cleaned up the kinds checking code somewhat. Reduced the number of silent typechecks being performed at named argument sites.
| | * Low-level optimization.Paul Phillips2011-12-305-20/+23
| | | | | | | | | | | | Eliminated a bunch of unnecessary array expense.
| | * Created VariantTypeMap.Paul Phillips2011-12-303-139/+197
| | | | | | | | | | | | | | | | | | | | | Noticed most TypeMaps ignore variance but perform all the variance bookkeeping regardless. Made it so only variant TypeMaps pay that cost. Also lent some organization to the one place making real use of VariantTypeMap, existentialAbstraction.
| | * Creator for existentials which flattens.Paul Phillips2011-12-307-19/+22
| | | | | | | | | | | | | | | | | | Currently it is possible to end up with nested existentials, because existentialAbstraction only looks one level deeper. This works harder to flatten them.
| | * Better hunting for tools.jar.Paul Phillips2011-12-304-27/+51
| | | | | | | | | | | | | | | Attempting to make the repl find it based on fewer clues so all can enjoy the javap goodness.
| | * Optimization in refchecks.Paul Phillips2011-12-302-36/+51
| | | | | | | | | | | | | | | | | | | | | addVarargBridges is extremely expensive to cover such a corner case (scala classes inheriting and overriding java varargs methods.) Added a fast path excluding every class which doesn't have a java varargs method somewhere amidst its ancestors.
| | * Optimization in backend.Paul Phillips2011-12-301-4/+2
| | | | | | | | | | | | | | | | | | | | | Eliminated one source of the thousands of copies of the same Strings we had/have (strongly reachable) on the heap. It is another good example of how constructor parameters unintentionally become fields and how that in turn brings the pain.
| | * Optimization in Flags.Paul Phillips2011-12-301-5/+26
| | | | | | | | | | | | Added fast and less slow paths for oddly expensive flagsToString.
| | * Optimization in method synthesis.Paul Phillips2011-12-303-5/+9
| | | | | | | | | | | | | | | Discovered expensive flag operations being performed on the wrong side of the only-when-logging by-name argument.
| | * Merge remote-tracking branch 'jsuereth/wip-lockable-projects'Paul Phillips2011-12-301-1/+6
| | |\
| | | * All projects can be locked now.Josh Suereth2011-12-291-1/+6
| | | | | | | | | | | | | | | | | | | | * Added 'lock' key to write 'compile.lock' file to target dir. * Added 'unlock' key to delete 'compile.lock' file to target dir.
| | * | Optimizations in typeref creation.Paul Phillips2011-12-302-3/+3
| | |/ | | | | | | | | | | | | | | | A couple locations where more work than necessary is performed when created a typeref. (Not to mention creating bogus typerefs applying arguments to implementation classes.)
| | * Merge branch 'develop'Paul Phillips2011-12-281-2/+84
| | |\
| | | * Merge remote-tracking branch 'kepler/topic/antbuildlocker' into developPaul Phillips2011-12-281-2/+84
| | | |\
| | | | * buildlocker for antEugene Burmako2011-12-281-2/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new command is more or less equivalent to regular "build". It is capable of: 1) automatically unlocking locker 2) not building stuff that hasn't changed 3) packing locker classes into JARs at build\palo\lib 4) populating bin directory at build\palo\bin All in all, buildlocker lets one work with locker as if it were quick. Except that it is rebuilds quicker than quick by a factor of 2x. Fastlocker does exactly the same, but without packing stuff into JARs. This makes things even faster. Of course, both targets don't build anything except library and compiler, so they aren't appropriate for all workflows, but, it was useful for me! P.S. Good news: you can use partest with locker, but it's not obvious. First, you need to transplant missing stuff that is necessary to run partest. I did it by maintaining a parallel clone of my repository that is used only to produce partest dependencies (partest itself, scalap and library/actors). Second, partest has to be switched into "testClasses" mode, which is tricky. I honestly tried to find out how to do this, but then fell back to a hack: https://gist.github.com/1525721. Finally, you need a special launcher (I haven't made friends with std script). The launcher is quite simple and looks as follows: https://gist.github.com/1525720
| | * | | Fixing slightly damaged test.Paul Phillips2011-12-281-1/+1
| | |/ /
| | * | repl power mode improvements.Paul Phillips2011-12-288-98/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented great suggestion from moors. More imports in power mode, including the contents of treedsl. Also, another swing at overcoming the mismatched global singletons problem, this time taking advantage of dependent method types. Amazingly, it seems to work. Continuing in the quest to create a useful compiler hacking environment, there is now an implicit from Symbol which allows you to pretend a Symbol takes type parameters, and the result is the applied type based on the manifests of the type arguments and the type constructor of the symbol. Examples: // magic with manifests scala> val tp = ArrayClass[scala.util.Random] tp: $r.global.Type = Array[scala.util.Random] // evidence scala> tp.memberType(Array_apply) res0: $r.global.Type = (i: Int)scala.util.Random // treedsl scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) m: $r.treedsl.global.Match = 10 match { case 5 => false case _ => true } // typed is in scope scala> typed(m).tpe res1: $r.treedsl.global.Type = Boolean
| | * | Tone down insensible-equality warning.Paul Phillips2011-12-274-8/+12
| | | | | | | | | | | | | | | | Closes SI-5175.
| | * | Merge branch 'type-currying-mini' of /scala/trunk into developPaul Phillips2011-12-273-3/+76
| | |\ \
| | | * | Consecutive type application.Paul Phillips2011-12-273-3/+76
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parser through I think a quirk of history would not allow back to back type applications, like expr[T1, T2][T3, T4] Now it does, meaning the only thing it can: val n0 = Partial[immutable.HashMap][String][Int] ++ Seq(("a", 1)) val n1 = Partial.apply[immutable.HashMap].apply[String].apply[Int] ++ Seq(("a", 1)) assert(n0 == n1)
| | | |
| | | \
| | | \
| | | \
| | | \
| | | \
| | | \
| | | \
| | *-------. \ Merge remote-tracking branches 'ijuma/issue/5341', ↵Paul Phillips2011-12-2726-1/+458
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 'kepler/topic/reifyclosuretests', 'kepler/topic/antscalacheck', 'szabolcsberecz/SI-5104', 'kepler/ticket/5334' and 'kepler/topic/miscfixes' into develop
| | | | | | | * | Documented emptyValDef fieldEugene Burmako2011-12-231-0/+5
| | | | | | | | |
| | | | | | * | | Tests for recently submitted SI-5334Eugene Burmako2011-12-232-0/+30
| | | | | | |/ /
| | | | | * / / fixes #5104 and related NaN ordering inconsistenciesSzabolcs Berecz2011-12-252-0/+170
| | | | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug was caused by the inconsistency between j.l.Math.min() and j.l.Double.compareTo() wrt NaN (j.l.Math.min() considers NaN to be less than any other value while j.l.Double.compareTo() says it's greater...) The fix changes Ordering.{FloatOrdering,DoubleOrdering) to base it's results on primitive comparisons and math.{min,max} instead of j.l.{Float,Double}.compareTo()
| | | | * | | scalacheck now also has pre-scalacheck and its personal timerEugene Burmako2011-12-261-1/+10
| | | | | | |
| | | * | | | A handful of tests for closures under reificationEugene Burmako2011-12-2620-0/+243
| | | | |_|/ | | | |/| |
| | * / | | Fix SI-5341: PhaseAssembly.removeDanglingNodes removes elements from mutable.MapIsmael Juma2011-12-271-1/+1
| | |/ / / | | | | | | | | | | | | | | | during iteration.
| | * | | Fixed regression in lub calculation.Paul Phillips2011-12-262-9/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changing NullaryMethodType to be a SimpleTypeProxy because nearly all its operations forward to its result type was it seems not such a good idea, because it also meant that calling .underlying returned the result type rather than the method type. The way this materialized was in subtype checks of refinement types. A lub is calculated for two nullary method types in the course of calculating a refinement, and then the input types are checked against the calculated lub. However in the lub refinement, the nullary method type has become a bare typeref, and so the subtype check failed. Closes SI-5317. This does give me confidence that all the malformed lubs one sees logged under -Ydebug (and there are still many, especially with type constructors) are alerting us to real bugs elsewhere in Types.
| | * | | Merge pull request #77 from scalamacros/topic/antlocalePaul Phillips2011-12-251-1/+1
| | |\ \ \ | | | |/ / | | |/| | Addresses a bug in SimpleDateFormatter
| | | * | Addresses a bug in SimpleDateFormatterEugene Burmako2011-12-251-1/+1
| | | |/
| | * | Optimizing at the Name/String boundary.Paul Phillips2011-12-2511-87/+114
| | | | | | | | | | | | | | | | | | | | | | | | Working on reducing the now significant amount of both garbage and retained but duplicated Strings taking place as Names become Strings and vice versa. Long way to go.
| | * | Optimization in ZipArchive.Paul Phillips2011-12-251-4/+8
| | | | | | | | | | | | | | | | Avoid creating empty array when len == 0.
| | * | Merge remote-tracking branch 'origin/develop' into developPaul Phillips2011-12-240-0/+0
| | |\ \
| | | * \ Merge pull request #1 from odersky/topic/reifyodersky2011-12-226-89/+78
| | | |\ \ | | | | | | | | | | | | | | | | | | Improvements to reification and resetAttrs
| | | | * | Hardening of resetAllAttrs to work in the case where TypeTrees refer to ↵Martin Odersky2011-12-222-41/+44
| | | | | | | | | | | | | | | | | | | | | | | | locally erased symbols.
| | | | * | Hardening of isJavaClass to survive IncompatibleClassChange errors.Martin Odersky2011-12-221-1/+1
| | | | | |
| | | | * | wipEugene Burmako2011-12-224-40/+2
| | | | | |
| | | | * | Non-essential TypeApply trees must be omitted, or they will cause a ↵Eugene Burmako2011-12-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | typecheck error
| | * | | | [vpm] when there's a default case, don't throw matcherrorAdriaan Moors2011-12-241-9/+16
| | | | | |
| | * | | | [vpm] lambdalift becomes less NSDNHO-proneAdriaan Moors2011-12-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | made lambdalift complaint more useful
| | * | | | [vpm] emitting switches -- BodyTreeMakerAdriaan Moors2011-12-249-166/+319
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) introduce BodyTreeMaker to get rid of special casing for body now each case is a list of TreeMakers rather than a pair of such a list and a tree needed to do this since emitting switches requires access to the untranslated body 2) emitting switches - alternatives are flattened: each alternative block ends with a jump to the next alternative (if there is one) - to avoid stack overflow in typedMatch: detect when translateMatch returns a Match the patch to uncurry would be nicer with an extractor, but that breaks due to a bug in old patmat made trees into dags again -- NPE in erasure tree.duplicate seems to break lambdalift because it does not give fresh symbols (or trees?) to the valdefs for the arguments of duplicated functions duplicate enclosing tree, not subtrees improved propagateSubstitution for AlternativesTreeMaker - it now propagates to all its alternatives, so we don't have to do that in chainBefore - by making propagation more regular, a bug in substitution in AlternativesTreeMaker manifested itself it introduced a new binder, unnecessarily, which then was unbound -- now reusing binder of outer pattern having removeSubstOnly in propagateSubstitution unveiled a bug: guard treemaker should substitute move fixerUpper closer to what it fixes up
| | * | | | [vpm] better codegen, especially for alternatives (suggested by Tiark)Adriaan Moors2011-12-243-246/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | factored out some of the optimizing codegen that had snuck into treemakers (guardtreemaker) removed `caseResult`, back to just `one` no longer emitting intermediate `one`s (using guard instead -- when not optimizing) so uncurry can't accidentally blow them away (it removes the `one` that represents the case's result, but should leave intermediate computation alone) still TODO: reusing-treemakers sharing prefixes of length 1 helps inlining suffix of alternatives if small enough
| | * | | | [vpm] common sub-expression elimination for conditionsAdriaan Moors2011-12-245-81/+456
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TreeMakers (esp. CondTreeMakers) are approximated by hash-cons'ed Conds sharing is detected for prefixes of Conds, and shared conditions are only tested once their results are stored, and repeated tests branch on the last shared condition, reusing the results from the first time they were checked a Test is 1-to-1 with a TreeMaker, but may share its Cond TODO: clean separation of the two translation strategies: - naive flatMap/orElse (for virtualization) - less-naive if-then-else (with CSE etc coming) sharing trees caused wrong bytecode to be emitted (verifyerror) tentative explanation: "because lambdalift uses mutable state to track which variables have been captured if you refer to the same variable with the same tree twice it'll get confused" Sent at 8:27 PM on Thursday >> grzegorz.kossakowski: so we found a bug in jvm according to http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc2.html checkcast should throw a classcastexception becuase it's a shorthand for if !(x instanceof T) throw ClassCastExcpt but jvm decided to throw verifyerror and yeah, the check is wrong if jvm was not throwing verifyerror it would throw classcast exception saying that ObjectRef cannot be casted to $colon$colon ... >> me: so now where does it come from? since a ref is involved, i thought LambdaLift >> grzegorz.kossakowski: yup or now I don't think lambalift introduces that kind of low-level casts but I might be wrong btw. it's interesting that it unpacks stuff from objectref twice in your code and in one place checkcast is correct and in another is wrong Sent at 9:33 PM on Thursday >> grzegorz.kossakowski: also, since it's a verifyerror I think genjvm should have an assertion >> grzegorz.kossakowski: 193: getfield #54; //Field scala/runtime/ObjectRef.elem:Ljava/lang/Object; 196: checkcast #8; //class scala/runtime/ObjectRef 199: invokevirtual #95; //Method scala/collection/immutable/$colon$colon.tl$1:()Lscala/collection/immutable/List; it's this see you have checkcast for ObjectRef and then on that value, you try to call tl() method from List Sent at 9:56 PM on Thursday >> me: fixed sharing trees is bad very bad because lambdalift uses mutable state to track which variables have been captured if you refer to the same variable with the same tree twice it'll get confused