1.1 --- a/src/share/vm/oops/methodOop.cpp Thu Mar 13 05:40:44 2008 -0700 1.2 +++ b/src/share/vm/oops/methodOop.cpp Thu Mar 13 14:17:48 2008 -0700 1.3 @@ -765,6 +765,28 @@ 1.4 } 1.5 1.6 1.7 +// give advice about whether this methodOop should be cached or not 1.8 +bool methodOopDesc::should_not_be_cached() const { 1.9 + if (is_old()) { 1.10 + // This method has been redefined. It is either EMCP or obsolete 1.11 + // and we don't want to cache it because that would pin the method 1.12 + // down and prevent it from being collectible if and when it 1.13 + // finishes executing. 1.14 + return true; 1.15 + } 1.16 + 1.17 + if (mark()->should_not_be_cached()) { 1.18 + // It is either not safe or not a good idea to cache this 1.19 + // method at this time because of the state of the embedded 1.20 + // markOop. See markOop.cpp for the gory details. 1.21 + return true; 1.22 + } 1.23 + 1.24 + // caching this method should be just fine 1.25 + return false; 1.26 +} 1.27 + 1.28 + 1.29 methodHandle methodOopDesc:: clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length, 1.30 u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS) { 1.31 // Code below does not work for native methods - they should never get rewritten anyway