< prev index next >

src/hotspot/share/code/codeBlob.cpp

Print this page

190 
191 void CodeBlob::restore_mutable_data(address reloc_data) {
192   // Relocation data is now stored as part of the mutable data area; allocate it before copy relocations
193   if (_mutable_data_size > 0) {
194     _mutable_data = (address)os::malloc(_mutable_data_size, mtCode);
195     if (_mutable_data == nullptr) {
196       vm_exit_out_of_memory(_mutable_data_size, OOM_MALLOC_ERROR, "codebuffer: no space for mutable data");
197     }
198   }
199   if (_relocation_size > 0) {
200     memcpy((address)relocation_begin(), reloc_data, relocation_size());
201   }
202 }
203 
204 void CodeBlob::purge() {
205   assert(_mutable_data != nullptr, "should never be null");
206   if (_mutable_data != blob_end()) {
207     os::free(_mutable_data);
208     _mutable_data = blob_end(); // Valid not null address
209   }
210   if (_oop_maps != nullptr) {
211     delete _oop_maps;
212     _oop_maps = nullptr;
213   }
214   NOT_PRODUCT(_asm_remarks.clear());
215   NOT_PRODUCT(_dbg_strings.clear());
216 }
217 
218 void CodeBlob::set_oop_maps(OopMapSet* p) {
219   // Danger Will Robinson! This method allocates a big
220   // chunk of memory, its your job to free it.
221   if (p != nullptr) {
222     _oop_maps = ImmutableOopMapSet::build_from(p);
223   } else {
224     _oop_maps = nullptr;
225   }
226 }
227 
228 const ImmutableOopMap* CodeBlob::oop_map_for_return_address(address return_address) const {
229   assert(_oop_maps != nullptr, "nope");
230   return _oop_maps->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin());

190 
191 void CodeBlob::restore_mutable_data(address reloc_data) {
192   // Relocation data is now stored as part of the mutable data area; allocate it before copy relocations
193   if (_mutable_data_size > 0) {
194     _mutable_data = (address)os::malloc(_mutable_data_size, mtCode);
195     if (_mutable_data == nullptr) {
196       vm_exit_out_of_memory(_mutable_data_size, OOM_MALLOC_ERROR, "codebuffer: no space for mutable data");
197     }
198   }
199   if (_relocation_size > 0) {
200     memcpy((address)relocation_begin(), reloc_data, relocation_size());
201   }
202 }
203 
204 void CodeBlob::purge() {
205   assert(_mutable_data != nullptr, "should never be null");
206   if (_mutable_data != blob_end()) {
207     os::free(_mutable_data);
208     _mutable_data = blob_end(); // Valid not null address
209   }
210   if (_oop_maps != nullptr && !AOTCodeCache::is_address_in_aot_cache((address)_oop_maps)) {
211     delete _oop_maps;
212     _oop_maps = nullptr;
213   }
214   NOT_PRODUCT(_asm_remarks.clear());
215   NOT_PRODUCT(_dbg_strings.clear());
216 }
217 
218 void CodeBlob::set_oop_maps(OopMapSet* p) {
219   // Danger Will Robinson! This method allocates a big
220   // chunk of memory, its your job to free it.
221   if (p != nullptr) {
222     _oop_maps = ImmutableOopMapSet::build_from(p);
223   } else {
224     _oop_maps = nullptr;
225   }
226 }
227 
228 const ImmutableOopMap* CodeBlob::oop_map_for_return_address(address return_address) const {
229   assert(_oop_maps != nullptr, "nope");
230   return _oop_maps->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin());
< prev index next >