33 // CodeBlob - superclass for all entries in the CodeCache. |
33 // CodeBlob - superclass for all entries in the CodeCache. |
34 // |
34 // |
35 // Suptypes are: |
35 // Suptypes are: |
36 // nmethod : Compiled Java methods (include method that calls to native code) |
36 // nmethod : Compiled Java methods (include method that calls to native code) |
37 // RuntimeStub : Call to VM runtime methods |
37 // RuntimeStub : Call to VM runtime methods |
|
38 // RicochetBlob : Used for blocking MethodHandle adapters |
38 // DeoptimizationBlob : Used for deoptimizatation |
39 // DeoptimizationBlob : Used for deoptimizatation |
39 // ExceptionBlob : Used for stack unrolling |
40 // ExceptionBlob : Used for stack unrolling |
40 // SafepointBlob : Used to handle illegal instruction exceptions |
41 // SafepointBlob : Used to handle illegal instruction exceptions |
41 // |
42 // |
42 // |
43 // |
93 |
94 |
94 // Deletion |
95 // Deletion |
95 void flush(); |
96 void flush(); |
96 |
97 |
97 // Typing |
98 // Typing |
98 virtual bool is_buffer_blob() const { return false; } |
99 virtual bool is_buffer_blob() const { return false; } |
99 virtual bool is_nmethod() const { return false; } |
100 virtual bool is_nmethod() const { return false; } |
100 virtual bool is_runtime_stub() const { return false; } |
101 virtual bool is_runtime_stub() const { return false; } |
101 virtual bool is_deoptimization_stub() const { return false; } |
102 virtual bool is_ricochet_stub() const { return false; } |
102 virtual bool is_uncommon_trap_stub() const { return false; } |
103 virtual bool is_deoptimization_stub() const { return false; } |
103 virtual bool is_exception_stub() const { return false; } |
104 virtual bool is_uncommon_trap_stub() const { return false; } |
|
105 virtual bool is_exception_stub() const { return false; } |
104 virtual bool is_safepoint_stub() const { return false; } |
106 virtual bool is_safepoint_stub() const { return false; } |
105 virtual bool is_adapter_blob() const { return false; } |
107 virtual bool is_adapter_blob() const { return false; } |
106 virtual bool is_method_handles_adapter_blob() const { return false; } |
108 virtual bool is_method_handles_adapter_blob() const { return false; } |
107 |
109 |
108 virtual bool is_compiled_by_c2() const { return false; } |
110 virtual bool is_compiled_by_c2() const { return false; } |
180 virtual void verify(); |
182 virtual void verify(); |
181 void print() const { print_on(tty); } |
183 void print() const { print_on(tty); } |
182 virtual void print_on(outputStream* st) const; |
184 virtual void print_on(outputStream* st) const; |
183 virtual void print_value_on(outputStream* st) const; |
185 virtual void print_value_on(outputStream* st) const; |
184 |
186 |
|
187 // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService. |
|
188 static void trace_new_stub(CodeBlob* blob, const char* name1, const char* name2 = ""); |
|
189 |
185 // Print the comment associated with offset on stream, if there is one |
190 // Print the comment associated with offset on stream, if there is one |
186 virtual void print_block_comment(outputStream* stream, address block_begin) { |
191 virtual void print_block_comment(outputStream* stream, address block_begin) { |
187 intptr_t offset = (intptr_t)(block_begin - code_begin()); |
192 intptr_t offset = (intptr_t)(block_begin - code_begin()); |
188 _comments.print_block_comment(stream, offset); |
193 _comments.print_block_comment(stream, offset); |
189 } |
194 } |
316 //---------------------------------------------------------------------------------------------------- |
321 //---------------------------------------------------------------------------------------------------- |
317 // Super-class for all blobs that exist in only one instance. Implements default behaviour. |
322 // Super-class for all blobs that exist in only one instance. Implements default behaviour. |
318 |
323 |
319 class SingletonBlob: public CodeBlob { |
324 class SingletonBlob: public CodeBlob { |
320 friend class VMStructs; |
325 friend class VMStructs; |
321 public: |
326 |
|
327 protected: |
|
328 void* operator new(size_t s, unsigned size); |
|
329 |
|
330 public: |
322 SingletonBlob( |
331 SingletonBlob( |
323 const char* name, |
332 const char* name, |
324 CodeBuffer* cb, |
333 CodeBuffer* cb, |
325 int header_size, |
334 int header_size, |
326 int size, |
335 int size, |
339 void print_value_on(outputStream* st) const; |
348 void print_value_on(outputStream* st) const; |
340 }; |
349 }; |
341 |
350 |
342 |
351 |
343 //---------------------------------------------------------------------------------------------------- |
352 //---------------------------------------------------------------------------------------------------- |
|
353 // RicochetBlob |
|
354 // Holds an arbitrary argument list indefinitely while Java code executes recursively. |
|
355 |
|
356 class RicochetBlob: public SingletonBlob { |
|
357 friend class VMStructs; |
|
358 private: |
|
359 |
|
360 int _bounce_offset; |
|
361 int _exception_offset; |
|
362 |
|
363 // Creation support |
|
364 RicochetBlob( |
|
365 CodeBuffer* cb, |
|
366 int size, |
|
367 int bounce_offset, |
|
368 int exception_offset, |
|
369 int frame_size |
|
370 ); |
|
371 |
|
372 public: |
|
373 // Creation |
|
374 static RicochetBlob* create( |
|
375 CodeBuffer* cb, |
|
376 int bounce_offset, |
|
377 int exception_offset, |
|
378 int frame_size |
|
379 ); |
|
380 |
|
381 // Typing |
|
382 bool is_ricochet_stub() const { return true; } |
|
383 |
|
384 // GC for args |
|
385 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } |
|
386 |
|
387 address bounce_addr() const { return code_begin() + _bounce_offset; } |
|
388 address exception_addr() const { return code_begin() + _exception_offset; } |
|
389 bool returns_to_bounce_addr(address pc) const { |
|
390 address bounce_pc = bounce_addr(); |
|
391 return (pc == bounce_pc || (pc + frame::pc_return_offset) == bounce_pc); |
|
392 } |
|
393 }; |
|
394 |
|
395 |
|
396 //---------------------------------------------------------------------------------------------------- |
344 // DeoptimizationBlob |
397 // DeoptimizationBlob |
345 |
398 |
346 class DeoptimizationBlob: public SingletonBlob { |
399 class DeoptimizationBlob: public SingletonBlob { |
347 friend class VMStructs; |
400 friend class VMStructs; |
348 private: |
401 private: |
376 int frame_size |
427 int frame_size |
377 ); |
428 ); |
378 |
429 |
379 // Typing |
430 // Typing |
380 bool is_deoptimization_stub() const { return true; } |
431 bool is_deoptimization_stub() const { return true; } |
381 const DeoptimizationBlob *as_deoptimization_stub() const { return this; } |
|
382 bool exception_address_is_unpack_entry(address pc) const { |
432 bool exception_address_is_unpack_entry(address pc) const { |
383 address unpack_pc = unpack(); |
433 address unpack_pc = unpack(); |
384 return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); |
434 return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); |
385 } |
435 } |
386 |
436 |