comparison src/cpu/sparc/vm/c1_Runtime1_sparc.cpp @ 4762:069ab3f976d3

7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions Summary: Moved sizeof(klassOopDesc), changed the return type to ByteSize and removed the _in_bytes suffix. Reviewed-by: never, bdelsart, coleenp, jrose
author stefank
date Wed, 07 Dec 2011 11:35:03 +0100
parents cec1757a0134
children 22cee0ee8927
comparison
equal deleted inserted replaced
4761:65149e74c706 4762:069ab3f976d3
396 // to stomp the real return address. 396 // to stomp the real return address.
397 __ save_frame(0); 397 __ save_frame(0);
398 398
399 if (id == fast_new_instance_init_check_id) { 399 if (id == fast_new_instance_init_check_id) {
400 // make sure the klass is initialized 400 // make sure the klass is initialized
401 __ ld(G5_klass, instanceKlass::init_state_offset_in_bytes() + sizeof(oopDesc), G3_t1); 401 __ ld(G5_klass, in_bytes(instanceKlass::init_state_offset()), G3_t1);
402 __ cmp_and_br_short(G3_t1, instanceKlass::fully_initialized, Assembler::notEqual, Assembler::pn, slow_path); 402 __ cmp_and_br_short(G3_t1, instanceKlass::fully_initialized, Assembler::notEqual, Assembler::pn, slow_path);
403 } 403 }
404 #ifdef ASSERT 404 #ifdef ASSERT
405 // assert object can be fast path allocated 405 // assert object can be fast path allocated
406 { 406 {
407 Label ok, not_ok; 407 Label ok, not_ok;
408 __ ld(G5_klass, Klass::layout_helper_offset_in_bytes() + sizeof(oopDesc), G1_obj_size); 408 __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size);
409 // make sure it's an instance (LH > 0) 409 // make sure it's an instance (LH > 0)
410 __ cmp_and_br_short(G1_obj_size, 0, Assembler::lessEqual, Assembler::pn, not_ok); 410 __ cmp_and_br_short(G1_obj_size, 0, Assembler::lessEqual, Assembler::pn, not_ok);
411 __ btst(Klass::_lh_instance_slow_path_bit, G1_obj_size); 411 __ btst(Klass::_lh_instance_slow_path_bit, G1_obj_size);
412 __ br(Assembler::zero, false, Assembler::pn, ok); 412 __ br(Assembler::zero, false, Assembler::pn, ok);
413 __ delayed()->nop(); 413 __ delayed()->nop();
423 __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G5_klass 423 __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G5_klass
424 424
425 __ bind(retry_tlab); 425 __ bind(retry_tlab);
426 426
427 // get the instance size 427 // get the instance size
428 __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size); 428 __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size);
429 429
430 __ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path); 430 __ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path);
431 431
432 __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2); 432 __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
433 __ verify_oop(O0_obj); 433 __ verify_oop(O0_obj);
435 __ ret(); 435 __ ret();
436 __ delayed()->restore(); 436 __ delayed()->restore();
437 437
438 __ bind(try_eden); 438 __ bind(try_eden);
439 // get the instance size 439 // get the instance size
440 __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size); 440 __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size);
441 __ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path); 441 __ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path);
442 __ incr_allocated_bytes(G1_obj_size, G3_t1, G4_t2); 442 __ incr_allocated_bytes(G1_obj_size, G3_t1, G4_t2);
443 443
444 __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2); 444 __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
445 __ verify_oop(O0_obj); 445 __ verify_oop(O0_obj);
469 { 469 {
470 Register G5_klass = G5; // Incoming 470 Register G5_klass = G5; // Incoming
471 Register G4_length = G4; // Incoming 471 Register G4_length = G4; // Incoming
472 Register O0_obj = O0; // Outgoing 472 Register O0_obj = O0; // Outgoing
473 473
474 Address klass_lh(G5_klass, ((klassOopDesc::header_size() * HeapWordSize) 474 Address klass_lh(G5_klass, Klass::layout_helper_offset());
475 + Klass::layout_helper_offset_in_bytes()));
476 assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise"); 475 assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise");
477 assert(Klass::_lh_header_size_mask == 0xFF, "bytewise"); 476 assert(Klass::_lh_header_size_mask == 0xFF, "bytewise");
478 // Use this offset to pick out an individual byte of the layout_helper: 477 // Use this offset to pick out an individual byte of the layout_helper:
479 const int klass_lh_header_size_offset = ((BytesPerInt - 1) // 3 - 2 selects byte {0,1,0,0} 478 const int klass_lh_header_size_offset = ((BytesPerInt - 1) // 3 - 2 selects byte {0,1,0,0}
480 - Klass::_lh_header_size_shift / BitsPerByte); 479 - Klass::_lh_header_size_shift / BitsPerByte);
590 589
591 // load the klass and check the has finalizer flag 590 // load the klass and check the has finalizer flag
592 Label register_finalizer; 591 Label register_finalizer;
593 Register t = O1; 592 Register t = O1;
594 __ load_klass(O0, t); 593 __ load_klass(O0, t);
595 __ ld(t, Klass::access_flags_offset_in_bytes() + sizeof(oopDesc), t); 594 __ ld(t, in_bytes(Klass::access_flags_offset()), t);
596 __ set(JVM_ACC_HAS_FINALIZER, G3); 595 __ set(JVM_ACC_HAS_FINALIZER, G3);
597 __ andcc(G3, t, G0); 596 __ andcc(G3, t, G0);
598 __ br(Assembler::notZero, false, Assembler::pt, register_finalizer); 597 __ br(Assembler::notZero, false, Assembler::pt, register_finalizer);
599 __ delayed()->nop(); 598 __ delayed()->nop();
600 599