8041623: Solaris Studio 12.4 C++ 5.13, CHECK_UNHANDLED_OOPS use of class oop's copy constructor definitions causing error level diagnostic.
authorlfoltan
Thu, 29 May 2014 08:58:51 -0400
changeset 24831 e4df2f64bb2e
parent 24830 2fbbde433861
child 24832 26a834fb508d
8041623: Solaris Studio 12.4 C++ 5.13, CHECK_UNHANDLED_OOPS use of class oop's copy constructor definitions causing error level diagnostic. Summary: Fix several minor compilation issues with volatile oops for CHECK_UNHANDLED_OOPS support. Reviewed-by: coleenp, hseigel
hotspot/src/share/vm/classfile/javaClasses.hpp
hotspot/src/share/vm/oops/oopsHierarchy.hpp
hotspot/src/share/vm/runtime/thread.cpp
hotspot/src/share/vm/services/memoryManager.cpp
hotspot/src/share/vm/services/memoryPool.cpp
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed May 28 22:59:29 2014 +0200
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Thu May 29 08:58:51 2014 -0400
@@ -1181,7 +1181,7 @@
   static oop              target(         oop site)             { return site->obj_field(             _target_offset);         }
   static void         set_target(         oop site, oop target) {        site->obj_field_put(         _target_offset, target); }
 
-  static volatile oop     target_volatile(oop site)             { return site->obj_field_volatile(    _target_offset);         }
+  static volatile oop     target_volatile(oop site)             { return oop((oopDesc *)(site->obj_field_volatile(_target_offset))); }
   static void         set_target_volatile(oop site, oop target) {        site->obj_field_put_volatile(_target_offset, target); }
 
   // Testers
--- a/hotspot/src/share/vm/oops/oopsHierarchy.hpp	Wed May 28 22:59:29 2014 +0200
+++ b/hotspot/src/share/vm/oops/oopsHierarchy.hpp	Thu May 29 08:58:51 2014 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -112,9 +112,7 @@
 
   // Assignment
   oop& operator=(const oop& o)                            { _o = o.obj(); return *this; }
-#ifndef SOLARIS
   volatile oop& operator=(const oop& o) volatile          { _o = o.obj(); return *this; }
-#endif
   volatile oop& operator=(const volatile oop& o) volatile { _o = o.obj(); return *this; }
 
   // Explict user conversions
@@ -123,11 +121,10 @@
   operator void* () const volatile    { return (void *)obj(); }
 #endif
   operator HeapWord* () const         { return (HeapWord*)obj(); }
-  operator oopDesc* () const          { return obj(); }
+  operator oopDesc* () const volatile { return obj(); }
   operator intptr_t* () const         { return (intptr_t*)obj(); }
   operator PromotedObject* () const   { return (PromotedObject*)obj(); }
   operator markOop () const           { return markOop(obj()); }
-
   operator address   () const         { return (address)obj(); }
 
   // from javaCalls.cpp
@@ -161,11 +158,10 @@
             oop::operator=(o);                                             \
             return *this;                                                  \
        }                                                                   \
-       NOT_SOLARIS(                                                        \
        volatile type##Oop& operator=(const type##Oop& o) volatile {        \
             (void)const_cast<oop&>(oop::operator=(o));                     \
             return *this;                                                  \
-       })                                                                  \
+       }                                                                   \
        volatile type##Oop& operator=(const volatile type##Oop& o) volatile {\
             (void)const_cast<oop&>(oop::operator=(o));                     \
             return *this;                                                  \
--- a/hotspot/src/share/vm/runtime/thread.cpp	Wed May 28 22:59:29 2014 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Thu May 29 08:58:51 2014 -0400
@@ -1434,7 +1434,7 @@
   _in_deopt_handler = 0;
   _doing_unsafe_access = false;
   _stack_guard_state = stack_guard_unused;
-  (void)const_cast<oop&>(_exception_oop = NULL);
+  (void)const_cast<oop&>(_exception_oop = oop(NULL));
   _exception_pc  = 0;
   _exception_handler_pc = 0;
   _is_method_handle_return = 0;
--- a/hotspot/src/share/vm/services/memoryManager.cpp	Wed May 28 22:59:29 2014 +0200
+++ b/hotspot/src/share/vm/services/memoryManager.cpp	Thu May 29 08:58:51 2014 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -39,7 +39,7 @@
 
 MemoryManager::MemoryManager() {
   _num_pools = 0;
-  (void)const_cast<instanceOop&>(_memory_mgr_obj = NULL);
+  (void)const_cast<instanceOop&>(_memory_mgr_obj = instanceOop(NULL));
 }
 
 void MemoryManager::add_pool(MemoryPool* pool) {
--- a/hotspot/src/share/vm/services/memoryPool.cpp	Wed May 28 22:59:29 2014 +0200
+++ b/hotspot/src/share/vm/services/memoryPool.cpp	Thu May 29 08:58:51 2014 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -46,7 +46,7 @@
   _name = name;
   _initial_size = init_size;
   _max_size = max_size;
-  (void)const_cast<instanceOop&>(_memory_pool_obj = NULL);
+  (void)const_cast<instanceOop&>(_memory_pool_obj = instanceOop(NULL));
   _available_for_allocation = true;
   _num_managers = 0;
   _type = type;