summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | | | [nomaster] Revert "SI-4664 Make scala.util.Random Serializable"Adriaan Moors2013-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also revert "SI-4664 [Make scala.util.Random Serializable] Add test case" This reverts commit 0b92073a38f9d1823f051ac18173078bfcfafc8a. This reverts commit 2aa66bec86fd464712b0d15251cc400ff9d52821. This is necessary to maintain binary compatibility with 2.10.0.
| | * | | | | [nomaster] Revert "Fixes SI-6521, overrides Range#head to be faster"Adriaan Moors2013-02-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit a557a973608a75c7a02f251bbcf49fe6f6b6655e. This is necessary to maintain binary compatibility with 2.10.0. Mima says: matchName="scala.collection.immutable.Range.head" problemName=IncompatibleResultTypeProblem The bridge method appeared because result is now Int, whereas the super-method's result type erases to Object
* | | | | | | Merge pull request #2182 from retronym/ticket/6191James Iry2013-03-011-2/+2
|\ \ \ \ \ \ \ | |_|_|_|_|/ / |/| | | | | | Tone down a soft-warning to only show under -Ydebug.
| * | | | | | Tone down a soft-warning to only show under -Ydebug.Jason Zaugg2013-03-011-2/+2
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SI-6191 remains open and can lead to incomplete debug scope information. In 2.10.0, the backend detected when this happend, and warned the user. But there is little the user can do about the warning. We have a few test cases for the problem now, so we should not pollute the compile output.
* | | | | | Merge pull request #2083 from scalamacros/ticket/6240Adriaan Moors2013-02-2720-331/+1468
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | SI-6240 synchronization for runtime reflection
| * | | | | removes the assertion in missingHookEugene Burmako2013-02-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the current synchronization scheme multiple threads can enter the missingHook trying to materialize a package, which hasn't been created. That's fine, because makeScalaPackage, which creates and enters package symbols is synchronized and checks whether the creation is necessary before commencing. Therefore even if makeScalaPackage is called multiple times in rapid succession, the calls will be serialized and all calls except the first one won't do anything.
| * | | | | synchronizes namesEugene Burmako2013-02-112-27/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we didn't have all possible name creation facilities covered with locks, so some of them silently misbehaved and caused much grief: http://groups.google.com/group/scala-internals/browse_thread/thread/ec1d3e2c4bcb000a. This patch gets all the name factories under control. Unfortunately it comes at a performance cost, which has to be evaluated.
| * | | | | synchronizes pendingVolatilesEugene Burmako2013-02-112-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Called from isVolatile, which is called from isStable, which is a part of the public reflection API.
| * | | | | 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-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-111-1/+1
| | | | | |
| * | | | | 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 #2134 from scalamacros/topic/resetattrs-thisPaul Phillips2013-02-271-9/+48
|\ \ \ \ \ \ | | | | | | | | | | | | | | resetAttrs now always erases This.tpe
| * | | | | | adds some comments to resetAttrsEugene Burmako2013-02-261-5/+41
| | | | | | |
| * | | | | | resetAttrs now always erases This.tpeEugene Burmako2013-02-171-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The symbol of This, if it points to a package class, isn't touched, just as usual, so that our Select(Select(Select(...))) => This(...) optimization works fine with attr reset. However the tpe is now erased, so that subsequent reflective compilation doesn't spuriously fail when seeing that some subtrees of a tree being compiled are typed. Erasing the tpe doesn't pose even a tiniest problem, because, as it can be seen in typedThis, type is trivially reconstructed from the symbol.
* | | | | | | Fix SI-7107: scala now thinks every exception is polymorphicGrzegorz Kossakowski2013-02-251-0/+3
| |_|_|_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to force info of the `cls` in `parseExceptions` because we pass `cls` to `addThrowsAnnotation` which in turn calls `Symbol.isMonomorphicType` that relies on a symbol being initialized to give right answers. In the future we should just clean up implementation of `isMonomorphicType` method to not rely on a symbol being initialized as there's no inherent reason for that in most cases. In cases where there's reason for that we should just force the initialization. This patch does not come with a test-case because it's hard to reproduce not initialized symbols in partest reliably.
* | | | | | Merge pull request #2149 from khernyo/issue/7074Grzegorz Kossakowski2013-02-251-1/+1
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | SI-7074 Fix xml attribute sorting
| * | | | | SI-7074 Fix xml attribute sortingSzabolcs Berecz2013-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sorting the attributes of an xml element could drop some of the attributes. It was caused by the incorrect use of MetaData#copy() to concatenate "smaller" with the rest of the attributes. The MetaData#copy() method is similar to the following hypothetical method on a List: def copy(other: List): List = head :: other The fix prepends all elements of "smaller" to the rest of the attributes in the proper order.
* | | | | | Merge pull request #2157 from retronym/ticket/7171James Iry2013-02-221-2/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7171 Consider prefix when assessing type finality.
| * | | | | | SI-7171 Consider prefix when assessing type finality.Jason Zaugg2013-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Type#isFinalType` determines if a type could have a non-bottom subtype. This property is exploited by the pattern matcher to flag impossible patterns. This check was ignoring the type's prefix, and incorrectly deemed that `T#A` in `trait T { final class A }` was a final type. But it could have been subtyped by `U#A` where `U` <:< `T`, or, more simply, by `T.this.A`. Now, type finality requires that the prefix is stable. The existing test cases in neg/patmat-type-check.scala still correctly flag incompatiblities. `isFinalType` is also used by some code that massages pattern matches post specialization. That is actually either broken or obsolete under virtpatmat, I've opened SI-7172 to invesigate that. It is also used by GenICode to determine whether to emit the appropriate equality checks that are correct in the face of boxing. It is possible that this change will force the slow path in some rare cases, but it won't affect correctness.
* | | | | | | Merge pull request #2120 from adriaanm/patmat-refactorAdriaan Moors2013-02-229-3862/+3951
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | refactor the pattern matcher into smaller files
| * | | | | | | please ant with filenames, add commentsAdriaan Moors2013-02-216-21/+37
| | | | | | | |
| * | | | | | | remove unused importsAdriaan Moors2013-02-157-263/+206
| | | | | | | |
| * | | | | | | [refactor] move some logic-related codeAdriaan Moors2013-02-123-352/+358
| | | | | | | |
| * | | | | | | [refactor] better name for symbolicCaseAdriaan Moors2013-02-121-16/+6
| | | | | | | |
| * | | | | | | [refactor] make hash-consing more robustAdriaan Moors2013-02-122-21/+23
| | | | | | | |
| * | | | | | | drop Cond in favor of PropAdriaan Moors2013-02-123-129/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings the optimizations and the analyses closer together. In the future we may consider using a solver in the optimizations. For now, implication is checked ad-hoc using hash-consing and equality/subset tests... NOTE: prepareNewAnalysis resets said hash-consing, so must be called before approximating a match to propositions
| * | | | | | | [refactor] prepare migration from Cond to PropAdriaan Moors2013-02-121-52/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no change in behavior. Remove `modelNull` boolean in favor of subclassing.
| * | | | | | | [refactor] type analysis consolidationAdriaan Moors2013-02-122-21/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | move instanceOfTpImplies out of CodeGen into TypeAnalysis
| * | | | | | | [refactor] move PatternMatching.scala to transform.patmatAdriaan Moors2013-02-129-3806/+4032
| | | | | | | |
| * | | | | | | re-align 2.10.x's pattern matcher with master'sAdriaan Moors2013-02-121-93/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The diff was mostly code cleanup, so most of that was propagated from master to 2.10.x. The remaining diff is encapsulated in compatibility stubs (see below). (There was also the on/off potential for the 2.10.x "new" pattern matcher. The old one is gone in 2.11, so no turning off new patmat, of course.) The stubs: ``` protected final def dealiasWiden(tp: Type) = tp.dealias // 2.11: dealiasWiden protected final def mkTRUE = CODE.TRUE_typed // 2.11: CODE.TRUE protected final def mkFALSE = CODE.FALSE_typed // 2.11: CODE.FALSE protected final def hasStableSymbol(p: Tree) = p.hasSymbol && p.symbol.isStable // 2.11: p.hasSymbolField && p.symbol.isStable protected final def devWarning(str: String) = global.debugwarn(str) // 2.11: omit ```
* | | | | | | | Merge pull request #2143 from heathermiller/docs/linearization-typoJames Iry2013-02-222-2/+2
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | Fixed error in reflection API docs about linearization order on method baseClasses
| * | | | | | | Fixed error in reflection API docs about linearization order on method ↵Heather Miller2013-02-192-2/+2
| | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | baseClasses
* | | | | | | Merge pull request #2133 from som-snytt/typos-2.10.xPaul Phillips2013-02-221-1/+1
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | | Shadowed Implict typo (fixes no issue)
| * | | | | | Shadowed Implict typo (fixes no issue)Som Snytt2013-02-161-1/+1
| | |_|/ / / | |/| | | |
* | | | | | Merge pull request #2118 from lrytz/annotatedRetypingJames Iry2013-02-191-9/+5
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Fix typing idempotency bug with Annotated trees
| * | | | | Fix typing idempotency bug with Annotated treesLukas Rytz2013-02-121-9/+5
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Merge pull request #2129 from gkossakowski/issues/SI-7130-StatisticsJames Iry2013-02-191-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Fix SI-7130: Memory leaked caused by Statistics
| * | | | | Fix SI-7130: Memory leaked caused by StatisticsGrzegorz Kossakowski2013-02-141-1/+1
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As described in the ticket, we were leaking memory by holding reference to Global through by-name argument that was captured by an instance of a class stored in global HashMap `qs`. The fix is simple: do not register quantities in HashMap unless statistics is enabled. This way, if Statistics is disabled we do not store any references. We still leak memory in case of statistics being enabled.
* | | | | Merge pull request #2136 from vigdorchik/scannersJames Iry2013-02-191-21/+13
|\ \ \ \ \ | | | | | | | | | | | | SI-7143 Fix scanner docComment production.
| * | | | | SI-7143 Fix scanner docComment: docBuffer and docPos are initializedEugene Vigdorchik2013-02-191-21/+13
| |/ / / / | | | | | | | | | | | | | | | | | | | | in different places and as a result can get out of sync and as a result the invariant that docComment has a position is broken.
* | | | | Merge pull request #2130 from vigdorchik/relax_docJames Iry2013-02-194-31/+34
|\ \ \ \ \ | | | | | | | | | | | | SI-7134: don't require doc.Settings in base api of scaladoc.
| * | | | | SI-7134: don't require doc.Settings in base api of scaladoc.Eugene Vigdorchik2013-02-154-31/+34
| |/ / / /
* | | | | Merge pull request #2131 from jozic/scaladoc-cleanupJames Iry2013-02-193-8/+8
|\ \ \ \ \ | | | | | | | | | | | | make Future scaladoc examples up-to-date and compilable