Print this page


Split Close
Expand all
Collapse all
          --- old/src/cpu/sparc/vm/templateTable_sparc.cpp
          +++ new/src/cpu/sparc/vm/templateTable_sparc.cpp
   1    1  /*
   2      - * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
        2 + * Copyright 1997-2010 Sun Microsystems, Inc.  All Rights Reserved.
   3    3   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4    4   *
   5    5   * This code is free software; you can redistribute it and/or modify it
   6    6   * under the terms of the GNU General Public License version 2 only, as
   7    7   * published by the Free Software Foundation.
   8    8   *
   9    9   * This code is distributed in the hope that it will be useful, but WITHOUT
  10   10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11   11   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12   12   * version 2 for more details (a copy is included in the LICENSE file that
↓ open down ↓ 1943 lines elided ↑ open up ↑
1956 1956  void TemplateTable::volatile_barrier(Assembler::Membar_mask_bits order_constraint) {
1957 1957    // Helper function to insert a is-volatile test and memory barrier
1958 1958    // All current sparc implementations run in TSO, needing only StoreLoad
1959 1959    if ((order_constraint & Assembler::StoreLoad) == 0) return;
1960 1960    __ membar( order_constraint );
1961 1961  }
1962 1962  
1963 1963  // ----------------------------------------------------------------------------
1964 1964  void TemplateTable::resolve_cache_and_index(int byte_no, Register Rcache, Register index) {
1965 1965    assert(byte_no == 1 || byte_no == 2, "byte_no out of range");
     1966 +  bool is_invokedynamic = (bytecode() == Bytecodes::_invokedynamic);
     1967 +
1966 1968    // Depends on cpCacheOop layout!
1967 1969    const int shift_count = (1 + byte_no)*BitsPerByte;
1968 1970    Label resolved;
1969 1971  
1970      -  __ get_cache_and_index_at_bcp(Rcache, index, 1);
1971      -  __ ld_ptr(Rcache, constantPoolCacheOopDesc::base_offset() +
1972      -                    ConstantPoolCacheEntry::indices_offset(), Lbyte_code);
     1972 +  __ get_cache_and_index_at_bcp(Rcache, index, 1, is_invokedynamic);
     1973 +  if (is_invokedynamic) {
     1974 +    // We are resolved if the f1 field contains a non-null CallSite object.
     1975 +    __ ld_ptr(Rcache, constantPoolCacheOopDesc::base_offset() +
     1976 +              ConstantPoolCacheEntry::f1_offset(), Lbyte_code);
     1977 +    __ tst(Lbyte_code);
     1978 +    __ br(Assembler::notEqual, false, Assembler::pt, resolved);
     1979 +    __ delayed()->set((int)bytecode(), O1);
     1980 +  } else {
     1981 +    __ ld_ptr(Rcache, constantPoolCacheOopDesc::base_offset() +
     1982 +              ConstantPoolCacheEntry::indices_offset(), Lbyte_code);
1973 1983  
1974      -  __ srl(  Lbyte_code, shift_count, Lbyte_code );
1975      -  __ and3( Lbyte_code,        0xFF, Lbyte_code );
1976      -  __ cmp(  Lbyte_code, (int)bytecode());
1977      -  __ br(   Assembler::equal, false, Assembler::pt, resolved);
1978      -  __ delayed()->set((int)bytecode(), O1);
     1984 +    __ srl(  Lbyte_code, shift_count, Lbyte_code );
     1985 +    __ and3( Lbyte_code,        0xFF, Lbyte_code );
     1986 +    __ cmp(  Lbyte_code, (int)bytecode());
     1987 +    __ br(   Assembler::equal, false, Assembler::pt, resolved);
     1988 +    __ delayed()->set((int)bytecode(), O1);
     1989 +  }
1979 1990  
1980 1991    address entry;
1981 1992    switch (bytecode()) {
1982 1993      case Bytecodes::_getstatic      : // fall through
1983 1994      case Bytecodes::_putstatic      : // fall through
1984 1995      case Bytecodes::_getfield       : // fall through
1985 1996      case Bytecodes::_putfield       : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_get_put); break;
1986 1997      case Bytecodes::_invokevirtual  : // fall through
1987 1998      case Bytecodes::_invokespecial  : // fall through
1988 1999      case Bytecodes::_invokestatic   : // fall through
1989 2000      case Bytecodes::_invokeinterface: entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invoke);  break;
     2001 +    case Bytecodes::_invokedynamic  : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invokedynamic);  break;
1990 2002      default                         : ShouldNotReachHere();                                 break;
1991 2003    }
1992 2004    // first time invocation - must resolve first
1993 2005    __ call_VM(noreg, entry, O1);
1994 2006    // Update registers with resolved info
1995      -  __ get_cache_and_index_at_bcp(Rcache, index, 1);
     2007 +  __ get_cache_and_index_at_bcp(Rcache, index, 1, is_invokedynamic);
1996 2008    __ bind(resolved);
1997 2009  }
1998 2010  
1999 2011  void TemplateTable::load_invoke_cp_cache_entry(int byte_no,
2000 2012                                                 Register Rmethod,
2001 2013                                                 Register Ritable_index,
2002 2014                                                 Register Rflags,
2003 2015                                                 bool is_invokevirtual,
2004 2016                                                 bool is_invokevfinal) {
2005 2017    // Uses both G3_scratch and G4_scratch
↓ open down ↓ 1117 lines elided ↑ open up ↑
3123 3135      // We should not encounter this bytecode if !EnableInvokeDynamic.
3124 3136      // The verifier will stop it.  However, if we get past the verifier,
3125 3137      // this will stop the thread in a reasonable way, without crashing the JVM.
3126 3138      __ call_VM(noreg, CAST_FROM_FN_PTR(address,
3127 3139                       InterpreterRuntime::throw_IncompatibleClassChangeError));
3128 3140      // the call_VM checks for exception, so we should never return here.
3129 3141      __ should_not_reach_here();
3130 3142      return;
3131 3143    }
3132 3144  
3133      -  __ stop("invokedynamic NYI");//6815692//
     3145 +  // G5: CallSite object (f1)
     3146 +  // XX: unused (f2)
     3147 +  // G3: receiver address
     3148 +  // XX: flags (unused)
     3149 +
     3150 +  Register G5_callsite = G5_method;
     3151 +  Register Rscratch    = G3_scratch;
     3152 +  Register Rtemp       = G1_scratch;
     3153 +  Register Rret        = Lscratch;
     3154 +
     3155 +  load_invoke_cp_cache_entry(byte_no, G5_callsite, noreg, Rret, false);
     3156 +  __ mov(SP, O5_savedSP);  // record SP that we wanted the callee to restore
     3157 +
     3158 +  __ verify_oop(G5_callsite);
     3159 +
     3160 +  // profile this call
     3161 +  __ profile_call(O4);
     3162 +
     3163 +  // get return address
     3164 +  AddressLiteral table(Interpreter::return_5_addrs_by_index_table());
     3165 +  __ set(table, Rtemp);
     3166 +  __ srl(Rret, ConstantPoolCacheEntry::tosBits, Rret);  // get return type
     3167 +  // Make sure we don't need to mask Rret for tosBits after the above shift
     3168 +  ConstantPoolCacheEntry::verify_tosBits();
     3169 +  __ sll(Rret, LogBytesPerWord, Rret);
     3170 +  __ ld_ptr(Rtemp, Rret, Rret);  // get return address
     3171 +
     3172 +  __ ld_ptr(G5_callsite, __ delayed_value(java_dyn_CallSite::target_offset_in_bytes, Rscratch), G3_method_handle);
     3173 +  __ null_check(G3_method_handle);
     3174 +
     3175 +  // Adjust Rret first so Llast_SP can be same as Rret
     3176 +  __ add(Rret, -frame::pc_return_offset, O7);
     3177 +  __ add(Lesp, BytesPerWord, Gargs);  // setup parameter pointer
     3178 +  __ jump_to_method_handle_entry(G3_method_handle, Rtemp, /* emit_delayed_nop */ false);
     3179 +  // Record SP so we can remove any stack space allocated by adapter transition
     3180 +  __ delayed()->mov(SP, Llast_SP);
3134 3181  }
3135 3182  
3136 3183  
3137 3184  //----------------------------------------------------------------------------------------------------
3138 3185  // Allocation
3139 3186  
3140 3187  void TemplateTable::_new() {
3141 3188    transition(vtos, atos);
3142 3189  
3143 3190    Label slow_case;
↓ open down ↓ 515 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX