src/cpu/x86/vm/assembler_x86.cpp

changeset 3395
40c2484c09e1
parent 3391
069ab3f976d3
child 3397
8940fd98d540
     1.1 --- a/src/cpu/x86/vm/assembler_x86.cpp	Fri Dec 23 09:36:23 2011 +0100
     1.2 +++ b/src/cpu/x86/vm/assembler_x86.cpp	Fri Dec 23 15:24:36 2011 -0800
     1.3 @@ -1465,8 +1465,14 @@
     1.4    if (L.is_bound()) {
     1.5      const int short_size = 2;
     1.6      address entry = target(L);
     1.7 -    assert(is8bit((intptr_t)entry - ((intptr_t)_code_pos + short_size)),
     1.8 -           "Dispacement too large for a short jmp");
     1.9 +#ifdef ASSERT
    1.10 +    intptr_t dist = (intptr_t)entry - ((intptr_t)_code_pos + short_size);
    1.11 +    intptr_t delta = short_branch_delta();
    1.12 +    if (delta != 0) {
    1.13 +      dist += (dist < 0 ? (-delta) :delta);
    1.14 +    }
    1.15 +    assert(is8bit(dist), "Dispacement too large for a short jmp");
    1.16 +#endif
    1.17      intptr_t offs = (intptr_t)entry - (intptr_t)_code_pos;
    1.18      // 0111 tttn #8-bit disp
    1.19      emit_byte(0x70 | cc);
    1.20 @@ -1532,9 +1538,15 @@
    1.21    if (L.is_bound()) {
    1.22      const int short_size = 2;
    1.23      address entry = target(L);
    1.24 -    assert(is8bit((entry - _code_pos) + short_size),
    1.25 -           "Dispacement too large for a short jmp");
    1.26      assert(entry != NULL, "jmp most probably wrong");
    1.27 +#ifdef ASSERT
    1.28 +    intptr_t dist = (intptr_t)entry - ((intptr_t)_code_pos + short_size);
    1.29 +    intptr_t delta = short_branch_delta();
    1.30 +    if (delta != 0) {
    1.31 +      dist += (dist < 0 ? (-delta) :delta);
    1.32 +    }
    1.33 +    assert(is8bit(dist), "Dispacement too large for a short jmp");
    1.34 +#endif
    1.35      intptr_t offs = entry - _code_pos;
    1.36      emit_byte(0xEB);
    1.37      emit_byte((offs - short_size) & 0xFF);
    1.38 @@ -9280,6 +9292,7 @@
    1.39                                        Register cnt1, Register cnt2,
    1.40                                        int int_cnt2,  Register result,
    1.41                                        XMMRegister vec, Register tmp) {
    1.42 +  ShortBranchVerifier sbv(this);
    1.43    assert(UseSSE42Intrinsics, "SSE4.2 is required");
    1.44  
    1.45    // This method uses pcmpestri inxtruction with bound registers
    1.46 @@ -9409,9 +9422,9 @@
    1.47        pcmpestri(vec, Address(result, tmp, Address::times_2, 0), 0x0d);
    1.48      }
    1.49      // Need to reload strings pointers if not matched whole vector
    1.50 -    jccb(Assembler::noOverflow, RELOAD_SUBSTR); // OF == 0
    1.51 +    jcc(Assembler::noOverflow, RELOAD_SUBSTR); // OF == 0
    1.52      addptr(cnt2, 8);
    1.53 -    jccb(Assembler::negative, SCAN_SUBSTR);
    1.54 +    jcc(Assembler::negative, SCAN_SUBSTR);
    1.55      // Fall through if found full substring
    1.56  
    1.57    } // (int_cnt2 > 8)
    1.58 @@ -9430,6 +9443,7 @@
    1.59                                      Register cnt1, Register cnt2,
    1.60                                      int int_cnt2,  Register result,
    1.61                                      XMMRegister vec, Register tmp) {
    1.62 +  ShortBranchVerifier sbv(this);
    1.63    assert(UseSSE42Intrinsics, "SSE4.2 is required");
    1.64    //
    1.65    // int_cnt2 is length of small (< 8 chars) constant substring
    1.66 @@ -9691,6 +9705,7 @@
    1.67  void MacroAssembler::string_compare(Register str1, Register str2,
    1.68                                      Register cnt1, Register cnt2, Register result,
    1.69                                      XMMRegister vec1) {
    1.70 +  ShortBranchVerifier sbv(this);
    1.71    Label LENGTH_DIFF_LABEL, POP_LABEL, DONE_LABEL, WHILE_HEAD_LABEL;
    1.72  
    1.73    // Compute the minimum of the string lengths and the
    1.74 @@ -9827,6 +9842,7 @@
    1.75  void MacroAssembler::char_arrays_equals(bool is_array_equ, Register ary1, Register ary2,
    1.76                                          Register limit, Register result, Register chr,
    1.77                                          XMMRegister vec1, XMMRegister vec2) {
    1.78 +  ShortBranchVerifier sbv(this);
    1.79    Label TRUE_LABEL, FALSE_LABEL, DONE, COMPARE_VECTORS, COMPARE_CHAR;
    1.80  
    1.81    int length_offset  = arrayOopDesc::length_offset_in_bytes();
    1.82 @@ -9946,6 +9962,7 @@
    1.83  void MacroAssembler::generate_fill(BasicType t, bool aligned,
    1.84                                     Register to, Register value, Register count,
    1.85                                     Register rtmp, XMMRegister xtmp) {
    1.86 +  ShortBranchVerifier sbv(this);
    1.87    assert_different_registers(to, value, count, rtmp);
    1.88    Label L_exit, L_skip_align1, L_skip_align2, L_fill_byte;
    1.89    Label L_fill_2_bytes, L_fill_4_bytes;

mercurial