137 }
138
139 VMReg content_reg() const { return VMRegImpl::as_VMReg(_content_reg, true); }
140
141 // Returns offset from sp.
142 int stack_offset() {
143 assert(reg()->is_stack(), "must be stack location");
144 return reg()->reg2stack();
145 }
146
147 void print_on(outputStream* st) const;
148 void print() const;
149 };
150
151
152 class OopMap: public ResourceObj {
153 friend class OopMapStream;
154 friend class VMStructs;
155 friend class OopMapSet;
156 friend class OopMapSort;
157 private:
158 int _pc_offset; // offset in the code that this OopMap corresponds to
159 int _omv_count; // number of OopMapValues in the stream
160 int _num_oops; // number of oops
161 int _index; // index in OopMapSet
162 bool _has_derived_oops;
163 CompressedWriteStream* _write_stream;
164
165 debug_only( OopMapValue::oop_types* _locs_used; int _locs_length;)
166
167 // Accessors
168 int omv_count() const { return _omv_count; }
169 void set_omv_count(int value) { _omv_count = value; }
170 void increment_count() { _omv_count++; }
171 void increment_num_oops() { _num_oops++; }
172 void set_has_derived_oops(bool value) { _has_derived_oops = value; }
173 CompressedWriteStream* write_stream() const { return _write_stream; }
174 void set_write_stream(CompressedWriteStream* value) { _write_stream = value; }
175
176 enum DeepCopyToken { _deep_copy_token };
177 OopMap(DeepCopyToken, OopMap* source); // used only by deep_copy
178
179 void set_xxx(VMReg reg, OopMapValue::oop_types x, VMReg optional);
180
181 public:
182 OopMap(int frame_size, int arg_count);
183
184 // pc-offset handling
185 int offset() const { return _pc_offset; }
186 void set_offset(int o) { _pc_offset = o; }
187 int count() const { return _omv_count; }
188 int data_size() const { return write_stream()->position(); }
189 address data() const { return write_stream()->buffer(); }
190 int num_oops() const { return _num_oops; }
191 bool has_derived_oops() const { return _has_derived_oops; }
192 int index() const { return _index; }
193
194 // Construction
195 // frame_size units are stack-slots (4 bytes) NOT intptr_t; we can name odd
196 // slots to hold 4-byte values like ints and floats in the LP64 build.
197 void set_oop ( VMReg local);
198 void set_narrowoop(VMReg local);
199 void set_callee_saved( VMReg local, VMReg caller_machine_register );
200 void set_derived_oop ( VMReg local, VMReg derived_from_local_register );
201
202 int heap_size() const;
203 void copy_data_to(address addr) const;
204 void copy_and_sort_data_to(address addr) const;
205 OopMap* deep_copy();
206
207 bool legal_vm_reg_name(VMReg local) {
208 return OopMapValue::legal_vm_reg_name(local);
209 }
210
211 // Printing
212 void print_on(outputStream* st) const;
213 void print() const;
214 bool equals(const OopMap* other) const;
215 };
216
217 class OopMapSet : public ResourceObj {
218 friend class VMStructs;
219 private:
220 GrowableArray<OopMap*> _list;
221
222 int add(OopMap* value) { return _list.append(value); }
223
224 public:
225 OopMapSet();
226
227 // returns the number of OopMaps in this OopMapSet
228 int size() const { return _list.length(); }
229 // returns the OopMap at a given index
230 OopMap* at(int index) const { return _list.at(index); }
231
232 // Collect OopMaps.
233 int add_gc_map(int pc, OopMap* map);
234
235 // Methods oops_do() and all_do() filter out nullptr oops and
236 // oop == CompressedOops::base() before passing oops
237 // to closures.
238
239 static const ImmutableOopMap* find_map(const CodeBlob* cb, address pc);
240 static const ImmutableOopMap* find_map(const frame *fr);
241
242 // Iterates through frame for a compiled method
243 static void oops_do (const frame* fr,
244 const RegisterMap* reg_map,
245 OopClosure* f,
|
137 }
138
139 VMReg content_reg() const { return VMRegImpl::as_VMReg(_content_reg, true); }
140
141 // Returns offset from sp.
142 int stack_offset() {
143 assert(reg()->is_stack(), "must be stack location");
144 return reg()->reg2stack();
145 }
146
147 void print_on(outputStream* st) const;
148 void print() const;
149 };
150
151
152 class OopMap: public ResourceObj {
153 friend class OopMapStream;
154 friend class VMStructs;
155 friend class OopMapSet;
156 friend class OopMapSort;
157 friend class SCCReader;
158 private:
159 int _pc_offset; // offset in the code that this OopMap corresponds to
160 int _omv_count; // number of OopMapValues in the stream
161 int _num_oops; // number of oops
162 int _index; // index in OopMapSet
163 bool _has_derived_oops;
164 CompressedWriteStream* _write_stream;
165
166 debug_only( OopMapValue::oop_types* _locs_used; int _locs_length;)
167
168 // Accessors
169 int omv_count() const { return _omv_count; }
170 void set_omv_count(int value) { _omv_count = value; }
171 void increment_count() { _omv_count++; }
172 void increment_num_oops() { _num_oops++; }
173 void set_has_derived_oops(bool value) { _has_derived_oops = value; }
174 CompressedWriteStream* write_stream() const { return _write_stream; }
175 void set_write_stream(CompressedWriteStream* value) { _write_stream = value; }
176
177 enum DeepCopyToken { _deep_copy_token };
178 OopMap(DeepCopyToken, OopMap* source); // used only by deep_copy
179
180 void set_xxx(VMReg reg, OopMapValue::oop_types x, VMReg optional);
181
182 public:
183 OopMap(int frame_size, int arg_count);
184 OopMap(int data_size);
185
186 // pc-offset handling
187 int offset() const { return _pc_offset; }
188 void set_offset(int o) { _pc_offset = o; }
189 int count() const { return _omv_count; }
190 int data_size() const { return write_stream()->position(); }
191 address data() const { return write_stream()->buffer(); }
192 int num_oops() const { return _num_oops; }
193 bool has_derived_oops() const { return _has_derived_oops; }
194 int index() const { return _index; }
195
196 // Construction
197 // frame_size units are stack-slots (4 bytes) NOT intptr_t; we can name odd
198 // slots to hold 4-byte values like ints and floats in the LP64 build.
199 void set_oop ( VMReg local);
200 void set_narrowoop(VMReg local);
201 void set_callee_saved( VMReg local, VMReg caller_machine_register );
202 void set_derived_oop ( VMReg local, VMReg derived_from_local_register );
203
204 int heap_size() const;
205 void copy_data_to(address addr) const;
206 void copy_and_sort_data_to(address addr) const;
207 OopMap* deep_copy();
208
209 bool legal_vm_reg_name(VMReg local) {
210 return OopMapValue::legal_vm_reg_name(local);
211 }
212
213 // Printing
214 void print_on(outputStream* st) const;
215 void print() const;
216 bool equals(const OopMap* other) const;
217 };
218
219 class OopMapSet : public ResourceObj {
220 friend class VMStructs;
221 friend class SCCReader;
222 private:
223 GrowableArray<OopMap*> _list;
224
225 int add(OopMap* value) { return _list.append(value); }
226
227 public:
228 OopMapSet();
229 OopMapSet(int size);
230
231 // returns the number of OopMaps in this OopMapSet
232 int size() const { return _list.length(); }
233 // returns the OopMap at a given index
234 OopMap* at(int index) const { return _list.at(index); }
235
236 // Collect OopMaps.
237 int add_gc_map(int pc, OopMap* map);
238
239 // Methods oops_do() and all_do() filter out nullptr oops and
240 // oop == CompressedOops::base() before passing oops
241 // to closures.
242
243 static const ImmutableOopMap* find_map(const CodeBlob* cb, address pc);
244 static const ImmutableOopMap* find_map(const frame *fr);
245
246 // Iterates through frame for a compiled method
247 static void oops_do (const frame* fr,
248 const RegisterMap* reg_map,
249 OopClosure* f,
|