diff src/share/vm/runtime/objectMonitor.inline.hpp @ 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 f95d63e2154a
children
line wrap: on
line diff
--- a/src/share/vm/runtime/objectMonitor.inline.hpp	Tue Jan 22 05:55:04 2013 -0800
+++ b/src/share/vm/runtime/objectMonitor.inline.hpp	Tue Jan 22 05:56:42 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -101,10 +101,12 @@
   return _count;
 }
 
+// Do NOT set _count = 0. There is a race such that _count could
+// be set while inflating prior to setting _owner
+// Just use Atomic::inc/dec and assert 0 when monitor put on free list
 inline void ObjectMonitor::set_owner(void* owner) {
   _owner = owner;
   _recursions = 0;
-  _count = 0;
 }