src/share/vm/oops/methodOop.cpp

Print this page




1065   m->constMethod()->set_is_conc_safe(oopDesc::IsUnsafeConc);
1066   assert(m->constMethod()->is_parsable(), "Should remain parsable");
1067 
1068   // NOTE: this is a reachable object that transiently signals "conc_unsafe"
1069   // However, no allocations are done during this window
1070   // during which it is tagged conc_unsafe, so we are assured that any concurrent
1071   // thread will not wait forever for the object to revert to "conc_safe".
1072   // Further, any such conc_unsafe object will indicate a stable size
1073   // through the transition.
1074   memcpy(newcm, m->constMethod(), sizeof(constMethodOopDesc));
1075   m->constMethod()->set_is_conc_safe(oopDesc::IsSafeConc);
1076   assert(m->constMethod()->is_parsable(), "Should remain parsable");
1077 
1078   // Reset correct method/const method, method size, and parameter info
1079   newm->set_constMethod(newcm);
1080   newm->constMethod()->set_code_size(new_code_length);
1081   newm->constMethod()->set_constMethod_size(new_const_method_size);
1082   newm->set_method_size(new_method_size);
1083   assert(newm->code_size() == new_code_length, "check");
1084   assert(newm->checked_exceptions_length() == checked_exceptions_len, "check");

1085   assert(newm->localvariable_table_length() == localvariable_len, "check");
1086   // Copy new byte codes
1087   memcpy(newm->code_base(), new_code, new_code_length);
1088   // Copy line number table
1089   if (new_compressed_linenumber_size > 0) {
1090     memcpy(newm->compressed_linenumber_table(),
1091            new_compressed_linenumber_table,
1092            new_compressed_linenumber_size);
1093   }
1094   // Copy checked_exceptions
1095   if (checked_exceptions_len > 0) {
1096     memcpy(newm->checked_exceptions_start(),
1097            m->checked_exceptions_start(),
1098            checked_exceptions_len * sizeof(CheckedExceptionElement));
1099   }






1100   // Copy local variable number table
1101   if (localvariable_len > 0) {
1102     memcpy(newm->localvariable_table_start(),
1103            m->localvariable_table_start(),
1104            localvariable_len * sizeof(LocalVariableTableElement));
1105   }
1106 
1107   // Only set is_conc_safe to true when changes to newcm are
1108   // complete.
1109   assert(!newm->is_parsable()  || nmsz  < 0 || newm->size()  == nmsz,  "newm->size()  inconsistency");
1110   assert(!newcm->is_parsable() || ncmsz < 0 || newcm->size() == ncmsz, "newcm->size() inconsistency");
1111   newcm->set_is_conc_safe(true);
1112   return newm;
1113 }
1114 
1115 vmSymbols::SID methodOopDesc::klass_id_for_intrinsics(klassOop holder) {
1116   // if loader is not the default loader (i.e., != NULL), we can't know the intrinsics
1117   // because we are not loading from core libraries
1118   if (instanceKlass::cast(holder)->class_loader() != NULL)
1119     return vmSymbols::NO_SID;   // regardless of name, no intrinsics here




1065   m->constMethod()->set_is_conc_safe(oopDesc::IsUnsafeConc);
1066   assert(m->constMethod()->is_parsable(), "Should remain parsable");
1067 
1068   // NOTE: this is a reachable object that transiently signals "conc_unsafe"
1069   // However, no allocations are done during this window
1070   // during which it is tagged conc_unsafe, so we are assured that any concurrent
1071   // thread will not wait forever for the object to revert to "conc_safe".
1072   // Further, any such conc_unsafe object will indicate a stable size
1073   // through the transition.
1074   memcpy(newcm, m->constMethod(), sizeof(constMethodOopDesc));
1075   m->constMethod()->set_is_conc_safe(oopDesc::IsSafeConc);
1076   assert(m->constMethod()->is_parsable(), "Should remain parsable");
1077 
1078   // Reset correct method/const method, method size, and parameter info
1079   newm->set_constMethod(newcm);
1080   newm->constMethod()->set_code_size(new_code_length);
1081   newm->constMethod()->set_constMethod_size(new_const_method_size);
1082   newm->set_method_size(new_method_size);
1083   assert(newm->code_size() == new_code_length, "check");
1084   assert(newm->checked_exceptions_length() == checked_exceptions_len, "check");
1085   assert(newm->exception_table_length() == exception_table_len, "check");
1086   assert(newm->localvariable_table_length() == localvariable_len, "check");
1087   // Copy new byte codes
1088   memcpy(newm->code_base(), new_code, new_code_length);
1089   // Copy line number table
1090   if (new_compressed_linenumber_size > 0) {
1091     memcpy(newm->compressed_linenumber_table(),
1092            new_compressed_linenumber_table,
1093            new_compressed_linenumber_size);
1094   }
1095   // Copy checked_exceptions
1096   if (checked_exceptions_len > 0) {
1097     memcpy(newm->checked_exceptions_start(),
1098            m->checked_exceptions_start(),
1099            checked_exceptions_len * sizeof(CheckedExceptionElement));
1100   }
1101   // Copy exception table
1102   if (exception_table_len > 0) {
1103     memcpy(newm->exception_table_start(),
1104            m->exception_table_start(),
1105            exception_table_len * sizeof(ExceptionTableElement));
1106   }
1107   // Copy local variable number table
1108   if (localvariable_len > 0) {
1109     memcpy(newm->localvariable_table_start(),
1110            m->localvariable_table_start(),
1111            localvariable_len * sizeof(LocalVariableTableElement));
1112   }
1113 
1114   // Only set is_conc_safe to true when changes to newcm are
1115   // complete.
1116   assert(!newm->is_parsable()  || nmsz  < 0 || newm->size()  == nmsz,  "newm->size()  inconsistency");
1117   assert(!newcm->is_parsable() || ncmsz < 0 || newcm->size() == ncmsz, "newcm->size() inconsistency");
1118   newcm->set_is_conc_safe(true);
1119   return newm;
1120 }
1121 
1122 vmSymbols::SID methodOopDesc::klass_id_for_intrinsics(klassOop holder) {
1123   // if loader is not the default loader (i.e., != NULL), we can't know the intrinsics
1124   // because we are not loading from core libraries
1125   if (instanceKlass::cast(holder)->class_loader() != NULL)
1126     return vmSymbols::NO_SID;   // regardless of name, no intrinsics here