src/cpu/x86/vm/c1_CodeStubs_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7118863 Sdiff src/cpu/x86/vm

src/cpu/x86/vm/c1_CodeStubs_x86.cpp

Print this page




 303       *ptr = 0x90; // make the site look like a nop
 304     }
 305   }
 306 
 307   address end_of_patch = __ pc();
 308   int bytes_to_skip = 0;
 309   if (_id == load_klass_id) {
 310     int offset = __ offset();
 311     if (CommentedAssembly) {
 312       __ block_comment(" being_initialized check");
 313     }
 314     assert(_obj != noreg, "must be a valid register");
 315     Register tmp = rax;
 316     Register tmp2 = rbx;
 317     __ push(tmp);
 318     __ push(tmp2);
 319     // Load without verification to keep code size small. We need it because
 320     // begin_initialized_entry_offset has to fit in a byte. Also, we know it's not null.
 321     __ load_heap_oop_not_null(tmp2, Address(_obj, java_lang_Class::klass_offset_in_bytes()));
 322     __ get_thread(tmp);
 323     __ cmpptr(tmp, Address(tmp2, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc)));
 324     __ pop(tmp2);
 325     __ pop(tmp);
 326     __ jcc(Assembler::notEqual, call_patch);
 327 
 328     // access_field patches may execute the patched code before it's
 329     // copied back into place so we need to jump back into the main
 330     // code of the nmethod to continue execution.
 331     __ jmp(_patch_site_continuation);
 332 
 333     // make sure this extra code gets skipped
 334     bytes_to_skip += __ offset() - offset;
 335   }
 336   if (CommentedAssembly) {
 337     __ block_comment("patch data encoded as movl");
 338   }
 339   // Now emit the patch record telling the runtime how to find the
 340   // pieces of the patch.  We only need 3 bytes but for readability of
 341   // the disassembly we make the data look like a movl reg, imm32,
 342   // which requires 5 bytes
 343   int sizeof_patch_record = 5;


 502   //   goto continuation
 503   //
 504   __ bind(_entry);
 505 
 506   assert(src()->is_register(), "sanity");
 507   Register src_reg = src()->as_register();
 508 
 509   if (gen_src_check()) {
 510     // The original src operand was not a constant.
 511     // Generate src == null?
 512     __ cmpptr(src_reg, (int32_t) NULL_WORD);
 513     __ jcc(Assembler::equal, _continuation);
 514   }
 515 
 516   // Generate src->_klass->_reference_type == REF_NONE)?
 517   assert(tmp()->is_register(), "sanity");
 518   Register tmp_reg = tmp()->as_register();
 519 
 520   __ load_klass(tmp_reg, src_reg);
 521 
 522   Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes() + sizeof(oopDesc));
 523   __ cmpl(ref_type_adr, REF_NONE);
 524   __ jcc(Assembler::equal, _continuation);
 525 
 526   // Is marking active?
 527   assert(thread()->is_register(), "precondition");
 528   Register thread_reg = thread()->as_pointer_register();
 529 
 530   Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() +
 531                                        PtrQueue::byte_offset_of_active()));
 532 
 533   if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
 534     __ cmpl(in_progress, 0);
 535   } else {
 536     assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
 537     __ cmpb(in_progress, 0);
 538   }
 539   __ jcc(Assembler::equal, _continuation);
 540 
 541   // val == null?
 542   assert(val()->is_register(), "Precondition.");




 303       *ptr = 0x90; // make the site look like a nop
 304     }
 305   }
 306 
 307   address end_of_patch = __ pc();
 308   int bytes_to_skip = 0;
 309   if (_id == load_klass_id) {
 310     int offset = __ offset();
 311     if (CommentedAssembly) {
 312       __ block_comment(" being_initialized check");
 313     }
 314     assert(_obj != noreg, "must be a valid register");
 315     Register tmp = rax;
 316     Register tmp2 = rbx;
 317     __ push(tmp);
 318     __ push(tmp2);
 319     // Load without verification to keep code size small. We need it because
 320     // begin_initialized_entry_offset has to fit in a byte. Also, we know it's not null.
 321     __ load_heap_oop_not_null(tmp2, Address(_obj, java_lang_Class::klass_offset_in_bytes()));
 322     __ get_thread(tmp);
 323     __ cmpptr(tmp, Address(tmp2, instanceKlass::init_thread_offset_in_bytes()));
 324     __ pop(tmp2);
 325     __ pop(tmp);
 326     __ jcc(Assembler::notEqual, call_patch);
 327 
 328     // access_field patches may execute the patched code before it's
 329     // copied back into place so we need to jump back into the main
 330     // code of the nmethod to continue execution.
 331     __ jmp(_patch_site_continuation);
 332 
 333     // make sure this extra code gets skipped
 334     bytes_to_skip += __ offset() - offset;
 335   }
 336   if (CommentedAssembly) {
 337     __ block_comment("patch data encoded as movl");
 338   }
 339   // Now emit the patch record telling the runtime how to find the
 340   // pieces of the patch.  We only need 3 bytes but for readability of
 341   // the disassembly we make the data look like a movl reg, imm32,
 342   // which requires 5 bytes
 343   int sizeof_patch_record = 5;


 502   //   goto continuation
 503   //
 504   __ bind(_entry);
 505 
 506   assert(src()->is_register(), "sanity");
 507   Register src_reg = src()->as_register();
 508 
 509   if (gen_src_check()) {
 510     // The original src operand was not a constant.
 511     // Generate src == null?
 512     __ cmpptr(src_reg, (int32_t) NULL_WORD);
 513     __ jcc(Assembler::equal, _continuation);
 514   }
 515 
 516   // Generate src->_klass->_reference_type == REF_NONE)?
 517   assert(tmp()->is_register(), "sanity");
 518   Register tmp_reg = tmp()->as_register();
 519 
 520   __ load_klass(tmp_reg, src_reg);
 521 
 522   Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes());
 523   __ cmpl(ref_type_adr, REF_NONE);
 524   __ jcc(Assembler::equal, _continuation);
 525 
 526   // Is marking active?
 527   assert(thread()->is_register(), "precondition");
 528   Register thread_reg = thread()->as_pointer_register();
 529 
 530   Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() +
 531                                        PtrQueue::byte_offset_of_active()));
 532 
 533   if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
 534     __ cmpl(in_progress, 0);
 535   } else {
 536     assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
 537     __ cmpb(in_progress, 0);
 538   }
 539   __ jcc(Assembler::equal, _continuation);
 540 
 541   // val == null?
 542   assert(val()->is_register(), "Precondition.");


src/cpu/x86/vm/c1_CodeStubs_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File