Functional: - dholmes CR: - Rename set_owner_from() to release_clear_owner_with_barrier(), drop the 'new_value' parameter and add a 'needs_fence' parameter; change logic from cmpxchg() to release_store() followed by fence() or a storeload() depending on 'needs_fence'. - Update the comments to explain why these two "Drop the lock" sites have different post release_store() barrier requirements. - eosterlund CR: - Fix FastHashCode() races with install_displaced_markword_in_object(). - rehn CR: - Dropped volatile from fields and now using Atomic ops to keep the compiler from messing with them: - ObjectMonitor::_next_om and _ref_count - Thread::om_free_list, om_free_count, om_in_use_list and om_in_use_count - Dropped volatile from global variables: - g_block_list, g_free_list, g_om_in_use_list, g_wait_list, g_om_free_count, g_om_in_use_count, g_om_population, g_om_wait_count - Dropped volatile from function parameters that were passed previously volatile fields or volatile global vars: - deflate_monitor_list() and deflate_monitor_list_using_JT() - prepend_list_to_common(), prepend_to_common(), take_from_start_of_common() - Moved global variables into ListVars struct to put them on their own cache lines (also renamed): - g_free_list -> LVars.free_list - g_om_in_use_list -> LVars.in_use_list - g_wait_list -> LVars.wait_list - g_om_free_count -> LVars.free_count - g_om_in_use_count -> LVars.in_use_count - g_om_population -> LVars.population - g_om_wait_count -> LVars.wait_count - Rename some related functions: - prepend_list_to_g_om_in_use_list() -> prepend_list_to_global_in_use_list() - prepend_list_to_g_free_list() -> prepend_list_to_global_free_list() - prepend_list_to_g_wait_list() -> prepend_list_to_global_wait_list() - take_from_start_of_g_free_list() -> take_from_start_of_global_free_list() - Make the use of (spin) locking clear instead of calling it "marking" and clean up the use of Atomic ops: - Add "#define OM_LOCK_BIT 0x1" and switch literal 0x1 uses for clarity. - Rename is_next_marked() -> is_locked(); now uses Atomic::load() instead of Atomic::load_acquire(). - Rename mark_next() -> try_om_lock(); now returns ObjectMonitor* instead of bool and drop the 'next' return parameter; now uses Atomic::load() to get the initial _next_om value. - Rename mark_next_loop() -> om_lock() and drop return of 'next' ObjectMonitor*. - set_next() now calls Atomic::store() instead of Atomic::release_store(). - Add om_unlock() to unlock an ObjectMonitor*; uses Atomic::load() to get the initial _next_om value and Atomic::store() to update. - Rename mark_list_head() -> get_list_head_locked(); now returns ObjectMonitor* instead of bool and drop the 'next' return parameter; now uses Atomic::load() to get the list head values. - unmarked_next() now calls Atomic::load() instead of Atomic::load_acquire(). - Rename mark_next_for_traversal() -> lock_next_for_traversal() and move it closer to the code that uses it. - List heads should be read with Atomic::load() and updated with Atomic::store() (when not updated with cmpxchg()). - Get rid of unnecessary OrderAccess::storestore() calls. - deflate_monitor_list_using_JT() and deflate_common_idle_monitors_using_JT() should call SafepointMechanism::should_block() instead of SafepointSynchronize::is_synchronizing(). Test update: - no changes Collateral: - eosterlund CR: - Tighten save_om_ptr() mark parameter guarantee. Cleanup: - dholmes CR: - Delete errant comments about MO_ACQ_REL and MO_SEQ_CST. - self review: - local variables that exist just for an assert() should be "#ifdef ASSERT...#endif" instead of DEBUG_ONLY(...). - correct description of AsyncDeflateIdleMonitors to "Deflate idle monitors using the ServiceThread." - rehn CR: - Add comments to ObjectMonitorHandle associated with Thread::current_pending_monitor() and Thread::current_waiting_monitor() calls to clarify why the ObjectMonitorHandle is there. - Clarify misc comments. - Revert increment of contentions to baseline's Atomic::inc() instead of Atomic::add() since we no longer care about the return value; missed that change when ref_count was added. - Separate sections in synchronizer.cpp for "Spinlock functions" and "List Management functions". Temporary: - dholmes CR: - Cleanup temporary debug code in ObjectMonitor::exit() for the "Non-balanced monitor enter/exit!" condition.