84 CodeBuffer* cb,
85 int header_size,
86 int size,
87 int frame_complete,
88 int frame_size,
89 OopMapSet* oop_maps
90 );
91
92 // Deletion
93 void flush();
94
95 // Typing
96 virtual bool is_buffer_blob() const { return false; }
97 virtual bool is_nmethod() const { return false; }
98 virtual bool is_runtime_stub() const { return false; }
99 virtual bool is_deoptimization_stub() const { return false; }
100 virtual bool is_uncommon_trap_stub() const { return false; }
101 virtual bool is_exception_stub() const { return false; }
102 virtual bool is_safepoint_stub() const { return false; }
103 virtual bool is_adapter_blob() const { return false; }
104 virtual bool is_method_handles_adapter_blob() const { return false; }
105
106 virtual bool is_compiled_by_c2() const { return false; }
107 virtual bool is_compiled_by_c1() const { return false; }
108
109 // Casting
110 nmethod* as_nmethod_or_null() { return is_nmethod() ? (nmethod*) this : NULL; }
111
112 // Boundaries
113 address header_begin() const { return (address) this; }
114 address header_end() const { return ((address) this) + _header_size; };
115 relocInfo* relocation_begin() const { return (relocInfo*) header_end(); };
116 relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); }
117 address content_begin() const { return (address) header_begin() + _content_offset; }
118 address content_end() const { return (address) header_begin() + _data_offset; }
119 address code_begin() const { return (address) header_begin() + _code_offset; }
120 address code_end() const { return (address) header_begin() + _data_offset; }
121 address data_begin() const { return (address) header_begin() + _data_offset; }
122 address data_end() const { return (address) header_begin() + _size; }
123
185
186 // Print the comment associated with offset on stream, if there is one
187 virtual void print_block_comment(outputStream* stream, address block_begin) const {
188 intptr_t offset = (intptr_t)(block_begin - code_begin());
189 _strings.print_block_comment(stream, offset);
190 }
191
192 // Transfer ownership of comments to this CodeBlob
193 void set_strings(CodeStrings& strings) {
194 _strings.assign(strings);
195 }
196 };
197
198
199 //----------------------------------------------------------------------------------------------------
200 // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
201
202 class BufferBlob: public CodeBlob {
203 friend class VMStructs;
204 friend class AdapterBlob;
205 friend class MethodHandlesAdapterBlob;
206
207 private:
208 // Creation support
209 BufferBlob(const char* name, int size);
210 BufferBlob(const char* name, int size, CodeBuffer* cb);
211
212 void* operator new(size_t s, unsigned size, bool is_critical = false) throw();
213
214 public:
215 // Creation
216 static BufferBlob* create(const char* name, int buffer_size);
217 static BufferBlob* create(const char* name, CodeBuffer* cb);
218
219 static void free(BufferBlob* buf);
220
221 // Typing
222 virtual bool is_buffer_blob() const { return true; }
223
224 // GC/Verification support
229 void print_on(outputStream* st) const;
230 void print_value_on(outputStream* st) const;
231 };
232
233
234 //----------------------------------------------------------------------------------------------------
235 // AdapterBlob: used to hold C2I/I2C adapters
236
237 class AdapterBlob: public BufferBlob {
238 private:
239 AdapterBlob(int size, CodeBuffer* cb);
240
241 public:
242 // Creation
243 static AdapterBlob* create(CodeBuffer* cb);
244
245 // Typing
246 virtual bool is_adapter_blob() const { return true; }
247 };
248
249
250 //----------------------------------------------------------------------------------------------------
251 // MethodHandlesAdapterBlob: used to hold MethodHandles adapters
252
253 class MethodHandlesAdapterBlob: public BufferBlob {
254 private:
255 MethodHandlesAdapterBlob(int size) : BufferBlob("MethodHandles adapters", size) {}
256
257 public:
258 // Creation
259 static MethodHandlesAdapterBlob* create(int buffer_size);
260
261 // Typing
262 virtual bool is_method_handles_adapter_blob() const { return true; }
263 };
264
265
266 //----------------------------------------------------------------------------------------------------
267 // RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine
268
269 class RuntimeStub: public CodeBlob {
|
84 CodeBuffer* cb,
85 int header_size,
86 int size,
87 int frame_complete,
88 int frame_size,
89 OopMapSet* oop_maps
90 );
91
92 // Deletion
93 void flush();
94
95 // Typing
96 virtual bool is_buffer_blob() const { return false; }
97 virtual bool is_nmethod() const { return false; }
98 virtual bool is_runtime_stub() const { return false; }
99 virtual bool is_deoptimization_stub() const { return false; }
100 virtual bool is_uncommon_trap_stub() const { return false; }
101 virtual bool is_exception_stub() const { return false; }
102 virtual bool is_safepoint_stub() const { return false; }
103 virtual bool is_adapter_blob() const { return false; }
104 virtual bool is_vtable_blob() const { return false; }
105 virtual bool is_method_handles_adapter_blob() const { return false; }
106
107 virtual bool is_compiled_by_c2() const { return false; }
108 virtual bool is_compiled_by_c1() const { return false; }
109
110 // Casting
111 nmethod* as_nmethod_or_null() { return is_nmethod() ? (nmethod*) this : NULL; }
112
113 // Boundaries
114 address header_begin() const { return (address) this; }
115 address header_end() const { return ((address) this) + _header_size; };
116 relocInfo* relocation_begin() const { return (relocInfo*) header_end(); };
117 relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); }
118 address content_begin() const { return (address) header_begin() + _content_offset; }
119 address content_end() const { return (address) header_begin() + _data_offset; }
120 address code_begin() const { return (address) header_begin() + _code_offset; }
121 address code_end() const { return (address) header_begin() + _data_offset; }
122 address data_begin() const { return (address) header_begin() + _data_offset; }
123 address data_end() const { return (address) header_begin() + _size; }
124
186
187 // Print the comment associated with offset on stream, if there is one
188 virtual void print_block_comment(outputStream* stream, address block_begin) const {
189 intptr_t offset = (intptr_t)(block_begin - code_begin());
190 _strings.print_block_comment(stream, offset);
191 }
192
193 // Transfer ownership of comments to this CodeBlob
194 void set_strings(CodeStrings& strings) {
195 _strings.assign(strings);
196 }
197 };
198
199
200 //----------------------------------------------------------------------------------------------------
201 // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
202
203 class BufferBlob: public CodeBlob {
204 friend class VMStructs;
205 friend class AdapterBlob;
206 friend class VtableBlob;
207 friend class MethodHandlesAdapterBlob;
208
209 private:
210 // Creation support
211 BufferBlob(const char* name, int size);
212 BufferBlob(const char* name, int size, CodeBuffer* cb);
213
214 void* operator new(size_t s, unsigned size, bool is_critical = false) throw();
215
216 public:
217 // Creation
218 static BufferBlob* create(const char* name, int buffer_size);
219 static BufferBlob* create(const char* name, CodeBuffer* cb);
220
221 static void free(BufferBlob* buf);
222
223 // Typing
224 virtual bool is_buffer_blob() const { return true; }
225
226 // GC/Verification support
231 void print_on(outputStream* st) const;
232 void print_value_on(outputStream* st) const;
233 };
234
235
236 //----------------------------------------------------------------------------------------------------
237 // AdapterBlob: used to hold C2I/I2C adapters
238
239 class AdapterBlob: public BufferBlob {
240 private:
241 AdapterBlob(int size, CodeBuffer* cb);
242
243 public:
244 // Creation
245 static AdapterBlob* create(CodeBuffer* cb);
246
247 // Typing
248 virtual bool is_adapter_blob() const { return true; }
249 };
250
251 //---------------------------------------------------------------------------------------------------
252 class VtableBlob: public BufferBlob {
253 private:
254 VtableBlob(const char*, int);
255
256 public:
257 // Creation
258 static VtableBlob* create(const char* name, int buffer_size);
259
260 // Typing
261 virtual bool is_vtable_blob() const { return true; }
262 };
263
264 //----------------------------------------------------------------------------------------------------
265 // MethodHandlesAdapterBlob: used to hold MethodHandles adapters
266
267 class MethodHandlesAdapterBlob: public BufferBlob {
268 private:
269 MethodHandlesAdapterBlob(int size) : BufferBlob("MethodHandles adapters", size) {}
270
271 public:
272 // Creation
273 static MethodHandlesAdapterBlob* create(int buffer_size);
274
275 // Typing
276 virtual bool is_method_handles_adapter_blob() const { return true; }
277 };
278
279
280 //----------------------------------------------------------------------------------------------------
281 // RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine
282
283 class RuntimeStub: public CodeBlob {
|