285 int a_byte = (*ptr) & 0xFF;
286 __ a_byte (a_byte);
287 }
288 }
289
290 address end_of_patch = __ pc();
291 int bytes_to_skip = 0;
292 if (_id == load_klass_id) {
293 int offset = __ offset();
294 if (CommentedAssembly) {
295 __ block_comment(" being_initialized check");
296 }
297
298 // static field accesses have special semantics while the class
299 // initializer is being run so we emit a test which can be used to
300 // check that this code is being executed by the initializing
301 // thread.
302 assert(_obj != noreg, "must be a valid register");
303 assert(_oop_index >= 0, "must have oop index");
304 __ load_heap_oop(_obj, java_lang_Class::klass_offset_in_bytes(), G3);
305 __ ld_ptr(G3, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc), G3);
306 __ cmp_and_brx_short(G2_thread, G3, Assembler::notEqual, Assembler::pn, call_patch);
307
308 // load_klass patches may execute the patched code before it's
309 // copied back into place so we need to jump back into the main
310 // code of the nmethod to continue execution.
311 __ br(Assembler::always, false, Assembler::pt, _patch_site_continuation);
312 __ delayed()->nop();
313
314 // make sure this extra code gets skipped
315 bytes_to_skip += __ offset() - offset;
316 }
317
318 // Now emit the patch record telling the runtime how to find the
319 // pieces of the patch. We only need 3 bytes but it has to be
320 // aligned as an instruction so emit 4 bytes.
321 int sizeof_patch_record = 4;
322 bytes_to_skip += sizeof_patch_record;
323
324 // emit the offsets needed to find the code to patch
325 int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record;
454 Register src_reg = src()->as_register();
455
456 if (gen_src_check()) {
457 // The original src operand was not a constant.
458 // Generate src == null?
459 if (__ is_in_wdisp16_range(_continuation)) {
460 __ br_null(src_reg, /*annul*/false, Assembler::pt, _continuation);
461 } else {
462 __ cmp(src_reg, G0);
463 __ brx(Assembler::equal, false, Assembler::pt, _continuation);
464 }
465 __ delayed()->nop();
466 }
467
468 // Generate src->_klass->_reference_type() == REF_NONE)?
469 assert(tmp()->is_register(), "sanity");
470 Register tmp_reg = tmp()->as_register();
471
472 __ load_klass(src_reg, tmp_reg);
473
474 Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes() + sizeof(oopDesc));
475 __ ld(ref_type_adr, tmp_reg);
476
477 // _reference_type field is of type ReferenceType (enum)
478 assert(REF_NONE == 0, "check this code");
479 __ cmp_zero_and_br(Assembler::equal, tmp_reg, _continuation, /*annul*/false, Assembler::pt);
480 __ delayed()->nop();
481
482 // Is marking active?
483 assert(thread()->is_register(), "precondition");
484 Register thread_reg = thread()->as_pointer_register();
485
486 Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() +
487 PtrQueue::byte_offset_of_active()));
488
489 if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
490 __ ld(in_progress, tmp_reg);
491 } else {
492 assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
493 __ ldsb(in_progress, tmp_reg);
494 }
|
285 int a_byte = (*ptr) & 0xFF;
286 __ a_byte (a_byte);
287 }
288 }
289
290 address end_of_patch = __ pc();
291 int bytes_to_skip = 0;
292 if (_id == load_klass_id) {
293 int offset = __ offset();
294 if (CommentedAssembly) {
295 __ block_comment(" being_initialized check");
296 }
297
298 // static field accesses have special semantics while the class
299 // initializer is being run so we emit a test which can be used to
300 // check that this code is being executed by the initializing
301 // thread.
302 assert(_obj != noreg, "must be a valid register");
303 assert(_oop_index >= 0, "must have oop index");
304 __ load_heap_oop(_obj, java_lang_Class::klass_offset_in_bytes(), G3);
305 __ ld_ptr(G3, instanceKlass::init_thread_offset_in_bytes(), G3);
306 __ cmp_and_brx_short(G2_thread, G3, Assembler::notEqual, Assembler::pn, call_patch);
307
308 // load_klass patches may execute the patched code before it's
309 // copied back into place so we need to jump back into the main
310 // code of the nmethod to continue execution.
311 __ br(Assembler::always, false, Assembler::pt, _patch_site_continuation);
312 __ delayed()->nop();
313
314 // make sure this extra code gets skipped
315 bytes_to_skip += __ offset() - offset;
316 }
317
318 // Now emit the patch record telling the runtime how to find the
319 // pieces of the patch. We only need 3 bytes but it has to be
320 // aligned as an instruction so emit 4 bytes.
321 int sizeof_patch_record = 4;
322 bytes_to_skip += sizeof_patch_record;
323
324 // emit the offsets needed to find the code to patch
325 int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record;
454 Register src_reg = src()->as_register();
455
456 if (gen_src_check()) {
457 // The original src operand was not a constant.
458 // Generate src == null?
459 if (__ is_in_wdisp16_range(_continuation)) {
460 __ br_null(src_reg, /*annul*/false, Assembler::pt, _continuation);
461 } else {
462 __ cmp(src_reg, G0);
463 __ brx(Assembler::equal, false, Assembler::pt, _continuation);
464 }
465 __ delayed()->nop();
466 }
467
468 // Generate src->_klass->_reference_type() == REF_NONE)?
469 assert(tmp()->is_register(), "sanity");
470 Register tmp_reg = tmp()->as_register();
471
472 __ load_klass(src_reg, tmp_reg);
473
474 Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes());
475 __ ld(ref_type_adr, tmp_reg);
476
477 // _reference_type field is of type ReferenceType (enum)
478 assert(REF_NONE == 0, "check this code");
479 __ cmp_zero_and_br(Assembler::equal, tmp_reg, _continuation, /*annul*/false, Assembler::pt);
480 __ delayed()->nop();
481
482 // Is marking active?
483 assert(thread()->is_register(), "precondition");
484 Register thread_reg = thread()->as_pointer_register();
485
486 Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() +
487 PtrQueue::byte_offset_of_active()));
488
489 if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
490 __ ld(in_progress, tmp_reg);
491 } else {
492 assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
493 __ ldsb(in_progress, tmp_reg);
494 }
|