Mercurial > hg > truffle
diff src/share/vm/oops/methodOop.cpp @ 48:d8b3ef7ee3e5
6599425: 4/3 OopMapCache::lookup() can cause later crash or assert() failure
Summary: Add should_not_be_cached() to markOop and methodOop and query that status inOopMapCache::lookup()
Reviewed-by: coleenp, sspitsyn, jmasa
author | dcubed |
---|---|
date | Wed, 12 Mar 2008 18:07:46 -0700 |
parents | a61af66fc99e |
children | 541929da62d2 |
line wrap: on
line diff
--- a/src/share/vm/oops/methodOop.cpp Wed Mar 12 18:06:50 2008 -0700 +++ b/src/share/vm/oops/methodOop.cpp Wed Mar 12 18:07:46 2008 -0700 @@ -765,6 +765,28 @@ } +// give advice about whether this methodOop should be cached or not +bool methodOopDesc::should_not_be_cached() const { + if (is_old()) { + // This method has been redefined. It is either EMCP or obsolete + // and we don't want to cache it because that would pin the method + // down and prevent it from being collectible if and when it + // finishes executing. + return true; + } + + if (mark()->should_not_be_cached()) { + // It is either not safe or not a good idea to cache this + // method at this time because of the state of the embedded + // markOop. See markOop.cpp for the gory details. + return true; + } + + // caching this method should be just fine + return false; +} + + methodHandle methodOopDesc:: clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length, u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS) { // Code below does not work for native methods - they should never get rewritten anyway