src/cpu/x86/vm/assembler_x86.cpp

changeset 4317
6ab62ad83507
parent 4205
a3ecd773a7b9
child 4318
cd3d6a6b95d9
     1.1 --- a/src/cpu/x86/vm/assembler_x86.cpp	Tue Nov 27 17:41:38 2012 -0800
     1.2 +++ b/src/cpu/x86/vm/assembler_x86.cpp	Fri Nov 30 11:44:05 2012 -0800
     1.3 @@ -1154,7 +1154,7 @@
     1.4    assert(entry != NULL, "call most probably wrong");
     1.5    InstructionMark im(this);
     1.6    emit_byte(0xE8);
     1.7 -  intptr_t disp = entry - (_code_pos + sizeof(int32_t));
     1.8 +  intptr_t disp = entry - (pc() + sizeof(int32_t));
     1.9    assert(is_simm32(disp), "must be 32bit offset (call2)");
    1.10    // Technically, should use call32_operand, but this format is
    1.11    // implied by the fact that we're emitting a call instruction.
    1.12 @@ -1417,7 +1417,7 @@
    1.13  
    1.14      const int short_size = 2;
    1.15      const int long_size = 6;
    1.16 -    intptr_t offs = (intptr_t)dst - (intptr_t)_code_pos;
    1.17 +    intptr_t offs = (intptr_t)dst - (intptr_t)pc();
    1.18      if (maybe_short && is8bit(offs - short_size)) {
    1.19        // 0111 tttn #8-bit disp
    1.20        emit_byte(0x70 | cc);
    1.21 @@ -1447,14 +1447,14 @@
    1.22      const int short_size = 2;
    1.23      address entry = target(L);
    1.24  #ifdef ASSERT
    1.25 -    intptr_t dist = (intptr_t)entry - ((intptr_t)_code_pos + short_size);
    1.26 +    intptr_t dist = (intptr_t)entry - ((intptr_t)pc() + short_size);
    1.27      intptr_t delta = short_branch_delta();
    1.28      if (delta != 0) {
    1.29        dist += (dist < 0 ? (-delta) :delta);
    1.30      }
    1.31      assert(is8bit(dist), "Dispacement too large for a short jmp");
    1.32  #endif
    1.33 -    intptr_t offs = (intptr_t)entry - (intptr_t)_code_pos;
    1.34 +    intptr_t offs = (intptr_t)entry - (intptr_t)pc();
    1.35      // 0111 tttn #8-bit disp
    1.36      emit_byte(0x70 | cc);
    1.37      emit_byte((offs - short_size) & 0xFF);
    1.38 @@ -1480,7 +1480,7 @@
    1.39      InstructionMark im(this);
    1.40      const int short_size = 2;
    1.41      const int long_size = 5;
    1.42 -    intptr_t offs = entry - _code_pos;
    1.43 +    intptr_t offs = entry - pc();
    1.44      if (maybe_short && is8bit(offs - short_size)) {
    1.45        emit_byte(0xEB);
    1.46        emit_byte((offs - short_size) & 0xFF);
    1.47 @@ -1510,7 +1510,7 @@
    1.48    InstructionMark im(this);
    1.49    emit_byte(0xE9);
    1.50    assert(dest != NULL, "must have a target");
    1.51 -  intptr_t disp = dest - (_code_pos + sizeof(int32_t));
    1.52 +  intptr_t disp = dest - (pc() + sizeof(int32_t));
    1.53    assert(is_simm32(disp), "must be 32bit offset (jmp)");
    1.54    emit_data(disp, rspec.reloc(), call32_operand);
    1.55  }
    1.56 @@ -1521,14 +1521,14 @@
    1.57      address entry = target(L);
    1.58      assert(entry != NULL, "jmp most probably wrong");
    1.59  #ifdef ASSERT
    1.60 -    intptr_t dist = (intptr_t)entry - ((intptr_t)_code_pos + short_size);
    1.61 +    intptr_t dist = (intptr_t)entry - ((intptr_t)pc() + short_size);
    1.62      intptr_t delta = short_branch_delta();
    1.63      if (delta != 0) {
    1.64        dist += (dist < 0 ? (-delta) :delta);
    1.65      }
    1.66      assert(is8bit(dist), "Dispacement too large for a short jmp");
    1.67  #endif
    1.68 -    intptr_t offs = entry - _code_pos;
    1.69 +    intptr_t offs = entry - pc();
    1.70      emit_byte(0xEB);
    1.71      emit_byte((offs - short_size) & 0xFF);
    1.72    } else {
    1.73 @@ -4361,7 +4361,7 @@
    1.74    disp = (int64_t)adr._target - ((int64_t)CodeCache::high_bound() + sizeof(int));
    1.75    if (!is_simm32(disp)) return false;
    1.76  
    1.77 -  disp = (int64_t)adr._target - ((int64_t)_code_pos + sizeof(int));
    1.78 +  disp = (int64_t)adr._target - ((int64_t)pc() + sizeof(int));
    1.79  
    1.80    // Because rip relative is a disp + address_of_next_instruction and we
    1.81    // don't know the value of address_of_next_instruction we apply a fudge factor
    1.82 @@ -4392,7 +4392,7 @@
    1.83                              relocInfo::relocType rtype,
    1.84                              int format) {
    1.85    if (rtype == relocInfo::none) {
    1.86 -    emit_long64(data);
    1.87 +    emit_int64(data);
    1.88    } else {
    1.89      emit_data64(data, Relocation::spec_simple(rtype), format);
    1.90    }
    1.91 @@ -4410,7 +4410,7 @@
    1.92  #ifdef ASSERT
    1.93    check_relocation(rspec, format);
    1.94  #endif
    1.95 -  emit_long64(data);
    1.96 +  emit_int64(data);
    1.97  }
    1.98  
    1.99  int Assembler::prefix_and_encode(int reg_enc, bool byteinst) {
   1.100 @@ -4943,7 +4943,7 @@
   1.101    InstructionMark im(this);
   1.102    int encode = prefixq_and_encode(dst->encoding());
   1.103    emit_byte(0xB8 | encode);
   1.104 -  emit_long64(imm64);
   1.105 +  emit_int64(imm64);
   1.106  }
   1.107  
   1.108  void Assembler::mov_literal64(Register dst, intptr_t imm64, RelocationHolder const& rspec) {
   1.109 @@ -7891,7 +7891,7 @@
   1.110      relocate(dst.reloc());
   1.111      const int short_size = 2;
   1.112      const int long_size = 6;
   1.113 -    int offs = (intptr_t)dst.target() - ((intptr_t)_code_pos);
   1.114 +    int offs = (intptr_t)dst.target() - ((intptr_t)pc());
   1.115      if (dst.reloc() == relocInfo::none && is8bit(offs - short_size)) {
   1.116        // 0111 tttn #8-bit disp
   1.117        emit_byte(0x70 | cc);

mercurial