src/cpu/x86/vm/x86_32.ad

changeset 3037
3d42f82cd811
parent 2877
bad7ecd0b6ed
child 3040
c7b60b601eb4
     1.1 --- a/src/cpu/x86/vm/x86_32.ad	Thu Jul 21 08:38:25 2011 -0700
     1.2 +++ b/src/cpu/x86/vm/x86_32.ad	Thu Jul 21 11:25:07 2011 -0700
     1.3 @@ -1713,14 +1713,14 @@
     1.4      else                               emit_d32(cbuf,con);
     1.5    %}
     1.6  
     1.7 -  enc_class Lbl (label labl) %{ // JMP, CALL
     1.8 +  enc_class Lbl (label labl) %{ // GOTO
     1.9      Label *l = $labl$$label;
    1.10 -    emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size()+4)) : 0);
    1.11 -  %}
    1.12 -
    1.13 -  enc_class LblShort (label labl) %{ // JMP, CALL
    1.14 +    emit_d32(cbuf, (l->loc_pos() - (cbuf.insts_size()+4)));
    1.15 +  %}
    1.16 +
    1.17 +  enc_class LblShort (label labl) %{ // GOTO
    1.18      Label *l = $labl$$label;
    1.19 -    int disp = l ? (l->loc_pos() - (cbuf.insts_size()+1)) : 0;
    1.20 +    int disp = l->loc_pos() - (cbuf.insts_size()+1);
    1.21      assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
    1.22      emit_d8(cbuf, disp);
    1.23    %}
    1.24 @@ -1751,13 +1751,13 @@
    1.25      Label *l = $labl$$label;
    1.26      $$$emit8$primary;
    1.27      emit_cc(cbuf, $secondary, $cop$$cmpcode);
    1.28 -    emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size()+4)) : 0);
    1.29 +    emit_d32(cbuf, (l->loc_pos() - (cbuf.insts_size()+4)));
    1.30    %}
    1.31  
    1.32    enc_class JccShort (cmpOp cop, label labl) %{    // JCC
    1.33      Label *l = $labl$$label;
    1.34      emit_cc(cbuf, $primary, $cop$$cmpcode);
    1.35 -    int disp = l ? (l->loc_pos() - (cbuf.insts_size()+1)) : 0;
    1.36 +    int disp = l->loc_pos() - (cbuf.insts_size()+1);
    1.37      assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
    1.38      emit_d8(cbuf, disp);
    1.39    %}
    1.40 @@ -13172,7 +13172,7 @@
    1.41      bool ok = false;
    1.42      if ($cop$$cmpcode == Assembler::notEqual) {
    1.43         // the two jumps 6 bytes apart so the jump distances are too
    1.44 -       parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0;
    1.45 +       parity_disp = l->loc_pos() - (cbuf.insts_size() + 4);
    1.46      } else if ($cop$$cmpcode == Assembler::equal) {
    1.47         parity_disp = 6;
    1.48         ok = true;
    1.49 @@ -13182,7 +13182,7 @@
    1.50      emit_d32(cbuf, parity_disp);
    1.51      $$$emit8$primary;
    1.52      emit_cc(cbuf, $secondary, $cop$$cmpcode);
    1.53 -    int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0;
    1.54 +    int disp = l->loc_pos() - (cbuf.insts_size() + 4);
    1.55      emit_d32(cbuf, disp);
    1.56    %}
    1.57    ins_pipe(pipe_jcc);
    1.58 @@ -13368,7 +13368,7 @@
    1.59      emit_cc(cbuf, $primary, Assembler::parity);
    1.60      int parity_disp = -1;
    1.61      if ($cop$$cmpcode == Assembler::notEqual) {
    1.62 -      parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
    1.63 +      parity_disp = l->loc_pos() - (cbuf.insts_size() + 1);
    1.64      } else if ($cop$$cmpcode == Assembler::equal) {
    1.65        parity_disp = 2;
    1.66      } else {
    1.67 @@ -13376,7 +13376,7 @@
    1.68      }
    1.69      emit_d8(cbuf, parity_disp);
    1.70      emit_cc(cbuf, $primary, $cop$$cmpcode);
    1.71 -    int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
    1.72 +    int disp = l->loc_pos() - (cbuf.insts_size() + 1);
    1.73      emit_d8(cbuf, disp);
    1.74      assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
    1.75      assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp");

mercurial