src/cpu/mips/vm/templateTable_mips_64.cpp

changeset 8858
e3f4d3592615
parent 8027
23d8d77777e0
child 8863
5376ce0dc552
     1.1 --- a/src/cpu/mips/vm/templateTable_mips_64.cpp	Thu May 24 18:59:17 2018 +0800
     1.2 +++ b/src/cpu/mips/vm/templateTable_mips_64.cpp	Tue Apr 10 10:21:49 2018 +0800
     1.3 @@ -194,6 +194,7 @@
     1.4    switch (bc) {
     1.5    case Bytecodes::_fast_aputfield:
     1.6    case Bytecodes::_fast_bputfield:
     1.7 +  case Bytecodes::_fast_zputfield:
     1.8    case Bytecodes::_fast_cputfield:
     1.9    case Bytecodes::_fast_dputfield:
    1.10    case Bytecodes::_fast_fputfield:
    1.11 @@ -1217,6 +1218,7 @@
    1.12    transition(itos, vtos);
    1.13    __ pop_i(SSR);
    1.14    if(UseBoundCheckInstruction) {
    1.15 +    guarantee(false, "unimplemented yet!");
    1.16      __ pop_ptr(T2);
    1.17      __ dadd(SSR, T2, SSR);
    1.18      __ addi(SSR, SSR, arrayOopDesc::base_offset_in_bytes(T_BYTE));  // base
    1.19 @@ -1228,6 +1230,22 @@
    1.20      __ gssble(FSR, SSR, AT);
    1.21    } else {
    1.22      index_check(T2, SSR);
    1.23 +
    1.24 +    // Need to check whether array is boolean or byte
    1.25 +    // since both types share the bastore bytecode.
    1.26 +    __ load_klass(T9, T2);
    1.27 +    __ lw(T9, T9, in_bytes(Klass::layout_helper_offset()));
    1.28 +
    1.29 +    int diffbit = Klass::layout_helper_boolean_diffbit();
    1.30 +    __ move(AT, diffbit);
    1.31 +
    1.32 +    Label L_skip;
    1.33 +    __ andr(AT, T9, AT);
    1.34 +    __ beq(AT, R0, L_skip);
    1.35 +    __ nop();
    1.36 +    __ andi(FSR, FSR, 0x1);
    1.37 +    __ bind(L_skip);
    1.38 +
    1.39      if (UseLoongsonISA && Assembler::is_simm(arrayOopDesc::base_offset_in_bytes(T_BYTE), 8)) {
    1.40        __ gssbx(FSR, T2, SSR, arrayOopDesc::base_offset_in_bytes(T_BYTE));
    1.41      } else {
    1.42 @@ -2561,6 +2579,14 @@
    1.43      InterpreterRuntime::register_finalizer), T1);
    1.44      __ bind(skip_register_finalizer);
    1.45    }
    1.46 +
    1.47 +  // Narrow result if state is itos but result type is smaller.
    1.48 +  // Need to narrow in the return bytecode rather than in generate_return_entry
    1.49 +  // since compiled code callers expect the result to already be narrowed.
    1.50 +  if (state == itos) {
    1.51 +    __ narrow(FSR);
    1.52 +  }
    1.53 +
    1.54    __ remove_activation(state, T9);
    1.55    __ sync();
    1.56  
    1.57 @@ -2825,12 +2851,12 @@
    1.58    __ dadd(index, obj, off);
    1.59  
    1.60  
    1.61 -  Label Done, notByte, notInt, notShort, notChar,
    1.62 +  Label Done, notByte, notBool, notInt, notShort, notChar,
    1.63                notLong, notFloat, notObj, notDouble;
    1.64  
    1.65    assert(btos == 0, "change code, btos != 0");
    1.66    __ dsrl(flags, flags, ConstantPoolCacheEntry::tos_state_shift);
    1.67 -  __ andi(flags, flags, 0xf);
    1.68 +  __ andi(flags, flags, ConstantPoolCacheEntry::tos_state_mask);
    1.69    __ bne(flags, R0, notByte);
    1.70    __ delayed()->nop();
    1.71  
    1.72 @@ -2845,7 +2871,26 @@
    1.73    __ b(Done);
    1.74    __ delayed()->daddi(SP, SP, - wordSize);
    1.75  
    1.76 +
    1.77    __ bind(notByte);
    1.78 +  __ move(AT, ztos);
    1.79 +  __ bne(flags, AT, notBool);
    1.80 +  __ delayed()->nop();
    1.81 +
    1.82 +  // ztos
    1.83 +  __ lb(FSR, index, 0);
    1.84 +  __ sd(FSR, SP, - wordSize);
    1.85 +
    1.86 +  // Rewrite bytecode to be faster
    1.87 +  if (!is_static) {
    1.88 +    // patch_bytecode(Bytecodes::_fast_igetfield, T3, T2);
    1.89 +    patch_bytecode(Bytecodes::_fast_bgetfield, T3, T2);
    1.90 +  }
    1.91 +  __ b(Done);
    1.92 +  __ delayed()->daddi(SP, SP, - wordSize);
    1.93 +
    1.94 +
    1.95 +  __ bind(notBool);
    1.96    __ move(AT, itos);
    1.97    __ bne(flags, AT, notInt);
    1.98    __ delayed()->nop();
    1.99 @@ -3096,7 +3141,7 @@
   1.100    }
   1.101  
   1.102  
   1.103 -  Label notByte, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble;
   1.104 +  Label notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble;
   1.105  
   1.106    assert(btos == 0, "change code, btos != 0");
   1.107  
   1.108 @@ -3119,8 +3164,28 @@
   1.109    __ b(Done);
   1.110    __ delayed()->nop();
   1.111  
   1.112 +  // ztos
   1.113 +  __ bind(notByte);
   1.114 +  __ move(AT, ztos);
   1.115 +  __ bne(flags, AT, notBool);
   1.116 +  __ delayed()->nop();
   1.117 +
   1.118 +  __ pop(ztos);
   1.119 +  if (!is_static) {
   1.120 +    pop_and_check_object(obj);
   1.121 +  }
   1.122 +  __ dadd(AT, obj, off);
   1.123 +  __ andi(FSR, FSR, 0x1);
   1.124 +  __ sb(FSR, AT, 0);
   1.125 +
   1.126 +  if (!is_static) {
   1.127 +    patch_bytecode(Bytecodes::_fast_zputfield, bc, off, true, byte_no);
   1.128 +  }
   1.129 +  __ b(Done);
   1.130 +  __ delayed()->nop();
   1.131 +
   1.132    // itos
   1.133 -  __ bind(notByte);
   1.134 +  __ bind(notBool);
   1.135    __ move(AT, itos);
   1.136    __ bne(flags, AT, notInt);
   1.137    __ delayed()->nop();
   1.138 @@ -3299,6 +3364,7 @@
   1.139      switch (bytecode()) {          // load values into the jvalue object
   1.140      case Bytecodes::_fast_aputfield: __ push_ptr(FSR); break;
   1.141      case Bytecodes::_fast_bputfield: // fall through
   1.142 +    case Bytecodes::_fast_zputfield: // fall through
   1.143      case Bytecodes::_fast_sputfield: // fall through
   1.144      case Bytecodes::_fast_cputfield: // fall through
   1.145      case Bytecodes::_fast_iputfield: __ push_i(FSR); break;
   1.146 @@ -3322,6 +3388,7 @@
   1.147      switch (bytecode()) {             // restore tos values
   1.148      case Bytecodes::_fast_aputfield: __ pop_ptr(FSR); break;
   1.149      case Bytecodes::_fast_bputfield: // fall through
   1.150 +    case Bytecodes::_fast_zputfield: // fall through
   1.151      case Bytecodes::_fast_sputfield: // fall through
   1.152      case Bytecodes::_fast_cputfield: // fall through
   1.153      case Bytecodes::_fast_iputfield: __ pop_i(FSR); break;
   1.154 @@ -3379,6 +3446,9 @@
   1.155  
   1.156    // access field
   1.157    switch (bytecode()) {
   1.158 +    case Bytecodes::_fast_zputfield:
   1.159 +      __ andi(FSR, FSR, 0x1);  // boolean is true if LSB is 1
   1.160 +      // fall through to bputfield
   1.161      case Bytecodes::_fast_bputfield:
   1.162        __ sb(FSR, T2, 0);
   1.163        break;

mercurial