[Upgrade] jdk8u77-b03 --> jdk8u91-b15 (ztos support for MIPS)

Tue, 10 Apr 2018 10:21:49 +0800

author
fujie
date
Tue, 10 Apr 2018 10:21:49 +0800
changeset 8858
e3f4d3592615
parent 8857
69619c96717a
child 8859
f39c2b3891e2

[Upgrade] jdk8u77-b03 --> jdk8u91-b15 (ztos support for MIPS)

src/cpu/mips/vm/interp_masm_mips_64.cpp file | annotate | diff | comparison | revisions
src/cpu/mips/vm/interp_masm_mips_64.hpp file | annotate | diff | comparison | revisions
src/cpu/mips/vm/templateInterpreter_mips_64.cpp file | annotate | diff | comparison | revisions
src/cpu/mips/vm/templateTable_mips_64.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/mips/vm/interp_masm_mips_64.cpp	Thu May 24 18:59:17 2018 +0800
     1.2 +++ b/src/cpu/mips/vm/interp_masm_mips_64.cpp	Tue Apr 10 10:21:49 2018 +0800
     1.3 @@ -219,6 +219,7 @@
     1.4        ld_ptr(V0, val_addr);               // fall through
     1.5        break;
     1.6      case btos:                                     // fall through
     1.7 +    case ztos:                                     // fall through
     1.8      case ctos:                                     // fall through
     1.9      case stos:                                     // fall through
    1.10      case itos:
    1.11 @@ -466,6 +467,7 @@
    1.12    switch (state) {
    1.13      case atos: pop_ptr();           break;
    1.14      case btos:
    1.15 +    case ztos:
    1.16      case ctos:
    1.17      case stos:
    1.18      case itos: pop_i();             break;
    1.19 @@ -484,6 +486,7 @@
    1.20    switch (state) {
    1.21      case atos: push_ptr();          break;
    1.22      case btos:
    1.23 +    case ztos:
    1.24      case ctos:
    1.25      case stos:
    1.26      case itos: push_i();            break;
    1.27 @@ -572,7 +575,7 @@
    1.28    if((long)table >= (long)Interpreter::dispatch_table(btos) &&
    1.29       (long)table <= (long)Interpreter::dispatch_table(vtos)
    1.30      ) {
    1.31 -     int table_size = (long)Interpreter::dispatch_table(ctos) - (long)Interpreter::dispatch_table(btos);
    1.32 +     int table_size = (long)Interpreter::dispatch_table(itos) - (long)Interpreter::dispatch_table(stos);
    1.33       int table_offset = ((int)state - (int)itos) * table_size;
    1.34  
    1.35       // 2013/12/17 Fu: GP points to the starting address of Interpreter::dispatch_table(itos).
    1.36 @@ -1626,6 +1629,53 @@
    1.37    }
    1.38  }
    1.39  
    1.40 +
    1.41 +void InterpreterMacroAssembler::narrow(Register result) {
    1.42 +
    1.43 +  // Get method->_constMethod->_result_type
    1.44 +  ld(T9, FP, frame::interpreter_frame_method_offset * wordSize);
    1.45 +  ld(T9, T9, in_bytes(Method::const_offset()));
    1.46 +  lbu(T9, T9, in_bytes(ConstMethod::result_type_offset()));
    1.47 +
    1.48 +  Label done, notBool, notByte, notChar;
    1.49 +
    1.50 +  // common case first
    1.51 +  addiu(AT, T9, -T_INT);
    1.52 +  beq(AT, R0, done);
    1.53 +  nop();
    1.54 +
    1.55 +  // mask integer result to narrower return type.
    1.56 +  addiu(AT, T9, -T_BOOLEAN);
    1.57 +  bne(AT, R0, notBool);
    1.58 +  nop();
    1.59 +  andi(result, result, 0x1);
    1.60 +  beq(R0, R0, done);
    1.61 +  nop();
    1.62 +
    1.63 +  bind(notBool);
    1.64 +  addiu(AT, T9, -T_BYTE);
    1.65 +  bne(AT, R0, notByte);
    1.66 +  nop();
    1.67 +  seb(result, result);
    1.68 +  beq(R0, R0, done);
    1.69 +  nop();
    1.70 +
    1.71 +  bind(notByte);
    1.72 +  addiu(AT, T9, -T_CHAR);
    1.73 +  bne(AT, R0, notChar);
    1.74 +  nop();
    1.75 +  andi(result, result, 0xFFFF);
    1.76 +  beq(R0, R0, done);
    1.77 +  nop();
    1.78 +
    1.79 +  bind(notChar);
    1.80 +  seh(result, result);
    1.81 +
    1.82 +  // Nothing to do for T_INT
    1.83 +  bind(done);
    1.84 +}
    1.85 +
    1.86 +
    1.87  void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
    1.88    Label update, next, none;
    1.89  
     2.1 --- a/src/cpu/mips/vm/interp_masm_mips_64.hpp	Thu May 24 18:59:17 2018 +0800
     2.2 +++ b/src/cpu/mips/vm/interp_masm_mips_64.hpp	Tue Apr 10 10:21:49 2018 +0800
     2.3 @@ -62,6 +62,9 @@
     2.4  #endif // CC_INTERP
     2.5  
     2.6   public:
     2.7 +  // narrow int return value
     2.8 +  void narrow(Register result);
     2.9 +
    2.10    InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code), _locals_register(LVP), _bcp_register(BCP) {}
    2.11  
    2.12    void  get_2_byte_integer_at_bcp(Register reg, Register tmp, int offset);
     3.1 --- a/src/cpu/mips/vm/templateInterpreter_mips_64.cpp	Thu May 24 18:59:17 2018 +0800
     3.2 +++ b/src/cpu/mips/vm/templateInterpreter_mips_64.cpp	Tue Apr 10 10:21:49 2018 +0800
     3.3 @@ -684,7 +684,7 @@
     3.4      __ dadd(T1, T1, T2);
     3.5      __ lw(T3, T1, 0);
     3.6  
     3.7 -    Label notByte, notShort, notChar, notObj;
     3.8 +    Label notByte, notBool, notShort, notChar, notObj;
     3.9      //    const Address field_address (eax, esi, Address::times_1);
    3.10  
    3.11      // Need to differentiate between igetfield, agetfield, bgetfield etc.
    3.12 @@ -701,8 +701,17 @@
    3.13      __ b(xreturn_path);
    3.14      __ delayed()->nop();
    3.15  
    3.16 +    //ztos
    3.17 +    __ bind(notByte);
    3.18 +    __ daddi(T1, T3, (-1) * ztos);
    3.19 +    __ bne(T1, R0, notBool);
    3.20 +    __ delayed()->nop();
    3.21 +    __ lb(V0, T0, 0);
    3.22 +    __ b(xreturn_path);
    3.23 +    __ delayed()->nop();
    3.24 +
    3.25      //stos
    3.26 -    __ bind(notByte);
    3.27 +    __ bind(notBool);
    3.28      __ daddi(T1, T3, (-1) * stos);
    3.29      __ bne(T1, R0, notShort);
    3.30      __ delayed()->nop();
     4.1 --- a/src/cpu/mips/vm/templateTable_mips_64.cpp	Thu May 24 18:59:17 2018 +0800
     4.2 +++ b/src/cpu/mips/vm/templateTable_mips_64.cpp	Tue Apr 10 10:21:49 2018 +0800
     4.3 @@ -194,6 +194,7 @@
     4.4    switch (bc) {
     4.5    case Bytecodes::_fast_aputfield:
     4.6    case Bytecodes::_fast_bputfield:
     4.7 +  case Bytecodes::_fast_zputfield:
     4.8    case Bytecodes::_fast_cputfield:
     4.9    case Bytecodes::_fast_dputfield:
    4.10    case Bytecodes::_fast_fputfield:
    4.11 @@ -1217,6 +1218,7 @@
    4.12    transition(itos, vtos);
    4.13    __ pop_i(SSR);
    4.14    if(UseBoundCheckInstruction) {
    4.15 +    guarantee(false, "unimplemented yet!");
    4.16      __ pop_ptr(T2);
    4.17      __ dadd(SSR, T2, SSR);
    4.18      __ addi(SSR, SSR, arrayOopDesc::base_offset_in_bytes(T_BYTE));  // base
    4.19 @@ -1228,6 +1230,22 @@
    4.20      __ gssble(FSR, SSR, AT);
    4.21    } else {
    4.22      index_check(T2, SSR);
    4.23 +
    4.24 +    // Need to check whether array is boolean or byte
    4.25 +    // since both types share the bastore bytecode.
    4.26 +    __ load_klass(T9, T2);
    4.27 +    __ lw(T9, T9, in_bytes(Klass::layout_helper_offset()));
    4.28 +
    4.29 +    int diffbit = Klass::layout_helper_boolean_diffbit();
    4.30 +    __ move(AT, diffbit);
    4.31 +
    4.32 +    Label L_skip;
    4.33 +    __ andr(AT, T9, AT);
    4.34 +    __ beq(AT, R0, L_skip);
    4.35 +    __ nop();
    4.36 +    __ andi(FSR, FSR, 0x1);
    4.37 +    __ bind(L_skip);
    4.38 +
    4.39      if (UseLoongsonISA && Assembler::is_simm(arrayOopDesc::base_offset_in_bytes(T_BYTE), 8)) {
    4.40        __ gssbx(FSR, T2, SSR, arrayOopDesc::base_offset_in_bytes(T_BYTE));
    4.41      } else {
    4.42 @@ -2561,6 +2579,14 @@
    4.43      InterpreterRuntime::register_finalizer), T1);
    4.44      __ bind(skip_register_finalizer);
    4.45    }
    4.46 +
    4.47 +  // Narrow result if state is itos but result type is smaller.
    4.48 +  // Need to narrow in the return bytecode rather than in generate_return_entry
    4.49 +  // since compiled code callers expect the result to already be narrowed.
    4.50 +  if (state == itos) {
    4.51 +    __ narrow(FSR);
    4.52 +  }
    4.53 +
    4.54    __ remove_activation(state, T9);
    4.55    __ sync();
    4.56  
    4.57 @@ -2825,12 +2851,12 @@
    4.58    __ dadd(index, obj, off);
    4.59  
    4.60  
    4.61 -  Label Done, notByte, notInt, notShort, notChar,
    4.62 +  Label Done, notByte, notBool, notInt, notShort, notChar,
    4.63                notLong, notFloat, notObj, notDouble;
    4.64  
    4.65    assert(btos == 0, "change code, btos != 0");
    4.66    __ dsrl(flags, flags, ConstantPoolCacheEntry::tos_state_shift);
    4.67 -  __ andi(flags, flags, 0xf);
    4.68 +  __ andi(flags, flags, ConstantPoolCacheEntry::tos_state_mask);
    4.69    __ bne(flags, R0, notByte);
    4.70    __ delayed()->nop();
    4.71  
    4.72 @@ -2845,7 +2871,26 @@
    4.73    __ b(Done);
    4.74    __ delayed()->daddi(SP, SP, - wordSize);
    4.75  
    4.76 +
    4.77    __ bind(notByte);
    4.78 +  __ move(AT, ztos);
    4.79 +  __ bne(flags, AT, notBool);
    4.80 +  __ delayed()->nop();
    4.81 +
    4.82 +  // ztos
    4.83 +  __ lb(FSR, index, 0);
    4.84 +  __ sd(FSR, SP, - wordSize);
    4.85 +
    4.86 +  // Rewrite bytecode to be faster
    4.87 +  if (!is_static) {
    4.88 +    // patch_bytecode(Bytecodes::_fast_igetfield, T3, T2);
    4.89 +    patch_bytecode(Bytecodes::_fast_bgetfield, T3, T2);
    4.90 +  }
    4.91 +  __ b(Done);
    4.92 +  __ delayed()->daddi(SP, SP, - wordSize);
    4.93 +
    4.94 +
    4.95 +  __ bind(notBool);
    4.96    __ move(AT, itos);
    4.97    __ bne(flags, AT, notInt);
    4.98    __ delayed()->nop();
    4.99 @@ -3096,7 +3141,7 @@
   4.100    }
   4.101  
   4.102  
   4.103 -  Label notByte, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble;
   4.104 +  Label notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble;
   4.105  
   4.106    assert(btos == 0, "change code, btos != 0");
   4.107  
   4.108 @@ -3119,8 +3164,28 @@
   4.109    __ b(Done);
   4.110    __ delayed()->nop();
   4.111  
   4.112 +  // ztos
   4.113 +  __ bind(notByte);
   4.114 +  __ move(AT, ztos);
   4.115 +  __ bne(flags, AT, notBool);
   4.116 +  __ delayed()->nop();
   4.117 +
   4.118 +  __ pop(ztos);
   4.119 +  if (!is_static) {
   4.120 +    pop_and_check_object(obj);
   4.121 +  }
   4.122 +  __ dadd(AT, obj, off);
   4.123 +  __ andi(FSR, FSR, 0x1);
   4.124 +  __ sb(FSR, AT, 0);
   4.125 +
   4.126 +  if (!is_static) {
   4.127 +    patch_bytecode(Bytecodes::_fast_zputfield, bc, off, true, byte_no);
   4.128 +  }
   4.129 +  __ b(Done);
   4.130 +  __ delayed()->nop();
   4.131 +
   4.132    // itos
   4.133 -  __ bind(notByte);
   4.134 +  __ bind(notBool);
   4.135    __ move(AT, itos);
   4.136    __ bne(flags, AT, notInt);
   4.137    __ delayed()->nop();
   4.138 @@ -3299,6 +3364,7 @@
   4.139      switch (bytecode()) {          // load values into the jvalue object
   4.140      case Bytecodes::_fast_aputfield: __ push_ptr(FSR); break;
   4.141      case Bytecodes::_fast_bputfield: // fall through
   4.142 +    case Bytecodes::_fast_zputfield: // fall through
   4.143      case Bytecodes::_fast_sputfield: // fall through
   4.144      case Bytecodes::_fast_cputfield: // fall through
   4.145      case Bytecodes::_fast_iputfield: __ push_i(FSR); break;
   4.146 @@ -3322,6 +3388,7 @@
   4.147      switch (bytecode()) {             // restore tos values
   4.148      case Bytecodes::_fast_aputfield: __ pop_ptr(FSR); break;
   4.149      case Bytecodes::_fast_bputfield: // fall through
   4.150 +    case Bytecodes::_fast_zputfield: // fall through
   4.151      case Bytecodes::_fast_sputfield: // fall through
   4.152      case Bytecodes::_fast_cputfield: // fall through
   4.153      case Bytecodes::_fast_iputfield: __ pop_i(FSR); break;
   4.154 @@ -3379,6 +3446,9 @@
   4.155  
   4.156    // access field
   4.157    switch (bytecode()) {
   4.158 +    case Bytecodes::_fast_zputfield:
   4.159 +      __ andi(FSR, FSR, 0x1);  // boolean is true if LSB is 1
   4.160 +      // fall through to bputfield
   4.161      case Bytecodes::_fast_bputfield:
   4.162        __ sb(FSR, T2, 0);
   4.163        break;

mercurial