src/hotspot/share/classfile/verifier.hpp
changeset 54847 59ea39bb2809
parent 54308 1dcacbe612ae
equal deleted inserted replaced
54846:e4049522b074 54847:59ea39bb2809
   444   void set_method_signatures_table(method_signatures_table_type* method_signatures_table) {
   444   void set_method_signatures_table(method_signatures_table_type* method_signatures_table) {
   445     _method_signatures_table = method_signatures_table;
   445     _method_signatures_table = method_signatures_table;
   446   }
   446   }
   447 
   447 
   448   int change_sig_to_verificationType(
   448   int change_sig_to_verificationType(
   449     SignatureStream* sig_type, VerificationType* inference_type, TRAPS);
   449     SignatureStream* sig_type, VerificationType* inference_type);
   450 
   450 
   451   VerificationType cp_index_to_type(int index, const constantPoolHandle& cp, TRAPS) {
   451   VerificationType cp_index_to_type(int index, const constantPoolHandle& cp, TRAPS) {
   452     return VerificationType::reference_type(cp->klass_name_at(index));
   452     return VerificationType::reference_type(cp->klass_name_at(index));
   453   }
   453   }
   454 
   454 
   455   // Keep a list of temporary symbols created during verification because
   455   // Keep a list of temporary symbols created during verification because
   456   // their reference counts need to be decremented when the verifier object
   456   // their reference counts need to be decremented when the verifier object
   457   // goes out of scope.  Since these symbols escape the scope in which they're
   457   // goes out of scope.  Since these symbols escape the scope in which they're
   458   // created, we can't use a TempNewSymbol.
   458   // created, we can't use a TempNewSymbol.
   459   Symbol* create_temporary_symbol(const Symbol* s, int begin, int end, TRAPS);
   459   Symbol* create_temporary_symbol(const Symbol* s, int begin, int end);
   460   Symbol* create_temporary_symbol(const char *s, int length, TRAPS);
   460   Symbol* create_temporary_symbol(const char *s, int length);
   461   Symbol* create_temporary_symbol(Symbol* s) {
   461   Symbol* create_temporary_symbol(Symbol* s) {
   462     if (s == _previous_symbol) {
   462     if (s == _previous_symbol) {
   463       return s;
   463       return s;
   464     }
   464     }
   465     if (!s->is_permanent()) {
   465     if (!s->is_permanent()) {
   471     }
   471     }
   472     _previous_symbol = s;
   472     _previous_symbol = s;
   473     return s;
   473     return s;
   474   }
   474   }
   475 
   475 
   476   TypeOrigin ref_ctx(const char* str, TRAPS);
   476   TypeOrigin ref_ctx(const char* str);
   477 
   477 
   478 };
   478 };
   479 
   479 
   480 inline int ClassVerifier::change_sig_to_verificationType(
   480 inline int ClassVerifier::change_sig_to_verificationType(
   481     SignatureStream* sig_type, VerificationType* inference_type, TRAPS) {
   481     SignatureStream* sig_type, VerificationType* inference_type) {
   482   BasicType bt = sig_type->type();
   482   BasicType bt = sig_type->type();
   483   switch (bt) {
   483   switch (bt) {
   484     case T_OBJECT:
   484     case T_OBJECT:
   485     case T_ARRAY:
   485     case T_ARRAY:
   486       {
   486       {
   487         Symbol* name = sig_type->as_symbol(CHECK_0);
   487         Symbol* name = sig_type->as_symbol();
   488         // Create another symbol to save as signature stream unreferences this symbol.
   488         // Create another symbol to save as signature stream unreferences this symbol.
   489         Symbol* name_copy = create_temporary_symbol(name);
   489         Symbol* name_copy = create_temporary_symbol(name);
   490         assert(name_copy == name, "symbols don't match");
   490         assert(name_copy == name, "symbols don't match");
   491         *inference_type =
   491         *inference_type =
   492           VerificationType::reference_type(name_copy);
   492           VerificationType::reference_type(name_copy);