106 if (locs_size != 0) {
107 _insts.initialize_locs(locs_size / sizeof(relocInfo));
108 }
109
110 assert(verify_section_allocation(), "initial use of blob is OK");
111 }
112
113
114 CodeBuffer::~CodeBuffer() {
115 // If we allocate our code buffer from the CodeCache
116 // via a BufferBlob, and it's not permanent, then
117 // free the BufferBlob.
118 // The rest of the memory will be freed when the ResourceObj
119 // is released.
120 assert(verify_section_allocation(), "final storage configuration still OK");
121 for (CodeBuffer* cb = this; cb != NULL; cb = cb->before_expand()) {
122 // Previous incarnations of this buffer are held live, so that internal
123 // addresses constructed before expansions will not be confused.
124 cb->free_blob();
125 }
126 #ifdef ASSERT
127 Copy::fill_to_bytes(this, sizeof(*this), badResourceValue);
128 #endif
129 }
130
131 void CodeBuffer::initialize_oop_recorder(OopRecorder* r) {
132 assert(_oop_recorder == &_default_oop_recorder && _default_oop_recorder.is_unused(), "do this once");
133 DEBUG_ONLY(_default_oop_recorder.oop_size()); // force unused OR to be frozen
134 _oop_recorder = r;
135 }
136
137 void CodeBuffer::initialize_section_size(CodeSection* cs, csize_t size) {
138 assert(cs != &_insts, "insts is the memory provider, not the consumer");
139 #ifdef ASSERT
140 for (int n = (int)SECT_INSTS+1; n < (int)SECT_LIMIT; n++) {
141 CodeSection* prevCS = code_section(n);
142 if (prevCS == cs) break;
143 assert(!prevCS->is_allocated(), "section allocation must be in reverse order");
144 }
145 #endif
|
106 if (locs_size != 0) {
107 _insts.initialize_locs(locs_size / sizeof(relocInfo));
108 }
109
110 assert(verify_section_allocation(), "initial use of blob is OK");
111 }
112
113
114 CodeBuffer::~CodeBuffer() {
115 // If we allocate our code buffer from the CodeCache
116 // via a BufferBlob, and it's not permanent, then
117 // free the BufferBlob.
118 // The rest of the memory will be freed when the ResourceObj
119 // is released.
120 assert(verify_section_allocation(), "final storage configuration still OK");
121 for (CodeBuffer* cb = this; cb != NULL; cb = cb->before_expand()) {
122 // Previous incarnations of this buffer are held live, so that internal
123 // addresses constructed before expansions will not be confused.
124 cb->free_blob();
125 }
126 if (_overflow_arena != NULL) {
127 // free any overflow storage
128 delete _overflow_arena;
129 }
130 #ifdef ASSERT
131 Copy::fill_to_bytes(this, sizeof(*this), badResourceValue);
132 #endif
133 }
134
135 void CodeBuffer::initialize_oop_recorder(OopRecorder* r) {
136 assert(_oop_recorder == &_default_oop_recorder && _default_oop_recorder.is_unused(), "do this once");
137 DEBUG_ONLY(_default_oop_recorder.oop_size()); // force unused OR to be frozen
138 _oop_recorder = r;
139 }
140
141 void CodeBuffer::initialize_section_size(CodeSection* cs, csize_t size) {
142 assert(cs != &_insts, "insts is the memory provider, not the consumer");
143 #ifdef ASSERT
144 for (int n = (int)SECT_INSTS+1; n < (int)SECT_LIMIT; n++) {
145 CodeSection* prevCS = code_section(n);
146 if (prevCS == cs) break;
147 assert(!prevCS->is_allocated(), "section allocation must be in reverse order");
148 }
149 #endif
|