365
366 const char* _name;
367
368 CodeSection _consts; // constants, jump tables
369 CodeSection _insts; // instructions (the main section)
370 CodeSection _stubs; // stubs (call site support), deopt, exception handling
371
372 CodeBuffer* _before_expand; // dead buffer, from before the last expansion
373
374 BufferBlob* _blob; // optional buffer in CodeCache for generated code
375 address _total_start; // first address of combined memory buffer
376 csize_t _total_size; // size in bytes of combined memory buffer
377
378 OopRecorder* _oop_recorder;
379 CodeStrings _code_strings;
380 OopRecorder _default_oop_recorder; // override with initialize_oop_recorder
381 Arena* _overflow_arena;
382
383 address _last_insn; // used to merge consecutive memory barriers, loads or stores.
384
385 address _decode_begin; // start address for decode
386 address decode_begin();
387
388 void initialize_misc(const char * name) {
389 // all pointers other than code_start/end and those inside the sections
390 assert(name != NULL, "must have a name");
391 _name = name;
392 _before_expand = NULL;
393 _blob = NULL;
394 _oop_recorder = NULL;
395 _decode_begin = NULL;
396 _overflow_arena = NULL;
397 _code_strings = CodeStrings();
398 _last_insn = NULL;
399 }
400
401 void initialize(address code_start, csize_t code_size) {
402 _consts.initialize_outer(this, SECT_CONSTS);
403 _insts.initialize_outer(this, SECT_INSTS);
404 _stubs.initialize_outer(this, SECT_STUBS);
405 _total_start = code_start;
406 _total_size = code_size;
407 // Initialize the main section:
408 _insts.initialize(code_start, code_size);
409 assert(!_stubs.is_allocated(), "no garbage here");
410 assert(!_consts.is_allocated(), "no garbage here");
411 _oop_recorder = &_default_oop_recorder;
412 }
413
414 void initialize_section_size(CodeSection* cs, csize_t size);
415
416 void freeze_section(CodeSection* cs);
417
418 // helper for CodeBuffer::expand()
611 // NMethod generation
612 void copy_code_and_locs_to(CodeBlob* blob) {
613 assert(blob != NULL, "sane");
614 copy_relocations_to(blob);
615 copy_code_to(blob);
616 }
617 void copy_values_to(nmethod* nm) {
618 if (!oop_recorder()->is_unused()) {
619 oop_recorder()->copy_values_to(nm);
620 }
621 }
622
623 // Transform an address from the code in this code buffer to a specified code buffer
624 address transform_address(const CodeBuffer &cb, address addr) const;
625
626 void block_comment(intptr_t offset, const char * comment) PRODUCT_RETURN;
627 const char* code_string(const char* str) PRODUCT_RETURN_(return NULL;);
628
629 // Log a little info about section usage in the CodeBuffer
630 void log_section_sizes(const char* name);
631
632 #ifndef PRODUCT
633 public:
634 // Printing / Decoding
635 // decodes from decode_begin() to code_end() and sets decode_begin to end
636 void decode();
637 void decode_all(); // decodes all the code
638 void skip_decode(); // sets decode_begin to code_end();
639 void print();
640 #endif
641
642
643 // The following header contains architecture-specific implementations
644 #include CPU_HEADER(codeBuffer)
645
646 };
647
648
649 inline void CodeSection::freeze() {
650 _outer->freeze_section(this);
|
365
366 const char* _name;
367
368 CodeSection _consts; // constants, jump tables
369 CodeSection _insts; // instructions (the main section)
370 CodeSection _stubs; // stubs (call site support), deopt, exception handling
371
372 CodeBuffer* _before_expand; // dead buffer, from before the last expansion
373
374 BufferBlob* _blob; // optional buffer in CodeCache for generated code
375 address _total_start; // first address of combined memory buffer
376 csize_t _total_size; // size in bytes of combined memory buffer
377
378 OopRecorder* _oop_recorder;
379 CodeStrings _code_strings;
380 OopRecorder _default_oop_recorder; // override with initialize_oop_recorder
381 Arena* _overflow_arena;
382
383 address _last_insn; // used to merge consecutive memory barriers, loads or stores.
384
385 #if INCLUDE_AOT
386 bool _immutable_PIC;
387 #endif
388
389 address _decode_begin; // start address for decode
390 address decode_begin();
391
392 void initialize_misc(const char * name) {
393 // all pointers other than code_start/end and those inside the sections
394 assert(name != NULL, "must have a name");
395 _name = name;
396 _before_expand = NULL;
397 _blob = NULL;
398 _oop_recorder = NULL;
399 _decode_begin = NULL;
400 _overflow_arena = NULL;
401 _code_strings = CodeStrings();
402 _last_insn = NULL;
403 #if INCLUDE_AOT
404 _immutable_PIC = false;
405 #endif
406 }
407
408 void initialize(address code_start, csize_t code_size) {
409 _consts.initialize_outer(this, SECT_CONSTS);
410 _insts.initialize_outer(this, SECT_INSTS);
411 _stubs.initialize_outer(this, SECT_STUBS);
412 _total_start = code_start;
413 _total_size = code_size;
414 // Initialize the main section:
415 _insts.initialize(code_start, code_size);
416 assert(!_stubs.is_allocated(), "no garbage here");
417 assert(!_consts.is_allocated(), "no garbage here");
418 _oop_recorder = &_default_oop_recorder;
419 }
420
421 void initialize_section_size(CodeSection* cs, csize_t size);
422
423 void freeze_section(CodeSection* cs);
424
425 // helper for CodeBuffer::expand()
618 // NMethod generation
619 void copy_code_and_locs_to(CodeBlob* blob) {
620 assert(blob != NULL, "sane");
621 copy_relocations_to(blob);
622 copy_code_to(blob);
623 }
624 void copy_values_to(nmethod* nm) {
625 if (!oop_recorder()->is_unused()) {
626 oop_recorder()->copy_values_to(nm);
627 }
628 }
629
630 // Transform an address from the code in this code buffer to a specified code buffer
631 address transform_address(const CodeBuffer &cb, address addr) const;
632
633 void block_comment(intptr_t offset, const char * comment) PRODUCT_RETURN;
634 const char* code_string(const char* str) PRODUCT_RETURN_(return NULL;);
635
636 // Log a little info about section usage in the CodeBuffer
637 void log_section_sizes(const char* name);
638
639 #if INCLUDE_AOT
640 // True if this is a code buffer used for immutable PIC, i.e. AOT
641 // compilation.
642 bool immutable_PIC() { return _immutable_PIC; }
643 void set_immutable_PIC(bool pic) { _immutable_PIC = pic; }
644 #endif
645
646 #ifndef PRODUCT
647 public:
648 // Printing / Decoding
649 // decodes from decode_begin() to code_end() and sets decode_begin to end
650 void decode();
651 void decode_all(); // decodes all the code
652 void skip_decode(); // sets decode_begin to code_end();
653 void print();
654 #endif
655
656
657 // The following header contains architecture-specific implementations
658 #include CPU_HEADER(codeBuffer)
659
660 };
661
662
663 inline void CodeSection::freeze() {
664 _outer->freeze_section(this);
|