< prev index next >
src/hotspot/share/classfile/verifier.hpp
Print this page
rev 54022 : 8220366: Optimize Symbol handling in ClassVerifier and SignatureStream
Reviewed-by: TBD
@@ -248,10 +248,12 @@
// A new instance of this class is created for each class being verified
class ClassVerifier : public StackObj {
private:
Thread* _thread;
+
+ Symbol* _previous_symbol; // cache of the previously looked up symbol
GrowableArray<Symbol*>* _symbols; // keep a list of symbols created
Symbol* _exception_type;
char* _message;
@@ -409,16 +411,22 @@
// their reference counts need to be decremented when the verifier object
// goes out of scope. Since these symbols escape the scope in which they're
// 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.
+ if (s == _previous_symbol) {
+ return s;
+ }
+ if (!s->is_permanent()) {
s->increment_refcount();
+ if (_symbols == NULL) {
+ _symbols = new GrowableArray<Symbol*>(50, 0, NULL);
+ }
_symbols->push(s);
+ }
+ _previous_symbol = s;
return s;
}
TypeOrigin ref_ctx(const char* str, TRAPS);
< prev index next >