hotspot/src/share/vm/oops/oopsHierarchy.hpp
changeset 24831 e4df2f64bb2e
parent 20282 7f9cbdf89af2
child 25478 7e6c884aa31f
equal deleted inserted replaced
24830:2fbbde433861 24831:e4df2f64bb2e
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2014, 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.
   110   bool operator>=(oop o) const        { return obj() >= o.obj(); }
   110   bool operator>=(oop o) const        { return obj() >= o.obj(); }
   111   bool operator!() const              { return !obj(); }
   111   bool operator!() const              { return !obj(); }
   112 
   112 
   113   // Assignment
   113   // Assignment
   114   oop& operator=(const oop& o)                            { _o = o.obj(); return *this; }
   114   oop& operator=(const oop& o)                            { _o = o.obj(); return *this; }
   115 #ifndef SOLARIS
       
   116   volatile oop& operator=(const oop& o) volatile          { _o = o.obj(); return *this; }
   115   volatile oop& operator=(const oop& o) volatile          { _o = o.obj(); return *this; }
   117 #endif
       
   118   volatile oop& operator=(const volatile oop& o) volatile { _o = o.obj(); return *this; }
   116   volatile oop& operator=(const volatile oop& o) volatile { _o = o.obj(); return *this; }
   119 
   117 
   120   // Explict user conversions
   118   // Explict user conversions
   121   operator void* () const             { return (void *)obj(); }
   119   operator void* () const             { return (void *)obj(); }
   122 #ifndef SOLARIS
   120 #ifndef SOLARIS
   123   operator void* () const volatile    { return (void *)obj(); }
   121   operator void* () const volatile    { return (void *)obj(); }
   124 #endif
   122 #endif
   125   operator HeapWord* () const         { return (HeapWord*)obj(); }
   123   operator HeapWord* () const         { return (HeapWord*)obj(); }
   126   operator oopDesc* () const          { return obj(); }
   124   operator oopDesc* () const volatile { return obj(); }
   127   operator intptr_t* () const         { return (intptr_t*)obj(); }
   125   operator intptr_t* () const         { return (intptr_t*)obj(); }
   128   operator PromotedObject* () const   { return (PromotedObject*)obj(); }
   126   operator PromotedObject* () const   { return (PromotedObject*)obj(); }
   129   operator markOop () const           { return markOop(obj()); }
   127   operator markOop () const           { return markOop(obj()); }
   130 
       
   131   operator address   () const         { return (address)obj(); }
   128   operator address   () const         { return (address)obj(); }
   132 
   129 
   133   // from javaCalls.cpp
   130   // from javaCalls.cpp
   134   operator jobject () const           { return (jobject)obj(); }
   131   operator jobject () const           { return (jobject)obj(); }
   135   // from javaClasses.cpp
   132   // from javaClasses.cpp
   159        }                                                                   \
   156        }                                                                   \
   160        type##Oop& operator=(const type##Oop& o) {                          \
   157        type##Oop& operator=(const type##Oop& o) {                          \
   161             oop::operator=(o);                                             \
   158             oop::operator=(o);                                             \
   162             return *this;                                                  \
   159             return *this;                                                  \
   163        }                                                                   \
   160        }                                                                   \
   164        NOT_SOLARIS(                                                        \
       
   165        volatile type##Oop& operator=(const type##Oop& o) volatile {        \
   161        volatile type##Oop& operator=(const type##Oop& o) volatile {        \
   166             (void)const_cast<oop&>(oop::operator=(o));                     \
   162             (void)const_cast<oop&>(oop::operator=(o));                     \
   167             return *this;                                                  \
   163             return *this;                                                  \
   168        })                                                                  \
   164        }                                                                   \
   169        volatile type##Oop& operator=(const volatile type##Oop& o) volatile {\
   165        volatile type##Oop& operator=(const volatile type##Oop& o) volatile {\
   170             (void)const_cast<oop&>(oop::operator=(o));                     \
   166             (void)const_cast<oop&>(oop::operator=(o));                     \
   171             return *this;                                                  \
   167             return *this;                                                  \
   172        }                                                                   \
   168        }                                                                   \
   173    };
   169    };