< prev index next >

src/hotspot/share/runtime/synchronizer.hpp

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 1998, 2023, 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.
--- 1,7 ---
  /*
!  * 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.

*** 90,11 ***
--- 90,22 ---
    // deoptimization at monitor exit. Hence, it does not take a Handle argument.
  
    // This is the "slow path" version of monitor enter and exit.
    static void enter(Handle obj, BasicLock* lock, JavaThread* current);
    static void exit(oop obj, BasicLock* lock, JavaThread* current);
+   // Used to enter a monitor for another thread. This requires that the
+   // locking_thread is suspended, and that entering on a potential
+   // inflated monitor may only contend with deflation. That is the obj being
+   // locked on is either already locked by the locking_thread or cannot
+   // escape the locking_thread.
+   static void enter_for(Handle obj, BasicLock* lock, JavaThread* locking_thread);
+ private:
+   // Shared implementation for enter and enter_for. Performs all but
+   // inflated monitor enter.
+   static bool enter_fast_impl(Handle obj, BasicLock* lock, JavaThread* locking_thread);
  
+ public:
    // Used only to handle jni locks or other unmatched monitor enter/exit
    // Internally they will use heavy weight monitor.
    static void jni_enter(Handle obj, JavaThread* current);
    static void jni_exit(oop obj, TRAPS);
  

*** 111,10 ***
--- 122,18 ---
    // throwing unexpected InterruptedExecutionExceptions.
    static void waitUninterruptibly(Handle obj, jlong Millis, TRAPS);
  
    // Inflate light weight monitor to heavy weight monitor
    static ObjectMonitor* inflate(Thread* current, oop obj, const InflateCause cause);
+   // Used to inflate a monitor as if it was done from the thread JavaThread.
+   static ObjectMonitor* inflate_for(JavaThread* thread, oop obj, const InflateCause cause);
+ 
+ private:
+   // Shared implementation between the different LockingMode.
+   static ObjectMonitor* inflate_impl(JavaThread* thread, oop obj, const InflateCause cause);
+ 
+ public:
    // This version is only for internal use
    static void inflate_helper(oop obj);
    static const char* inflate_cause_name(const InflateCause cause);
  
    // Returns the identity hash value for an oop

*** 191,11 ***
    static u_char* get_gvars_addr();
    static u_char* get_gvars_hc_sequence_addr();
    static size_t get_gvars_size();
    static u_char* get_gvars_stw_random_addr();
  
!   static void handle_sync_on_value_based_class(Handle obj, JavaThread* current);
  };
  
  // ObjectLocker enforces balanced locking and can never throw an
  // IllegalMonitorStateException. However, a pending exception may
  // have to pass through, and we must also be able to deal with
--- 210,11 ---
    static u_char* get_gvars_addr();
    static u_char* get_gvars_hc_sequence_addr();
    static size_t get_gvars_size();
    static u_char* get_gvars_stw_random_addr();
  
!   static void handle_sync_on_value_based_class(Handle obj, JavaThread* locking_thread);
  };
  
  // ObjectLocker enforces balanced locking and can never throw an
  // IllegalMonitorStateException. However, a pending exception may
  // have to pass through, and we must also be able to deal with
< prev index next >