248 |
248 |
249 // A new instance of this class is created for each class being verified |
249 // A new instance of this class is created for each class being verified |
250 class ClassVerifier : public StackObj { |
250 class ClassVerifier : public StackObj { |
251 private: |
251 private: |
252 Thread* _thread; |
252 Thread* _thread; |
|
253 |
|
254 Symbol* _previous_symbol; // cache of the previously looked up symbol |
253 GrowableArray<Symbol*>* _symbols; // keep a list of symbols created |
255 GrowableArray<Symbol*>* _symbols; // keep a list of symbols created |
254 |
256 |
255 Symbol* _exception_type; |
257 Symbol* _exception_type; |
256 char* _message; |
258 char* _message; |
257 |
259 |
409 // their reference counts need to be decremented when the verifier object |
411 // their reference counts need to be decremented when the verifier object |
410 // goes out of scope. Since these symbols escape the scope in which they're |
412 // goes out of scope. Since these symbols escape the scope in which they're |
411 // created, we can't use a TempNewSymbol. |
413 // created, we can't use a TempNewSymbol. |
412 Symbol* create_temporary_symbol(const Symbol* s, int begin, int end, TRAPS); |
414 Symbol* create_temporary_symbol(const Symbol* s, int begin, int end, TRAPS); |
413 Symbol* create_temporary_symbol(const char *s, int length, TRAPS); |
415 Symbol* create_temporary_symbol(const char *s, int length, TRAPS); |
414 |
|
415 Symbol* create_temporary_symbol(Symbol* s) { |
416 Symbol* create_temporary_symbol(Symbol* s) { |
416 // This version just updates the reference count and saves the symbol to be |
417 if (s == _previous_symbol) { |
417 // dereferenced later. |
418 return s; |
418 s->increment_refcount(); |
419 } |
419 _symbols->push(s); |
420 if (!s->is_permanent()) { |
|
421 s->increment_refcount(); |
|
422 if (_symbols == NULL) { |
|
423 _symbols = new GrowableArray<Symbol*>(50, 0, NULL); |
|
424 } |
|
425 _symbols->push(s); |
|
426 } |
|
427 _previous_symbol = s; |
420 return s; |
428 return s; |
421 } |
429 } |
422 |
430 |
423 TypeOrigin ref_ctx(const char* str, TRAPS); |
431 TypeOrigin ref_ctx(const char* str, TRAPS); |
424 |
432 |