summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| | | * | | | | | | synchronizes toolboxesEugene Burmako2013-02-111-23/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't guarantee thread-safety of the front end, but everything else looks good now.
| | | * | | | | | | SI-7045 reflection now auto-initializes selfTypeEugene Burmako2013-02-113-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | selfType joins the happy family of flags, annotations and privateWithin, which automatically trigger initialization, when used within runtime reflection.
| | | * | | | | | | optimizes Scala reflection GILEugene Burmako2013-02-114-64/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First of all, GIL should only apply to runtime reflection, because noone is going to run toolboxes in multiple threads: a) that's impossible, b/c the compiler isn't thread safe, b) ToolBox api prevents that. Secondly, the only things in symbols which require synchronization are: 1) info/validTo (completers aren't thread-safe), 2) rawInfo and its dependencies (it shares a mutable field with info) 3) non-trivial caches like in typeAsMemberOfLock If you think about it, other things like sourceModule or associatedFile don't need synchronization, because they are either set up when a symbol is created or cloned or when it's completed. The former is obviously safe, while the latter is safe as well, because before acquiring init-dependent state of symbols, the compiler calls `initialize`, which is synchronized. We can say that symbols can be in four possible states: 1) being created, 2) created, but not yet initialized, 3) initializing, 4) initialized. in runtime reflection can undergo is init. #3 is dangerous and needs protection
| | | * | | | | | | initializes lazy vals and inner objects in advanceEugene Burmako2013-02-115-5/+1041
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed at http://groups.google.com/group/scala-internals/browse_thread/thread/97840ba4fd37b52e, `synchronized(this)` employed by lazy val and inner object initialization is an excellent way to deadlock yourself in the foot. Imagine a thread, which grabs a reflection GIL and then calls one of those lazy vals / objects that reflection exposes (e.g. a companion module of an innocently looking SingleType case class). Then imagine another thread, which calls something else in SymbolTable, grabbing symbol table's monitor, and then tries to get a reflection GIL to do something non-trivial. Hello, we've just arrived at a deadlock. Since, as discussed in the aforementioned thread, there's no easy way to change lazy vals / inner objects in reflection to use GIL instead of synchronizing on this, I bit the bullet and manually initialized all things with deferred initialization defined in reflect.runtime.SymbolTable. The list of all things `$lzycompute` has been mined by a simple Python script, then I copy/pasted that list into `JavaUniverse.scala` and went ahead forcing objects and lazy vals mentioned there. Notably, I've been able to force all lazy vals in Definitions.scala. There are some todos left, but I suggest we move forward without securing them, because the 2.10.1-RC1 release date is very close, so we'd better have a 95% solution instead of keeping reflection thread-unsafe. Though here's the list of todo lazy vals for the reference: * BaseTypeSeq.maxDepth * WeakTypeTag.tpe * AnnotationInfo.forcedInfo For each of those lazy vals we need to make sure that their initializers never call back into themselves. Otherwise, there's a danger of a deadlock.
| | | * | | | | | | introduces GIL to Scala reflectionEugene Burmako2013-02-1110-178/+235
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On a serious note, I feel really uncomfortable about having to juggle this slew of locks. Despite that I can't immediately find a deadlock, I'm 100% sure there is one hiding in the shadows. Hence, I'm abandoning all runtime reflection locks in favor of a single per-universe one.
| | | * | | | | | | cleans up initialization of runtime reflectionEugene Burmako2013-02-117-29/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At first I just tried to remove syntheticCoreClasses from missingHook and put them into the initializer of freshly created mirrors in order to reduce the non-determinism in mutations of the global symbol table. And then it didn't work, crashing on me claiming that AnyRef is missing. Apparently we still need AnyRefClass in missingHook, just because it's impossible to initialize (i.e. unpickle) ScalaPackageClass without it. And then it still didn't work, whining about multiple overloaded defs of some synthetic symbols. That was really tricky, but I figured it out as well by initializing ScalaPackageClass first before forcing any synthetic symbols (see the details in comments).
| | | * | | | | | | reflection no longer uses atPhase and friendsEugene Burmako2013-02-114-28/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mentioned methods mutate the global `atPhaseStack` variable, which can easily lead to imbalances and, ultimately, to the empty stack error. Luckily for us, there's only one dummy phase, SomePhase, which is used by runtime reflection, so there is absolutely zero need to invoke atPhase in non-compiler reflexive universes. The cleanest solution would be to override `atPhase` for runtime reflection, but it's @inline final, so I didn't want to pay performance penalties for something that's used three times in runtime reflection (during unpickling, in reflection-specific completers and in `Symbol.typeParams/unsafeTypeParams`). Therefore I added overrideable analogues of `atPhase` and `atPhaseNotLaterThan` which are called from the aforementioned code shared between the compiler and runtime reflection. I also had to duplicate the code of `Symbol.XXXtypeParams`, again due to them being very performance-sensitive.
| | | * | | | | | | synchronizes symbolsEugene Burmako2013-02-113-16/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synchronization via decoration would be neat if it actually worked. Unfortunately, root symbols never got decorated, therefore their children also never got decorated and all the way down to the very turtles. This commit fixes this sad issue by turning root symbols from objects to lazy vals. Yes, this is going to induce a performance penalty, which will hopefully not be high enough to invalidate this cornerstone of our synchronization strategy. Now when root symbols are lazy vals, they can be overridden in the runtime reflexive universe and decorated with SynchronizedSymbol, which makes their children sync and sound.
| | | * | | | | | | removes the crazy extraneous logEugene Burmako2013-02-113-1/+7
| | | | | | | | | |
| | | * | | | | | | moves Symbol#SymbolKind to SymbolsEugene Burmako2013-02-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Too bad I didn't notice that before. That will free up quite a bit of memory, removing an extraneous field in every single Symbol, namely the: private volatile Symbols.Symbol.SymbolKind$ SymbolKind$module
* | | | | | | | | | Merge pull request #2205 from JamesIry/master_deoptimizeJames Iry2013-03-065-1/+35
|\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / |/| | | | | | | | | Add option to disable optimization
| * | | | | | | | | Add option to disable optimizationJames Iry2013-03-055-1/+35
|/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default we run par test under -optimise. But occasionally we need to test optimizations in isolation. This commit adds a Ynooptimise flag that turns the optimize flags off back off after they've been turned on. A test is included to ensure that -Ynooptimise turns off optimizations and an existing test is modified to show that optimizations coming after -Ynooptimise in command line are enabled.
* | | | | | | | | Merge pull request #2203 from paulp/topic/bool-arg-rebasedPaul Phillips2013-03-05108-404/+426
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Name boolean arguments (rebased)
| * | | | | | | | | Check named-args-for-clarity incur no extra bytecodeJason Zaugg2013-03-053-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When named arguments correspond the the parameter declaration order, the compiler should not lift out assignments before the method call, as it would have to do for out-of-order arguments. Confirm this with a bytecode comparison test.
| * | | | | | | | | Name boolean arguments in src/library.Jason Zaugg2013-03-0524-71/+71
| | | | | | | | | |
| * | | | | | | | | Name boolean arguments in src/reflect.Jason Zaugg2013-03-0511-31/+31
| | | | | | | | | |
| * | | | | | | | | Name boolean arguments in src/compiler.Jason Zaugg2013-03-0570-302/+302
|/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What would you prefer? adaptToMemberWithArgs(tree, qual, name, mode, false, false) Or: adaptToMemberWithArgs(tree, qual, name, mode, reportAmbiguous = false, saveErrors = false)
* | | | | | | | | Merge pull request #2197 from paulp/pr/integrate-range-positionsJames Iry2013-03-0521-420/+372
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Integrate range positions.
| * | | | | | | | | Eliminated separate RangePositions trait.Paul Phillips2013-03-049-311/+271
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of those eternal headaches which probably sounded better on paper. Even before range positions are the default, there's no reason we can't have the range position code available in all globals enabled via settings, just like everything else.
| * | | | | | | | | Disentangled RangePositions from interactive.Paul Phillips2013-03-0420-409/+401
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a stepping stone to having range positions all the time, as well as to modularizing the presentation compiler. It does not enable range positions by default, only places them smoewhere where they can be.
* | | | | | | | | | Merge pull request #2183 from mt2309/tailrec-intmapPaul Phillips2013-03-051-0/+3
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Require firstKey and lastKey on IntMap tail-recursive.
| * | | | | | | | | | Require firstKey and lastKey on IntMap to be tail recursive.Michael Thorpe2013-03-021-0/+3
| | | | | | | | | | |
* | | | | | | | | | | Merge pull request #2195 from vigdorchik/lint_libraryPaul Phillips2013-03-0511-40/+14
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Changes around lint
| * | | | | | | | | | | Remove unused symbols and imports from the library.Eugene Vigdorchik2013-03-057-12/+1
| | | | | | | | | | | |
| * | | | | | | | | | | Since the problem in SI-6758 is fixed, it's ok to move checking for unused ↵Eugene Vigdorchik2013-03-054-28/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | imports to Analyzer. This allows the check to be used in the IDE.
* | | | | | | | | | | | Merge pull request #2191 from mergeconflict/SI-7132Paul Phillips2013-03-053-15/+22
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | SI-7132 - don't discard Unit type in interpreter
| * | | | | | | | | | | | SI-7132 - don't discard Unit type in interpreterDan Rosen2013-03-023-15/+22
| | | | | | | | | | | | |
* | | | | | | | | | | | | Merge pull request #2187 from JamesIry/master_SI-6816Paul Phillips2013-03-054-1/+15
|\ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | SI-6816 Deprecate -Yeta-expand-keeps-star
| * | | | | | | | | | | | | SI-6816 Deprecate -Yeta-expand-keeps-starJames Iry2013-03-014-1/+15
| |/ / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit deprecates the -Yeta-expand-keeps-star flag. It was created in 2.10 to help in the transition from 2.9 but by the time 2.11 comes out it should no longer be necessary.
* | | | | | | | | | | | | Merge pull request #2196 from paulp/pr/logging-and-typevarsPaul Phillips2013-03-056-86/+105
|\ \ \ \ \ \ \ \ \ \ \ \ \ | |_|_|_|/ / / / / / / / / |/| | | | | | | | | | | | Logging little understood maneuverings during type inference
| * | | | | | | | | | | | Cleanup in isHKSubType0.Paul Phillips2013-03-041-38/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making the mechanisms more apparent. Renamed to isHKSubType, because there is no other.
| * | | | | | | | | | | | Add some logging to sinful typevar methods.Paul Phillips2013-03-043-48/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These super-mutation-oriented methods should enthusiastically communicate what they are doing, especially when they encounter anything unexpected. None of this work should be taken as an endorsement of any of the worked-upon code.
| * | | | | | | | | | | | Added methods debuglogResult and devWarningResult.Paul Phillips2013-03-041-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lowering the barriers to sensible logging - these methods are key in avoiding the "too much trouble" syndrome.
| * | | | | | | | | | | | Always at least log devWarnings.Paul Phillips2013-03-041-0/+2
|/ / / / / / / / / / / /
* | | | | | | | | | | | Merge pull request #2192 from paulp/pr/rename-type-paramAdriaan Moors2013-03-031-5/+5
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | Renamed type param to be consistent with convention.
| * | | | | | | | | | | | Renamed type param to be consistent with convention.Paul Phillips2013-03-031-5/+5
| |/ / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's super confusing to see debugging output showing a type constructor called "Coll". The convention in the collections is that CC[A] takes type parameters and Coll is an alias for the applied type.
* | | | | | | | | | | | Merge pull request #2163 from paulp/pr/as-seen-fromAdriaan Moors2013-03-032-132/+201
|\ \ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / / |/| | | | | | | | | | | Refactors AsSeenFromMap to expose extension point.
| * | | | | | | | | | | Establishes what's up with widening in asSeenFrom.Paul Phillips2013-03-031-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added explanatory comment.
| * | | | | | | | | | | Simplified correspondingTypeArgument based on reviewer feedback.Paul Phillips2013-03-021-15/+10
| | | | | | | | | | | |
| * | | | | | | | | | | Refactors AsSeenFromMap to expose extension point.Paul Phillips2013-03-012-131/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The extension point was the initial motivation but I also tried to bring some clarity to the internals. This is a setup commit for scaladoc and interactive modularization, and also will be followed by a fix for abstract types losing their prefixes (SI-6161.)
* | | | | | | | | | | | Merge pull request #2180 from adriaanm/merge-2.10.1-masterAdriaan Moors2013-03-0115-26/+154
|\ \ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / / |/| | | | | | | | | | | Merge 2.10.1 into master
| * | | | | | | | | | | Merge branch 2.10.1 into masterAdriaan Moors2013-02-2715-26/+154
| |\ \ \ \ \ \ \ \ \ \ \ | | | |_|_|_|_|/ / / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/ast/Trees.scala src/library/scala/concurrent/impl/ExecutionContextImpl.scala
| | * | | | | | | | | | Merge 2.10.1 into 2.10.x.Adriaan Moors2013-02-2733-479/+878
| | |\ \ \ \ \ \ \ \ \ \ | | | |_|_|/ / / / / / / | | |/| | | | | / / / / | | | | |_|_|_|/ / / / | | | |/| | | | | | |
| | | * | | | | | | | Merge pull request #2160 from scalamacros/topic/7112-followup-2101v2.10.1-RC2Adriaan Moors2013-02-251-1/+1
| | | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | fixes the test for SI-7112
| | | | * | | | | | | | fixes the test for SI-7112Eugene Burmako2013-02-231-1/+1
| | | | | |_|_|_|/ / / | | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Freshly released Java 1.6.0_41 for OSX fails with "IllegalAccessError: tried to access class JavaSimpleEnumeration_1 from class sun.proxy.$Proxy6", and rightfully so, because that class isn't public. I think I will avoid the usual "how could this even work before" in this commit message.
| | | * | | | | | | | Merge pull request #2166 from retronym/ticket/7180Adriaan Moors2013-02-252-1/+14
| | | |\ \ \ \ \ \ \ \ | | | | |/ / / / / / / | | | |/| | | | | | | SI-7180 Fix regression in implicit scope of HK type alias.
| | | | * | | | | | | SI-7180 Fix regression in implicit scope of HK type alias.Jason Zaugg2013-02-252-1/+14
| | | |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We actually need to call normalize here, otherwise we don't progress through #1 below. [infer implicit] scala.this.Predef.implicitly[Higher[Foo.Bar]] with pt=Higher[Foo.Bar] in object Foo 1. tp=Foo.Bar tp.normalize=[A <: <?>]Foo.Bar[A] tp.dealias=Foo.Bar 2. tp=Foo.Bar[A] tp.normalize=Box[A] tp.dealias=Box[A]
| | | * | | | | | | Merge pull request #2152 from retronym/topic/annotatedRetyping-2.10.1Adriaan Moors2013-02-215-9/+87
| | | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | SI-7163 backport of annotated retyping to 2.10.1
| | | | * | | | | | | Additional test case for Lukas' fix to annotated originals.Jason Zaugg2013-02-212-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was inspired by the regression that Mark encountered when upgrading SBT from 2.10.0 to 2.10.1-RC1.
| | | | * | | | | | | Fix typing idempotency bug with Annotated treesLukas Rytz2013-02-213-9/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | typedAnnotated transforms an Annotated tree into a Typed tree. The original field of the result is set to the Annotated tree. The bug was that typedAnnotated was using the untyped Annotated tree as original, but also set its type. When re-typing later on the same Annotated tree, the typer would consider it as alreadyTyped. This is incorrect, the typer needs to convert Annotated trees to Typed. Also, the Annotated tree only had its type field set, but its children were still untyped. This crashed the compiler lateron, non-typed trees would get out of the typing phase.