diff -r 2ab55d39fb5b -r 829bf950287e src/hotspot/share/classfile/verifier.hpp --- a/src/hotspot/share/classfile/verifier.hpp Wed Mar 13 22:05:09 2019 -0700 +++ b/src/hotspot/share/classfile/verifier.hpp Thu Mar 14 18:56:25 2019 +0100 @@ -250,6 +250,8 @@ class ClassVerifier : public StackObj { private: Thread* _thread; + + Symbol* _previous_symbol; // cache of the previously looked up symbol GrowableArray* _symbols; // keep a list of symbols created Symbol* _exception_type; @@ -411,12 +413,18 @@ // created, we can't use a TempNewSymbol. Symbol* create_temporary_symbol(const Symbol* s, int begin, int end, TRAPS); Symbol* create_temporary_symbol(const char *s, int length, TRAPS); - Symbol* create_temporary_symbol(Symbol* s) { - // This version just updates the reference count and saves the symbol to be - // dereferenced later. - s->increment_refcount(); - _symbols->push(s); + if (s == _previous_symbol) { + return s; + } + if (!s->is_permanent()) { + s->increment_refcount(); + if (_symbols == NULL) { + _symbols = new GrowableArray(50, 0, NULL); + } + _symbols->push(s); + } + _previous_symbol = s; return s; }