diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-07-14 17:28:13 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-07-14 17:28:13 +0200 |
commit | b2f64b6d22c7c39de5f5dff6d55c226de6ee9e86 (patch) | |
tree | a72948af7d3df250381a3c5ab653d5aa3890f00e /src | |
parent | 74c2e2326f6a68a889347ef3052d88a586aca84f (diff) | |
download | dotty-b2f64b6d22c7c39de5f5dff6d55c226de6ee9e86.tar.gz dotty-b2f64b6d22c7c39de5f5dff6d55c226de6ee9e86.tar.bz2 dotty-b2f64b6d22c7c39de5f5dff6d55c226de6ee9e86.zip |
Fix StackOverflow in Names.rehash
Testing suite of specialization is creating huge amount of names,
that triggered a StackOverflow in non-tail-recursive method.
Not rehash is tail-recursive.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/Names.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Names.scala b/src/dotty/tools/dotc/core/Names.scala index 1ee56fe1c..3ff10598d 100644 --- a/src/dotty/tools/dotc/core/Names.scala +++ b/src/dotty/tools/dotc/core/Names.scala @@ -268,10 +268,11 @@ object Names { /** Rehash chain of names */ def rehash(name: TermName): Unit = if (name != null) { - rehash(name.next) + val oldNext = name.next val h = hashValue(chrs, name.start, name.length) & (table.size - 1) name.next = table(h) table(h) = name + rehash(oldNext) } /** Make sure the hash table is large enough for the given load factor */ |