8247281: migrate ObjectMonitor::_object to OopStorage

Co-authored-by: Erik Österlund <erik.osterlund@oracle.com>
Co-authored-by: Daniel Daugherty <daniel.daugherty@oracle.com>
Reviewed-by: eosterlund, coleenp, dholmes, stefank, kbarrett, rkennke, sspitsyn
This commit is contained in:
Daniel D. Daugherty 2020-09-21 22:12:07 +00:00
parent f800af978c
commit d8921ed573
37 changed files with 211 additions and 344 deletions

View file

@ -28,6 +28,7 @@
#include "memory/allocation.hpp"
#include "memory/padded.hpp"
#include "oops/markWord.hpp"
#include "oops/weakHandle.hpp"
#include "runtime/os.hpp"
#include "runtime/park.hpp"
#include "runtime/perfData.hpp"
@ -132,14 +133,17 @@ class ObjectMonitor {
friend class VMStructs;
JVMCI_ONLY(friend class JVMCIVMStructs;)
static OopStorage* _oop_storage;
// The sync code expects the header field to be at offset zero (0).
// Enforced by the assert() in header_addr().
volatile markWord _header; // displaced object header word - mark
void* volatile _object; // backward object pointer - strong root
WeakHandle _object; // backward object pointer
typedef enum {
Free = 0, // Free must be 0 for monitor to be free after memset(..,0,..).
New,
Old
Old,
ChainMarker
} AllocationState;
AllocationState _allocation_state;
// Separate _header and _owner on different cache lines since both can
@ -148,7 +152,7 @@ class ObjectMonitor {
// change until deflation so _object and _allocation_state are good
// choices to share the cache line with _header.
DEFINE_PAD_MINUS_SIZE(0, OM_CACHE_LINE_SIZE, sizeof(volatile markWord) +
sizeof(void* volatile) + sizeof(AllocationState));
sizeof(WeakHandle) + sizeof(AllocationState));
// Used by async deflation as a marker in the _owner field:
#define DEFLATER_MARKER reinterpret_cast<void*>(-1)
void* volatile _owner; // pointer to owning thread OR BasicLock
@ -329,6 +333,7 @@ class ObjectMonitor {
public:
oop object() const;
oop object_peek() const;
oop* object_addr();
void set_object(oop obj);
void release_set_allocation_state(AllocationState s);
@ -338,6 +343,7 @@ class ObjectMonitor {
bool is_free() const;
bool is_old() const;
bool is_new() const;
bool is_chainmarker() const;
// Returns true if the specified thread owns the ObjectMonitor. Otherwise
// returns false and throws IllegalMonitorStateException (IMSE).