comparison src/cpu/sparc/vm/sparc.ad @ 6848:8e47bac5643a

7054512: Compress class pointers after perm gen removal Summary: support of compress class pointers in the compilers. Reviewed-by: kvn, twisti
author roland
date Tue, 09 Oct 2012 10:11:38 +0200
parents 859c45fb8cea
children f6badecb7ea7
comparison
equal deleted inserted replaced
6847:65d07d9ee446 6848:8e47bac5643a
555 } else { 555 } else {
556 assert(!UseInlineCaches, "expect vtable calls only if not using ICs"); 556 assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
557 int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size(); 557 int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size();
558 int v_off = entry_offset*wordSize + vtableEntry::method_offset_in_bytes(); 558 int v_off = entry_offset*wordSize + vtableEntry::method_offset_in_bytes();
559 int klass_load_size; 559 int klass_load_size;
560 if (UseCompressedOops && UseCompressedKlassPointers) { 560 if (UseCompressedKlassPointers) {
561 assert(Universe::heap() != NULL, "java heap should be initialized"); 561 assert(Universe::heap() != NULL, "java heap should be initialized");
562 if (Universe::narrow_oop_base() == NULL) 562 if (Universe::narrow_klass_base() == NULL)
563 klass_load_size = 2*BytesPerInstWord; // see MacroAssembler::load_klass() 563 klass_load_size = 2*BytesPerInstWord; // see MacroAssembler::load_klass()
564 else 564 else
565 klass_load_size = 3*BytesPerInstWord; 565 klass_load_size = 3*BytesPerInstWord;
566 } else { 566 } else {
567 klass_load_size = 1*BytesPerInstWord; 567 klass_load_size = 1*BytesPerInstWord;
1705 //============================================================================= 1705 //=============================================================================
1706 #ifndef PRODUCT 1706 #ifndef PRODUCT
1707 void MachUEPNode::format( PhaseRegAlloc *ra_, outputStream *st ) const { 1707 void MachUEPNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
1708 st->print_cr("\nUEP:"); 1708 st->print_cr("\nUEP:");
1709 #ifdef _LP64 1709 #ifdef _LP64
1710 if (UseCompressedOops) { 1710 if (UseCompressedKlassPointers) {
1711 assert(Universe::heap() != NULL, "java heap should be initialized"); 1711 assert(Universe::heap() != NULL, "java heap should be initialized");
1712 st->print_cr("\tLDUW [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check - compressed klass"); 1712 st->print_cr("\tLDUW [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check - compressed klass");
1713 st->print_cr("\tSLL R_G5,3,R_G5"); 1713 st->print_cr("\tSLL R_G5,3,R_G5");
1714 if (Universe::narrow_oop_base() != NULL) 1714 if (Universe::narrow_klass_base() != NULL)
1715 st->print_cr("\tADD R_G5,R_G6_heap_base,R_G5"); 1715 st->print_cr("\tADD R_G5,R_G6_heap_base,R_G5");
1716 } else { 1716 } else {
1717 st->print_cr("\tLDX [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check"); 1717 st->print_cr("\tLDX [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check");
1718 } 1718 }
1719 st->print_cr("\tCMP R_G5,R_G3" ); 1719 st->print_cr("\tCMP R_G5,R_G3" );
1937 const bool Matcher::need_masked_shift_count = false; 1937 const bool Matcher::need_masked_shift_count = false;
1938 1938
1939 bool Matcher::narrow_oop_use_complex_address() { 1939 bool Matcher::narrow_oop_use_complex_address() {
1940 NOT_LP64(ShouldNotCallThis()); 1940 NOT_LP64(ShouldNotCallThis());
1941 assert(UseCompressedOops, "only for compressed oops code"); 1941 assert(UseCompressedOops, "only for compressed oops code");
1942 return false;
1943 }
1944
1945 bool Matcher::narrow_klass_use_complex_address() {
1946 NOT_LP64(ShouldNotCallThis());
1947 assert(UseCompressedKlassPointers, "only for compressed klass code");
1942 return false; 1948 return false;
1943 } 1949 }
1944 1950
1945 // Is it better to copy float constants, or load them directly from memory? 1951 // Is it better to copy float constants, or load them directly from memory?
1946 // Intel can load a float constant from a direct address, requiring no 1952 // Intel can load a float constant from a direct address, requiring no
2600 // get receiver klass (receiver already checked for non-null) 2606 // get receiver klass (receiver already checked for non-null)
2601 // If we end up going thru a c2i adapter interpreter expects method in G5 2607 // If we end up going thru a c2i adapter interpreter expects method in G5
2602 int off = __ offset(); 2608 int off = __ offset();
2603 __ load_klass(O0, G3_scratch); 2609 __ load_klass(O0, G3_scratch);
2604 int klass_load_size; 2610 int klass_load_size;
2605 if (UseCompressedOops && UseCompressedKlassPointers) { 2611 if (UseCompressedKlassPointers) {
2606 assert(Universe::heap() != NULL, "java heap should be initialized"); 2612 assert(Universe::heap() != NULL, "java heap should be initialized");
2607 if (Universe::narrow_oop_base() == NULL) 2613 if (Universe::narrow_klass_base() == NULL)
2608 klass_load_size = 2*BytesPerInstWord; 2614 klass_load_size = 2*BytesPerInstWord;
2609 else 2615 else
2610 klass_load_size = 3*BytesPerInstWord; 2616 klass_load_size = 3*BytesPerInstWord;
2611 } else { 2617 } else {
2612 klass_load_size = 1*BytesPerInstWord; 2618 klass_load_size = 1*BytesPerInstWord;
3608 op_cost(10); 3614 op_cost(10);
3609 format %{ %} 3615 format %{ %}
3610 interface(CONST_INTER); 3616 interface(CONST_INTER);
3611 %} 3617 %}
3612 3618
3619 operand immNKlass()
3620 %{
3621 match(ConNKlass);
3622
3623 op_cost(10);
3624 format %{ %}
3625 interface(CONST_INTER);
3626 %}
3627
3613 // NULL Pointer Immediate 3628 // NULL Pointer Immediate
3614 operand immN0() 3629 operand immN0()
3615 %{ 3630 %{
3616 predicate(n->get_narrowcon() == 0); 3631 predicate(n->get_narrowcon() == 0);
3617 match(ConN); 3632 match(ConN);
6157 __ set_narrow_oop((jobject)$src$$constant, dst); 6172 __ set_narrow_oop((jobject)$src$$constant, dst);
6158 %} 6173 %}
6159 ins_pipe(ialu_hi_lo_reg); 6174 ins_pipe(ialu_hi_lo_reg);
6160 %} 6175 %}
6161 6176
6177 instruct loadConNKlass(iRegN dst, immNKlass src) %{
6178 match(Set dst src);
6179 ins_cost(DEFAULT_COST * 3/2);
6180 format %{ "SET $src,$dst\t! compressed klass ptr" %}
6181 ins_encode %{
6182 Register dst = $dst$$Register;
6183 __ set_narrow_klass((Klass*)$src$$constant, dst);
6184 %}
6185 ins_pipe(ialu_hi_lo_reg);
6186 %}
6187
6162 // Materialize long value (predicated by immL_cheap). 6188 // Materialize long value (predicated by immL_cheap).
6163 instruct loadConL_set64(iRegL dst, immL_cheap con, o7RegL tmp) %{ 6189 instruct loadConL_set64(iRegL dst, immL_cheap con, o7RegL tmp) %{
6164 match(Set dst con); 6190 match(Set dst con);
6165 effect(KILL tmp); 6191 effect(KILL tmp);
6166 ins_cost(DEFAULT_COST * 3); 6192 ins_cost(DEFAULT_COST * 3);
6473 } 6499 }
6474 %} 6500 %}
6475 ins_pipe(istore_mem_spORreg); 6501 ins_pipe(istore_mem_spORreg);
6476 %} 6502 %}
6477 6503
6504 instruct storeNKlass(memory dst, iRegN src) %{
6505 match(Set dst (StoreNKlass dst src));
6506 ins_cost(MEMORY_REF_COST);
6507 size(4);
6508
6509 format %{ "STW $src,$dst\t! compressed klass ptr" %}
6510 ins_encode %{
6511 Register base = as_Register($dst$$base);
6512 Register index = as_Register($dst$$index);
6513 Register src = $src$$Register;
6514 if (index != G0) {
6515 __ stw(src, base, index);
6516 } else {
6517 __ stw(src, base, $dst$$disp);
6518 }
6519 %}
6520 ins_pipe(istore_mem_spORreg);
6521 %}
6522
6478 instruct storeN0(memory dst, immN0 src) %{ 6523 instruct storeN0(memory dst, immN0 src) %{
6479 match(Set dst (StoreN dst src)); 6524 match(Set dst (StoreN dst src));
6480 ins_cost(MEMORY_REF_COST); 6525 ins_cost(MEMORY_REF_COST);
6481 size(4); 6526 size(4);
6482 6527
6580 __ decode_heap_oop_not_null($src$$Register, $dst$$Register); 6625 __ decode_heap_oop_not_null($src$$Register, $dst$$Register);
6581 %} 6626 %}
6582 ins_pipe(ialu_reg); 6627 ins_pipe(ialu_reg);
6583 %} 6628 %}
6584 6629
6630 instruct encodeKlass_not_null(iRegN dst, iRegP src) %{
6631 match(Set dst (EncodePKlass src));
6632 format %{ "encode_klass_not_null $src, $dst" %}
6633 ins_encode %{
6634 __ encode_klass_not_null($src$$Register, $dst$$Register);
6635 %}
6636 ins_pipe(ialu_reg);
6637 %}
6638
6639 instruct decodeKlass_not_null(iRegP dst, iRegN src) %{
6640 match(Set dst (DecodeNKlass src));
6641 format %{ "decode_klass_not_null $src, $dst" %}
6642 ins_encode %{
6643 __ decode_klass_not_null($src$$Register, $dst$$Register);
6644 %}
6645 ins_pipe(ialu_reg);
6646 %}
6585 6647
6586 //----------MemBar Instructions----------------------------------------------- 6648 //----------MemBar Instructions-----------------------------------------------
6587 // Memory barrier flavors 6649 // Memory barrier flavors
6588 6650
6589 instruct membar_acquire() %{ 6651 instruct membar_acquire() %{