Skip to content

Commit

Permalink
8347431: Update ObjectMonitor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
coleenp committed Jan 10, 2025
1 parent a77ed30 commit c5f1ee6
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/hotspot/share/runtime/objectMonitor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -84,12 +84,6 @@ class ObjectWaiter : public CHeapObj<mtThread> {
//
// ObjectMonitor Layout Overview/Highlights/Restrictions:
//
// - The _metadata field must be at offset 0 because the displaced header
// from markWord is stored there. We do not want markWord.hpp to include
// ObjectMonitor.hpp to avoid exposing ObjectMonitor everywhere. This
// means that ObjectMonitor cannot inherit from any other class nor can
// it use any virtual member functions. This restriction is critical to
// the proper functioning of the VM.
// - The _metadata and _owner fields should be separated by enough space
// to avoid false sharing due to parallel access by different threads.
// This is an advisory recommendation.
Expand Down Expand Up @@ -117,11 +111,7 @@ class ObjectWaiter : public CHeapObj<mtThread> {
//
// - See TEST_VM(ObjectMonitor, sanity) gtest for how critical restrictions are
// enforced.
// - Adjacent ObjectMonitors should be separated by enough space to avoid
// false sharing. This is handled by the ObjectMonitor allocation code
// in synchronizer.cpp. Also see TEST_VM(SynchronizerTest, sanity) gtest.
//
// Futures notes:
// - Separating _owner from the <remaining_fields> by enough space to
// avoid false sharing might be profitable. Given that the CAS in
// monitorenter will invalidate the line underlying _owner. We want
Expand Down Expand Up @@ -151,7 +141,7 @@ class ObjectMonitor : public CHeapObj<mtObjectMonitor> {
// ParkEvent of unblocker thread.
static ParkEvent* _vthread_unparker_ParkEvent;

// The sync code expects the metadata field to be at offset zero (0).
// Because of frequent access, the the metadata field is at offset zero (0).
// Enforced by the assert() in metadata_addr().
// * LM_LIGHTWEIGHT with UseObjectMonitorTable:
// Contains the _object's hashCode.
Expand Down

0 comments on commit c5f1ee6

Please sign in to comment.