983 localvariable_len, |
983 localvariable_len, |
984 checked_exceptions_len, |
984 checked_exceptions_len, |
985 IsUnsafeConc, |
985 IsUnsafeConc, |
986 CHECK_(methodHandle())); |
986 CHECK_(methodHandle())); |
987 methodHandle newm (THREAD, newm_oop); |
987 methodHandle newm (THREAD, newm_oop); |
|
988 NOT_PRODUCT(int nmsz = newm->is_parsable() ? newm->size() : -1;) |
988 int new_method_size = newm->method_size(); |
989 int new_method_size = newm->method_size(); |
989 // Create a shallow copy of methodOopDesc part, but be careful to preserve the new constMethodOop |
990 // Create a shallow copy of methodOopDesc part, but be careful to preserve the new constMethodOop |
990 constMethodOop newcm = newm->constMethod(); |
991 constMethodOop newcm = newm->constMethod(); |
|
992 NOT_PRODUCT(int ncmsz = newcm->is_parsable() ? newcm->size() : -1;) |
991 int new_const_method_size = newm->constMethod()->object_size(); |
993 int new_const_method_size = newm->constMethod()->object_size(); |
992 |
994 |
993 memcpy(newm(), m(), sizeof(methodOopDesc)); |
995 memcpy(newm(), m(), sizeof(methodOopDesc)); |
994 // Create shallow copy of constMethodOopDesc, but be careful to preserve the methodOop |
996 // Create shallow copy of constMethodOopDesc, but be careful to preserve the methodOop |
995 // is_conc_safe is set to false because that is the value of |
997 // is_conc_safe is set to false because that is the value of |
997 // not overwrite that value. During the window during which it is |
999 // not overwrite that value. During the window during which it is |
998 // tagged as unsafe, some extra work could be needed during precleaning |
1000 // tagged as unsafe, some extra work could be needed during precleaning |
999 // or concurrent marking but those phases will be correct. Setting and |
1001 // or concurrent marking but those phases will be correct. Setting and |
1000 // resetting is done in preference to a careful copying into newcm to |
1002 // resetting is done in preference to a careful copying into newcm to |
1001 // avoid having to know the precise layout of a constMethodOop. |
1003 // avoid having to know the precise layout of a constMethodOop. |
1002 m->constMethod()->set_is_conc_safe(false); |
1004 m->constMethod()->set_is_conc_safe(oopDesc::IsUnsafeConc); |
|
1005 assert(m->constMethod()->is_parsable(), "Should remain parsable"); |
|
1006 |
|
1007 // NOTE: this is a reachable object that transiently signals "conc_unsafe" |
|
1008 // However, no allocations are done during this window |
|
1009 // during which it is tagged conc_unsafe, so we are assured that any concurrent |
|
1010 // thread will not wait forever for the object to revert to "conc_safe". |
|
1011 // Further, any such conc_unsafe object will indicate a stable size |
|
1012 // through the transition. |
1003 memcpy(newcm, m->constMethod(), sizeof(constMethodOopDesc)); |
1013 memcpy(newcm, m->constMethod(), sizeof(constMethodOopDesc)); |
1004 m->constMethod()->set_is_conc_safe(true); |
1014 m->constMethod()->set_is_conc_safe(oopDesc::IsSafeConc); |
|
1015 assert(m->constMethod()->is_parsable(), "Should remain parsable"); |
|
1016 |
1005 // Reset correct method/const method, method size, and parameter info |
1017 // Reset correct method/const method, method size, and parameter info |
1006 newcm->set_method(newm()); |
1018 newcm->set_method(newm()); |
1007 newm->set_constMethod(newcm); |
1019 newm->set_constMethod(newcm); |
1008 assert(newcm->method() == newm(), "check"); |
1020 assert(newcm->method() == newm(), "check"); |
1009 newm->constMethod()->set_code_size(new_code_length); |
1021 newm->constMethod()->set_code_size(new_code_length); |
1033 localvariable_len * sizeof(LocalVariableTableElement)); |
1045 localvariable_len * sizeof(LocalVariableTableElement)); |
1034 } |
1046 } |
1035 |
1047 |
1036 // Only set is_conc_safe to true when changes to newcm are |
1048 // Only set is_conc_safe to true when changes to newcm are |
1037 // complete. |
1049 // complete. |
|
1050 assert(!newm->is_parsable() || nmsz < 0 || newm->size() == nmsz, "newm->size() inconsistency"); |
|
1051 assert(!newcm->is_parsable() || ncmsz < 0 || newcm->size() == ncmsz, "newcm->size() inconsistency"); |
1038 newcm->set_is_conc_safe(true); |
1052 newcm->set_is_conc_safe(true); |
1039 return newm; |
1053 return newm; |
1040 } |
1054 } |
1041 |
1055 |
1042 vmSymbols::SID methodOopDesc::klass_id_for_intrinsics(klassOop holder) { |
1056 vmSymbols::SID methodOopDesc::klass_id_for_intrinsics(klassOop holder) { |