< prev index next >

src/hotspot/cpu/ppc/nativeInst_ppc.cpp

Print this page

188     return addr_at(load_const_instruction_size);
189   }
190 }
191 
192 intptr_t NativeMovConstReg::data() const {
193   address   addr = addr_at(0);
194 
195   if (MacroAssembler::is_load_const_at(addr)) {
196     return MacroAssembler::get_const(addr);
197   }
198 
199   CodeBlob* cb = CodeCache::find_blob(addr);
200   assert(cb != nullptr, "Could not find code blob");
201   if (MacroAssembler::is_set_narrow_oop(addr, cb->content_begin())) {
202     narrowOop no = MacroAssembler::get_narrow_oop(addr, cb->content_begin());
203     // We can reach here during GC with 'no' pointing to new object location
204     // while 'heap()->is_in' still reports false (e.g. with SerialGC).
205     // Therefore we use raw decoding.
206     if (CompressedOops::is_null(no)) return 0;
207     return cast_from_oop<intptr_t>(CompressedOops::decode_raw(no));
208   } else {
209     assert(MacroAssembler::is_load_const_from_method_toc_at(addr), "must be load_const_from_pool");
210 
211     address ctable = cb->content_begin();
212     int offset = MacroAssembler::get_offset_of_load_const_from_method_toc_at(addr);
213     return *(intptr_t *)(ctable + offset);




214   }
215 }
216 
217 address NativeMovConstReg::set_data_plain(intptr_t data, CodeBlob *cb) {
218   address addr         = instruction_address();
219   address next_address = nullptr;
220   if (!cb) cb = CodeCache::find_blob(addr);
221 
222   if (cb != nullptr && MacroAssembler::is_load_const_from_method_toc_at(addr)) {
223     // A load from the method's TOC (ctable).
224     assert(cb->is_nmethod(), "must be nmethod");
225     const address ctable = cb->content_begin();
226     const int toc_offset = MacroAssembler::get_offset_of_load_const_from_method_toc_at(addr);
227     *(intptr_t *)(ctable + toc_offset) = data;
228     next_address = addr + BytesPerInstWord;
229   } else if (cb != nullptr &&
230              MacroAssembler::is_calculate_address_from_global_toc_at(addr, cb->content_begin())) {
231     // A calculation relative to the global TOC.
232     if (MacroAssembler::get_address_of_calculate_address_from_global_toc_at(addr, cb->content_begin()) !=
233         (address)data) {

188     return addr_at(load_const_instruction_size);
189   }
190 }
191 
192 intptr_t NativeMovConstReg::data() const {
193   address   addr = addr_at(0);
194 
195   if (MacroAssembler::is_load_const_at(addr)) {
196     return MacroAssembler::get_const(addr);
197   }
198 
199   CodeBlob* cb = CodeCache::find_blob(addr);
200   assert(cb != nullptr, "Could not find code blob");
201   if (MacroAssembler::is_set_narrow_oop(addr, cb->content_begin())) {
202     narrowOop no = MacroAssembler::get_narrow_oop(addr, cb->content_begin());
203     // We can reach here during GC with 'no' pointing to new object location
204     // while 'heap()->is_in' still reports false (e.g. with SerialGC).
205     // Therefore we use raw decoding.
206     if (CompressedOops::is_null(no)) return 0;
207     return cast_from_oop<intptr_t>(CompressedOops::decode_raw(no));
208   } else if (MacroAssembler::is_load_const_from_method_toc_at(addr)) {


209     address ctable = cb->content_begin();
210     int offset = MacroAssembler::get_offset_of_load_const_from_method_toc_at(addr);
211     return *(intptr_t *)(ctable + offset);
212   } else {
213     assert(MacroAssembler::is_calculate_address_from_global_toc_at(addr, addr - BytesPerInstWord),
214            "must be calculate_address_from_global_toc");
215     return (intptr_t) MacroAssembler::get_address_of_calculate_address_from_global_toc_at(addr, addr - BytesPerInstWord);
216   }
217 }
218 
219 address NativeMovConstReg::set_data_plain(intptr_t data, CodeBlob *cb) {
220   address addr         = instruction_address();
221   address next_address = nullptr;
222   if (!cb) cb = CodeCache::find_blob(addr);
223 
224   if (cb != nullptr && MacroAssembler::is_load_const_from_method_toc_at(addr)) {
225     // A load from the method's TOC (ctable).
226     assert(cb->is_nmethod(), "must be nmethod");
227     const address ctable = cb->content_begin();
228     const int toc_offset = MacroAssembler::get_offset_of_load_const_from_method_toc_at(addr);
229     *(intptr_t *)(ctable + toc_offset) = data;
230     next_address = addr + BytesPerInstWord;
231   } else if (cb != nullptr &&
232              MacroAssembler::is_calculate_address_from_global_toc_at(addr, cb->content_begin())) {
233     // A calculation relative to the global TOC.
234     if (MacroAssembler::get_address_of_calculate_address_from_global_toc_at(addr, cb->content_begin()) !=
235         (address)data) {
< prev index next >