358 sect_mask = (1<<sect_bits)-1
359 };
360
361 const char* _name;
362
363 CodeSection _consts; // constants, jump tables
364 CodeSection _insts; // instructions (the main section)
365 CodeSection _stubs; // stubs (call site support), deopt, exception handling
366
367 CodeBuffer* _before_expand; // dead buffer, from before the last expansion
368
369 BufferBlob* _blob; // optional buffer in CodeCache for generated code
370 address _total_start; // first address of combined memory buffer
371 csize_t _total_size; // size in bytes of combined memory buffer
372
373 OopRecorder* _oop_recorder;
374 CodeStrings _code_strings;
375 OopRecorder _default_oop_recorder; // override with initialize_oop_recorder
376 Arena* _overflow_arena;
377
378 address _decode_begin; // start address for decode
379 address decode_begin();
380
381 void initialize_misc(const char * name) {
382 // all pointers other than code_start/end and those inside the sections
383 assert(name != NULL, "must have a name");
384 _name = name;
385 _before_expand = NULL;
386 _blob = NULL;
387 _oop_recorder = NULL;
388 _decode_begin = NULL;
389 _overflow_arena = NULL;
390 _code_strings = CodeStrings();
391 }
392
393 void initialize(address code_start, csize_t code_size) {
394 _consts.initialize_outer(this, SECT_CONSTS);
395 _insts.initialize_outer(this, SECT_INSTS);
396 _stubs.initialize_outer(this, SECT_STUBS);
397 _total_start = code_start;
398 _total_size = code_size;
399 // Initialize the main section:
400 _insts.initialize(code_start, code_size);
401 assert(!_stubs.is_allocated(), "no garbage here");
402 assert(!_consts.is_allocated(), "no garbage here");
403 _oop_recorder = &_default_oop_recorder;
404 }
405
406 void initialize_section_size(CodeSection* cs, csize_t size);
407
408 void freeze_section(CodeSection* cs);
409
410 // helper for CodeBuffer::expand()
558 OopRecorder* recorder = oop_recorder();
559 return (recorder == NULL)? 0: recorder->oop_size();
560 }
561
562 // allocated size of any and all recorded metadata
563 csize_t total_metadata_size() const {
564 OopRecorder* recorder = oop_recorder();
565 return (recorder == NULL)? 0: recorder->metadata_size();
566 }
567
568 // Configuration functions, called immediately after the CB is constructed.
569 // The section sizes are subtracted from the original insts section.
570 // Note: Call them in reverse section order, because each steals from insts.
571 void initialize_consts_size(csize_t size) { initialize_section_size(&_consts, size); }
572 void initialize_stubs_size(csize_t size) { initialize_section_size(&_stubs, size); }
573 // Override default oop recorder.
574 void initialize_oop_recorder(OopRecorder* r);
575
576 OopRecorder* oop_recorder() const { return _oop_recorder; }
577 CodeStrings& strings() { return _code_strings; }
578
579 void free_strings() {
580 if (!_code_strings.is_null()) {
581 _code_strings.free(); // sets _strings Null as a side-effect.
582 }
583 }
584
585 // Code generation
586 void relocate(address at, RelocationHolder const& rspec, int format = 0) {
587 _insts.relocate(at, rspec, format);
588 }
589 void relocate(address at, relocInfo::relocType rtype, int format = 0) {
590 _insts.relocate(at, rtype, format);
591 }
592
593 // Management of overflow storage for binding of Labels.
594 GrowableArray<int>* create_patch_overflow();
595
596 // NMethod generation
597 void copy_code_and_locs_to(CodeBlob* blob) {
|
358 sect_mask = (1<<sect_bits)-1
359 };
360
361 const char* _name;
362
363 CodeSection _consts; // constants, jump tables
364 CodeSection _insts; // instructions (the main section)
365 CodeSection _stubs; // stubs (call site support), deopt, exception handling
366
367 CodeBuffer* _before_expand; // dead buffer, from before the last expansion
368
369 BufferBlob* _blob; // optional buffer in CodeCache for generated code
370 address _total_start; // first address of combined memory buffer
371 csize_t _total_size; // size in bytes of combined memory buffer
372
373 OopRecorder* _oop_recorder;
374 CodeStrings _code_strings;
375 OopRecorder _default_oop_recorder; // override with initialize_oop_recorder
376 Arena* _overflow_arena;
377
378 #ifdef AARCH64
379 address _last_membar; // used to merge consecutive memory barriers
380 #endif
381
382 address _decode_begin; // start address for decode
383 address decode_begin();
384
385 void initialize_misc(const char * name) {
386 // all pointers other than code_start/end and those inside the sections
387 assert(name != NULL, "must have a name");
388 _name = name;
389 _before_expand = NULL;
390 _blob = NULL;
391 _oop_recorder = NULL;
392 _decode_begin = NULL;
393 _overflow_arena = NULL;
394 _code_strings = CodeStrings();
395 #ifdef AARCH64
396 _last_membar = NULL;
397 #endif
398 }
399
400 void initialize(address code_start, csize_t code_size) {
401 _consts.initialize_outer(this, SECT_CONSTS);
402 _insts.initialize_outer(this, SECT_INSTS);
403 _stubs.initialize_outer(this, SECT_STUBS);
404 _total_start = code_start;
405 _total_size = code_size;
406 // Initialize the main section:
407 _insts.initialize(code_start, code_size);
408 assert(!_stubs.is_allocated(), "no garbage here");
409 assert(!_consts.is_allocated(), "no garbage here");
410 _oop_recorder = &_default_oop_recorder;
411 }
412
413 void initialize_section_size(CodeSection* cs, csize_t size);
414
415 void freeze_section(CodeSection* cs);
416
417 // helper for CodeBuffer::expand()
565 OopRecorder* recorder = oop_recorder();
566 return (recorder == NULL)? 0: recorder->oop_size();
567 }
568
569 // allocated size of any and all recorded metadata
570 csize_t total_metadata_size() const {
571 OopRecorder* recorder = oop_recorder();
572 return (recorder == NULL)? 0: recorder->metadata_size();
573 }
574
575 // Configuration functions, called immediately after the CB is constructed.
576 // The section sizes are subtracted from the original insts section.
577 // Note: Call them in reverse section order, because each steals from insts.
578 void initialize_consts_size(csize_t size) { initialize_section_size(&_consts, size); }
579 void initialize_stubs_size(csize_t size) { initialize_section_size(&_stubs, size); }
580 // Override default oop recorder.
581 void initialize_oop_recorder(OopRecorder* r);
582
583 OopRecorder* oop_recorder() const { return _oop_recorder; }
584 CodeStrings& strings() { return _code_strings; }
585
586 #ifdef AARCH64
587 address last_membar() const { return _last_membar; }
588 void set_last_membar(address a) { _last_membar = a; }
589 void clear_last_membar() { set_last_membar(NULL); }
590 #endif
591
592 void free_strings() {
593 if (!_code_strings.is_null()) {
594 _code_strings.free(); // sets _strings Null as a side-effect.
595 }
596 }
597
598 // Code generation
599 void relocate(address at, RelocationHolder const& rspec, int format = 0) {
600 _insts.relocate(at, rspec, format);
601 }
602 void relocate(address at, relocInfo::relocType rtype, int format = 0) {
603 _insts.relocate(at, rtype, format);
604 }
605
606 // Management of overflow storage for binding of Labels.
607 GrowableArray<int>* create_patch_overflow();
608
609 // NMethod generation
610 void copy_code_and_locs_to(CodeBlob* blob) {
|