src/cpu/mips/vm/interp_masm_mips_64.cpp

changeset 8858
e3f4d3592615
parent 7999
b57e01e9f81e
child 8863
5376ce0dc552
     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  

mercurial