8003635: NPG: AsynchGetCallTrace broken by Method* virtual call

Make metaspace::contains be lock free and used to see if something is in metaspace, also compare Method* with vtbl pointer.

Reviewed-by: dholmes, sspitsyn, dcubed, jmasa
This commit is contained in:
Coleen Phillimore 2012-11-28 17:50:21 -05:00
parent 696ef20cb4
commit 6538c5134b
14 changed files with 60 additions and 80 deletions

View file

@ -242,36 +242,6 @@ oop CollectedHeap::array_allocate_nozero(KlassHandle klass,
return (oop)obj;
}
// Returns "TRUE" if "p" is a method oop in the
// current heap with high probability. NOTE: The main
// current consumers of this interface are Forte::
// and ThreadProfiler::. In these cases, the
// interpreter frame from which "p" came, may be
// under construction when sampled asynchronously, so
// the clients want to check that it represents a
// valid method before using it. Nonetheless since
// the clients do not typically lock out GC, the
// predicate is_valid_method() is not stable, so
// it is possible that by the time "p" is used, it
// is no longer valid.
inline bool CollectedHeap::is_valid_method(Method* p) const {
return
p != NULL &&
// Check whether "method" is metadata
p->is_metadata() &&
// See if GC is active; however, there is still an
// apparently unavoidable window after this call
// and before the client of this interface uses "p".
// If the client chooses not to lock out GC, then
// it's a risk the client must accept.
!is_gc_active() &&
// Check that p is a Method*.
p->is_method();
}
inline void CollectedHeap::oop_iterate_no_header(OopClosure* cl) {
NoHeaderExtendedOopClosure no_header_cl(cl);
oop_iterate(&no_header_cl);