summaryrefslogtreecommitdiff
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* optimizing type tests and related stuffAdriaan Moors2011-11-222-10/+39
|
* a wider variety of treemakersAdriaan Moors2011-11-221-148/+163
| | | | | | optimized combining substitutions why we substitute in EqualityTestTreeMaker
* optimized version of condAdriaan Moors2011-11-221-0/+19
|
* fixed extraneous output. no review.Martin Odersky2011-11-221-1/+1
|
* Changed the way use cases are handled in scaladoc.Vlad Ureche2011-11-222-3/+21
| | | | | | | | | | If use cases are present, the original member disappears from the list. References SI-5054, but needs more work on the html part. If use cases are present along with links, scaladoc doesn't crash anymore. Closes SI-4898. Review by kzys.
* Compiler part of fast orElse.Martin Odersky2011-11-223-2/+20
| | | | | | | "According to the spec this code should not be legal. Disabling for now." Need to come back and either make it work or (more likely) make nsc reject the test)
* Long-standing performance mystery solved.Paul Phillips2011-11-224-33/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed a long time ago that calls to def annotations in Symbols figured way, way too high in profiling output, but my earlier efforts to modify it failed because I didn't understand the "accidental" service it was supplying. Here is the key piece of the former implementation of annotations: - val annots1 = initialize.rawannots map { - case x: LazyAnnotationInfo => x.annot() - case x: AnnotationInfo => x - } filterNot (_.atp.isError) The first thing you might notice is that because it calls initialize, any call to either annotations or (more frequently) a method like "hasAnnotation" causes a symbol to be initialized. The upshot is that taking away tens of thousands of calls to initialize means a certain amount of "free lunch" is over. The second thing is that this implementation lead to the allocation of a new list on every call to annotations. 99.999% of the time it's the same elements in the list. The fact that rawannots is typed as a list of "AnnotationInfoBase" which may as well be AnyRef means you can't even use mapConserve, but even mapConserve would be an abuse of the garbage collector given how infrequently there is any change. So here's what we have now: 1) Annotations are delivered from trees to symbols by way of an externally positioned map, not a field on the symbol. It's done once. The only overhead on a call to annotations now is a null check. 2) I added a small sprinkling of calls to initialize in sensible locations. 3) The profiler impact is hard to believe, but this is reproducible. For whatever reason the non-profiler wall clock time impact is not as impressive. My profiling target was the compilation of these 15 files: src/library/scala/collection/generic/G*.scala Before this patch, heap usage peaked at 60MB. After, 35MB. 40% drop in profiler measured time elapsed. (Again, it's not like that outside the profiler.) About a 55% drop in number of allocations. About a 40% drop in total size of allocations. +----------------------+------------------+-----------------+-----------------+ | Name | Time Diff (ms) | Old Time (ms) | New Time (ms) | +----------------------+------------------+-----------------+-----------------+ | +---<All threads> | -19,569 | 52,496 | 32,926 | +----------------------+------------------+-----------------+-----------------+ +----------------------------+--------------------+-----------------------+ | Packages and Classes | Objects (+/-) | Size (+/-) | +----------------------------+--------------------+-----------------------+ | +---<Objects by classes> | -877,387 -56 % | -26,425,512 -37 % | | | | | | | +---char[] | -43,308 -2 % | -2,756,744 -3 % | | | | | | | +---java | -67,064 -3 % | -2,027,264 -2 % | | | | | | | +---scala | -745,099 -48 % | -19,021,760 -26 % | +----------------------------+--------------------+-----------------------+
* Implemented manifest-based class-paths.Paul Phillips2011-11-214-13/+46
| | | | | | | | | | | | | | | | | | | | If you run a jar directly, like scala foo.jar Then if a Class-Path attribute is present in the jar manifest, the classpath will be constructed from that instead of the arguments. Some things remain to be determined, like whether it's supposed to replace a classpath given on the command line or supplement it, and whether the master jar should be on the classpath or only and exactly the jars listed in the manifest. There's a really nice test case, which won't be run of course, but I can't stand going any further without tests for these hard to test on all platforms things. The faux .check file shows what I see. Closes SI-4355, review by harrah.
* Fix for what have been rather uncommon common o...Paul Phillips2011-11-211-39/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix for what have been rather uncommon common owners. The complete histogram of results for "commonOwner" until this patch, when building quick.lib and quick.comp: Calculated common owner Occurrences ----------------------- ----------- NoSymbol 299,242 Everything Else 0 Since I'm always paranoid somebody will think I'm the one who broke such things in the first place, I got in the gitmobile and fingered the responsible party. Looks OK when it was checked in: r3930, Feb 4 2005. And it was smooth sailing until... r4026, Mar 22 2005. So 6 1/2 weeks of goodness for poor commonOwnerMap, to be followed by 6 1/2 years of endless NoSymboldom. In 2005 I was still making a living grifting strangers in seedy gambling halls, so I think I'm in the clear. Here's the exact spot. https://github.com/scala/scala/commit/ae0da87d1aaeded9eb7f9c9ecbed8a31 3667757d#L12L991 I found this while trying to figure out why we are generating so many refinements. This doesn't fix any of that, but maybe takes us a notch closer. Review by odersky.
* moving tree making to the TreeMaker factoryAdriaan Moors2011-11-191-98/+125
| | | | | | | | | | | | providing a richer TreeMakers interface in hopes of performing analyses and optimizations on TreeMakers rather than the trees they generate not sure yet, though: on the one hand, working on raw trees removes the unsoundness potential due to the extra indirection layer on the other hand, indirection is nice, and recovering the meaning lost in translation from richer treemakers to raw trees is such a drag no review
* Partial cleanup and generalization of tree prin...Martin Odersky2011-11-194-156/+116
| | | | | | | Partial cleanup and generalization of tree printing. You can now print a tree in direct case class form with `showRaw(tree)`. Should make NodePrinters redundant.
* further clean up in virtpatmatAdriaan Moors2011-11-191-228/+218
| | | | | | | | | | | | farewell ProtoTreeMaker, we hardly knew ye needed one more repeatedToSeq for pos/annotDepMethType when compiling under -Xexperimental and -Yvirtpatmat... I wonder why this hadn't failed before outer check for extractor type test: definitely need it for case classes, and probably makes sense for user-defined extractors as well no review
* Cleanups in TypeApply creation and casting.Paul Phillips2011-11-1912-78/+74
| | | | | | | | | There's every hint that it's a requirement that a TypeApply have non-empty typeArgs, but testing for and handling the empty condition is done irregularly. Made a mkTypeApply which handles the isEmpty case (returning "fun" unchanged.) Also unified most of the variations of casts under one umbrella. Review by moors.
* Bringing a bit of order to symbol substitution.Paul Phillips2011-11-1918-269/+302
| | | | | | | | | | | | | | | | | | | | | Painstakingly winnowed out the most frequently duplicated code sequences related to symbol cloning and substitution. Created canonical methods to perform these actions and documented them. Key methods include: def createFromClonedSymbols[T](syms: List[Symbol], tpe: Type)(creator: (List[Symbol], Type) => T): T def deriveSymbols(syms: List[Symbol], symFn: Symbol => Symbol): List[Symbol] def deriveType(syms: List[Symbol], symFn: Symbol => Symbol)(tpe: Type): Type Many example usages enclosed with commit. I did lots of timing tests, I find no material difference before and after. Actually I won by four seconds in this incarnation: Before - Total time: 7 minutes 55 seconds After - Total time: 7 minutes 51 seconds Review by moors.
* Fix for unfortunate thinko recently introduced.Paul Phillips2011-11-181-1/+1
| | | | | | | Many thanks to Jordi Salvat i Alabart for catching this. Universal equality is a formidable foe when it comes to avoiding this kind of mistake. Closes SI-5206, no review.
* Enable the use of spaces in paths for the Scala...Stefan Zeiger2011-11-184-18/+34
| | | | | | | | | | | | | | | | | | | Enable the use of spaces in paths for the Scala build on Windows -- take 2. (The original commit in r26026, reverted in r26027, used the new compilerargs element in the Scala build -- we cannot do this until it's in starr.) - Revert r25995 which was fixing it only partly and in the wrong place. - Properly encode argument files for scalac in scalac ant task. - Allow 'compilerarg' elements in scalac ant task (like in ant's built-in javac task) to allow passing extra parameters like plugindir path with proper encoding of spaces and file names. - Fix space handling in get-scala-revision.bat. Closes SI-3047.
* Revert "Enable the use of spaces in paths for t...Paul Phillips2011-11-184-34/+18
| | | | | | | | | | | Revert "Enable the use of spaces in paths for the Scala build on Windows." This reverts the previous commit due to failure to build: BUILD FAILED /scratch/trunk1/build.xml:639: scalacfork doesn't support the nested "compilerarg" element.
* Enable the use of spaces in paths for the Scala...Paul Phillips2011-11-184-18/+34
| | | | | | | | | | | | | | Enable the use of spaces in paths for the Scala build on Windows. Revert r25995 which was fixing it only partly and in the wrong place. Properly encode argument files for scalac in scalac ant task. Allow 'compilerarg' elements in scalac ant task (like in ant's built-in javac task) to allow passing extra parameters like plugindir path with proper encoding of spaces and file names, and use it in the Scala build. Fix space handling in get-scala-revision.bat. (Patch by Stefan Zeiger.) Closes SI-3047.
* Updated/fixed the following two Scala Ant tasks:michelou2011-11-162-68/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scalac (ant.Scalac) - added attributes `dependencyfile`, `explaintypes`, `nobootcp`, `nowarn` and `usejavacp` - added support for nested element `compilerarg` (see Ant manual) in order to pass prefix settings (eg. -J-Xbootclasspath, -Ddebug=true) to nsc.CompileClient - updated list of permissible values for compiler phases fsc (ant.FastScalac) - added attributes `ip4` and `maxIdle` in addition to `reset`, `server` and `shutdown` (and forwards them to nsc.CompileClient) - also forwards prefix settings `jvmargs` and `defines`, and boolean settings `explaintypes`, `nospecialization`, `nowarn`, `optimise`, `unchecked` and `usejavacp` to nsc.CompileClient - fixed CompileClient.process if-test Nota Bene I added the following element to partest.PartestTask (commit is pending) in order to automatically test the Scala Ant tasks: <anttests dir="${partest.dir}/${partest.srcdir}/ant" includes="*build.xml"/> Here is the output: [user@localhost scala]$ ant test.ant Buildfile: /home/user/workspace/scala/build.xml [echo] Forking with JVM opts: -Xms1536M [...] init: [echo] Build number is '2.10.0.r26022-b20111116212958' [echo] Built 16 November 2011, 21:29:58 [...] [...] test.ant: [partest] Running ant task tests [partest] testing: [...]/files/ant/fsc-build.xml [ OK ] [partest] testing: [...]/files/ant/scaladoc-build.xml [ OK ] [partest] testing: [...]/files/ant/scalac-build.xml [ OK ] [partest] Test suite finished with no failures. BUILD SUCCESSFUL Total time: 12 seconds
* Revert "Testing a theory about the windows build."Paul Phillips2011-11-161-1/+1
| | | | | No review.
* Reverted ProductN parent for case classes.Paul Phillips2011-11-161-7/+8
| | | | | Looks like we will need blood, toil, tears, and sweat. No review.
* Towards better reflection APIs.Martin Odersky2011-11-1514-376/+447
|
* Amending my previous commit with a comment expl...Iulian Dragos2011-11-151-0/+5
| | | | | | Amending my previous commit with a comment explaining a bit better what my code does and why.
* Made LazyType fail more graciously with incompl...Iulian Dragos2011-11-151-2/+9
| | | | | | | | | | | | | | | | | | | Made LazyType fail more graciously with incomplete class paths. SymbolLoaders already do the right thing, printing an error instead of crashing the compiler. However, the unpickler has two more lazy types that crash and stop the compiler if, on completion, it encounters a reference to a missing class file. Since the SymbolTable has no way of reporting an error, we convert the MissingRequirementError in TypeErrors. This has the benefit of being printed nicely by the type checker (with a position where the type was needed). This fixes extremely worrying behavior in the IDE when the class path is incomplete (for instance, after a rebuild with compilation errors). review by odersky, extempore.
* Changed reflection to allow getting a Scala Sym...amin2011-11-151-4/+6
| | | | | | Changed reflection to allow getting a Scala Symbol for the implementation class of a trait.
* factoring more into ProtoTreeMakersAdriaan Moors2011-11-141-67/+82
| | | | | | | | | contemplating the demise of ProtoTreeMaker, could TreeMaker be all we need? no review, but with apologies if this generates merge conflicts for those exhausting themselves
* got rid of unsafe in typedSubstAdriaan Moors2011-11-141-39/+27
| | | | | | | | don't need to re-type to the original type for correctness (was more to verify the substitution was indeed type-preserving whenever possibly) no review
* minor cleanup in virtpatmatAdriaan Moors2011-11-141-15/+11
| | | | | no review
* null-robustness for presentation testAdriaan Moors2011-11-141-2/+6
| | | | | | | | | ran into NPEs while running the test suite using the virtpatmat compiler, decided it might happen to others thus undertook to shield said others from sad NPEs no review
* Turning line endings to unix.Paul Phillips2011-11-131-33/+33
| | | | | This is my last idea regarding the windows build.
* behold ExtractorCall: encapsulating extractorsAdriaan Moors2011-11-131-202/+222
| | | | | | | | also, moving more codegen out of translation and into codegen in preparation of making codegen suitable for analysis no review, though I'm sure extempore will be all over this
* Added functionality to clear project files from...Martin Odersky2011-11-132-5/+78
| | | | | Added functionality to clear project files from a resident compiler.
* Minor virtpatmat cleanup.Paul Phillips2011-11-131-1/+2
|
* Sin some more.Paul Phillips2011-11-133-3/+5
| | | | | | | | | | | "Fiddle with lubs and glbs by never considering getClass as a member in a refinement generated from them. In a sense we have justification for this by saying we already treated getClass in an ad-hoc way, so we might as well go all the way." -- m. odersky Closes SI-4846.
* Testing a theory about the windows build.Paul Phillips2011-11-131-1/+1
|
* scala.bat expansion with quotes and spaces.Paul Phillips2011-11-131-2/+2
| | | | | Closes SI-4858.
* Delayed expansion in scala.bat.Paul Phillips2011-11-131-3/+5
| | | | | Closes SI-4019.
* More defense against spaces in paths.Paul Phillips2011-11-131-1/+3
| | | | | Closes SI-3047.
* Working on the runners.Paul Phillips2011-11-134-56/+99
| | | | | | | | | | | | | | | | | | | | | | Removed assumption that bash is in /bin. Removed --posix option to bash. Modernized shell constructs: $() instead of ``, [[ ]] instead of [ ]. Added -debug option for all runners which will show you the exact java command line being run before running it. Added -usebootcp to complement -nobootcp, and made regular classpath the default on cygwin. Quoted more things to give us a fighting chance against spaces and parens in paths. I took the waste-half-a-day step of installing vmware fusion so I could install windows so I could install cygwin so I could install scala under cygwin so I could see if it still worked. Seems to. We still desperately need some way of testing not only everything I'm attempting to address in this pile of patches but everything which is most likely now regressing. :javap now sort of works on windows (not for repl-defined classes as yet) if JAVA_HOME is set such that I can find tools.jar. Closes SI-4959. (Risks breaking and) references SI-2092. References SI-622 since that shouldn't be hard to get working.
* Made windows less aggressive about failing.Paul Phillips2011-11-131-2/+1
| | | | | | | | | | | | | There's no way to ever correctly check against a platform String and then fail if it doesn't exactly match. You have to handle such things gracefully, because even if you have omniscience and omnipotence at the time you write it, you will become wrong later. // example of a condition a vast distance from what should // be tested before intentionally failing if "%OS%" NEQ "Windows_NT" Closes SI-4800.
* Makes -toolcp available on windows.Paul Phillips2011-11-131-0/+20
| | | | | Contributed by Matthew Farwell. Closes SI-5062.
* Work in progress on #4541.Aleksandar Pokopec2011-11-112-3/+45
| | | | | No review.
* Small changes to reflection prompted by code re...Martin Odersky2011-11-114-8/+25
| | | | | Small changes to reflection prompted by code review.
* Deprecated ambiguous dot syntaxes.Paul Phillips2011-11-113-5/+39
| | | | | | | | | | | | | | | 1.+(2) - what is it? Is it 3 or 3.0? Come scala 2.11 you won't have to not know (or even not know there's something you don't know.) 1.+(2) will then be safely considered equivalent to 1 + 2, because any dot not followed by a digit is not part of a number. Primarily, that's these forms: 3.f 3.d 3. If you prefer an error to a warning, use -Xfuture. Let's deprecate 012 == 10 too! (See comment.) References SI-5089, no review.
* Cleanup around typeref creation and rebinding.Paul Phillips2011-11-112-59/+39
|
* A comment answering one of adriaan's philosophi...Paul Phillips2011-11-111-0/+6
| | | | | | A comment answering one of adriaan's philosophical musings on why programs fail, and a test case informed by the comment. Review by moors.
* Allow to load $class classes using Scala reflec...Grzegorz Kossakowski2011-11-101-1/+4
| | | | | | | | | | | | | | Allow to load $class classes using Scala reflection. Tweaked implementation of invalidClassName method to exclude *$class clasess from the set of invalid names. It's not exactly clear what was the intent of this method in first place so I'm not sure if it's the best way to fix SI-5176. Added test-case that covers this issue. Fixes SI-5176. Review by odersky.
* Better virtpatmat situation.Paul Phillips2011-11-101-1/+2
| | | | | | | | Enabled fancy type inference if opt.virtPatMat is true so one need not enable -Xexperimental to use El Virto (since I keep wasting time on edge cases arising from unrelated -Xexperimental-enabled features.) No review.
* Fix for regression in overriding with defaults.Paul Phillips2011-11-101-1/+2
| | | | | | | I should know better than to behave as if usable inferences can be drawn from a comment like "SYNTHETIC because of DEVIRTUALIZE". Maybe it was even true when it was written, but no more. Closes SI-5178, no review.
* More refinements for the scratchpad.Martin Odersky2011-11-102-30/+93
|