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()
559 OopRecorder* recorder = oop_recorder();
560 return (recorder == NULL)? 0: recorder->oop_size();
561 }
562
563 // allocated size of any and all recorded metadata
564 csize_t total_metadata_size() const {
565 OopRecorder* recorder = oop_recorder();
566 return (recorder == NULL)? 0: recorder->metadata_size();
567 }
568
569 // Configuration functions, called immediately after the CB is constructed.
570 // The section sizes are subtracted from the original insts section.
571 // Note: Call them in reverse section order, because each steals from insts.
572 void initialize_consts_size(csize_t size) { initialize_section_size(&_consts, size); }
573 void initialize_stubs_size(csize_t size) { initialize_section_size(&_stubs, size); }
574 // Override default oop recorder.
575 void initialize_oop_recorder(OopRecorder* r);
576
577 OopRecorder* oop_recorder() const { return _oop_recorder; }
578 CodeStrings& strings() { return _code_strings; }
579
580 void free_strings() {
581 if (!_code_strings.is_null()) {
582 _code_strings.free(); // sets _strings Null as a side-effect.
583 }
584 }
585
586 // Code generation
587 void relocate(address at, RelocationHolder const& rspec, int format = 0) {
588 _insts.relocate(at, rspec, format);
589 }
590 void relocate(address at, relocInfo::relocType rtype, int format = 0) {
591 _insts.relocate(at, rtype, format);
592 }
593
594 // Management of overflow storage for binding of Labels.
595 GrowableArray<int>* create_patch_overflow();
596
597 // NMethod generation
598 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 address _last_membar; // used to merge consecutive memory barriers
379
380 address _decode_begin; // start address for decode
381 address decode_begin();
382
383 void initialize_misc(const char * name) {
384 // all pointers other than code_start/end and those inside the sections
385 assert(name != NULL, "must have a name");
386 _name = name;
387 _before_expand = NULL;
388 _blob = NULL;
389 _oop_recorder = NULL;
390 _decode_begin = NULL;
391 _overflow_arena = NULL;
392 _code_strings = CodeStrings();
393 _last_membar = NULL;
394 }
395
396 void initialize(address code_start, csize_t code_size) {
397 _consts.initialize_outer(this, SECT_CONSTS);
398 _insts.initialize_outer(this, SECT_INSTS);
399 _stubs.initialize_outer(this, SECT_STUBS);
400 _total_start = code_start;
401 _total_size = code_size;
402 // Initialize the main section:
403 _insts.initialize(code_start, code_size);
404 assert(!_stubs.is_allocated(), "no garbage here");
405 assert(!_consts.is_allocated(), "no garbage here");
406 _oop_recorder = &_default_oop_recorder;
407 }
408
409 void initialize_section_size(CodeSection* cs, csize_t size);
410
411 void freeze_section(CodeSection* cs);
412
413 // helper for CodeBuffer::expand()
562 OopRecorder* recorder = oop_recorder();
563 return (recorder == NULL)? 0: recorder->oop_size();
564 }
565
566 // allocated size of any and all recorded metadata
567 csize_t total_metadata_size() const {
568 OopRecorder* recorder = oop_recorder();
569 return (recorder == NULL)? 0: recorder->metadata_size();
570 }
571
572 // Configuration functions, called immediately after the CB is constructed.
573 // The section sizes are subtracted from the original insts section.
574 // Note: Call them in reverse section order, because each steals from insts.
575 void initialize_consts_size(csize_t size) { initialize_section_size(&_consts, size); }
576 void initialize_stubs_size(csize_t size) { initialize_section_size(&_stubs, size); }
577 // Override default oop recorder.
578 void initialize_oop_recorder(OopRecorder* r);
579
580 OopRecorder* oop_recorder() const { return _oop_recorder; }
581 CodeStrings& strings() { return _code_strings; }
582
583 address last_membar() const { return _last_membar; }
584 void set_last_membar(address a) { _last_membar = a; }
585 void clear_last_membar() { set_last_membar(NULL); }
586
587 void free_strings() {
588 if (!_code_strings.is_null()) {
589 _code_strings.free(); // sets _strings Null as a side-effect.
590 }
591 }
592
593 // Code generation
594 void relocate(address at, RelocationHolder const& rspec, int format = 0) {
595 _insts.relocate(at, rspec, format);
596 }
597 void relocate(address at, relocInfo::relocType rtype, int format = 0) {
598 _insts.relocate(at, rtype, format);
599 }
600
601 // Management of overflow storage for binding of Labels.
602 GrowableArray<int>* create_patch_overflow();
603
604 // NMethod generation
605 void copy_code_and_locs_to(CodeBlob* blob) {
|