From c5f1ee61a1a26f9be32191d12db67ac53c6be170 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 10 Jan 2025 16:17:56 +0000 Subject: [PATCH] 8347431: Update ObjectMonitor comments --- src/hotspot/share/runtime/objectMonitor.hpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/hotspot/share/runtime/objectMonitor.hpp b/src/hotspot/share/runtime/objectMonitor.hpp index cf364cc012d39..3e1c97442cc09 100644 --- a/src/hotspot/share/runtime/objectMonitor.hpp +++ b/src/hotspot/share/runtime/objectMonitor.hpp @@ -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 @@ -84,12 +84,6 @@ class ObjectWaiter : public CHeapObj { // // 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. @@ -117,11 +111,7 @@ class ObjectWaiter : public CHeapObj { // // - 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 by enough space to // avoid false sharing might be profitable. Given that the CAS in // monitorenter will invalidate the line underlying _owner. We want @@ -151,7 +141,7 @@ class ObjectMonitor : public CHeapObj { // 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.