src/share/vm/c1/c1_LIRGenerator.cpp

changeset 1
2d8a650513c2
parent 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Apr 27 01:25:04 2016 +0800
     1.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Apr 29 00:06:10 2016 +0800
     1.3 @@ -22,6 +22,12 @@
     1.4   *
     1.5   */
     1.6  
     1.7 +/*
     1.8 + * This file has been modified by Loongson Technology in 2015. These
     1.9 + * modifications are Copyright (c) 2015 Loongson Technology, and are made
    1.10 + * available on the same license terms set forth above.
    1.11 + */
    1.12 +
    1.13  #include "precompiled.hpp"
    1.14  #include "c1/c1_Compilation.hpp"
    1.15  #include "c1/c1_FrameMap.hpp"
    1.16 @@ -307,6 +313,15 @@
    1.17  
    1.18  void LIRGenerator::init() {
    1.19    _bs = Universe::heap()->barrier_set();
    1.20 +#ifdef MIPS64
    1.21 +        assert(_bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
    1.22 +        CardTableModRefBS* ct = (CardTableModRefBS*)_bs;
    1.23 +        assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
    1.24 +        //_card_table_base = new LIR_Const((intptr_t)ct->byte_map_base);
    1.25 +        //        //FIXME, untested in 32bit. by aoqi
    1.26 +        _card_table_base = new LIR_Const(ct->byte_map_base);
    1.27 +#endif
    1.28 +
    1.29  }
    1.30  
    1.31  
    1.32 @@ -481,13 +496,27 @@
    1.33                                      CodeEmitInfo* null_check_info, CodeEmitInfo* range_check_info) {
    1.34    CodeStub* stub = new RangeCheckStub(range_check_info, index);
    1.35    if (index->is_constant()) {
    1.36 +#ifndef MIPS64
    1.37      cmp_mem_int(lir_cond_belowEqual, array, arrayOopDesc::length_offset_in_bytes(),
    1.38                  index->as_jint(), null_check_info);
    1.39      __ branch(lir_cond_belowEqual, T_INT, stub); // forward branch
    1.40 +#else
    1.41 +        LIR_Opr left = LIR_OprFact::address(new LIR_Address(array, arrayOopDesc::length_offset_in_bytes(), T_INT));
    1.42 +        LIR_Opr right = LIR_OprFact::intConst(index->as_jint());
    1.43 +	__ null_check_for_branch(lir_cond_belowEqual, left, right, null_check_info);
    1.44 +        __ branch(lir_cond_belowEqual, left, right ,T_INT, stub); // forward branch
    1.45 +#endif
    1.46    } else {
    1.47 +#ifndef MIPS64
    1.48      cmp_reg_mem(lir_cond_aboveEqual, index, array,
    1.49                  arrayOopDesc::length_offset_in_bytes(), T_INT, null_check_info);
    1.50      __ branch(lir_cond_aboveEqual, T_INT, stub); // forward branch
    1.51 +#else
    1.52 +        LIR_Opr left = index;
    1.53 +        LIR_Opr right = LIR_OprFact::address(new LIR_Address( array, arrayOopDesc::length_offset_in_bytes(), T_INT));
    1.54 +        __ null_check_for_branch(lir_cond_aboveEqual, left, right, null_check_info);
    1.55 +	__ branch(lir_cond_aboveEqual,left, right ,T_INT, stub); // forward branch
    1.56 +#endif
    1.57    }
    1.58  }
    1.59  
    1.60 @@ -495,12 +524,26 @@
    1.61  void LIRGenerator::nio_range_check(LIR_Opr buffer, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info) {
    1.62    CodeStub* stub = new RangeCheckStub(info, index, true);
    1.63    if (index->is_constant()) {
    1.64 +#ifndef MIPS64
    1.65      cmp_mem_int(lir_cond_belowEqual, buffer, java_nio_Buffer::limit_offset(), index->as_jint(), info);
    1.66      __ branch(lir_cond_belowEqual, T_INT, stub); // forward branch
    1.67 +#else
    1.68 +        LIR_Opr left = LIR_OprFact::address(new LIR_Address(buffer, java_nio_Buffer::limit_offset(),T_INT));
    1.69 +        LIR_Opr right = LIR_OprFact::intConst(index->as_jint());
    1.70 +	__ null_check_for_branch(lir_cond_belowEqual, left, right, info);
    1.71 +        __ branch(lir_cond_belowEqual,left, right ,T_INT, stub); // forward branch
    1.72 +#endif
    1.73    } else {
    1.74 +#ifndef MIPS64
    1.75      cmp_reg_mem(lir_cond_aboveEqual, index, buffer,
    1.76                  java_nio_Buffer::limit_offset(), T_INT, info);
    1.77      __ branch(lir_cond_aboveEqual, T_INT, stub); // forward branch
    1.78 +#else
    1.79 +        LIR_Opr left = index;
    1.80 +        LIR_Opr right = LIR_OprFact::address(new LIR_Address( buffer, java_nio_Buffer::limit_offset(), T_INT));
    1.81 +	__ null_check_for_branch(lir_cond_aboveEqual, left, right, info);
    1.82 +        __ branch(lir_cond_aboveEqual,left, right ,T_INT, stub); // forward branch
    1.83 +#endif
    1.84    }
    1.85    __ move(index, result);
    1.86  }
    1.87 @@ -660,8 +703,13 @@
    1.88    __ unlock_object(hdr, object, lock, scratch, slow_path);
    1.89  }
    1.90  
    1.91 -
    1.92 +#ifndef MIPS64
    1.93  void LIRGenerator::new_instance(LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info) {
    1.94 +#else
    1.95 +void LIRGenerator::new_instance(LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, 
    1.96 +                                LIR_Opr scratch4, LIR_Opr scratch5, LIR_Opr scratch6,LIR_Opr klass_reg, CodeEmitInfo* info) {
    1.97 +#endif
    1.98 +
    1.99    klass2reg_with_patching(klass_reg, klass, info);
   1.100    // If klass is not loaded we do not know if the klass has finalizers:
   1.101    if (UseFastNewInstance && klass->is_loaded()
   1.102 @@ -675,12 +723,23 @@
   1.103      // allocate space for instance
   1.104      assert(klass->size_helper() >= 0, "illegal instance size");
   1.105      const int instance_size = align_object_size(klass->size_helper());
   1.106 +#ifndef MIPS64
   1.107      __ allocate_object(dst, scratch1, scratch2, scratch3, scratch4,
   1.108                         oopDesc::header_size(), instance_size, klass_reg, !klass->is_initialized(), slow_path);
   1.109 +#else
   1.110 +    __ allocate_object(dst, scratch1, scratch2, scratch3, scratch4, scratch5, scratch6,
   1.111 +                        oopDesc::header_size(), instance_size, klass_reg, !klass->is_initialized(), slow_path);
   1.112 +
   1.113 +#endif
   1.114    } else {
   1.115      CodeStub* slow_path = new NewInstanceStub(klass_reg, dst, klass, info, Runtime1::new_instance_id);
   1.116 +#ifndef MIPS64
   1.117      __ branch(lir_cond_always, T_ILLEGAL, slow_path);
   1.118      __ branch_destination(slow_path->continuation());
   1.119 +#else
   1.120 +    __ branch(lir_cond_always, LIR_OprFact::illegalOpr,  LIR_OprFact::illegalOpr, T_ILLEGAL, slow_path);
   1.121 +    __ branch_destination(slow_path->continuation());
   1.122 +#endif
   1.123    }
   1.124  }
   1.125  
   1.126 @@ -923,7 +982,7 @@
   1.127    __ move(value, tmp);
   1.128    return tmp;
   1.129  }
   1.130 -
   1.131 +#ifndef MIPS64
   1.132  void LIRGenerator::profile_branch(If* if_instr, If::Condition cond) {
   1.133    if (if_instr->should_profile()) {
   1.134      ciMethod* method = if_instr->profiled_method();
   1.135 @@ -960,6 +1019,55 @@
   1.136      __ move(data_reg, data_addr);
   1.137    }
   1.138  }
   1.139 +#else
   1.140 +void LIRGenerator::profile_branch(If* if_instr, If::Condition cond , LIR_Opr left, LIR_Opr right) {
   1.141 +        if (if_instr->should_profile()) {
   1.142 +                ciMethod* method = if_instr->profiled_method();
   1.143 +                assert(method != NULL, "method should be set if branch is profiled");
   1.144 +                ciMethodData* md = method->method_data_or_null();
   1.145 +                if (md == NULL) {
   1.146 +                        bailout("out of memory building methodDataOop");
   1.147 +                        return;
   1.148 +                }
   1.149 +                ciProfileData* data = md->bci_to_data(if_instr->profiled_bci());
   1.150 +                assert(data != NULL, "must have profiling data");
   1.151 +                assert(data->is_BranchData(), "need BranchData for two-way branches");
   1.152 +                int taken_count_offset     = md->byte_offset_of_slot(data, BranchData::taken_offset());
   1.153 +                int not_taken_count_offset = md->byte_offset_of_slot(data, BranchData::not_taken_offset());
   1.154 +                if (if_instr->is_swapped()) {
   1.155 +                 int t = taken_count_offset;
   1.156 +                 taken_count_offset = not_taken_count_offset;
   1.157 +                 not_taken_count_offset = t; 
   1.158 +                }
   1.159 +                LIR_Opr md_reg = new_register(T_METADATA);
   1.160 +                __ metadata2reg(md->constant_encoding(), md_reg);
   1.161 +                //__ move(LIR_OprFact::oopConst(md->constant_encoding()), md_reg);
   1.162 +                LIR_Opr data_offset_reg = new_pointer_register();
   1.163 +
   1.164 +                LIR_Opr opr1 =  LIR_OprFact::intConst(taken_count_offset);
   1.165 +                LIR_Opr opr2 =  LIR_OprFact::intConst(not_taken_count_offset);
   1.166 +                LabelObj* skip = new LabelObj();
   1.167 +
   1.168 +                __ move(opr1, data_offset_reg);
   1.169 +                __ branch( lir_cond(cond), left, right, skip->label());
   1.170 +                __ move(opr2, data_offset_reg);
   1.171 +                __ branch_destination(skip->label());
   1.172 +
   1.173 +                LIR_Opr data_reg = new_pointer_register();
   1.174 +                LIR_Opr tmp_reg = new_pointer_register();
   1.175 +                // LIR_Address* data_addr = new LIR_Address(md_reg, data_offset_reg, T_INT);
   1.176 +                                __ move(data_offset_reg, tmp_reg);
   1.177 +                __ add(tmp_reg, md_reg, tmp_reg);
   1.178 +                LIR_Address* data_addr = new LIR_Address(tmp_reg, 0, T_INT);
   1.179 +                __ move(LIR_OprFact::address(data_addr), data_reg);
   1.180 +                LIR_Address* fake_incr_value = new LIR_Address(data_reg, DataLayout::counter_increment, T_INT);
   1.181 +                // Use leal instead of add to avoid destroying condition codes on x86
   1.182 +                                __ leal(LIR_OprFact::address(fake_incr_value), data_reg);
   1.183 +                __ move(data_reg, LIR_OprFact::address(data_addr));
   1.184 +        }
   1.185 +}
   1.186 +
   1.187 +#endif
   1.188  
   1.189  // Phi technique:
   1.190  // This is about passing live values from one basic block to the other.
   1.191 @@ -1086,6 +1194,35 @@
   1.192    }
   1.193    return NULL;
   1.194  }
   1.195 +#ifdef MIPS64
   1.196 +void LIRGenerator::write_barrier(LIR_Opr addr) {
   1.197 +        if (addr->is_address()) {
   1.198 +        LIR_Address* address = (LIR_Address*)addr;
   1.199 +        LIR_Opr ptr = new_register(T_OBJECT);
   1.200 +        if (!address->index()->is_valid() && address->disp() == 0) {
   1.201 +                __ move(address->base(), ptr);
   1.202 +        } else {
   1.203 +                __ leal(addr, ptr);
   1.204 +        }
   1.205 +                addr = ptr;
   1.206 +        }
   1.207 +        assert(addr->is_register(), "must be a register at this point");
   1.208 +
   1.209 +        LIR_Opr tmp = new_pointer_register();
   1.210 +        if (TwoOperandLIRForm) {
   1.211 +                __ move(addr, tmp);
   1.212 +                __ unsigned_shift_right(tmp, CardTableModRefBS::card_shift, tmp);
   1.213 +        } else {
   1.214 +                __ unsigned_shift_right(addr, CardTableModRefBS::card_shift, tmp);
   1.215 +        }
   1.216 +        if (can_inline_as_constant(card_table_base())) {
   1.217 +                __ move(LIR_OprFact::intConst(0), new LIR_Address(tmp, card_table_base()->as_jint(), T_BYTE));
   1.218 +        } else {
   1.219 +                __ add(tmp, load_constant(card_table_base()), tmp);
   1.220 +                __ move(LIR_OprFact::intConst(0), new LIR_Address(tmp, 0, T_BYTE));
   1.221 +        }
   1.222 +}
   1.223 +#endif
   1.224  
   1.225  
   1.226  void LIRGenerator::do_ExceptionObject(ExceptionObject* x) {
   1.227 @@ -1471,7 +1608,9 @@
   1.228    // Read the marking-in-progress flag.
   1.229    LIR_Opr flag_val = new_register(T_INT);
   1.230    __ load(mark_active_flag_addr, flag_val);
   1.231 +#ifndef MIPS64
   1.232    __ cmp(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0));
   1.233 +#endif
   1.234  
   1.235    LIR_PatchCode pre_val_patch_code = lir_patch_none;
   1.236  
   1.237 @@ -1500,7 +1639,11 @@
   1.238      slow = new G1PreBarrierStub(pre_val);
   1.239    }
   1.240  
   1.241 +#ifndef MIPS64
   1.242    __ branch(lir_cond_notEqual, T_INT, slow);
   1.243 +#else
   1.244 +  __ branch(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0), T_INT, slow);
   1.245 +#endif
   1.246    __ branch_destination(slow->continuation());
   1.247  }
   1.248  
   1.249 @@ -1558,10 +1701,16 @@
   1.250    }
   1.251    assert(new_val->is_register(), "must be a register at this point");
   1.252  
   1.253 +#ifndef MIPS64
   1.254    __ cmp(lir_cond_notEqual, xor_shift_res, LIR_OprFact::intptrConst(NULL_WORD));
   1.255  
   1.256 +#endif
   1.257    CodeStub* slow = new G1PostBarrierStub(addr, new_val);
   1.258 +#ifndef MIPS64
   1.259    __ branch(lir_cond_notEqual, LP64_ONLY(T_LONG) NOT_LP64(T_INT), slow);
   1.260 +#else
   1.261 +  __ branch(lir_cond_notEqual, xor_shift_res, LIR_OprFact::intptrConst((intptr_t)NULL_WORD), LP64_ONLY(T_LONG) NOT_LP64(T_INT), slow);
   1.262 +#endif
   1.263    __ branch_destination(slow->continuation());
   1.264  }
   1.265  
   1.266 @@ -1617,9 +1766,16 @@
   1.267      __ move(LIR_OprFact::intConst(0),
   1.268                new LIR_Address(tmp, card_table_base->as_jint(), T_BYTE));
   1.269    } else {
   1.270 +#ifndef MIPS64
   1.271      __ move(LIR_OprFact::intConst(0),
   1.272                new LIR_Address(tmp, load_constant(card_table_base),
   1.273                                T_BYTE));
   1.274 +#else
   1.275 +    __ add(tmp, load_constant(card_table_base), tmp);
   1.276 +    __ move(LIR_OprFact::intConst(0),
   1.277 +              new LIR_Address(tmp, 0,
   1.278 +                              T_BYTE));
   1.279 +#endif
   1.280    }
   1.281  #endif // ARM
   1.282  }
   1.283 @@ -1838,12 +1994,29 @@
   1.284      CodeEmitInfo* info = state_for(x);
   1.285      CodeStub* stub = new RangeCheckStub(info, index.result(), true);
   1.286      if (index.result()->is_constant()) {
   1.287 +#ifndef MIPS64
   1.288        cmp_mem_int(lir_cond_belowEqual, buf.result(), java_nio_Buffer::limit_offset(), index.result()->as_jint(), info);
   1.289        __ branch(lir_cond_belowEqual, T_INT, stub);
   1.290 +#else
   1.291 +            LIR_Opr left = LIR_OprFact::address(new LIR_Address( buf.result(),
   1.292 +                                                java_nio_Buffer::limit_offset(),T_INT));
   1.293 +        LIR_Opr right = LIR_OprFact::intConst(index.result()->as_jint());
   1.294 +      __ null_check_for_branch(lir_cond_belowEqual, left, right, info);
   1.295 +            __ branch(lir_cond_belowEqual,left, right ,T_INT, stub); // forward branch
   1.296 +
   1.297 +#endif
   1.298      } else {
   1.299 +#ifndef MIPS64
   1.300        cmp_reg_mem(lir_cond_aboveEqual, index.result(), buf.result(),
   1.301                    java_nio_Buffer::limit_offset(), T_INT, info);
   1.302        __ branch(lir_cond_aboveEqual, T_INT, stub);
   1.303 +#else
   1.304 +            LIR_Opr right = LIR_OprFact::address(new LIR_Address( buf.result(), java_nio_Buffer::limit_offset(),T_INT));
   1.305 +            LIR_Opr left =  index.result();
   1.306 +      __ null_check_for_branch(lir_cond_aboveEqual, left, right, info);
   1.307 +            __ branch(lir_cond_aboveEqual, left, right , T_INT, stub); // forward branch
   1.308 +#endif
   1.309 +
   1.310      }
   1.311      __ move(index.result(), result);
   1.312    } else {
   1.313 @@ -1920,12 +2093,21 @@
   1.314  
   1.315    if (GenerateRangeChecks && needs_range_check) {
   1.316      if (StressLoopInvariantCodeMotion && range_check_info->deoptimize_on_exception()) {
   1.317 +#ifndef MIPS64
   1.318        __ branch(lir_cond_always, T_ILLEGAL, new RangeCheckStub(range_check_info, index.result()));
   1.319 +#else
   1.320 +     tty->print_cr("LIRGenerator::do_LoadIndexed(LoadIndexed* x) unimplemented yet!");
   1.321 +     Unimplemented();
   1.322 +#endif
   1.323      } else if (use_length) {
   1.324        // TODO: use a (modified) version of array_range_check that does not require a
   1.325        //       constant length to be loaded to a register
   1.326 +#ifndef MIPS64
   1.327        __ cmp(lir_cond_belowEqual, length.result(), index.result());
   1.328        __ branch(lir_cond_belowEqual, T_INT, new RangeCheckStub(range_check_info, index.result()));
   1.329 +#else
   1.330 +      __ branch(lir_cond_belowEqual, length.result(), index.result(),T_INT, new RangeCheckStub(range_check_info, index.result()));
   1.331 +#endif
   1.332      } else {
   1.333        array_range_check(array.result(), index.result(), null_check_info, range_check_info);
   1.334        // The range check performs the null check, so clear it out for the load
   1.335 @@ -2088,7 +2270,19 @@
   1.336          index_op = tmp;
   1.337        }
   1.338  #endif
   1.339 +#ifndef MIPS64
   1.340        addr = new LIR_Address(base_op, index_op, dst_type);
   1.341 +#else
   1.342 +   #ifdef _LP64
   1.343 +      LIR_Opr ptr = new_register(T_LONG);
   1.344 +   #else
   1.345 +      LIR_Opr ptr = new_register(T_INT);
   1.346 +   #endif
   1.347 +      __ move(base_op, ptr);
   1.348 +      if(index_op -> is_valid())
   1.349 +         __ add(ptr, index_op, ptr);
   1.350 +      addr = new LIR_Address(ptr, 0, dst_type);
   1.351 +#endif
   1.352      } else {
   1.353        LIR_Opr tmp = new_pointer_register();
   1.354        __ shift_left(index_op, log2_scale, tmp);
   1.355 @@ -2286,14 +2480,22 @@
   1.356            referent_off = new_register(T_LONG);
   1.357            __ move(LIR_OprFact::longConst(java_lang_ref_Reference::referent_offset), referent_off);
   1.358          }
   1.359 +#ifndef MIPS64
   1.360          __ cmp(lir_cond_notEqual, off.result(), referent_off);
   1.361          __ branch(lir_cond_notEqual, as_BasicType(off.type()), Lcont->label());
   1.362 +#else
   1.363 +        __ branch(lir_cond_notEqual, off.result(), referent_off,  Lcont->label());
   1.364 +#endif
   1.365        }
   1.366        if (gen_source_check) {
   1.367          // offset is a const and equals referent offset
   1.368          // if (source == null) -> continue
   1.369 +#ifndef MIPS64
   1.370          __ cmp(lir_cond_equal, src.result(), LIR_OprFact::oopConst(NULL));
   1.371          __ branch(lir_cond_equal, T_OBJECT, Lcont->label());
   1.372 +#else
   1.373 +        __ branch(lir_cond_equal, src.result(), LIR_OprFact::oopConst(NULL),  Lcont->label());
   1.374 +#endif
   1.375        }
   1.376        LIR_Opr src_klass = new_register(T_OBJECT);
   1.377        if (gen_type_check) {
   1.378 @@ -2303,8 +2505,12 @@
   1.379          LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE);
   1.380          LIR_Opr reference_type = new_register(T_INT);
   1.381          __ move(reference_type_addr, reference_type);
   1.382 +#ifndef MIPS64
   1.383          __ cmp(lir_cond_equal, reference_type, LIR_OprFact::intConst(REF_NONE));
   1.384          __ branch(lir_cond_equal, T_INT, Lcont->label());
   1.385 +#else
   1.386 +        __ branch(lir_cond_equal, reference_type, LIR_OprFact::intConst(REF_NONE),  Lcont->label());
   1.387 +#endif
   1.388        }
   1.389        {
   1.390          // We have determined that src->_klass->_reference_type != REF_NONE
   1.391 @@ -2384,20 +2590,36 @@
   1.392      int high_key = one_range->high_key();
   1.393      BlockBegin* dest = one_range->sux();
   1.394      if (low_key == high_key) {
   1.395 +#ifndef MIPS64
   1.396        __ cmp(lir_cond_equal, value, low_key);
   1.397        __ branch(lir_cond_equal, T_INT, dest);
   1.398 +#else
   1.399 +      __ branch(lir_cond_equal, value, LIR_OprFact::intConst(low_key), T_INT, dest);
   1.400 +#endif
   1.401      } else if (high_key - low_key == 1) {
   1.402 +#ifndef MIPS64
   1.403        __ cmp(lir_cond_equal, value, low_key);
   1.404        __ branch(lir_cond_equal, T_INT, dest);
   1.405        __ cmp(lir_cond_equal, value, high_key);
   1.406        __ branch(lir_cond_equal, T_INT, dest);
   1.407 +#else
   1.408 +      __ branch(lir_cond_equal, value, LIR_OprFact::intConst(low_key), T_INT, dest);
   1.409 +      __ branch(lir_cond_equal, value, LIR_OprFact::intConst(high_key), T_INT, dest);
   1.410 +
   1.411 +#endif
   1.412      } else {
   1.413        LabelObj* L = new LabelObj();
   1.414 +#ifndef MIPS64
   1.415        __ cmp(lir_cond_less, value, low_key);
   1.416        __ branch(lir_cond_less, T_INT, L->label());
   1.417        __ cmp(lir_cond_lessEqual, value, high_key);
   1.418        __ branch(lir_cond_lessEqual, T_INT, dest);
   1.419        __ branch_destination(L->label());
   1.420 +#else
   1.421 +      __ branch(lir_cond_less, value, LIR_OprFact::intConst(low_key), L->label());
   1.422 +      __ branch(lir_cond_lessEqual, value, LIR_OprFact::intConst(high_key), T_INT, dest);
   1.423 +      __ branch_destination(L->label());
   1.424 +#endif
   1.425      }
   1.426    }
   1.427    __ jump(default_sux);
   1.428 @@ -2483,8 +2705,12 @@
   1.429      do_SwitchRanges(create_lookup_ranges(x), value, x->default_sux());
   1.430    } else {
   1.431      for (int i = 0; i < len; i++) {
   1.432 +#ifndef MIPS64
   1.433        __ cmp(lir_cond_equal, value, i + lo_key);
   1.434        __ branch(lir_cond_equal, T_INT, x->sux_at(i));
   1.435 +#else
   1.436 +      __ branch(lir_cond_equal, value, LIR_OprFact::intConst(i+lo_key), T_INT, x->sux_at(i));
   1.437 +#endif
   1.438      }
   1.439      __ jump(x->default_sux());
   1.440    }
   1.441 @@ -2509,8 +2735,12 @@
   1.442    } else {
   1.443      int len = x->length();
   1.444      for (int i = 0; i < len; i++) {
   1.445 +#ifndef MIPS64
   1.446        __ cmp(lir_cond_equal, value, x->key_at(i));
   1.447        __ branch(lir_cond_equal, T_INT, x->sux_at(i));
   1.448 +#else
   1.449 +      __ branch(lir_cond_equal, value, LIR_OprFact::intConst(x->key_at(i)), T_INT, x->sux_at(i));
   1.450 +#endif
   1.451      }
   1.452      __ jump(x->default_sux());
   1.453    }
   1.454 @@ -3012,9 +3242,18 @@
   1.455    t_val.dont_load_item();
   1.456    f_val.dont_load_item();
   1.457    LIR_Opr reg = rlock_result(x);
   1.458 -
   1.459 +#ifndef MIPS64
   1.460    __ cmp(lir_cond(x->cond()), left.result(), right.result());
   1.461    __ cmove(lir_cond(x->cond()), t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type()));
   1.462 +#else
   1.463 +  LIR_Opr opr1 =  t_val.result();
   1.464 +  LIR_Opr opr2 =  f_val.result();
   1.465 +  LabelObj* skip = new LabelObj();
   1.466 +  __ move(opr1, reg);
   1.467 +  __ branch(lir_cond(x->cond()), left.result(), right.result(), skip->label());
   1.468 +  __ move(opr2, reg);
   1.469 +  __ branch_destination(skip->label());
   1.470 +#endif
   1.471  }
   1.472  
   1.473  void LIRGenerator::do_RuntimeCall(address routine, int expected_arguments, Intrinsic* x) {
   1.474 @@ -3365,10 +3604,16 @@
   1.475      LIR_Opr meth = new_register(T_METADATA);
   1.476      __ metadata2reg(method->constant_encoding(), meth);
   1.477      __ logical_and(result, mask, result);
   1.478 +#ifndef MIPS64
   1.479      __ cmp(lir_cond_equal, result, LIR_OprFact::intConst(0));
   1.480 +#endif
   1.481      // The bci for info can point to cmp for if's we want the if bci
   1.482      CodeStub* overflow = new CounterOverflowStub(info, bci, meth);
   1.483 +#ifndef MIPS64
   1.484      __ branch(lir_cond_equal, T_INT, overflow);
   1.485 +#else
   1.486 +    __ branch(lir_cond_equal, result, LIR_OprFact::intConst(0), T_INT, overflow);
   1.487 +#endif
   1.488      __ branch_destination(overflow->continuation());
   1.489    }
   1.490  }
   1.491 @@ -3480,8 +3725,13 @@
   1.492      CodeEmitInfo *info = state_for(x, x->state());
   1.493      CodeStub* stub = new PredicateFailedStub(info);
   1.494  
   1.495 +#ifndef MIPS64
   1.496      __ cmp(lir_cond(cond), left, right);
   1.497      __ branch(lir_cond(cond), right->type(), stub);
   1.498 +#else
   1.499 +    tty->print_cr("LIRGenerator::do_RangeCheckPredicate(RangeCheckPredicate *x) unimplemented yet!");
   1.500 +    Unimplemented();
   1.501 +#endif
   1.502    }
   1.503  }
   1.504  

mercurial