< prev index next >

src/hotspot/share/runtime/objectMonitor.inline.hpp

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 1998, 2024, 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -100,10 +100,16 @@
  // Add value to the contentions field.
  inline void ObjectMonitor::add_to_contentions(int value) {
    Atomic::add(&_contentions, value);
  }
  
+ inline void ObjectMonitor::set_recursions(size_t recursions) {
+   assert(_recursions == 0, "must be");
+   assert(has_owner(), "must be owned");
+   _recursions = checked_cast<intx>(recursions);
+ }
+ 
  // Clear _owner field; current value must match old_value.
  inline void ObjectMonitor::release_clear_owner(void* old_value) {
  #ifdef ASSERT
    void* prev = Atomic::load(&_owner);
    assert(prev == old_value, "unexpected prev owner=" INTPTR_FORMAT
< prev index next >