115
116 CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments);
117 CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments);
118 public:
119 // Returns the space needed for CodeBlob
120 static unsigned int allocation_size(CodeBuffer* cb, int header_size);
121 static unsigned int align_code_offset(int offset);
122
123 // Deletion
124 virtual void flush();
125
126 // Typing
127 virtual bool is_buffer_blob() const { return false; }
128 virtual bool is_nmethod() const { return false; }
129 virtual bool is_runtime_stub() const { return false; }
130 virtual bool is_deoptimization_stub() const { return false; }
131 virtual bool is_uncommon_trap_stub() const { return false; }
132 virtual bool is_exception_stub() const { return false; }
133 virtual bool is_safepoint_stub() const { return false; }
134 virtual bool is_adapter_blob() const { return false; }
135 virtual bool is_method_handles_adapter_blob() const { return false; }
136 virtual bool is_aot() const { return false; }
137 virtual bool is_compiled() const { return false; }
138
139 inline bool is_compiled_by_c1() const { return _type == compiler_c1; };
140 inline bool is_compiled_by_c2() const { return _type == compiler_c2; };
141 inline bool is_compiled_by_jvmci() const { return _type == compiler_jvmci; };
142 const char* compiler_name() const;
143
144 // Casting
145 nmethod* as_nmethod_or_null() { return is_nmethod() ? (nmethod*) this : NULL; }
146 nmethod* as_nmethod() { assert(is_nmethod(), "must be nmethod"); return (nmethod*) this; }
147 CompiledMethod* as_compiled_method_or_null() { return is_compiled() ? (CompiledMethod*) this : NULL; }
148 CompiledMethod* as_compiled_method() { assert(is_compiled(), "must be compiled"); return (CompiledMethod*) this; }
149 CodeBlob* as_codeblob_or_null() const { return (CodeBlob*) this; }
150
151 // Boundaries
152 address header_begin() const { return (address) this; }
153 relocInfo* relocation_begin() const { return (relocInfo*) _relocation_begin; };
154 relocInfo* relocation_end() const { return (relocInfo*) _relocation_end; }
363
364 // OopMap for frame
365 virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { ShouldNotReachHere(); }
366
367 // Debugging
368 void print() const { print_on(tty); }
369 virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
370 virtual void print_value_on(outputStream* st) const { CodeBlob::print_value_on(st); }
371
372 // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
373 static void trace_new_stub(RuntimeBlob* blob, const char* name1, const char* name2 = "");
374 };
375
376 class WhiteBox;
377 //----------------------------------------------------------------------------------------------------
378 // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
379
380 class BufferBlob: public RuntimeBlob {
381 friend class VMStructs;
382 friend class AdapterBlob;
383 friend class MethodHandlesAdapterBlob;
384 friend class WhiteBox;
385
386 private:
387 // Creation support
388 BufferBlob(const char* name, int size);
389 BufferBlob(const char* name, int size, CodeBuffer* cb);
390
391 void* operator new(size_t s, unsigned size) throw();
392
393 public:
394 // Creation
395 static BufferBlob* create(const char* name, int buffer_size);
396 static BufferBlob* create(const char* name, CodeBuffer* cb);
397
398 static void free(BufferBlob* buf);
399
400 // Typing
401 virtual bool is_buffer_blob() const { return true; }
402
408 void print_on(outputStream* st) const;
409 void print_value_on(outputStream* st) const;
410 };
411
412
413 //----------------------------------------------------------------------------------------------------
414 // AdapterBlob: used to hold C2I/I2C adapters
415
416 class AdapterBlob: public BufferBlob {
417 private:
418 AdapterBlob(int size, CodeBuffer* cb);
419
420 public:
421 // Creation
422 static AdapterBlob* create(CodeBuffer* cb);
423
424 // Typing
425 virtual bool is_adapter_blob() const { return true; }
426 };
427
428
429 //----------------------------------------------------------------------------------------------------
430 // MethodHandlesAdapterBlob: used to hold MethodHandles adapters
431
432 class MethodHandlesAdapterBlob: public BufferBlob {
433 private:
434 MethodHandlesAdapterBlob(int size) : BufferBlob("MethodHandles adapters", size) {}
435
436 public:
437 // Creation
438 static MethodHandlesAdapterBlob* create(int buffer_size);
439
440 // Typing
441 virtual bool is_method_handles_adapter_blob() const { return true; }
442 };
443
444
445 //----------------------------------------------------------------------------------------------------
446 // RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine
447
448 class RuntimeStub: public RuntimeBlob {
|
115
116 CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments);
117 CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments);
118 public:
119 // Returns the space needed for CodeBlob
120 static unsigned int allocation_size(CodeBuffer* cb, int header_size);
121 static unsigned int align_code_offset(int offset);
122
123 // Deletion
124 virtual void flush();
125
126 // Typing
127 virtual bool is_buffer_blob() const { return false; }
128 virtual bool is_nmethod() const { return false; }
129 virtual bool is_runtime_stub() const { return false; }
130 virtual bool is_deoptimization_stub() const { return false; }
131 virtual bool is_uncommon_trap_stub() const { return false; }
132 virtual bool is_exception_stub() const { return false; }
133 virtual bool is_safepoint_stub() const { return false; }
134 virtual bool is_adapter_blob() const { return false; }
135 virtual bool is_vtable_blob() const { return false; }
136 virtual bool is_method_handles_adapter_blob() const { return false; }
137 virtual bool is_aot() const { return false; }
138 virtual bool is_compiled() const { return false; }
139
140 inline bool is_compiled_by_c1() const { return _type == compiler_c1; };
141 inline bool is_compiled_by_c2() const { return _type == compiler_c2; };
142 inline bool is_compiled_by_jvmci() const { return _type == compiler_jvmci; };
143 const char* compiler_name() const;
144
145 // Casting
146 nmethod* as_nmethod_or_null() { return is_nmethod() ? (nmethod*) this : NULL; }
147 nmethod* as_nmethod() { assert(is_nmethod(), "must be nmethod"); return (nmethod*) this; }
148 CompiledMethod* as_compiled_method_or_null() { return is_compiled() ? (CompiledMethod*) this : NULL; }
149 CompiledMethod* as_compiled_method() { assert(is_compiled(), "must be compiled"); return (CompiledMethod*) this; }
150 CodeBlob* as_codeblob_or_null() const { return (CodeBlob*) this; }
151
152 // Boundaries
153 address header_begin() const { return (address) this; }
154 relocInfo* relocation_begin() const { return (relocInfo*) _relocation_begin; };
155 relocInfo* relocation_end() const { return (relocInfo*) _relocation_end; }
364
365 // OopMap for frame
366 virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { ShouldNotReachHere(); }
367
368 // Debugging
369 void print() const { print_on(tty); }
370 virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
371 virtual void print_value_on(outputStream* st) const { CodeBlob::print_value_on(st); }
372
373 // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
374 static void trace_new_stub(RuntimeBlob* blob, const char* name1, const char* name2 = "");
375 };
376
377 class WhiteBox;
378 //----------------------------------------------------------------------------------------------------
379 // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
380
381 class BufferBlob: public RuntimeBlob {
382 friend class VMStructs;
383 friend class AdapterBlob;
384 friend class VtableBlob;
385 friend class MethodHandlesAdapterBlob;
386 friend class WhiteBox;
387
388 private:
389 // Creation support
390 BufferBlob(const char* name, int size);
391 BufferBlob(const char* name, int size, CodeBuffer* cb);
392
393 void* operator new(size_t s, unsigned size) throw();
394
395 public:
396 // Creation
397 static BufferBlob* create(const char* name, int buffer_size);
398 static BufferBlob* create(const char* name, CodeBuffer* cb);
399
400 static void free(BufferBlob* buf);
401
402 // Typing
403 virtual bool is_buffer_blob() const { return true; }
404
410 void print_on(outputStream* st) const;
411 void print_value_on(outputStream* st) const;
412 };
413
414
415 //----------------------------------------------------------------------------------------------------
416 // AdapterBlob: used to hold C2I/I2C adapters
417
418 class AdapterBlob: public BufferBlob {
419 private:
420 AdapterBlob(int size, CodeBuffer* cb);
421
422 public:
423 // Creation
424 static AdapterBlob* create(CodeBuffer* cb);
425
426 // Typing
427 virtual bool is_adapter_blob() const { return true; }
428 };
429
430 //---------------------------------------------------------------------------------------------------
431 class VtableBlob: public BufferBlob {
432 private:
433 VtableBlob(const char*, int);
434
435 public:
436 // Creation
437 static VtableBlob* create(const char* name, int buffer_size);
438
439 // Typing
440 virtual bool is_vtable_blob() const { return true; }
441 };
442
443 //----------------------------------------------------------------------------------------------------
444 // MethodHandlesAdapterBlob: used to hold MethodHandles adapters
445
446 class MethodHandlesAdapterBlob: public BufferBlob {
447 private:
448 MethodHandlesAdapterBlob(int size) : BufferBlob("MethodHandles adapters", size) {}
449
450 public:
451 // Creation
452 static MethodHandlesAdapterBlob* create(int buffer_size);
453
454 // Typing
455 virtual bool is_method_handles_adapter_blob() const { return true; }
456 };
457
458
459 //----------------------------------------------------------------------------------------------------
460 // RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine
461
462 class RuntimeStub: public RuntimeBlob {
|