src/cpu/sparc/vm/templateTable_sparc.cpp

changeset 8368
32b682649973
parent 6223
add2caa66e7e
child 8604
04d83ba48607
child 8997
f8a45a60bc6b
     1.1 --- a/src/cpu/sparc/vm/templateTable_sparc.cpp	Mon Jan 11 13:41:45 2016 -0800
     1.2 +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp	Fri Jan 15 22:33:15 2016 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -167,6 +167,7 @@
    1.11    switch (bc) {
    1.12    case Bytecodes::_fast_aputfield:
    1.13    case Bytecodes::_fast_bputfield:
    1.14 +  case Bytecodes::_fast_zputfield:
    1.15    case Bytecodes::_fast_cputfield:
    1.16    case Bytecodes::_fast_dputfield:
    1.17    case Bytecodes::_fast_fputfield:
    1.18 @@ -913,8 +914,20 @@
    1.19    transition(itos, vtos);
    1.20    __ pop_i(O2); // index
    1.21    // Otos_i: val
    1.22 +  // O2: index
    1.23    // O3: array
    1.24    __ index_check(O3, O2, 0, G3_scratch, O2);
    1.25 +  // Need to check whether array is boolean or byte
    1.26 +  // since both types share the bastore bytecode.
    1.27 +  __ load_klass(O3, G4_scratch);
    1.28 +  __ ld(G4_scratch, in_bytes(Klass::layout_helper_offset()), G4_scratch);
    1.29 +  __ set(Klass::layout_helper_boolean_diffbit(), G3_scratch);
    1.30 +  __ andcc(G3_scratch, G4_scratch, G0);
    1.31 +  Label L_skip;
    1.32 +  __ br(Assembler::zero, false, Assembler::pn, L_skip);
    1.33 +  __ delayed()->nop();
    1.34 +  __ and3(Otos_i, 1, Otos_i);  // if it is a T_BOOLEAN array, mask the stored value to 0/1
    1.35 +  __ bind(L_skip);
    1.36    __ stb(Otos_i, O2, arrayOopDesc::base_offset_in_bytes(T_BYTE));
    1.37  }
    1.38  
    1.39 @@ -1997,6 +2010,12 @@
    1.40      __ bind(skip_register_finalizer);
    1.41    }
    1.42  
    1.43 +  // Narrow result if state is itos but result type is smaller.
    1.44 +  // Need to narrow in the return bytecode rather than in generate_return_entry
    1.45 +  // since compiled code callers expect the result to already be narrowed.
    1.46 +  if (state == itos) {
    1.47 +    __ narrow(Otos_i);
    1.48 +  }
    1.49    __ remove_activation(state, /* throw_monitor_exception */ true);
    1.50  
    1.51    // The caller's SP was adjusted upon method entry to accomodate
    1.52 @@ -2216,7 +2235,7 @@
    1.53    Label checkVolatile;
    1.54  
    1.55    // compute field type
    1.56 -  Label notByte, notInt, notShort, notChar, notLong, notFloat, notObj;
    1.57 +  Label notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj;
    1.58    __ srl(Rflags, ConstantPoolCacheEntry::tos_state_shift, Rflags);
    1.59    // Make sure we don't need to mask Rflags after the above shift
    1.60    ConstantPoolCacheEntry::verify_tos_state_shift();
    1.61 @@ -2271,7 +2290,7 @@
    1.62  
    1.63    // cmp(Rflags, btos);
    1.64    __ br(Assembler::notEqual, false, Assembler::pt, notByte);
    1.65 -  __ delayed() ->cmp(Rflags, ctos);
    1.66 +  __ delayed() ->cmp(Rflags, ztos);
    1.67  
    1.68    // btos
    1.69    __ ldsb(Rclass, Roffset, Otos_i);
    1.70 @@ -2284,6 +2303,22 @@
    1.71  
    1.72    __ bind(notByte);
    1.73  
    1.74 +  // cmp(Rflags, ztos);
    1.75 +  __ br(Assembler::notEqual, false, Assembler::pt, notBool);
    1.76 +  __ delayed() ->cmp(Rflags, ctos);
    1.77 +
    1.78 +  // ztos
    1.79 +  __ ldsb(Rclass, Roffset, Otos_i);
    1.80 +  __ push(itos);
    1.81 +  if (!is_static) {
    1.82 +    // use btos rewriting, no truncating to t/f bit is needed for getfield.
    1.83 +    patch_bytecode(Bytecodes::_fast_bgetfield, G3_scratch, G4_scratch);
    1.84 +  }
    1.85 +  __ ba(checkVolatile);
    1.86 +  __ delayed()->tst(Lscratch);
    1.87 +
    1.88 +  __ bind(notBool);
    1.89 +
    1.90    // cmp(Rflags, ctos);
    1.91    __ br(Assembler::notEqual, false, Assembler::pt, notChar);
    1.92    __ delayed() ->cmp(Rflags, stos);
    1.93 @@ -2445,6 +2480,7 @@
    1.94      switch (bytecode()) {  // save tos values before call_VM() clobbers them
    1.95      case Bytecodes::_fast_aputfield: __ push_ptr(Otos_i); break;
    1.96      case Bytecodes::_fast_bputfield: // fall through
    1.97 +    case Bytecodes::_fast_zputfield: // fall through
    1.98      case Bytecodes::_fast_sputfield: // fall through
    1.99      case Bytecodes::_fast_cputfield: // fall through
   1.100      case Bytecodes::_fast_iputfield: __ push_i(Otos_i); break;
   1.101 @@ -2462,6 +2498,7 @@
   1.102      switch (bytecode()) {             // restore tos values
   1.103      case Bytecodes::_fast_aputfield: __ pop_ptr(Otos_i); break;
   1.104      case Bytecodes::_fast_bputfield: // fall through
   1.105 +    case Bytecodes::_fast_zputfield: // fall through
   1.106      case Bytecodes::_fast_sputfield: // fall through
   1.107      case Bytecodes::_fast_cputfield: // fall through
   1.108      case Bytecodes::_fast_iputfield: __ pop_i(Otos_i); break;
   1.109 @@ -2577,7 +2614,7 @@
   1.110    ConstantPoolCacheEntry::verify_tos_state_shift();
   1.111  
   1.112    // compute field type
   1.113 -  Label notInt, notShort, notChar, notObj, notByte, notLong, notFloat;
   1.114 +  Label notInt, notShort, notChar, notObj, notByte, notBool, notLong, notFloat;
   1.115  
   1.116    if (is_static) {
   1.117      // putstatic with object type most likely, check that first
   1.118 @@ -2645,7 +2682,7 @@
   1.119  
   1.120    // cmp(Rflags, btos);
   1.121    __ br(Assembler::notEqual, false, Assembler::pt, notByte);
   1.122 -  __ delayed()->cmp(Rflags, ltos);
   1.123 +  __ delayed()->cmp(Rflags, ztos);
   1.124  
   1.125    // btos
   1.126    {
   1.127 @@ -2660,6 +2697,25 @@
   1.128    }
   1.129  
   1.130    __ bind(notByte);
   1.131 +
   1.132 +  // cmp(Rflags, btos);
   1.133 +  __ br(Assembler::notEqual, false, Assembler::pt, notBool);
   1.134 +  __ delayed()->cmp(Rflags, ltos);
   1.135 +
   1.136 +  // ztos
   1.137 +  {
   1.138 +    __ pop_i();
   1.139 +    if (!is_static) pop_and_check_object(Rclass);
   1.140 +    __ and3(Otos_i, 1, Otos_i);
   1.141 +    __ stb(Otos_i, Rclass, Roffset);
   1.142 +    if (!is_static) {
   1.143 +      patch_bytecode(Bytecodes::_fast_zputfield, G3_scratch, G4_scratch, true, byte_no);
   1.144 +    }
   1.145 +    __ ba(checkVolatile);
   1.146 +    __ delayed()->tst(Lscratch);
   1.147 +  }
   1.148 +
   1.149 +  __ bind(notBool);
   1.150    // cmp(Rflags, ltos);
   1.151    __ br(Assembler::notEqual, false, Assembler::pt, notLong);
   1.152    __ delayed()->cmp(Rflags, ctos);
   1.153 @@ -2783,6 +2839,7 @@
   1.154    pop_and_check_object(Rclass);
   1.155  
   1.156    switch (bytecode()) {
   1.157 +    case Bytecodes::_fast_zputfield: __ and3(Otos_i, 1, Otos_i);  // fall through to bputfield
   1.158      case Bytecodes::_fast_bputfield: __ stb(Otos_i, Rclass, Roffset); break;
   1.159      case Bytecodes::_fast_cputfield: /* fall through */
   1.160      case Bytecodes::_fast_sputfield: __ sth(Otos_i, Rclass, Roffset); break;

mercurial