src/hotspot/share/oops/oopHandle.hpp
changeset 49816 a3e79f97e86b
parent 47216 71c04702a3d5
child 49824 e242740a92b8
equal deleted inserted replaced
49815:76e3bcb9bee1 49816:a3e79f97e86b
     1 /*
     1 /*
     2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2017, 2018, 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.
    24 
    24 
    25 #ifndef SHARE_VM_OOPS_OOPHANDLE_HPP
    25 #ifndef SHARE_VM_OOPS_OOPHANDLE_HPP
    26 #define SHARE_VM_OOPS_OOPHANDLE_HPP
    26 #define SHARE_VM_OOPS_OOPHANDLE_HPP
    27 
    27 
    28 #include "oops/oop.hpp"
    28 #include "oops/oop.hpp"
    29 #include "runtime/atomic.hpp"
       
    30 #include "runtime/orderAccess.hpp"
       
    31 
    29 
    32 // Simple class for encapsulating oop pointers stored in metadata.
    30 // Simple class for encapsulating oop pointers stored in metadata.
    33 // These are different from Handle.  The Handle class stores pointers
    31 // These are different from Handle.  The Handle class stores pointers
    34 // to oops on the stack, and manages the allocation from a thread local
    32 // to oops on the stack, and manages the allocation from a thread local
    35 // area in the constructor.
    33 // area in the constructor.
    43 
    41 
    44 public:
    42 public:
    45   OopHandle() : _obj(NULL) {}
    43   OopHandle() : _obj(NULL) {}
    46   OopHandle(oop* w) : _obj(w) {}
    44   OopHandle(oop* w) : _obj(w) {}
    47 
    45 
    48   oop resolve() const { return (_obj == NULL) ? (oop)NULL : *_obj; }
    46   inline oop resolve() const;
    49 
    47 
    50   // Used only for removing handle.
    48   // Used only for removing handle.
    51   oop* ptr_raw() { return _obj; }
    49   oop* ptr_raw() { return _obj; }
    52 };
    50 };
    53 
    51