equal
deleted
inserted
replaced
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 |