RFR: 8212827: GlobalCounter should support nested critical sections
Kim Barrett
kim.barrett at oracle.com
Fri Oct 26 20:16:12 UTC 2018
> On Oct 26, 2018, at 4:06 AM, Robbin Ehn <robbin.ehn at oracle.com> wrote:
> I would like the return value here:
> inline uintx GlobalCounter::critical_section_begin(Thread *thread) {
> And thus the parameter here:
> 46 inline void GlobalCounter::critical_section_end(Thread *thread, uintx begin_value) {
> be an opaque type so we don't leak out the implementation, but as long as the
> GlobalCounter have the implementation as name, that doesn't help much.
>
> I'm thinking of something like:
> inline RCUContext RCU::critical_section_begin(Thread *thread) {
> inline void RCU::critical_section_end(Thread *thread, RCUContext context) {
> Or
> inline CSContext CriticalSection::begin(Thread *thread) {
> inline void CriticalSection::end(Thread *thread, CSContext context) {
Giving this value it's own type name seems like a good idea. I didn't
want to go so far as an actual class wrapper though, so just added a
typedef for CSContext, even though that's weak. Better would be a
C++11 enum class, e.g.
enum class CSContext : uintx {};
I've written the code as if it was that (e.g. using static_casts for
conversions where needed). I'll file an RFE to change the type,
blocked by the C++11/14 JEP.
Making that change required adding an #include of globalCounter.hpp to
concurrentHashTable.hpp. While there, I added a couple more obviously
missing #includes to that file. I didn't verify that what I added was
sufficient to #include this file without other preceeding #includes.
There were enough changes involved in this that I'm providing new
webrevs for your consideration:
full: http://cr.openjdk.java.net/~kbarrett/8212827/open.01/
incr: http://cr.openjdk.java.net/~kbarrett/8212827/open.01.inc/
Testing: local (linux-x64) tier1.
More information about the hotspot-dev
mailing list