summaryrefslogtreecommitdiff
path: root/src/library
Commit message (Collapse)AuthorAgeFilesLines
* Specialization action.Paul Phillips2012-02-1474-152/+160
| | | | | | | | | | | | | | | | | | | | | The crickets at http://www.scala-lang.org/node/11901 were in unanimous agreement that I should proceed as suggested. - No arguments to @specialize gets you 10/10, not 9/10 - Fixed bugs in AnyRef specialization revealed by trying to use it - Specialized Function1 on AnyRef. - Changed AnyRef specialization to use OBJECT_TAG, not TVAR_TAG. - Deprecated SpecializableCompanion in favor of Specializable, which has the virtue of being public so it can be referenced from outside the library. - Cooked up mechanism to group specializable types so we don't have to repeat ourselves quite so much, and create a few groups for illustrative purposes. I'm not too serious about those names but I used up all my name-thinking-up brain for the day. - Updated genprod and friends since I had to regenerate Function1. - Put tests for a bunch of remaining specialization bugs in pending. Closes SI-4740, SI-4770, SI-5267.
* Made speclib less of a maintenance headache.Paul Phillips2012-02-141-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Now it copies in the current versions of BoxesRunTime and ScalaRunTime and applies patches to them, and the whole build is automated. # This is the only thing I actually typed, the rest is fancy echo. $ test/instrumented/mkinstrumented.sh build % rm -rf /scratch/trunk1/test/instrumented/classes % cp /scratch/trunk1/test/instrumented/../../src/library/scala/runtime/BoxesRunTime.java /scratch/trunk1/test/instrumented/../../src/library/scala/runtime/ScalaRunTime.scala /scratch/trunk1/test/instrumented/library/scala/runtime % patch BoxesRunTime.java /scratch/trunk1/test/instrumented/boxes.patch patching file BoxesRunTime.java % patch ScalaRunTime.scala /scratch/trunk1/test/instrumented/srt.patch patching file ScalaRunTime.scala Hunk #3 succeeded at 63 (offset 23 lines). Hunk #4 succeeded at 78 (offset 23 lines). Hunk #5 succeeded at 81 (offset 23 lines). Hunk #6 succeeded at 96 (offset 23 lines). % /scratch/trunk1/test/instrumented/../../build/pack/bin/scalac -d /scratch/trunk1/test/instrumented/classes /scratch/trunk1/test/instrumented/library/scala/runtime/BoxesRunTime.java /scratch/trunk1/test/instrumented/library/scala/runtime/ScalaRunTime.scala % javac -cp /scratch/trunk1/test/instrumented/../../build/pack/lib/scala-library.jar -d /scratch/trunk1/test/instrumented/classes /scratch/trunk1/test/instrumented/library/scala/runtime/BoxesRunTime.java % cd /scratch/trunk1/test/instrumented/classes % jar cf instrumented.jar . % mv -f instrumented.jar /scratch/trunk1/test/instrumented/../../test/files/speclib /scratch/trunk1/test/files/speclib/instrumented.jar has been created.
* reifyAnnotationsEugene Burmako2012-02-121-0/+20
| | | | | | | | | | | | | | | | | | | | | | | Annotations are now supported by the reifier: * AnnotationInfos from symbols get transformed back into mods. * AnnotatedTypes are retained and are reified along with AnnotationInfos. Reification is no magic, and reification of annotations especially: * Annotations cannot refer to symbols defined inside the quasiquote. This restriction is due to the fact that we need to erase locally defined symbols before reifying to make subsequent reflective compilations succeed. However, while doing that, we also need to make sure that we don't make resulting ASTs non-compilable by removing essential information. This is tricky, and it more or less works for TypeTrees, but not for annotations that can contain arbitrary ASTs. For more details look into the comments to Reifiers.scala. * Classfile annotations that contain array arguments and are applied to types, i.e. the ones that generate AnnotatedTypes, cannot be reified. This is because of limitations of manifest infrastructure. Typechecking "Array(mirror.LiteralAnnotArg(...))" would require the compiler to produce a manifest for a path-dependent type, which cannot be done now. Review by @odersky.
* Removed Code.scalaEugene Burmako2012-02-081-25/+0
| | | | | | | | This is a logical next step after deprecating and removing LiftCode: https://github.com/scala/scala/commit/ffc2389840852a120fecd772206d55db9a79f30e Now when Paul has uploaded a starr that doesn't need Code, Code$ and Code.lift we can finally remove the last remaining pieces of the old reification logic.
* Added a rootdoc page for the compiler API scaladocVlad Ureche2012-02-061-0/+27
|
*-. Merge remote-tracking branches 'rklaehn/SI-5139', 'axel22/feature/pc-ctrie', ↵Paul Phillips2012-02-0635-475/+1834
|\ \ | | | | | | | | | 'greedy/auto-fetch-jars', 'scalamacros/pullrequest/assorted' and 'VladUreche/feature/scaladoc-nofail' into develop
| * | Merge branch 'master' into feature/pc-ctrieAleksandar Prokopec2012-02-0617-161/+256
| |\|
| | * Revert "Added a rootdoc page for the compiler API scaladoc"Paul Phillips2012-02-051-27/+0
| | | | | | | | | | | | This reverts commit e34098b7f6e37420198fa5c7c2820d0443b46cc4.
| | * Refining the reflection api.Paul Phillips2012-02-0510-112/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the pursuit of simplicity and consistency. - Method names like getType, getClass, and getValue are far too ambiguous, both internally and especially with java reflection names. Methods which accept or return scala symbols should not refer to them as "classes" in the reflection library. (We can live with the FooClass convention for naming the well-known symbols, it's names like "getClass" and "classToType" which are needlessly conflationary.) - Meaningless names like "subst" have to be expanded. - We should hew closely to the terms which are used by scala programmers wherever possible, thus using "thisType" to mean "C.this" can only beget confusion, given that "thisType" doesn't mean "this.type" but what is normally called the "self type." - It's either "enclosing" or "encl", not both, and similar consistency issues. - Eliminated getAnnotations. - Removed what I could get away with from the API; would like to push those which are presently justified as being "required for LiftCode" out of the core. - Changed a number of AnyRefs to Any both on general principles and because before long it may actually matter. - There are !!!s scattered all over this commit, mostly where I think the name could be better. - I think we should standardize on method names like "vmSignature, vmClass" etc. when we are talking about jvm (and ostensibly other vm) things. There are a bunch more places to make this distinction clear (e.g. Symbol's javaBinaryName, etc.) - There is a lot more I want to do on this and I don't know where the time will come from to do it. Review by @odersky, @scalamacros.
| | * Reimplemented Modifer.Paul Phillips2012-02-054-23/+83
| | | | | | | | | | | | | | | Couldn't live with a scala.Enumeration being a permanent fixture in the reflection library. Rolled it by hand.
| | *-. Merge remote-tracking branches 'VladUreche/feature/compiler-rootdoc', ↵Paul Phillips2012-02-051-0/+27
| | |\ \ | | | | | | | | | | | | | | | 'scalamacros/pullrequest/5334', 'scalamacros/pullrequest/5272' and 'VladUreche/issue/5287-cleanup' into develop
| | | * | Added a rootdoc page for the compiler API scaladocVlad Ureche2012-02-051-0/+27
| | | |/
| | * / Replaced LiftCode with a function in MacroContextEugene Burmako2012-02-055-3/+59
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Major cleanup of reification: * LiftCode phase has been removed * Code has been deprecated and will be removed as we roll a new starr * Logic related to type-directed lifting has been purged scala.reflect.macro.Context#reify now provides the same services as LiftCode provided (except that it returns Tree, not Code). For testing purposes, I've retained the oh-so-convenient automagic lift. test/files/codelib/code.jar now hosts Code.lift reimplemented in a macro, so that the tests can continue working as if nothing has happened.
| * | Add tests for parallel Ctrie.Aleksandar Prokopec2012-02-031-1/+0
| | | | | | | | | | | | Changed parameters in some tests to speed them up.
| * | Fix some issues in parallel Ctrie.Aleksandar Prokopec2012-02-034-46/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change resolves some issues with ParCtrie splitters and their `remaining` method, which currently evaluates the size of the Ctrie. Since this is still not done lazily, nor in parallel, it has a certain cost, which is unacceptable. Change #1: The `shouldSplitFurther` method is by default implemented by calling the `remaining` method. This method now forwards the call to the same method in the splitter which is by default implemented in the same way as before, but can be overridden by custom collections such as the ParCtrie. Change #2: ParCtrie splitter now has a `level` member which just counts how many times the method has been split. This information is used to override the default `shouldSplitFurther` implementation. Change #3: The tasks and splitters rely heavily on the `remaining` method in the splitter for most operations. There is an additional method called `isRemainingCheap` which returns true by default, but can be overridden by custom collections such as the `Ctrie`.
| * | Add parallel Ctrie parallel collection.Aleksandar Prokopec2012-02-025-10/+151
| | |
| * | Incorporate Ctrie into standard library.Aleksandar Prokopec2012-02-021-11/+92
| | | | | | | | | | | | Implemented Ctrie serialization. Improved hashcode computation.
| * | Add the Ctrie concurrent map implementation.Aleksandar Prokopec2012-02-015-0/+1015
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ctrie is a scalable concurrent map implementation that supports constant time lock-free lazy snapshots. Due to the well-known private volatile field problem, atomic reference updaters cannot be used efficiently in Scala yet. For this reason, 4 java files had to be included as well. None of these pollute the namespace, as most of the classes are private. Unit tests and a scalacheck check is also included.
| * | Remove ParIterator and SignalContextPassingIterator.Aleksandar Prokopec2012-02-0114-182/+113
| | | | | | | | | | | | | | | This unclutters the namespace and makes defining custom parallel collections a lot easier.
| * | Add support for combiner sharing to parallel collections.Aleksandar Prokopec2012-02-014-119/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Concurrent (thread-safe) collections can implement builders directly for parallel collections by having themselves as builders, similar to buffers being builders for themselves in sequential collections. Combining 2 shared combiners can be expensive (more than logn), but is never done, since `combine` is always called with `this` (receiver) combiner, so `combine` just returns `this`. This commit adds support for implementing a parallel collection by having itself as combiner (parallel builder). To do this, clients must now merely implement their combiners by overriding the method `canBeShared` and having it return `true`. The support is implemented by refining the abstraction which creates combiners in tasks - this abstraction is provided by the protected `combinerFactory` method, previously `cbfactory`. The essential difference is that if the combiner can be shared, this method returns a combiner factory which always returns the same combiner. Otherwise, it always creates a new combiner. Span and takeWhile had to be modified for shared combiners to make this work, but for all other collections they work as before. Several other tasks had to be modified slightly, as well.
* | | added reference equality checks to improve structural sharingRuediger Klaehn2012-02-051-7/+12
| |/ |/| | | | | | | added reference equality checks to updated0 and removed0 to prevent creation of a new map when updating an entry with the same value or removing an entry that was not present to begin with.
* | Merge commit 'c58b240' into developPaul Phillips2012-02-021-27/+0
|\ \
| * | [vpm] __match determines match semantics; virtualizationAdriaan Moors2012-02-021-27/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | determine match strategy by typing `__match` factored out the interface to generate code in this monad, cleaned up codegen a bit no longer solving a context bound to determine the match strategy and the monad's type constructor it's too expensive don't consider implicits looking for __match implicit search causes HUGE slowdowns -- now the overhead is about 4% compared to just assuming there's no __match in scope to support virtualization&staging, we use the type of `__match.one` as the prototype for how to wrap "pure" types and types "in the monad" pure types T are wrapped as P[T], and T goes into the monad as M[T], if one is defined as: def one[T](x: P[T]): M[T] for staging, P will typically be the Rep type constructor, and type M[T] = Rep[Option[T]] furthermore, naive codegen no longer supplies type information -- type inference will have to work it out optimized codegen still does, of course, and that's enough since we only bootstrap that way TODO: improve the test (currently the condition is not represented)
* | | Fixes reifyThisEugene Burmako2012-02-021-0/+3
| | |
* | | Miscellaneous fixes to reificationEugene Burmako2012-02-021-1/+6
|/ / | | | | | | | | | | | | | | More specifically: * Importers now preserve wasEmpty and original * ToolBoxes no longer auto-evaluate nullary functions returned by runExpr * All local symbols from previous typechecks are now correctly erased by ResetAttrs * Originals are now reified
* | Update RoundingMode.Paul Phillips2012-02-011-1/+3
| | | | | | | | Not to use the deprecated Enumeration constructor.
| |
| \
*-. \ Merge remote-tracking branches 'gkossakowski/virtpatmat-switch', ↵Paul Phillips2012-02-011-1/+1
|\ \ \ | | |/ | |/| | | | 'scalamacros/pullrequest/5427' and 'scalamacros/pullrequest/5423' into develop
| | * Introduce getAnnotations that triggers symbol completionEugene Burmako2012-01-311-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Default getter for annotations doesn't perform initialization, hence we've faced the following bug: https://issues.scala-lang.org/browse/SI-5423. One of the approaches to fixing it would be to auto-complete on getter, but according to Martin we'd better not do that because of cycles. That's why I'm just introducing a new, eager, variation of `annotations' and redirecting public API to it. Review by @odersky.
* / Fix for slice boundary condition.Paul Phillips2012-02-011-1/+1
|/ | | | | Negative "to" index should be normalized to 0 before using it in a difference operation.
*-. Merge remote-tracking branches 'axel22/issue/4147', 'axel22/issue/5374' and ↵Paul Phillips2012-01-301-1/+1
|\ \ | | | | | | | | | 'hubertp/ticket/4336' into develop
| * | Merge branch 'master' into issue/5374aleksandar2012-01-3015-119/+210
| |\|
| * | Changed the serialVersionUID in List serialization start marker.aleksandar2012-01-301-1/+1
| | |
* | | Merge pull request #1 from lpereir4/avlAleksandar Prokopec2012-01-302-135/+170
|\ \ \ | |_|/ |/| | AvlTree performance improvements
| * | Use of polymorphic dispatch instead of pattern matching.Lucien Pereira2012-01-282-127/+168
| | | | | | | | | | | | Use a specialized iterator.
| * | Getting rid of closure creation occuring for each rebalancing. Tail ↵Lucien Pereira2012-01-151-34/+28
| | | | | | | | | | | | recursion is not necessary here.
| * | syntactic error correctionLucien Pereira2012-01-141-1/+1
| | |
* | | Set fields in immutable hash maps and hash sets to vals.aleksandar2012-01-263-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is part of an effort to make the immutable collections (more) thread safe. The `::` still has non-final member fields for head and tail, but there is not much that can be done right now about that, since these fields are used by list buffers. Tried writing a test with unsafe initialization, but could not invent a scenario which actually fails, at least on the JDK6.
| | |
| \ \
*-. \ \ Merge remote-tracking branches 'axel22/issue/5374' and 'axel22/issue/5375' ↵Paul Phillips2012-01-255-31/+83
|\ \ \ \ | | |_|/ | |/| | | | | | into develop
| | * | Fix for SI-5375.aleksandar2012-01-253-27/+35
| | | | | | | | | | | | | | | | | | | | Changed CompositeThrowable to inherit Exception instead of Throwable. A few minor fixes for the jdk1.5 parallel collection tasks.
| * | | Refine fix for SI-5374 - make list deserialization backward-compatible.aleksandar2012-01-252-4/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done by structurally serializing list nodes, but prepending a special `ListSerializationStart` symbol ahead of the list. If this symbol is not in the object input stream, the deserialization reverts to the old mode. Note there is not much to be done for list buffers - their serialization was broken before, so legacy serialized list buffers are no longer deserializable. However, their serialVersionUID was changed to reflect this, so deserializing a legacy list buffer should fail fast.
* | | | Merge remote-tracking branch 'odersky/topic/reflect' into developPaul Phillips2012-01-255-59/+111
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/reflect/internal/Symbols.scala src/compiler/scala/reflect/internal/Types.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/library/scala/reflect/api/Trees.scala
| * | | | More work on making reflection thread-safe.Martin Odersky2012-01-251-2/+2
| | | | |
| * | | | Making reflection thread-safe.Martin Odersky2012-01-252-27/+16
| | | | | | | | | | | | | | | | | | | | The idea is that all operations that need to be synchronized are overriden in classes reflect.runtime.Synchronized*. Sometimes this applies to operations defined in SymbolTable, which can be directly overridden. Sometimes it is more convenient to generate SynchronizedClazz subclasses of SymbolTable classes Clazz. In the latter case, all instance creation must go over factory methods that can be overridden in the Synchronized traits.
| * | | | Cleanup and better documentation of reflect.api.Symbols traitMartin Odersky2012-01-251-28/+63
| | | | |
| * | | | Added doc comments to Names trait.Martin Odersky2012-01-251-3/+30
| | | | |
| | | | |
| \ \ \ \
| \ \ \ \
| \ \ \ \
*---. \ \ \ \ Merge remote-tracking branches 'hubertp/topic/errors', ↵Paul Phillips2012-01-252-5/+6
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 'scalamacros/topic/antbuildexception', 'leifwickland/SI-5405' and 'axel22/issue/5377' into develop
| | | * | | | | Update for fix for SI-5377.aleksandar2012-01-241-2/+3
| | | | |_|/ / | | | |/| | | | | | | | | | | | | | | | | Converting the buffer to another arraybuffer instead of to a list.
| | * / | | | SI-5405: Fix documentation error in scala.math.BigIntLeif Wickland2012-01-241-3/+3
| | |/ / / /
* | / / / / Use context for buffering errors that cannot/shouldn't be reported in the ↵Hubert Plociniczak2012-01-251-3/+1
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | given moment (instead of throwing type errors). This avoids previous problems where we were creating fake error trees in some incorrect places like in type completers in Namers etc. Implicits relied heavily on type errors being thrown but performance should stay the same due to some explicit checks/returns. Some of the problems involved how ambiguous error messages were collected/reported because it was very random (similarly for divergent implicits). This should be more explicit now. Reduced the number of unnecessary cyclic references being thrown (apart from those in Symbols/Types which don't have a context and need to stay for now as is). Review by @paulp, @odersky.
* / / / / Cleaner range counting.Paul Phillips2012-01-241-9/+27
|/ / / / | | | | | | | | | | | | Plus a big unit test I had lying around.