comparison src/share/vm/runtime/objectMonitor.cpp @ 7629:22ba8c8ce6a6

8004902: correctness fixes motivated by contended locking work (6607129) Summary: misc correctness fixes Reviewed-by: acorn, dholmes, dice, sspitsyn Contributed-by: dave.dice@oracle.com
author dcubed
date Tue, 22 Jan 2013 05:56:42 -0800
parents f34d701e952e
children 746b070f5022
comparison
equal deleted inserted replaced
7628:f3184f32ce0b 7629:22ba8c8ce6a6
1 /* 1 /*
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
651 if (_succ == Self) _succ = NULL ; 651 if (_succ == Self) _succ = NULL ;
652 652
653 assert (_succ != Self, "invariant") ; 653 assert (_succ != Self, "invariant") ;
654 if (_Responsible == Self) { 654 if (_Responsible == Self) {
655 _Responsible = NULL ; 655 _Responsible = NULL ;
656 // Dekker pivot-point. 656 OrderAccess::fence(); // Dekker pivot-point
657 // Consider OrderAccess::storeload() here
658 657
659 // We may leave threads on cxq|EntryList without a designated 658 // We may leave threads on cxq|EntryList without a designated
660 // "Responsible" thread. This is benign. When this thread subsequently 659 // "Responsible" thread. This is benign. When this thread subsequently
661 // exits the monitor it can "see" such preexisting "old" threads -- 660 // exits the monitor it can "see" such preexisting "old" threads --
662 // threads that arrived on the cxq|EntryList before the fence, above -- 661 // threads that arrived on the cxq|EntryList before the fence, above --
672 // ST cxq=nonnull; MEMBAR; LD Responsible (in enter prolog) 671 // ST cxq=nonnull; MEMBAR; LD Responsible (in enter prolog)
673 // The (ST cxq; MEMBAR) is accomplished with CAS(). 672 // The (ST cxq; MEMBAR) is accomplished with CAS().
674 // 673 //
675 // The MEMBAR, above, prevents the LD of cxq|EntryList in the subsequent 674 // The MEMBAR, above, prevents the LD of cxq|EntryList in the subsequent
676 // exit operation from floating above the ST Responsible=null. 675 // exit operation from floating above the ST Responsible=null.
677 //
678 // In *practice* however, EnterI() is always followed by some atomic
679 // operation such as the decrement of _count in ::enter(). Those atomics
680 // obviate the need for the explicit MEMBAR, above.
681 } 676 }
682 677
683 // We've acquired ownership with CAS(). 678 // We've acquired ownership with CAS().
684 // CAS is serializing -- it has MEMBAR/FENCE-equivalent semantics. 679 // CAS is serializing -- it has MEMBAR/FENCE-equivalent semantics.
685 // But since the CAS() this thread may have also stored into _succ, 680 // But since the CAS() this thread may have also stored into _succ,