106 // [2] All Array<T> dimensions are statically declared.
107 class Ref : public CHeapObj<mtMetaspace> {
108 Writability _writability;
109 address _enclosing_obj;
110 Ref* _next;
111 NONCOPYABLE(Ref);
112
113 protected:
114 virtual void** mpp() const = 0;
115 Ref(Writability w) : _writability(w), _enclosing_obj(nullptr), _next(nullptr) {}
116 public:
117 virtual bool not_null() const = 0;
118 virtual int size() const = 0;
119 virtual void metaspace_pointers_do(MetaspaceClosure *it) const = 0;
120 virtual void metaspace_pointers_do_at(MetaspaceClosure *it, address new_loc) const = 0;
121 virtual MetaspaceObj::Type msotype() const = 0;
122 virtual bool is_read_only_by_default() const = 0;
123 virtual ~Ref() {}
124
125 address obj() const {
126 return *addr();
127 }
128
129 address* addr() const {
130 return (address*)mpp();
131 }
132
133 // See comments in ArchiveBuilder::remember_embedded_pointer_in_enclosing_obj()
134 address enclosing_obj() const {
135 return _enclosing_obj;
136 }
137 void set_enclosing_obj(address obj) {
138 _enclosing_obj = obj;
139 }
140
141 Writability writability() const { return _writability; };
142 void set_next(Ref* n) { _next = n; }
143 Ref* next() const { return _next; }
144 };
145
146 private:
|
106 // [2] All Array<T> dimensions are statically declared.
107 class Ref : public CHeapObj<mtMetaspace> {
108 Writability _writability;
109 address _enclosing_obj;
110 Ref* _next;
111 NONCOPYABLE(Ref);
112
113 protected:
114 virtual void** mpp() const = 0;
115 Ref(Writability w) : _writability(w), _enclosing_obj(nullptr), _next(nullptr) {}
116 public:
117 virtual bool not_null() const = 0;
118 virtual int size() const = 0;
119 virtual void metaspace_pointers_do(MetaspaceClosure *it) const = 0;
120 virtual void metaspace_pointers_do_at(MetaspaceClosure *it, address new_loc) const = 0;
121 virtual MetaspaceObj::Type msotype() const = 0;
122 virtual bool is_read_only_by_default() const = 0;
123 virtual ~Ref() {}
124
125 address obj() const {
126 return address(intptr_t(*addr()) & ~0x3); // FIXME: just in case it is tagged
127 }
128
129 address* addr() const {
130 return (address*)mpp();
131 }
132
133 // See comments in ArchiveBuilder::remember_embedded_pointer_in_enclosing_obj()
134 address enclosing_obj() const {
135 return _enclosing_obj;
136 }
137 void set_enclosing_obj(address obj) {
138 _enclosing_obj = obj;
139 }
140
141 Writability writability() const { return _writability; };
142 void set_next(Ref* n) { _next = n; }
143 Ref* next() const { return _next; }
144 };
145
146 private:
|