src/cpu/x86/vm/x86_32.ad

changeset 4037
da91efe96a93
parent 4001
006050192a5a
child 4106
7eca5de9e0b6
     1.1 --- a/src/cpu/x86/vm/x86_32.ad	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/cpu/x86/vm/x86_32.ad	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -367,7 +367,7 @@
     1.4  }
     1.5  
     1.6     // rRegI ereg, memory mem) %{    // emit_reg_mem
     1.7 -void encode_RegMem( CodeBuffer &cbuf, int reg_encoding, int base, int index, int scale, int displace, bool displace_is_oop ) {
     1.8 +void encode_RegMem( CodeBuffer &cbuf, int reg_encoding, int base, int index, int scale, int displace, relocInfo::relocType disp_reloc ) {
     1.9    // There is no index & no scale, use form without SIB byte
    1.10    if ((index == 0x4) &&
    1.11        (scale == 0) && (base != ESP_enc)) {
    1.12 @@ -377,7 +377,7 @@
    1.13      }
    1.14      else {                    // If 8-bit displacement, mode 0x1
    1.15        if ((displace >= -128) && (displace <= 127)
    1.16 -          && !(displace_is_oop) ) {
    1.17 +          && (disp_reloc == relocInfo::none) ) {
    1.18          emit_rm(cbuf, 0x1, reg_encoding, base);
    1.19          emit_d8(cbuf, displace);
    1.20        }
    1.21 @@ -385,16 +385,16 @@
    1.22          if (base == -1) { // Special flag for absolute address
    1.23            emit_rm(cbuf, 0x0, reg_encoding, 0x5);
    1.24            // (manual lies; no SIB needed here)
    1.25 -          if ( displace_is_oop ) {
    1.26 -            emit_d32_reloc(cbuf, displace, relocInfo::oop_type, 1);
    1.27 +          if ( disp_reloc != relocInfo::none ) {
    1.28 +            emit_d32_reloc(cbuf, displace, disp_reloc, 1);
    1.29            } else {
    1.30              emit_d32      (cbuf, displace);
    1.31            }
    1.32          }
    1.33          else {                // Normal base + offset
    1.34            emit_rm(cbuf, 0x2, reg_encoding, base);
    1.35 -          if ( displace_is_oop ) {
    1.36 -            emit_d32_reloc(cbuf, displace, relocInfo::oop_type, 1);
    1.37 +          if ( disp_reloc != relocInfo::none ) {
    1.38 +            emit_d32_reloc(cbuf, displace, disp_reloc, 1);
    1.39            } else {
    1.40              emit_d32      (cbuf, displace);
    1.41            }
    1.42 @@ -410,7 +410,7 @@
    1.43      }
    1.44      else {                    // If 8-bit displacement, mode 0x1
    1.45        if ((displace >= -128) && (displace <= 127)
    1.46 -          && !(displace_is_oop) ) {
    1.47 +          && (disp_reloc == relocInfo::none) ) {
    1.48          emit_rm(cbuf, 0x1, reg_encoding, 0x4);
    1.49          emit_rm(cbuf, scale, index, base);
    1.50          emit_d8(cbuf, displace);
    1.51 @@ -423,8 +423,8 @@
    1.52            emit_rm(cbuf, 0x2, reg_encoding, 0x4);
    1.53            emit_rm(cbuf, scale, index, base);
    1.54          }
    1.55 -        if ( displace_is_oop ) {
    1.56 -          emit_d32_reloc(cbuf, displace, relocInfo::oop_type, 1);
    1.57 +        if ( disp_reloc != relocInfo::none ) {
    1.58 +          emit_d32_reloc(cbuf, displace, disp_reloc, 1);
    1.59          } else {
    1.60            emit_d32      (cbuf, displace);
    1.61          }
    1.62 @@ -689,7 +689,7 @@
    1.63                          int opcode, const char *op_str, int size, outputStream* st ) {
    1.64    if( cbuf ) {
    1.65      emit_opcode  (*cbuf, opcode );
    1.66 -    encode_RegMem(*cbuf, Matcher::_regEncode[reg], ESP_enc, 0x4, 0, offset, false);
    1.67 +    encode_RegMem(*cbuf, Matcher::_regEncode[reg], ESP_enc, 0x4, 0, offset, relocInfo::none);
    1.68  #ifndef PRODUCT
    1.69    } else if( !do_size ) {
    1.70      if( size != 0 ) st->print("\n\t");
    1.71 @@ -1090,7 +1090,7 @@
    1.72      }
    1.73      if( cbuf ) {
    1.74        emit_opcode  (*cbuf, op );
    1.75 -      encode_RegMem(*cbuf, 0x0, ESP_enc, 0x4, 0, offset, false);
    1.76 +      encode_RegMem(*cbuf, 0x0, ESP_enc, 0x4, 0, offset, relocInfo::none);
    1.77        emit_opcode  (*cbuf, 0xDD );           // FSTP   ST(i)
    1.78        emit_d8      (*cbuf, 0xD8+Matcher::_regEncode[dst_first] );
    1.79  #ifndef PRODUCT
    1.80 @@ -1260,8 +1260,8 @@
    1.81    if (base == NULL)  return;  // CodeBuffer::expand failed
    1.82    // static stub relocation stores the instruction address of the call
    1.83    __ relocate(static_stub_Relocation::spec(mark), RELOC_IMM32);
    1.84 -  // static stub relocation also tags the methodOop in the code-stream.
    1.85 -  __ movoop(rbx, (jobject)NULL);  // method is zapped till fixup time
    1.86 +  // static stub relocation also tags the Method* in the code-stream.
    1.87 +  __ mov_metadata(rbx, (Metadata*)NULL);  // method is zapped till fixup time
    1.88    // This is recognized as unresolved by relocs/nativeInst/ic code
    1.89    __ jump(RuntimeAddress(__ pc()));
    1.90  
    1.91 @@ -1891,26 +1891,15 @@
    1.92    %}
    1.93  
    1.94    enc_class Java_Dynamic_Call (method meth) %{    // JAVA DYNAMIC CALL
    1.95 -    // !!!!!
    1.96 -    // Generate  "Mov EAX,0x00", placeholder instruction to load oop-info
    1.97 -    // emit_call_dynamic_prologue( cbuf );
    1.98 -    cbuf.set_insts_mark();
    1.99 -    emit_opcode(cbuf, 0xB8 + EAX_enc);        // mov    EAX,-1
   1.100 -    emit_d32_reloc(cbuf, (int)Universe::non_oop_word(), oop_Relocation::spec_for_immediate(), RELOC_IMM32);
   1.101 -    address  virtual_call_oop_addr = cbuf.insts_mark();
   1.102 -    // CALL to fixup routine.  Fixup routine uses ScopeDesc info to determine
   1.103 -    // who we intended to call.
   1.104 -    cbuf.set_insts_mark();
   1.105 -    $$$emit8$primary;
   1.106 -    emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
   1.107 -                virtual_call_Relocation::spec(virtual_call_oop_addr), RELOC_IMM32 );
   1.108 +    MacroAssembler _masm(&cbuf);
   1.109 +    __ ic_call((address)$meth$$method);
   1.110    %}
   1.111  
   1.112    enc_class Java_Compiled_Call (method meth) %{    // JAVA COMPILED CALL
   1.113 -    int disp = in_bytes(methodOopDesc::from_compiled_offset());
   1.114 +    int disp = in_bytes(Method::from_compiled_offset());
   1.115      assert( -128 <= disp && disp <= 127, "compiled_code_offset isn't small");
   1.116  
   1.117 -    // CALL *[EAX+in_bytes(methodOopDesc::from_compiled_code_entry_point_offset())]
   1.118 +    // CALL *[EAX+in_bytes(Method::from_compiled_code_entry_point_offset())]
   1.119      cbuf.set_insts_mark();
   1.120      $$$emit8$primary;
   1.121      emit_rm(cbuf, 0x01, $secondary, EAX_enc );  // R/M byte
   1.122 @@ -2127,8 +2116,8 @@
   1.123      int index = $mem$$index;
   1.124      int scale = $mem$$scale;
   1.125      int displace = $mem$$disp;
   1.126 -    bool disp_is_oop = $mem->disp_is_oop();
   1.127 -    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_is_oop);
   1.128 +    relocInfo::relocType disp_reloc = $mem->disp_reloc();
   1.129 +    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_reloc);
   1.130    %}
   1.131  
   1.132    enc_class RegMem_Hi(eRegL ereg, memory mem) %{    // emit_reg_mem
   1.133 @@ -2137,8 +2126,8 @@
   1.134      int index = $mem$$index;
   1.135      int scale = $mem$$scale;
   1.136      int displace = $mem$$disp + 4;      // Offset is 4 further in memory
   1.137 -    assert( !$mem->disp_is_oop(), "Cannot add 4 to oop" );
   1.138 -    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, false/*disp_is_oop*/);
   1.139 +    assert( $mem->disp_reloc() == relocInfo::none, "Cannot add 4 to oop" );
   1.140 +    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, relocInfo::none);
   1.141    %}
   1.142  
   1.143    enc_class move_long_small_shift( eRegL dst, immI_1_31 cnt ) %{
   1.144 @@ -2192,8 +2181,8 @@
   1.145      int index    = $mem$$index;
   1.146      int scale    = $mem$$scale;
   1.147      int displace = $mem$$disp + $disp_for_half$$constant;
   1.148 -    bool disp_is_oop = false;
   1.149 -    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_is_oop);
   1.150 +    relocInfo::relocType disp_reloc = relocInfo::none;
   1.151 +    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_reloc);
   1.152    %}
   1.153  
   1.154    // !!!!! Special Custom Code used by MemMove, and stack access instructions !!!!!
   1.155 @@ -2207,8 +2196,8 @@
   1.156      int index    = $mem$$index;
   1.157      int scale    = $mem$$scale;
   1.158      int displace = $mem$$disp;
   1.159 -    assert( !$mem->disp_is_oop(), "No oops here because no relo info allowed" );
   1.160 -    encode_RegMem(cbuf, rm_byte_opcode, base, index, scale, displace, false);
   1.161 +    assert( $mem->disp_reloc() == relocInfo::none, "No oops here because no reloc info allowed" );
   1.162 +    encode_RegMem(cbuf, rm_byte_opcode, base, index, scale, displace, relocInfo::none);
   1.163    %}
   1.164  
   1.165    enc_class RMopc_Mem (immI rm_opcode, memory mem) %{
   1.166 @@ -2217,8 +2206,8 @@
   1.167      int index    = $mem$$index;
   1.168      int scale    = $mem$$scale;
   1.169      int displace = $mem$$disp;
   1.170 -    bool disp_is_oop = $mem->disp_is_oop(); // disp-as-oop when working with static globals
   1.171 -    encode_RegMem(cbuf, rm_byte_opcode, base, index, scale, displace, disp_is_oop);
   1.172 +    relocInfo::relocType disp_reloc = $mem->disp_reloc(); // disp-as-oop when working with static globals
   1.173 +    encode_RegMem(cbuf, rm_byte_opcode, base, index, scale, displace, disp_reloc);
   1.174    %}
   1.175  
   1.176    enc_class RegLea (rRegI dst, rRegI src0, immI src1 ) %{    // emit_reg_lea
   1.177 @@ -2227,8 +2216,8 @@
   1.178      int index        = 0x04;            // 0x04 indicates no index
   1.179      int scale        = 0x00;            // 0x00 indicates no scale
   1.180      int displace     = $src1$$constant; // 0x00 indicates no displacement
   1.181 -    bool disp_is_oop = false;
   1.182 -    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_is_oop);
   1.183 +    relocInfo::relocType disp_reloc = relocInfo::none;
   1.184 +    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_reloc);
   1.185    %}
   1.186  
   1.187    enc_class min_enc (rRegI dst, rRegI src) %{    // MIN
   1.188 @@ -2263,7 +2252,7 @@
   1.189      int index = $mem$$index;
   1.190      int scale = $mem$$scale;
   1.191      int displace = $mem$$disp;
   1.192 -    bool disp_is_oop = $mem->disp_is_oop(); // disp-as-oop when working with static globals
   1.193 +    relocInfo::relocType disp_reloc = $mem->disp_reloc(); // disp-as-oop when working with static globals
   1.194      if( $src$$reg != FPR1L_enc ) {
   1.195        reg_encoding = 0x3;  // Store & pop
   1.196        emit_opcode( cbuf, 0xD9 ); // FLD (i.e., push it)
   1.197 @@ -2271,7 +2260,7 @@
   1.198      }
   1.199      cbuf.set_insts_mark();       // Mark start of opcode for reloc info in mem operand
   1.200      emit_opcode(cbuf,$primary);
   1.201 -    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_is_oop);
   1.202 +    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_reloc);
   1.203    %}
   1.204  
   1.205    enc_class neg_reg(rRegI dst) %{
   1.206 @@ -2321,8 +2310,8 @@
   1.207      int index = $mem$$index;
   1.208      int scale = $mem$$scale;
   1.209      int displace = $mem$$disp;
   1.210 -    bool disp_is_oop = $mem->disp_is_oop();
   1.211 -    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_is_oop);
   1.212 +    relocInfo::relocType disp_reloc = $mem->disp_reloc();
   1.213 +    encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_reloc);
   1.214      // ADD $p,$tmp
   1.215      emit_opcode(cbuf,0x03);
   1.216      emit_rm(cbuf, 0x3, $p$$reg, tmpReg);
   1.217 @@ -3645,8 +3634,8 @@
   1.218      int index    = $mem$$index;
   1.219      int scale    = $mem$$scale;
   1.220      int displace = $mem$$disp;
   1.221 -    bool disp_is_oop = $mem->disp_is_oop(); // disp-as-oop when working with static globals
   1.222 -    encode_RegMem(cbuf, rm_byte_opcode, base, index, scale, displace, disp_is_oop);
   1.223 +    relocInfo::relocType disp_reloc = $mem->disp_reloc(); // disp-as-oop when working with static globals
   1.224 +    encode_RegMem(cbuf, rm_byte_opcode, base, index, scale, displace, disp_reloc);
   1.225      store_to_stackslot( cbuf, 0x0DF, 0x07, $dst$$disp );
   1.226    %}
   1.227  
   1.228 @@ -3663,8 +3652,8 @@
   1.229      int index    = $mem$$index;
   1.230      int scale    = $mem$$scale;
   1.231      int displace = $mem$$disp;
   1.232 -    bool disp_is_oop = $mem->disp_is_oop(); // disp-as-oop when working with static globals
   1.233 -    encode_RegMem(cbuf, rm_byte_opcode, base, index, scale, displace, disp_is_oop);
   1.234 +    relocInfo::relocType disp_reloc = $mem->disp_reloc(); // disp-as-oop when working with static globals
   1.235 +    encode_RegMem(cbuf, rm_byte_opcode, base, index, scale, displace, disp_reloc);
   1.236    %}
   1.237  
   1.238    // Safepoint Poll.  This polls the safepoint page, and causes an
   1.239 @@ -5817,8 +5806,8 @@
   1.240    ins_encode %{
   1.241      //__ popcntl($dst$$Register, $mem$$Address$$first);
   1.242      //__ popcntl($tmp$$Register, $mem$$Address$$second);
   1.243 -    __ popcntl($dst$$Register, Address::make_raw($mem$$base, $mem$$index, $mem$$scale, $mem$$disp, false));
   1.244 -    __ popcntl($tmp$$Register, Address::make_raw($mem$$base, $mem$$index, $mem$$scale, $mem$$disp + 4, false));
   1.245 +    __ popcntl($dst$$Register, Address::make_raw($mem$$base, $mem$$index, $mem$$scale, $mem$$disp, relocInfo::none));
   1.246 +    __ popcntl($tmp$$Register, Address::make_raw($mem$$base, $mem$$index, $mem$$scale, $mem$$disp + 4, relocInfo::none));
   1.247      __ addl($dst$$Register, $tmp$$Register);
   1.248    %}
   1.249    ins_pipe(ialu_reg);
   1.250 @@ -6185,8 +6174,8 @@
   1.251              "MOV    $dst.hi,$mem+4" %}
   1.252  
   1.253    ins_encode %{
   1.254 -    Address Amemlo = Address::make_raw($mem$$base, $mem$$index, $mem$$scale, $mem$$disp, false);
   1.255 -    Address Amemhi = Address::make_raw($mem$$base, $mem$$index, $mem$$scale, $mem$$disp + 4, false);
   1.256 +    Address Amemlo = Address::make_raw($mem$$base, $mem$$index, $mem$$scale, $mem$$disp, relocInfo::none);
   1.257 +    Address Amemhi = Address::make_raw($mem$$base, $mem$$index, $mem$$scale, $mem$$disp + 4, relocInfo::none);
   1.258      __ movl($dst$$Register, Amemlo);
   1.259      __ movl(HIGH_FROM_LOW($dst$$Register), Amemhi);
   1.260    %}
   1.261 @@ -11795,7 +11784,7 @@
   1.262  // Only works because non-oop pointers must be raw pointers
   1.263  // and raw pointers have no anti-dependencies.
   1.264  instruct compP_mem_eReg( eFlagsRegU cr, eRegP op1, memory op2 ) %{
   1.265 -  predicate( !n->in(2)->in(2)->bottom_type()->isa_oop_ptr() );
   1.266 +  predicate( n->in(2)->in(2)->bottom_type()->reloc() == relocInfo::none );
   1.267    match(Set cr (CmpP op1 (LoadP op2)));
   1.268  
   1.269    format %{ "CMPu   $op1,$op2" %}

mercurial