summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/Scopes.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2012-07-12 17:25:17 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-07-14 12:09:31 +0200
commit0e3c70f2ab7f8b03cd157749f50cc301971cef03 (patch)
treea45c8dd107b53a434b9dcd12c0c7d297fbf56223 /src/reflect/scala/reflect/internal/Scopes.scala
parent41f4497cc57f5e010df10a9f5a98c9815c1c36fd (diff)
downloadscala-0e3c70f2ab7f8b03cd157749f50cc301971cef03.tar.gz
scala-0e3c70f2ab7f8b03cd157749f50cc301971cef03.tar.bz2
scala-0e3c70f2ab7f8b03cd157749f50cc301971cef03.zip
Attempt #3 to optimize findMember
Fixed fingerPrinting scheme to work with rehashes, also added finger prints to typedIdent searches.
Diffstat (limited to 'src/reflect/scala/reflect/internal/Scopes.scala')
-rw-r--r--src/reflect/scala/reflect/internal/Scopes.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/Scopes.scala b/src/reflect/scala/reflect/internal/Scopes.scala
index 939cd556a6..89e3c52de6 100644
--- a/src/reflect/scala/reflect/internal/Scopes.scala
+++ b/src/reflect/scala/reflect/internal/Scopes.scala
@@ -41,15 +41,15 @@ trait Scopes extends api.Scopes { self: SymbolTable =>
* This is necessary because when run from reflection every scope needs to have a
* SynchronizedScope as mixin.
*/
- class Scope protected[Scopes] (initElems: ScopeEntry = null) extends Iterable[Symbol] {
+ class Scope protected[Scopes] (initElems: ScopeEntry = null, initFingerPrints: Long = 0L) extends Iterable[Symbol] {
/** A bitset containing the last 6 bits of the start value of every name
* stored in this scope.
*/
- var fingerPrints: Long = 0L
+ var fingerPrints: Long = initFingerPrints
protected[Scopes] def this(base: Scope) = {
- this(base.elems)
+ this(base.elems, base.fingerPrints)
nestinglevel = base.nestinglevel + 1
}
@@ -119,7 +119,7 @@ trait Scopes extends api.Scopes { self: SymbolTable =>
* @param sym ...
*/
def enter[T <: Symbol](sym: T): T = {
- fingerPrints |= (1L << sym.name.start)
+ fingerPrints |= sym.name.fingerPrint
enterEntry(newScopeEntry(sym, this))
sym
}
@@ -156,6 +156,7 @@ trait Scopes extends api.Scopes { self: SymbolTable =>
}
def rehash(sym: Symbol, newname: Name) {
+ fingerPrints |= newname.fingerPrint
if (hashtable ne null) {
val index = sym.name.start & HASHMASK
var e1 = hashtable(index)