< prev index next >
src/share/vm/oops/constantPool.cpp
Print this page
rev 6875 : 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
Reviewed-by: mgerdin, coleenp, bdelsart
@@ -1815,15 +1815,26 @@
#undef DBG
void ConstantPool::set_on_stack(const bool value) {
if (value) {
- _flags |= _on_stack;
+ int old_flags = *const_cast<volatile int *>(&_flags);
+ while ((old_flags & _on_stack) == 0) {
+ int new_flags = old_flags | _on_stack;
+ int result = Atomic::cmpxchg(new_flags, &_flags, old_flags);
+
+ if (result == old_flags) {
+ // Succeeded.
+ MetadataOnStackMark::record(this, Thread::current());
+ return;
+ }
+ old_flags = result;
+ }
} else {
+ // Clearing is done single-threadedly.
_flags &= ~_on_stack;
}
- if (value) MetadataOnStackMark::record(this);
}
// JSR 292 support for patching constant pool oops after the class is linked and
// the oop array for resolved references are created.
// We can't do this during classfile parsing, which is how the other indexes are
< prev index next >