< prev index next > src/hotspot/share/oops/access.hpp
less_template_poop_in_access_hpp
// Steps 5.a and 5.b require knowledge about the GC backends, and therefore needs to
// include the various GC backend .inline.hpp headers. Their implementation resides in
// access.inline.hpp. The accesses that are allowed through the access.hpp file
// must be instantiated in access.cpp using the INSTANTIATE_HPP_ACCESS macro.
-namespace AccessInternal {
- template <DecoratorSet decorators, typename T>
- void store_at(oop base, ptrdiff_t offset, T value);
-
- template <DecoratorSet decorators, typename T>
- T load_at(oop base, ptrdiff_t offset);
-
- template <DecoratorSet decorators, typename T>
- T atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value);
-
- template <DecoratorSet decorators, typename T>
- T atomic_xchg_at(T new_value, oop base, ptrdiff_t offset);
-
- template <DecoratorSet decorators, typename P, typename T>
- void store(P* addr, T value);
-
- template <DecoratorSet decorators, typename P, typename T>
- T load(P* addr);
-
- template <DecoratorSet decorators, typename P, typename T>
- T atomic_cmpxchg(T new_value, P* addr, T compare_value);
-
- template <DecoratorSet decorators, typename P, typename T>
- T atomic_xchg(T new_value, P* addr);
-
- template <DecoratorSet decorators, typename T>
- bool arraycopy(arrayOop src_obj, arrayOop dst_obj, T *src, T *dst, size_t length);
-
- template <DecoratorSet decorators>
- void clone(oop src, oop dst, size_t size);
-
- template <DecoratorSet decorators>
- oop resolve(oop src);
-
- template <DecoratorSet decorators>
- bool equals(oop o1, oop o2);
-
- // Infer the type that should be returned from a load.
- template <typename P, DecoratorSet decorators>
- class OopLoadProxy: public StackObj {
- private:
- P *const _addr;
- public:
- OopLoadProxy(P* addr) : _addr(addr) {}
-
- inline operator oop() {
- return load<decorators | INTERNAL_VALUE_IS_OOP, P, oop>(_addr);
- }
-
- inline operator narrowOop() {
- return load<decorators | INTERNAL_VALUE_IS_OOP, P, narrowOop>(_addr);
- }
-
- template <typename T>
- inline bool operator ==(const T& other) const {
- return load<decorators | INTERNAL_VALUE_IS_OOP, P, T>(_addr) == other;
- }
-
- template <typename T>
- inline bool operator !=(const T& other) const {
- return load<decorators | INTERNAL_VALUE_IS_OOP, P, T>(_addr) != other;
- }
- };
-
- // Infer the type that should be returned from a load_at.
- template <DecoratorSet decorators>
- class LoadAtProxy: public StackObj {
- private:
- const oop _base;
- const ptrdiff_t _offset;
- public:
- LoadAtProxy(oop base, ptrdiff_t offset) : _base(base), _offset(offset) {}
-
- template <typename T>
- inline operator T() const {
- return load_at<decorators, T>(_base, _offset);
- }
-
- template <typename T>
- inline bool operator ==(const T& other) const { return load_at<decorators, T>(_base, _offset) == other; }
-
- template <typename T>
- inline bool operator !=(const T& other) const { return load_at<decorators, T>(_base, _offset) != other; }
- };
-
- template <DecoratorSet decorators>
- class OopLoadAtProxy: public StackObj {
- private:
- const oop _base;
- const ptrdiff_t _offset;
- public:
- OopLoadAtProxy(oop base, ptrdiff_t offset) : _base(base), _offset(offset) {}
-
- inline operator oop() const {
- return load_at<decorators | INTERNAL_VALUE_IS_OOP, oop>(_base, _offset);
- }
-
- inline operator narrowOop() const {
- return load_at<decorators | INTERNAL_VALUE_IS_OOP, narrowOop>(_base, _offset);
- }
-
- template <typename T>
- inline bool operator ==(const T& other) const {
- return load_at<decorators | INTERNAL_VALUE_IS_OOP, T>(_base, _offset) == other;
- }
-
- template <typename T>
- inline bool operator !=(const T& other) const {
- return load_at<decorators | INTERNAL_VALUE_IS_OOP, T>(_base, _offset) != other;
- }
- };
-}
-
template <DecoratorSet decorators = INTERNAL_EMPTY>
class Access: public AllStatic {
// This function asserts that if an access gets passed in a decorator outside
// of the expected_decorators, then something is wrong. It additionally checks
// the consistency of the decorators so that supposedly disjoint decorators are indeed
< prev index next >