Ignore:
Timestamp:
Feb 13, 2012, 10:07:12 PM (14 years ago)
Author:
dmik
Message:

trunk: Merged in openjdk6 b24 from branches/vendor/oracle.

Location:
trunk/openjdk
Files:
83 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk

  • trunk/openjdk/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_assembler_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "asm/assembler.hpp"
     27#include "assembler_sparc.inline.hpp"
     28#include "gc_interface/collectedHeap.inline.hpp"
     29#include "interpreter/interpreter.hpp"
     30#include "memory/cardTableModRefBS.hpp"
     31#include "memory/resourceArea.hpp"
     32#include "prims/methodHandles.hpp"
     33#include "runtime/biasedLocking.hpp"
     34#include "runtime/interfaceSupport.hpp"
     35#include "runtime/objectMonitor.hpp"
     36#include "runtime/os.hpp"
     37#include "runtime/sharedRuntime.hpp"
     38#include "runtime/stubRoutines.hpp"
     39#ifndef SERIALGC
     40#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
     41#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
     42#include "gc_implementation/g1/heapRegion.hpp"
     43#endif
    2744
    2845// Convert the raw encoding form into the form expected by the
     
    894911    // Save & restore possible 64-bit Long arguments in G-regs
    895912    sllx(L0,32,G2);             // Move old high G1 bits high in G2
    896     sllx(G1, 0,G1);             // Clear current high G1 bits
     913    srl(G1, 0,G1);              // Clear current high G1 bits
    897914    or3 (G1,G2,G1);             // Recover 64-bit G1
    898915    sllx(L6,32,G2);             // Move old high G4 bits high in G2
    899     sllx(G4, 0,G4);             // Clear current high G4 bits
     916    srl(G4, 0,G4);              // Clear current high G4 bits
    900917    or3 (G4,G2,G4);             // Recover 64-bit G4
    901918#endif
     
    13121329
    13131330
    1314 int MacroAssembler::size_of_sethi(address a, bool worst_case) {
     1331int MacroAssembler::insts_for_sethi(address a, bool worst_case) {
    13151332#ifdef _LP64
    1316   if (worst_case) return 7;
    1317   intptr_t iaddr = (intptr_t)a;
    1318   int hi32 = (int)(iaddr >> 32);
    1319   int lo32 = (int)(iaddr);
    1320   int inst_count;
    1321   if (hi32 == 0 && lo32 >= 0)
    1322     inst_count = 1;
    1323   else if (hi32 == -1)
    1324     inst_count = 2;
     1333  if (worst_case)  return 7;
     1334  intptr_t iaddr = (intptr_t) a;
     1335  int msb32 = (int) (iaddr >> 32);
     1336  int lsb32 = (int) (iaddr);
     1337  int count;
     1338  if (msb32 == 0 && lsb32 >= 0)
     1339    count = 1;
     1340  else if (msb32 == -1)
     1341    count = 2;
    13251342  else {
    1326     inst_count = 2;
    1327     if ( hi32 & 0x3ff )
    1328       inst_count++;
    1329     if ( lo32 & 0xFFFFFC00 ) {
    1330       if( (lo32 >> 20) & 0xfff ) inst_count += 2;
    1331       if( (lo32 >> 10) & 0x3ff ) inst_count += 2;
     1343    count = 2;
     1344    if (msb32 & 0x3ff)
     1345      count++;
     1346    if (lsb32 & 0xFFFFFC00 ) {
     1347      if ((lsb32 >> 20) & 0xfff)  count += 2;
     1348      if ((lsb32 >> 10) & 0x3ff)  count += 2;
    13321349    }
    13331350  }
    1334   return BytesPerInstWord * inst_count;
     1351  return count;
    13351352#else
    1336   return BytesPerInstWord;
     1353  return 1;
    13371354#endif
    13381355}
    13391356
    1340 int MacroAssembler::worst_case_size_of_set() {
    1341   return size_of_sethi(NULL, true) + 1;
    1342 }
    1343 
    1344 
     1357int MacroAssembler::worst_case_insts_for_set() {
     1358  return insts_for_sethi(NULL, true) + 1;
     1359}
     1360
     1361
     1362// Keep in sync with MacroAssembler::insts_for_internal_set
    13451363void MacroAssembler::internal_set(const AddressLiteral& addrlit, Register d, bool ForceRelocatable) {
    13461364  intptr_t value = addrlit.value();
     
    13641382}
    13651383
     1384// Keep in sync with MacroAssembler::internal_set
     1385int MacroAssembler::insts_for_internal_set(intptr_t value) {
     1386  // can optimize
     1387  if (-4096 <= value && value <= 4095) {
     1388    return 1;
     1389  }
     1390  if (inv_hi22(hi22(value)) == value) {
     1391    return insts_for_sethi((address) value);
     1392  }
     1393  int count = insts_for_sethi((address) value);
     1394  AddressLiteral al(value);
     1395  if (al.low10() != 0) {
     1396    count++;
     1397  }
     1398  return count;
     1399}
     1400
    13661401void MacroAssembler::set(const AddressLiteral& al, Register d) {
    13671402  internal_set(al, d, false);
     
    14261461    or3 (d, tmp, d);
    14271462  }
     1463}
     1464
     1465int MacroAssembler::insts_for_set64(jlong value) {
     1466  v9_dep();
     1467
     1468  int hi = (int) (value >> 32);
     1469  int lo = (int) (value & ~0);
     1470  int count = 0;
     1471
     1472  // (Matcher::isSimpleConstant64 knows about the following optimizations.)
     1473  if (Assembler::is_simm13(lo) && value == lo) {
     1474    count++;
     1475  } else if (hi == 0) {
     1476    count++;
     1477    if (low10(lo) != 0)
     1478      count++;
     1479  }
     1480  else if (hi == -1) {
     1481    count += 2;
     1482  }
     1483  else if (lo == 0) {
     1484    if (Assembler::is_simm13(hi)) {
     1485      count++;
     1486    } else {
     1487      count++;
     1488      if (low10(hi) != 0)
     1489        count++;
     1490    }
     1491    count++;
     1492  }
     1493  else {
     1494    count += 2;
     1495    if (low10(hi) != 0)
     1496      count++;
     1497    if (low10(lo) != 0)
     1498      count++;
     1499    count += 2;
     1500  }
     1501  return count;
    14281502}
    14291503
     
    30953169                                              Register temp_reg,
    30963170                                              Label& wrong_method_type) {
    3097   if (UseCompressedOops)  unimplemented("coop");  // field accesses must decode
    30983171  assert_different_registers(mtype_reg, mh_reg, temp_reg);
    30993172  // compare method type against that of the receiver
    31003173  RegisterOrConstant mhtype_offset = delayed_value(java_dyn_MethodHandle::type_offset_in_bytes, temp_reg);
    3101   ld_ptr(mh_reg, mhtype_offset, temp_reg);
     3174  load_heap_oop(mh_reg, mhtype_offset, temp_reg);
    31023175  cmp(temp_reg, mtype_reg);
    31033176  br(Assembler::notEqual, false, Assembler::pn, wrong_method_type);
     
    31133186                                                Register temp_reg) {
    31143187  assert_different_registers(vmslots_reg, mh_reg, temp_reg);
    3115   if (UseCompressedOops)  unimplemented("coop");  // field accesses must decode
    31163188  // load mh.type.form.vmslots
    31173189  if (java_dyn_MethodHandle::vmslots_offset_in_bytes() != 0) {
    31183190    // hoist vmslots into every mh to avoid dependent load chain
    3119     ld(    Address(mh_reg,    delayed_value(java_dyn_MethodHandle::vmslots_offset_in_bytes, temp_reg)),   vmslots_reg);
     3191    ld(           Address(mh_reg,    delayed_value(java_dyn_MethodHandle::vmslots_offset_in_bytes, temp_reg)),   vmslots_reg);
    31203192  } else {
    31213193    Register temp2_reg = vmslots_reg;
    3122     ld_ptr(Address(mh_reg,    delayed_value(java_dyn_MethodHandle::type_offset_in_bytes, temp_reg)),      temp2_reg);
    3123     ld_ptr(Address(temp2_reg, delayed_value(java_dyn_MethodType::form_offset_in_bytes, temp_reg)),        temp2_reg);
    3124     ld(    Address(temp2_reg, delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, temp_reg)), vmslots_reg);
     3194    load_heap_oop(Address(mh_reg,    delayed_value(java_dyn_MethodHandle::type_offset_in_bytes, temp_reg)),      temp2_reg);
     3195    load_heap_oop(Address(temp2_reg, delayed_value(java_dyn_MethodType::form_offset_in_bytes, temp_reg)),        temp2_reg);
     3196    ld(           Address(temp2_reg, delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, temp_reg)), vmslots_reg);
    31253197  }
    31263198}
     
    31313203  assert_different_registers(mh_reg, temp_reg);
    31323204
    3133   if (UseCompressedOops)  unimplemented("coop");  // field accesses must decode
    3134 
    31353205  // pick out the interpreted side of the handler
     3206  // NOTE: vmentry is not an oop!
    31363207  ld_ptr(mh_reg, delayed_value(java_dyn_MethodHandle::vmentry_offset_in_bytes, temp_reg), temp_reg);
    31373208
     
    40324103  verify_oop(top);
    40334104
     4105  ld_ptr(G2_thread, in_bytes(JavaThread::tlab_start_offset()), t1);
     4106  sub(top, t1, t1); // size of tlab's allocated portion
     4107  incr_allocated_bytes(t1, t2, t3);
     4108
    40344109  // refill the tlab with an eden allocation
    40354110  bind(do_refill);
    40364111  ld_ptr(G2_thread, in_bytes(JavaThread::tlab_size_offset()), t1);
    40374112  sll_ptr(t1, LogHeapWordSize, t1);
    4038   // add object_size ??
     4113  // allocate new tlab, address returned in top
    40394114  eden_allocate(top, t1, 0, t2, t3, slow_case);
    40404115
     
    40624137  br(Assembler::always, false, Assembler::pt, retry);
    40634138  delayed()->nop();
     4139}
     4140
     4141void MacroAssembler::incr_allocated_bytes(RegisterOrConstant size_in_bytes,
     4142                                          Register t1, Register t2) {
     4143  // Bump total bytes allocated by this thread
     4144  assert(t1->is_global(), "must be global reg"); // so all 64 bits are saved on a context switch
     4145  assert_different_registers(size_in_bytes.register_or_noreg(), t1, t2);
     4146  // v8 support has gone the way of the dodo
     4147  ldx(G2_thread, in_bytes(JavaThread::allocated_bytes_offset()), t1);
     4148  add(t1, ensure_simm13_or_reg(size_in_bytes, t2), t1);
     4149  stx(t1, G2_thread, in_bytes(JavaThread::allocated_bytes_offset()));
    40644150}
    40654151
     
    41934279static void generate_satb_log_enqueue(bool with_frame) {
    41944280  BufferBlob* bb = BufferBlob::create("enqueue_with_frame", EnqueueCodeSize);
    4195   CodeBuffer buf(bb->instructions_begin(), bb->instructions_size());
     4281  CodeBuffer buf(bb);
    41964282  MacroAssembler masm(&buf);
    41974283  address start = masm.pc();
     
    44224508static void generate_dirty_card_log_enqueue(jbyte* byte_map_base) {
    44234509  BufferBlob* bb = BufferBlob::create("dirty_card_enqueue", EnqueueCodeSize*2);
    4424   CodeBuffer buf(bb->instructions_begin(), bb->instructions_size());
     4510  CodeBuffer buf(bb);
    44254511  MacroAssembler masm(&buf);
    44264512  address start = masm.pc();
     
    46544740}
    46554741
     4742void MacroAssembler::load_heap_oop(Register s1, RegisterOrConstant s2, Register d) {
     4743  if (s2.is_constant())  load_heap_oop(s1, s2.as_constant(), d);
     4744  else                   load_heap_oop(s1, s2.as_register(), d);
     4745}
     4746
    46564747void MacroAssembler::store_heap_oop(Register d, Register s1, Register s2) {
    46574748  if (UseCompressedOops) {
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_ASSEMBLER_SPARC_HPP
     26#define CPU_SPARC_VM_ASSEMBLER_SPARC_HPP
    2427
    2528class BiasedLockingCounters;
     
    821824
    822825  // test if x is within signed immediate range for nbits
    823   static bool is_simm(int x, int nbits) { return -( 1 << nbits-1 )  <= x   &&   x  <  ( 1 << nbits-1 ); }
     826  static bool is_simm(intptr_t x, int nbits) { return -( intptr_t(1) << nbits-1 )  <= x   &&   x  <  ( intptr_t(1) << nbits-1 ); }
    824827
    825828  // test if -4096 <= x <= 4095
    826   static bool is_simm13(int x) { return is_simm(x, 13); }
     829  static bool is_simm13(intptr_t x) { return is_simm(x, 13); }
     830
     831  static bool is_in_wdisp_range(address a, address b, int nbits) {
     832    intptr_t d = intptr_t(b) - intptr_t(a);
     833    return is_simm(d, nbits + 2);
     834  }
     835
     836  // test if label is in simm16 range in words (wdisp16).
     837  bool is_in_wdisp16_range(Label& L) {
     838    return is_in_wdisp_range(target(L), pc(), 16);
     839  }
     840  // test if the distance between two addresses fits in simm30 range in words
     841  static bool is_in_wdisp30_range(address a, address b) {
     842    return is_in_wdisp_range(a, b, 30);
     843  }
    827844
    828845  enum ASIs { // page 72, v9
     
    11211138  inline void add(Register s1, int simm13a, Register d, RelocationHolder const& rspec);
    11221139  inline void add(Register s1, RegisterOrConstant s2, Register d, int offset = 0);
    1123   inline void add(const Address& a, Register d, int offset = 0) { add( a.base(), a.disp() + offset, d, a.rspec(offset)); }
     1140  inline void add(const Address& a, Register d, int offset = 0);
    11241141
    11251142  void addcc(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
     
    16131630  void sub(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3              ) | rs1(s1) | rs2(s2) ); }
    16141631  void sub(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
     1632
     1633  // Note: offset is added to s2.
     1634  inline void sub(Register s1, RegisterOrConstant s2, Register d, int offset = 0);
     1635
    16151636  void subcc(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3 | cc_bit_op3 ) | rs1(s1) | rs2(s2) ); }
    16161637  void subcc(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3 | cc_bit_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
     
    17901811  inline void br( Condition c, bool a, Predict p, address d, relocInfo::relocType rt = relocInfo::none );
    17911812  inline void br( Condition c, bool a, Predict p, Label& L );
     1813
    17921814  inline void fb( Condition c, bool a, Predict p, address d, relocInfo::relocType rt = relocInfo::none );
    17931815  inline void fb( Condition c, bool a, Predict p, Label& L );
     
    18301852  inline void jmp( Register s1, int simm13a, RelocationHolder const& rspec = RelocationHolder() );
    18311853
     1854  // Check if the call target is out of wdisp30 range (relative to the code cache)
     1855  static inline bool is_far_target(address d);
    18321856  inline void call( address d,  relocInfo::relocType rt = relocInfo::runtime_call_type );
    18331857  inline void call( Label& L,   relocInfo::relocType rt = relocInfo::runtime_call_type );
     
    18711895  void patchable_sethi(const AddressLiteral& addrlit, Register d);
    18721896
    1873   // compute the size of a sethi/set
    1874   static int  size_of_sethi( address a, bool worst_case = false );
    1875   static int  worst_case_size_of_set();
     1897  // compute the number of instructions for a sethi/set
     1898  static int  insts_for_sethi( address a, bool worst_case = false );
     1899  static int  worst_case_insts_for_set();
    18761900
    18771901  // set may be either setsw or setuw (high 32 bits may be zero or sign)
    18781902private:
    18791903  void internal_set(const AddressLiteral& al, Register d, bool ForceRelocatable);
     1904  static int insts_for_internal_set(intptr_t value);
    18801905public:
    18811906  void set(const AddressLiteral& addrlit, Register d);
    18821907  void set(intptr_t value, Register d);
    18831908  void set(address addr, Register d, RelocationHolder const& rspec);
     1909  static int insts_for_set(intptr_t value) { return insts_for_internal_set(value); }
     1910
    18841911  void patchable_set(const AddressLiteral& addrlit, Register d);
    18851912  void patchable_set(intptr_t value, Register d);
    18861913  void set64(jlong value, Register d, Register tmp);
     1914  static int insts_for_set64(jlong value);
    18871915
    18881916  // sign-extend 32 to 64
     
    21042132  void load_heap_oop(Register s1, Register s2, Register d);
    21052133  void load_heap_oop(Register s1, int simm13a, Register d);
     2134  void load_heap_oop(Register s1, RegisterOrConstant s2, Register d);
    21062135  void store_heap_oop(Register d, Register s1, Register s2);
    21072136  void store_heap_oop(Register d, Register s1, int simm13a);
     
    22262255  void warn(const char* msg);                          // prints msg, but don't stop
    22272256  void untested(const char* what = "");
    2228   void unimplemented(const char* what = "")              { char* b = new char[1024];  sprintf(b, "unimplemented: %s", what);  stop(b); }
     2257  void unimplemented(const char* what = "")      { char* b = new char[1024];  jio_snprintf(b, 1024, "unimplemented: %s", what);  stop(b); }
    22292258  void should_not_reach_here()                   { stop("should not reach here"); }
    22302259  void print_CPU_state();
     
    23712400  );
    23722401  void tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case);
     2402  void incr_allocated_bytes(RegisterOrConstant size_in_bytes,
     2403                            Register t1, Register t2);
    23732404
    23742405  // interface method calling
     
    24942525inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
    24952526#endif
     2527
     2528#endif // CPU_SPARC_VM_ASSEMBLER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_ASSEMBLER_SPARC_INLINE_HPP
     26#define CPU_SPARC_VM_ASSEMBLER_SPARC_INLINE_HPP
     27
     28#include "asm/assembler.inline.hpp"
     29#include "asm/codeBuffer.hpp"
     30#include "code/codeCache.hpp"
     31#include "runtime/handles.inline.hpp"
     32
    2533inline void MacroAssembler::pd_patch_instruction(address branch, address target) {
    2634  jint& stub_inst = *(jint*) branch;
     
    207215
    208216// form effective addresses this way:
     217inline void Assembler::add(const Address& a, Register d, int offset) {
     218  if (a.has_index())   add(a.base(), a.index(),         d);
     219  else               { add(a.base(), a.disp() + offset, d, a.rspec(offset)); offset = 0; }
     220  if (offset != 0)     add(d,        offset,            d);
     221}
    209222inline void Assembler::add(Register s1, RegisterOrConstant s2, Register d, int offset) {
    210223  if (s2.is_register())  add(s1, s2.as_register(),          d);
     
    316329inline void Assembler::stdcq(  int crd, Register s1, int simm13a) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(stdcq_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
    317330
     331inline void Assembler::sub(Register s1, RegisterOrConstant s2, Register d, int offset) {
     332  if (s2.is_register())  sub(s1, s2.as_register(),          d);
     333  else                 { sub(s1, s2.as_constant() + offset, d); offset = 0; }
     334  if (offset != 0)       sub(d,  offset,                    d);
     335}
    318336
    319337// pp 231
     
    571589inline void MacroAssembler::jmp( Register s1, int simm13a, RelocationHolder const& rspec ) { jmpl( s1, simm13a, G0, rspec); }
    572590
     591inline bool MacroAssembler::is_far_target(address d) {
     592  return !is_in_wdisp30_range(d, CodeCache::low_bound()) || !is_in_wdisp30_range(d, CodeCache::high_bound());
     593}
     594
    573595// Call with a check to see if we need to deal with the added
    574596// expense of relocation and if we overflow the displacement
    575 // of the quick call instruction./
    576 // Check to see if we have to deal with relocations
     597// of the quick call instruction.
    577598inline void MacroAssembler::call( address d, relocInfo::relocType rt ) {
    578599#ifdef _LP64
     
    586607  // Is this address within range of the call instruction?
    587608  // If not, use the expensive instruction sequence
    588   disp = (intptr_t)d - (intptr_t)pc();
    589   if ( disp != (intptr_t)(int32_t)disp ) {
     609  if (is_far_target(d)) {
    590610    relocate(rt);
    591611    AddressLiteral dest(d);
    592612    jumpl_to(dest, O7, O7);
    593   }
    594   else {
    595     Assembler::call( d, rt );
     613  } else {
     614    Assembler::call(d, rt);
    596615  }
    597616#else
     
    818837  }
    819838}
     839
     840#endif // CPU_SPARC_VM_ASSEMBLER_SPARC_INLINE_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#include "precompiled.hpp"
     26#include "asm/assembler.hpp"
     27#include "interp_masm_sparc.hpp"
     28#include "interpreter/bytecodeInterpreter.hpp"
     29#include "interpreter/bytecodeInterpreter.inline.hpp"
     30#include "interpreter/interpreter.hpp"
     31#include "interpreter/interpreterRuntime.hpp"
     32#include "oops/methodDataOop.hpp"
     33#include "oops/methodOop.hpp"
     34#include "oops/oop.inline.hpp"
     35#include "prims/jvmtiExport.hpp"
     36#include "prims/jvmtiThreadState.hpp"
     37#include "runtime/deoptimization.hpp"
     38#include "runtime/frame.inline.hpp"
     39#include "runtime/sharedRuntime.hpp"
     40#include "runtime/stubRoutines.hpp"
     41#include "runtime/synchronizer.hpp"
     42#include "runtime/vframeArray.hpp"
     43#include "utilities/debug.hpp"
     44
    2545// KILL THIS FILE
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_HPP
     26#define CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_HPP
    2427
    2528// Platform specific for C++ based Interpreter
     
    98101#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
    99102                                                ((VMJavaVal64*)(addr))->l)
     103
     104#endif // CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_INLINE_HPP
     26#define CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_INLINE_HPP
    2427
    2528// Inline interpreter functions for sparc
     
    332335};
    333336#endif /* ALIGN_CONVERTER */
     337
     338#endif // CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_INLINE_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/bytecodes_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_bytecodes_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "interpreter/bytecodes.hpp"
    2727
    2828
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/bytecodes_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_BYTECODES_SPARC_HPP
     26#define CPU_SPARC_VM_BYTECODES_SPARC_HPP
     27
    2528#ifdef SPARC
    2629#define NLOCALS_IN_REGS 6
     
    3134
    3235// (none)
     36
     37#endif // CPU_SPARC_VM_BYTECODES_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/bytes_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_BYTES_SPARC_HPP
     26#define CPU_SPARC_VM_BYTES_SPARC_HPP
     27
     28#include "memory/allocation.hpp"
    2429
    2530class Bytes: AllStatic {
     
    156161// 1.17 99/06/22 16:37:35 bytes_i486.hpp
    157162//End
     163
     164#endif // CPU_SPARC_VM_BYTES_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp

    r278 r309  
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_c1_CodeStubs_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "c1/c1_CodeStubs.hpp"
     27#include "c1/c1_FrameMap.hpp"
     28#include "c1/c1_LIRAssembler.hpp"
     29#include "c1/c1_MacroAssembler.hpp"
     30#include "c1/c1_Runtime1.hpp"
     31#include "nativeInst_sparc.hpp"
     32#include "runtime/sharedRuntime.hpp"
     33#include "vmreg_sparc.inline.hpp"
     34#ifndef SERIALGC
     35#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
     36#endif
    2737
    2838#define __ ce->masm()->
     
    3343  , _index(index)
    3444{
     45  assert(info != NULL, "must have info");
    3546  _info = new CodeEmitInfo(info);
    3647}
     
    5869}
    5970
    60 #ifdef TIERED
    6171
    6272void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
     
    6474  __ set(_bci, G4);
    6575  __ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type);
    66   __ delayed()->nop();
     76  __ delayed()->mov_or_nop(_method->as_register(), G5);
    6777  ce->add_call_info_here(_info);
    6878  ce->verify_oop_map(_info);
     
    7282}
    7383
    74 #endif // TIERED
    7584
    7685void DivByZeroStub::emit_code(LIR_Assembler* ce) {
     
    426435  Register pre_val_reg = pre_val()->as_register();
    427436
    428   ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false);
    429   __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
    430                     pre_val_reg, _continuation);
     437  ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
     438  if (__ is_in_wdisp16_range(_continuation)) {
     439    __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
     440                      pre_val_reg, _continuation);
     441  } else {
     442    __ cmp(pre_val_reg, G0);
     443    __ brx(Assembler::equal, false, Assembler::pn, _continuation);
     444  }
    431445  __ delayed()->nop();
    432446
     
    454468  Register addr_reg = addr()->as_pointer_register();
    455469  Register new_val_reg = new_val()->as_register();
    456   __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
    457                     new_val_reg, _continuation);
     470  if (__ is_in_wdisp16_range(_continuation)) {
     471    __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
     472                      new_val_reg, _continuation);
     473  } else {
     474    __ cmp(new_val_reg, G0);
     475    __ brx(Assembler::equal, false, Assembler::pn, _continuation);
     476  }
    458477  __ delayed()->nop();
    459478
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_Defs_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_C1_DEFS_SPARC_HPP
     26#define CPU_SPARC_VM_C1_DEFS_SPARC_HPP
    2427
    2528// native word offsets from memory address (big endian)
     
    6669  pd_float_saved_as_double = false
    6770};
     71
     72#endif // CPU_SPARC_VM_C1_DEFS_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_FpuStackSim_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#include "precompiled.hpp"
     26#include "c1/c1_FpuStackSim.hpp"
     27#include "c1/c1_FrameMap.hpp"
     28#include "utilities/array.hpp"
     29#include "utilities/ostream.hpp"
     30
    2531// No FPU stack on SPARC
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_FpuStackSim_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_C1_FPUSTACKSIM_SPARC_HPP
     26#define CPU_SPARC_VM_C1_FPUSTACKSIM_SPARC_HPP
     27
    2528// No FPU stack on SPARC
    2629class FpuStackSim;
     30
     31#endif // CPU_SPARC_VM_C1_FPUSTACKSIM_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp

    r278 r309  
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_c1_FrameMap_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "c1/c1_FrameMap.hpp"
     27#include "c1/c1_LIR.hpp"
     28#include "runtime/sharedRuntime.hpp"
     29#include "vmreg_sparc.inline.hpp"
    2730
    2831
     
    7477LIR_Opr FrameMap::in_long_opr;
    7578LIR_Opr FrameMap::out_long_opr;
     79LIR_Opr FrameMap::g1_long_single_opr;
    7680
    7781LIR_Opr FrameMap::F0_opr;
     
    239243  in_long_opr    = as_long_opr(I0);
    240244  out_long_opr   = as_long_opr(O0);
     245  g1_long_single_opr    = as_long_single_opr(G1);
    241246
    242247  G0_opr = as_opr(G0);
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp

    r278 r309  
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_C1_FRAMEMAP_SPARC_HPP
     26#define CPU_SPARC_VM_C1_FRAMEMAP_SPARC_HPP
    2427
    2528 public:
     
    104107  static LIR_Opr in_long_opr;
    105108  static LIR_Opr out_long_opr;
     109  static LIR_Opr g1_long_single_opr;
    106110
    107111  static LIR_Opr F0_opr;
     
    114118  static FloatRegister  _fpu_regs [nof_fpu_regs];
    115119
     120  static LIR_Opr as_long_single_opr(Register r) {
     121    return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r));
     122  }
     123  static LIR_Opr as_long_pair_opr(Register r) {
     124    return LIR_OprFact::double_cpu(cpu_reg2rnr(r->successor()), cpu_reg2rnr(r));
     125  }
     126
    116127 public:
    117128
    118129#ifdef _LP64
    119130  static LIR_Opr as_long_opr(Register r) {
    120     return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r));
     131    return as_long_single_opr(r);
    121132  }
    122133  static LIR_Opr as_pointer_opr(Register r) {
    123     return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r));
     134    return as_long_single_opr(r);
    124135  }
    125136#else
    126137  static LIR_Opr as_long_opr(Register r) {
    127     return LIR_OprFact::double_cpu(cpu_reg2rnr(r->successor()), cpu_reg2rnr(r));
     138    return as_long_pair_opr(r);
    128139  }
    129140  static LIR_Opr as_pointer_opr(Register r) {
     
    144155  static bool is_caller_save_register (LIR_Opr  reg);
    145156  static bool is_caller_save_register (Register r);
     157
     158  static int nof_caller_save_cpu_regs() { return pd_nof_caller_save_cpu_regs_frame_map; }
     159  static int last_cpu_reg()             { return pd_last_cpu_reg;  }
     160
     161#endif // CPU_SPARC_VM_C1_FRAMEMAP_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_c1_LIRAssembler_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "c1/c1_Compilation.hpp"
     27#include "c1/c1_LIRAssembler.hpp"
     28#include "c1/c1_MacroAssembler.hpp"
     29#include "c1/c1_Runtime1.hpp"
     30#include "c1/c1_ValueStack.hpp"
     31#include "ci/ciArrayKlass.hpp"
     32#include "ci/ciInstance.hpp"
     33#include "gc_interface/collectedHeap.hpp"
     34#include "memory/barrierSet.hpp"
     35#include "memory/cardTableModRefBS.hpp"
     36#include "nativeInst_sparc.hpp"
     37#include "oops/objArrayKlass.hpp"
     38#include "runtime/sharedRuntime.hpp"
    2739
    2840#define __ _masm->
     
    8799          ((src->is_double_fpu() || dst->is_double_fpu()) && op1->move_kind() != lir_move_normal)) {
    88100        return false;
     101      }
     102
     103      if (UseCompressedOops) {
     104        if (dst->is_address() && !dst->is_stack() && (dst->type() == T_OBJECT || dst->type() == T_ARRAY)) return false;
     105        if (src->is_address() && !src->is_stack() && (src->type() == T_OBJECT || src->type() == T_ARRAY)) return false;
    89106      }
    90107
     
    242259    int  count_offset = java_lang_String:: count_offset_in_bytes();
    243260
    244     __ ld_ptr(str0, value_offset, tmp0);
     261    __ load_heap_oop(str0, value_offset, tmp0);
    245262    __ ld(str0, offset_offset, tmp2);
    246263    __ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0);
     
    251268    add_debug_info_for_null_check_here(info);
    252269
    253     __ ld_ptr(str1, value_offset, tmp1);
     270    __ load_heap_oop(str1, value_offset, tmp1);
    254271    __ add(tmp0, tmp2, tmp0);
    255272
     
    755772void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) {
    756773  add_debug_info_for_null_check_here(op->info());
    757   __ ld_ptr(O0, oopDesc::klass_offset_in_bytes(), G3_scratch);
     774  __ load_klass(O0, G3_scratch);
    758775  if (__ is_simm13(op->vtable_offset())) {
    759776    __ ld_ptr(G3_scratch, op->vtable_offset(), G5_method);
     
    769786}
    770787
    771 
    772 // load with 32-bit displacement
    773 int LIR_Assembler::load(Register s, int disp, Register d, BasicType ld_type, CodeEmitInfo *info) {
    774   int load_offset = code_offset();
    775   if (Assembler::is_simm13(disp)) {
    776     if (info != NULL) add_debug_info_for_null_check_here(info);
    777     switch(ld_type) {
    778       case T_BOOLEAN: // fall through
    779       case T_BYTE  : __ ldsb(s, disp, d); break;
    780       case T_CHAR  : __ lduh(s, disp, d); break;
    781       case T_SHORT : __ ldsh(s, disp, d); break;
    782       case T_INT   : __ ld(s, disp, d); break;
    783       case T_ADDRESS:// fall through
    784       case T_ARRAY : // fall through
    785       case T_OBJECT: __ ld_ptr(s, disp, d); break;
    786       default      : ShouldNotReachHere();
    787     }
    788   } else {
    789     __ set(disp, O7);
    790     if (info != NULL) add_debug_info_for_null_check_here(info);
    791     load_offset = code_offset();
    792     switch(ld_type) {
    793       case T_BOOLEAN: // fall through
    794       case T_BYTE  : __ ldsb(s, O7, d); break;
    795       case T_CHAR  : __ lduh(s, O7, d); break;
    796       case T_SHORT : __ ldsh(s, O7, d); break;
    797       case T_INT   : __ ld(s, O7, d); break;
    798       case T_ADDRESS:// fall through
    799       case T_ARRAY : // fall through
    800       case T_OBJECT: __ ld_ptr(s, O7, d); break;
    801       default      : ShouldNotReachHere();
    802     }
    803   }
    804   if (ld_type == T_ARRAY || ld_type == T_OBJECT) __ verify_oop(d);
    805   return load_offset;
    806 }
    807 
    808 
    809 // store with 32-bit displacement
    810 void LIR_Assembler::store(Register value, Register base, int offset, BasicType type, CodeEmitInfo *info) {
    811   if (Assembler::is_simm13(offset)) {
    812     if (info != NULL)  add_debug_info_for_null_check_here(info);
    813     switch (type) {
    814       case T_BOOLEAN: // fall through
    815       case T_BYTE  : __ stb(value, base, offset); break;
    816       case T_CHAR  : __ sth(value, base, offset); break;
    817       case T_SHORT : __ sth(value, base, offset); break;
    818       case T_INT   : __ stw(value, base, offset); break;
    819       case T_ADDRESS:// fall through
    820       case T_ARRAY : // fall through
    821       case T_OBJECT: __ st_ptr(value, base, offset); break;
    822       default      : ShouldNotReachHere();
    823     }
    824   } else {
    825     __ set(offset, O7);
    826     if (info != NULL) add_debug_info_for_null_check_here(info);
    827     switch (type) {
    828       case T_BOOLEAN: // fall through
    829       case T_BYTE  : __ stb(value, base, O7); break;
    830       case T_CHAR  : __ sth(value, base, O7); break;
    831       case T_SHORT : __ sth(value, base, O7); break;
    832       case T_INT   : __ stw(value, base, O7); break;
    833       case T_ADDRESS:// fall through
    834       case T_ARRAY : //fall through
    835       case T_OBJECT: __ st_ptr(value, base, O7); break;
    836       default      : ShouldNotReachHere();
    837     }
    838   }
    839   // Note: Do the store before verification as the code might be patched!
    840   if (type == T_ARRAY || type == T_OBJECT) __ verify_oop(value);
    841 }
    842 
    843 
    844 // load float with 32-bit displacement
    845 void LIR_Assembler::load(Register s, int disp, FloatRegister d, BasicType ld_type, CodeEmitInfo *info) {
    846   FloatRegisterImpl::Width w;
    847   switch(ld_type) {
    848     case T_FLOAT : w = FloatRegisterImpl::S; break;
    849     case T_DOUBLE: w = FloatRegisterImpl::D; break;
    850     default      : ShouldNotReachHere();
    851   }
    852 
    853   if (Assembler::is_simm13(disp)) {
    854     if (info != NULL) add_debug_info_for_null_check_here(info);
    855     if (disp % BytesPerLong != 0 && w == FloatRegisterImpl::D) {
    856       __ ldf(FloatRegisterImpl::S, s, disp + BytesPerWord, d->successor());
    857       __ ldf(FloatRegisterImpl::S, s, disp               , d);
    858     } else {
    859       __ ldf(w, s, disp, d);
    860     }
    861   } else {
    862     __ set(disp, O7);
    863     if (info != NULL) add_debug_info_for_null_check_here(info);
    864     __ ldf(w, s, O7, d);
    865   }
    866 }
    867 
    868 
    869 // store float with 32-bit displacement
    870 void LIR_Assembler::store(FloatRegister value, Register base, int offset, BasicType type, CodeEmitInfo *info) {
    871   FloatRegisterImpl::Width w;
    872   switch(type) {
    873     case T_FLOAT : w = FloatRegisterImpl::S; break;
    874     case T_DOUBLE: w = FloatRegisterImpl::D; break;
    875     default      : ShouldNotReachHere();
    876   }
    877 
    878   if (Assembler::is_simm13(offset)) {
    879     if (info != NULL) add_debug_info_for_null_check_here(info);
    880     if (w == FloatRegisterImpl::D && offset % BytesPerLong != 0) {
    881       __ stf(FloatRegisterImpl::S, value->successor(), base, offset + BytesPerWord);
    882       __ stf(FloatRegisterImpl::S, value             , base, offset);
    883     } else {
    884       __ stf(w, value, base, offset);
    885     }
    886   } else {
    887     __ set(offset, O7);
    888     if (info != NULL) add_debug_info_for_null_check_here(info);
    889     __ stf(w, value, O7, base);
    890   }
    891 }
    892 
    893 
    894 int LIR_Assembler::store(LIR_Opr from_reg, Register base, int offset, BasicType type, bool unaligned) {
     788int LIR_Assembler::store(LIR_Opr from_reg, Register base, int offset, BasicType type, bool wide, bool unaligned) {
    895789  int store_offset;
    896790  if (!Assembler::is_simm13(offset + (type == T_LONG) ? wordSize : 0)) {
     
    898792    // for offsets larger than a simm13 we setup the offset in O7
    899793    __ set(offset, O7);
    900     store_offset = store(from_reg, base, O7, type);
    901   } else {
    902     if (type == T_ARRAY || type == T_OBJECT) __ verify_oop(from_reg->as_register());
     794    store_offset = store(from_reg, base, O7, type, wide);
     795  } else {
     796    if (type == T_ARRAY || type == T_OBJECT) {
     797      __ verify_oop(from_reg->as_register());
     798    }
    903799    store_offset = code_offset();
    904800    switch (type) {
     
    923819#endif
    924820        break;
    925       case T_ADDRESS:// fall through
     821      case T_ADDRESS:
     822        __ st_ptr(from_reg->as_register(), base, offset);
     823        break;
    926824      case T_ARRAY : // fall through
    927       case T_OBJECT: __ st_ptr(from_reg->as_register(), base, offset); break;
     825      case T_OBJECT:
     826        {
     827          if (UseCompressedOops && !wide) {
     828            __ encode_heap_oop(from_reg->as_register(), G3_scratch);
     829            store_offset = code_offset();
     830            __ stw(G3_scratch, base, offset);
     831          } else {
     832            __ st_ptr(from_reg->as_register(), base, offset);
     833          }
     834          break;
     835        }
     836
    928837      case T_FLOAT : __ stf(FloatRegisterImpl::S, from_reg->as_float_reg(), base, offset); break;
    929838      case T_DOUBLE:
     
    947856
    948857
    949 int LIR_Assembler::store(LIR_Opr from_reg, Register base, Register disp, BasicType type) {
    950   if (type == T_ARRAY || type == T_OBJECT) __ verify_oop(from_reg->as_register());
     858int LIR_Assembler::store(LIR_Opr from_reg, Register base, Register disp, BasicType type, bool wide) {
     859  if (type == T_ARRAY || type == T_OBJECT) {
     860    __ verify_oop(from_reg->as_register());
     861  }
    951862  int store_offset = code_offset();
    952863  switch (type) {
     
    964875#endif
    965876      break;
    966     case T_ADDRESS:// fall through
     877    case T_ADDRESS:
     878      __ st_ptr(from_reg->as_register(), base, disp);
     879      break;
    967880    case T_ARRAY : // fall through
    968     case T_OBJECT: __ st_ptr(from_reg->as_register(), base, disp); break;
     881    case T_OBJECT:
     882      {
     883        if (UseCompressedOops && !wide) {
     884          __ encode_heap_oop(from_reg->as_register(), G3_scratch);
     885          store_offset = code_offset();
     886          __ stw(G3_scratch, base, disp);
     887        } else {
     888          __ st_ptr(from_reg->as_register(), base, disp);
     889        }
     890        break;
     891      }
    969892    case T_FLOAT : __ stf(FloatRegisterImpl::S, from_reg->as_float_reg(), base, disp); break;
    970893    case T_DOUBLE: __ stf(FloatRegisterImpl::D, from_reg->as_double_reg(), base, disp); break;
     
    975898
    976899
    977 int LIR_Assembler::load(Register base, int offset, LIR_Opr to_reg, BasicType type, bool unaligned) {
     900int LIR_Assembler::load(Register base, int offset, LIR_Opr to_reg, BasicType type, bool wide, bool unaligned) {
    978901  int load_offset;
    979902  if (!Assembler::is_simm13(offset + (type == T_LONG) ? wordSize : 0)) {
     
    982905    // for offsets larger than a simm13 we setup the offset in O7
    983906    __ set(offset, O7);
    984     load_offset = load(base, O7, to_reg, type);
     907    load_offset = load(base, O7, to_reg, type, wide);
    985908  } else {
    986909    load_offset = code_offset();
     
    1019942        }
    1020943        break;
    1021       case T_ADDRESS:// fall through
     944      case T_ADDRESS:  __ ld_ptr(base, offset, to_reg->as_register()); break;
    1022945      case T_ARRAY : // fall through
    1023       case T_OBJECT: __ ld_ptr(base, offset, to_reg->as_register()); break;
     946      case T_OBJECT:
     947        {
     948          if (UseCompressedOops && !wide) {
     949            __ lduw(base, offset, to_reg->as_register());
     950            __ decode_heap_oop(to_reg->as_register());
     951          } else {
     952            __ ld_ptr(base, offset, to_reg->as_register());
     953          }
     954          break;
     955        }
    1024956      case T_FLOAT:  __ ldf(FloatRegisterImpl::S, base, offset, to_reg->as_float_reg()); break;
    1025957      case T_DOUBLE:
     
    1037969      default      : ShouldNotReachHere();
    1038970    }
    1039     if (type == T_ARRAY || type == T_OBJECT) __ verify_oop(to_reg->as_register());
     971    if (type == T_ARRAY || type == T_OBJECT) {
     972      __ verify_oop(to_reg->as_register());
     973    }
    1040974  }
    1041975  return load_offset;
     
    1043977
    1044978
    1045 int LIR_Assembler::load(Register base, Register disp, LIR_Opr to_reg, BasicType type) {
     979int LIR_Assembler::load(Register base, Register disp, LIR_Opr to_reg, BasicType type, bool wide) {
    1046980  int load_offset = code_offset();
    1047981  switch(type) {
    1048982    case T_BOOLEAN: // fall through
    1049     case T_BYTE  : __ ldsb(base, disp, to_reg->as_register()); break;
    1050     case T_CHAR  : __ lduh(base, disp, to_reg->as_register()); break;
    1051     case T_SHORT : __ ldsh(base, disp, to_reg->as_register()); break;
    1052     case T_INT   : __ ld(base, disp, to_reg->as_register()); break;
    1053     case T_ADDRESS:// fall through
     983    case T_BYTE  :  __ ldsb(base, disp, to_reg->as_register()); break;
     984    case T_CHAR  :  __ lduh(base, disp, to_reg->as_register()); break;
     985    case T_SHORT :  __ ldsh(base, disp, to_reg->as_register()); break;
     986    case T_INT   :  __ ld(base, disp, to_reg->as_register()); break;
     987    case T_ADDRESS: __ ld_ptr(base, disp, to_reg->as_register()); break;
    1054988    case T_ARRAY : // fall through
    1055     case T_OBJECT: __ ld_ptr(base, disp, to_reg->as_register()); break;
     989    case T_OBJECT:
     990      {
     991          if (UseCompressedOops && !wide) {
     992            __ lduw(base, disp, to_reg->as_register());
     993            __ decode_heap_oop(to_reg->as_register());
     994          } else {
     995            __ ld_ptr(base, disp, to_reg->as_register());
     996          }
     997          break;
     998      }
    1056999    case T_FLOAT:  __ ldf(FloatRegisterImpl::S, base, disp, to_reg->as_float_reg()); break;
    10571000    case T_DOUBLE: __ ldf(FloatRegisterImpl::D, base, disp, to_reg->as_double_reg()); break;
     
    10671010    default      : ShouldNotReachHere();
    10681011  }
    1069   if (type == T_ARRAY || type == T_OBJECT) __ verify_oop(to_reg->as_register());
     1012  if (type == T_ARRAY || type == T_OBJECT) {
     1013    __ verify_oop(to_reg->as_register());
     1014  }
    10701015  return load_offset;
    10711016}
    1072 
    1073 
    1074 // load/store with an Address
    1075 void LIR_Assembler::load(const Address& a, Register d,  BasicType ld_type, CodeEmitInfo *info, int offset) {
    1076   load(a.base(), a.disp() + offset, d, ld_type, info);
    1077 }
    1078 
    1079 
    1080 void LIR_Assembler::store(Register value, const Address& dest, BasicType type, CodeEmitInfo *info, int offset) {
    1081   store(value, dest.base(), dest.disp() + offset, type, info);
    1082 }
    1083 
    1084 
    1085 // loadf/storef with an Address
    1086 void LIR_Assembler::load(const Address& a, FloatRegister d, BasicType ld_type, CodeEmitInfo *info, int offset) {
    1087   load(a.base(), a.disp() + offset, d, ld_type, info);
    1088 }
    1089 
    1090 
    1091 void LIR_Assembler::store(FloatRegister value, const Address& dest, BasicType type, CodeEmitInfo *info, int offset) {
    1092   store(value, dest.base(), dest.disp() + offset, type, info);
    1093 }
    1094 
    1095 
    1096 // load/store with an Address
    1097 void LIR_Assembler::load(LIR_Address* a, Register d,  BasicType ld_type, CodeEmitInfo *info) {
    1098   load(as_Address(a), d, ld_type, info);
    1099 }
    1100 
    1101 
    1102 void LIR_Assembler::store(Register value, LIR_Address* dest, BasicType type, CodeEmitInfo *info) {
    1103   store(value, as_Address(dest), type, info);
    1104 }
    1105 
    1106 
    1107 // loadf/storef with an Address
    1108 void LIR_Assembler::load(LIR_Address* a, FloatRegister d, BasicType ld_type, CodeEmitInfo *info) {
    1109   load(as_Address(a), d, ld_type, info);
    1110 }
    1111 
    1112 
    1113 void LIR_Assembler::store(FloatRegister value, LIR_Address* dest, BasicType type, CodeEmitInfo *info) {
    1114   store(value, as_Address(dest), type, info);
    1115 }
    1116 
    11171017
    11181018void LIR_Assembler::const2stack(LIR_Opr src, LIR_Opr dest) {
     
    11201020  switch (c->type()) {
    11211021    case T_INT:
    1122     case T_FLOAT:
     1022    case T_FLOAT: {
     1023      Register src_reg = O7;
     1024      int value = c->as_jint_bits();
     1025      if (value == 0) {
     1026        src_reg = G0;
     1027      } else {
     1028        __ set(value, O7);
     1029      }
     1030      Address addr = frame_map()->address_for_slot(dest->single_stack_ix());
     1031      __ stw(src_reg, addr.base(), addr.disp());
     1032      break;
     1033    }
    11231034    case T_ADDRESS: {
    11241035      Register src_reg = O7;
     
    11301041      }
    11311042      Address addr = frame_map()->address_for_slot(dest->single_stack_ix());
    1132       __ stw(src_reg, addr.base(), addr.disp());
     1043      __ st_ptr(src_reg, addr.base(), addr.disp());
    11331044      break;
    11341045    }
     
    11671078
    11681079
    1169 void LIR_Assembler::const2mem(LIR_Opr src, LIR_Opr dest, BasicType type, CodeEmitInfo* info ) {
     1080void LIR_Assembler::const2mem(LIR_Opr src, LIR_Opr dest, BasicType type, CodeEmitInfo* info, bool wide) {
    11701081  LIR_Const* c = src->as_constant_ptr();
    11711082  LIR_Address* addr     = dest->as_address_ptr();
    11721083  Register base = addr->base()->as_pointer_register();
    1173 
    1174   if (info != NULL) {
    1175     add_debug_info_for_null_check_here(info);
    1176   }
     1084  int offset = -1;
     1085
    11771086  switch (c->type()) {
    11781087    case T_INT:
     
    11881097      if (addr->index()->is_valid()) {
    11891098        assert(addr->disp() == 0, "must be zero");
    1190         store(tmp, base, addr->index()->as_pointer_register(), type);
     1099        offset = store(tmp, base, addr->index()->as_pointer_register(), type, wide);
    11911100      } else {
    11921101        assert(Assembler::is_simm13(addr->disp()), "can't handle larger addresses");
    1193         store(tmp, base, addr->disp(), type);
     1102        offset = store(tmp, base, addr->disp(), type, wide, false);
    11941103      }
    11951104      break;
     
    12011110             Assembler::is_simm13(addr->disp() + 4), "can't handle larger addresses");
    12021111
    1203       Register tmp = O7;
     1112      LIR_Opr tmp = FrameMap::O7_opr;
    12041113      int value_lo = c->as_jint_lo_bits();
    12051114      if (value_lo == 0) {
    1206         tmp = G0;
     1115        tmp = FrameMap::G0_opr;
    12071116      } else {
    12081117        __ set(value_lo, O7);
    12091118      }
    1210       store(tmp, base, addr->disp() + lo_word_offset_in_bytes, T_INT);
     1119      offset = store(tmp, base, addr->disp() + lo_word_offset_in_bytes, T_INT, wide, false);
    12111120      int value_hi = c->as_jint_hi_bits();
    12121121      if (value_hi == 0) {
    1213         tmp = G0;
     1122        tmp = FrameMap::G0_opr;
    12141123      } else {
    12151124        __ set(value_hi, O7);
    12161125      }
    1217       store(tmp, base, addr->disp() + hi_word_offset_in_bytes, T_INT);
     1126      offset = store(tmp, base, addr->disp() + hi_word_offset_in_bytes, T_INT, wide, false);
    12181127      break;
    12191128    }
     
    12301139      if (addr->index()->is_valid()) {
    12311140        assert(addr->disp() == 0, "must be zero");
    1232         store(tmp, base, addr->index()->as_pointer_register(), type);
     1141        offset = store(tmp, base, addr->index()->as_pointer_register(), type, wide);
    12331142      } else {
    12341143        assert(Assembler::is_simm13(addr->disp()), "can't handle larger addresses");
    1235         store(tmp, base, addr->disp(), type);
     1144        offset = store(tmp, base, addr->disp(), type, wide, false);
    12361145      }
    12371146
     
    12401149    default:
    12411150      Unimplemented();
     1151  }
     1152  if (info != NULL) {
     1153    assert(offset != -1, "offset should've been set");
     1154    add_debug_info_for_null_check(offset, info);
    12421155  }
    12431156}
     
    13251238
    13261239          __ set(const_addrlit, O7);
    1327           load(O7, 0, to_reg->as_register(), T_INT);
     1240          __ ld(O7, 0, to_reg->as_register());
    13281241        }
    13291242      }
     
    14181331
    14191332void LIR_Assembler::mem2reg(LIR_Opr src_opr, LIR_Opr dest, BasicType type,
    1420                             LIR_PatchCode patch_code, CodeEmitInfo* info, bool unaligned) {
     1333                            LIR_PatchCode patch_code, CodeEmitInfo* info, bool wide, bool unaligned) {
    14211334
    14221335  LIR_Address* addr = src_opr->as_address_ptr();
     
    14641377  assert(disp_reg != noreg || Assembler::is_simm13(disp_value), "should have set this up");
    14651378  if (disp_reg == noreg) {
    1466     offset = load(src, disp_value, to_reg, type, unaligned);
     1379    offset = load(src, disp_value, to_reg, type, wide, unaligned);
    14671380  } else {
    14681381    assert(!unaligned, "can't handle this");
    1469     offset = load(src, disp_reg, to_reg, type);
     1382    offset = load(src, disp_reg, to_reg, type, wide);
    14701383  }
    14711384
     
    14731386    patching_epilog(patch, patch_code, src, info);
    14741387  }
    1475 
    14761388  if (info != NULL) add_debug_info_for_null_check(offset, info);
    14771389}
     
    15071419
    15081420  bool unaligned = (addr.disp() - STACK_BIAS) % 8 != 0;
    1509   load(addr.base(), addr.disp(), dest, dest->type(), unaligned);
     1421  load(addr.base(), addr.disp(), dest, dest->type(), true /*wide*/, unaligned);
    15101422}
    15111423
     
    15191431  }
    15201432  bool unaligned = (addr.disp() - STACK_BIAS) % 8 != 0;
    1521   store(from_reg, addr.base(), addr.disp(), from_reg->type(), unaligned);
     1433  store(from_reg, addr.base(), addr.disp(), from_reg->type(), true /*wide*/, unaligned);
    15221434}
    15231435
     
    15671479void LIR_Assembler::reg2mem(LIR_Opr from_reg, LIR_Opr dest, BasicType type,
    15681480                            LIR_PatchCode patch_code, CodeEmitInfo* info, bool pop_fpu_stack,
    1569                             bool unaligned) {
     1481                            bool wide, bool unaligned) {
    15701482  LIR_Address* addr = dest->as_address_ptr();
    15711483
     
    16111523  assert(disp_reg != noreg || Assembler::is_simm13(disp_value), "should have set this up");
    16121524  if (disp_reg == noreg) {
    1613     offset = store(from_reg, src, disp_value, type, unaligned);
     1525    offset = store(from_reg, src, disp_value, type, wide, unaligned);
    16141526  } else {
    16151527    assert(!unaligned, "can't handle this");
    1616     offset = store(from_reg, src, disp_reg, type);
     1528    offset = store(from_reg, src, disp_reg, type, wide);
    16171529  }
    16181530
     
    16271539void LIR_Assembler::return_op(LIR_Opr result) {
    16281540  // the poll may need a register so just pick one that isn't the return register
    1629 #ifdef TIERED
     1541#if defined(TIERED) && !defined(_LP64)
    16301542  if (result->type_field() == LIR_OprDesc::long_type) {
    16311543    // Must move the result to G1
     
    16341546    __ srl (I1, 0, I1);           // Zero extend O1 (harmless?)
    16351547    __ or3 (I1, G1, G1);          // OR 64 bits into G1
     1548#ifdef ASSERT
     1549    // mangle it so any problems will show up
     1550    __ set(0xdeadbeef, I0);
     1551    __ set(0xdeadbeef, I1);
     1552#endif
    16361553  }
    16371554#endif // TIERED
     
    17891706
    17901707
    1791 void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result) {
    1792 
     1708void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type) {
    17931709  Assembler::Condition acond;
    17941710  switch (condition) {
     
    18211737  }
    18221738  Label skip;
    1823   __ br(acond, false, Assembler::pt, skip);
     1739#ifdef _LP64
     1740    if  (type == T_INT) {
     1741      __ br(acond, false, Assembler::pt, skip);
     1742    } else
     1743#endif
     1744      __ brx(acond, false, Assembler::pt, skip); // checks icc on 32bit and xcc on 64bit
    18241745  if (opr1->is_constant() && opr1->type() == T_INT) {
    18251746    Register dest = result->as_register();
     
    21682089  if (flags & LIR_OpArrayCopy::src_null_check) {
    21692090    __ tst(src);
    2170     __ br(Assembler::equal, false, Assembler::pn, *stub->entry());
     2091    __ brx(Assembler::equal, false, Assembler::pn, *stub->entry());
    21712092    __ delayed()->nop();
    21722093  }
     
    21742095  if (flags & LIR_OpArrayCopy::dst_null_check) {
    21752096    __ tst(dst);
    2176     __ br(Assembler::equal, false, Assembler::pn, *stub->entry());
     2097    __ brx(Assembler::equal, false, Assembler::pn, *stub->entry());
    21772098    __ delayed()->nop();
    21782099  }
     
    22162137
    22172138  if (flags & LIR_OpArrayCopy::type_check) {
    2218     __ ld_ptr(src, oopDesc::klass_offset_in_bytes(), tmp);
    2219     __ ld_ptr(dst, oopDesc::klass_offset_in_bytes(), tmp2);
    2220     __ cmp(tmp, tmp2);
    2221     __ br(Assembler::notEqual, false, Assembler::pt, *stub->entry());
     2139    if (UseCompressedOops) {
     2140      // We don't need decode because we just need to compare
     2141      __ lduw(src, oopDesc::klass_offset_in_bytes(), tmp);
     2142      __ lduw(dst, oopDesc::klass_offset_in_bytes(), tmp2);
     2143      __ cmp(tmp, tmp2);
     2144      __ br(Assembler::notEqual, false, Assembler::pt, *stub->entry());
     2145    } else {
     2146      __ ld_ptr(src, oopDesc::klass_offset_in_bytes(), tmp);
     2147      __ ld_ptr(dst, oopDesc::klass_offset_in_bytes(), tmp2);
     2148      __ cmp(tmp, tmp2);
     2149      __ brx(Assembler::notEqual, false, Assembler::pt, *stub->entry());
     2150    }
    22222151    __ delayed()->nop();
    22232152  }
     
    22342163    Label known_ok, halt;
    22352164    jobject2reg(op->expected_type()->constant_encoding(), tmp);
    2236     __ ld_ptr(dst, oopDesc::klass_offset_in_bytes(), tmp2);
    2237     if (basic_type != T_OBJECT) {
    2238       __ cmp(tmp, tmp2);
    2239       __ br(Assembler::notEqual, false, Assembler::pn, halt);
    2240       __ delayed()->ld_ptr(src, oopDesc::klass_offset_in_bytes(), tmp2);
    2241       __ cmp(tmp, tmp2);
    2242       __ br(Assembler::equal, false, Assembler::pn, known_ok);
    2243       __ delayed()->nop();
     2165    if (UseCompressedOops) {
     2166      // tmp holds the default type. It currently comes uncompressed after the
     2167      // load of a constant, so encode it.
     2168      __ encode_heap_oop(tmp);
     2169      // load the raw value of the dst klass, since we will be comparing
     2170      // uncompressed values directly.
     2171      __ lduw(dst, oopDesc::klass_offset_in_bytes(), tmp2);
     2172      if (basic_type != T_OBJECT) {
     2173        __ cmp(tmp, tmp2);
     2174        __ br(Assembler::notEqual, false, Assembler::pn, halt);
     2175        // load the raw value of the src klass.
     2176        __ delayed()->lduw(src, oopDesc::klass_offset_in_bytes(), tmp2);
     2177        __ cmp(tmp, tmp2);
     2178        __ br(Assembler::equal, false, Assembler::pn, known_ok);
     2179        __ delayed()->nop();
     2180      } else {
     2181        __ cmp(tmp, tmp2);
     2182        __ br(Assembler::equal, false, Assembler::pn, known_ok);
     2183        __ delayed()->cmp(src, dst);
     2184        __ brx(Assembler::equal, false, Assembler::pn, known_ok);
     2185        __ delayed()->nop();
     2186      }
    22442187    } else {
    2245       __ cmp(tmp, tmp2);
    2246       __ br(Assembler::equal, false, Assembler::pn, known_ok);
    2247       __ delayed()->cmp(src, dst);
    2248       __ br(Assembler::equal, false, Assembler::pn, known_ok);
    2249       __ delayed()->nop();
     2188      __ ld_ptr(dst, oopDesc::klass_offset_in_bytes(), tmp2);
     2189      if (basic_type != T_OBJECT) {
     2190        __ cmp(tmp, tmp2);
     2191        __ brx(Assembler::notEqual, false, Assembler::pn, halt);
     2192        __ delayed()->ld_ptr(src, oopDesc::klass_offset_in_bytes(), tmp2);
     2193        __ cmp(tmp, tmp2);
     2194        __ brx(Assembler::equal, false, Assembler::pn, known_ok);
     2195        __ delayed()->nop();
     2196      } else {
     2197        __ cmp(tmp, tmp2);
     2198        __ brx(Assembler::equal, false, Assembler::pn, known_ok);
     2199        __ delayed()->cmp(src, dst);
     2200        __ brx(Assembler::equal, false, Assembler::pn, known_ok);
     2201        __ delayed()->nop();
     2202      }
    22502203    }
    22512204    __ bind(halt);
     
    24062359         op->tmp4()->as_register()  == O1 &&
    24072360         op->klass()->as_register() == G5, "must be");
     2361
     2362  LP64_ONLY( __ signx(op->len()->as_register()); )
    24082363  if (UseSlowPath ||
    24092364      (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) ||
     
    24262381
    24272382
     2383void LIR_Assembler::type_profile_helper(Register mdo, int mdo_offset_bias,
     2384                                        ciMethodData *md, ciProfileData *data,
     2385                                        Register recv, Register tmp1, Label* update_done) {
     2386  uint i;
     2387  for (i = 0; i < VirtualCallData::row_limit(); i++) {
     2388    Label next_test;
     2389    // See if the receiver is receiver[n].
     2390    Address receiver_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)) -
     2391                          mdo_offset_bias);
     2392    __ ld_ptr(receiver_addr, tmp1);
     2393    __ verify_oop(tmp1);
     2394    __ cmp(recv, tmp1);
     2395    __ brx(Assembler::notEqual, false, Assembler::pt, next_test);
     2396    __ delayed()->nop();
     2397    Address data_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i)) -
     2398                      mdo_offset_bias);
     2399    __ ld_ptr(data_addr, tmp1);
     2400    __ add(tmp1, DataLayout::counter_increment, tmp1);
     2401    __ st_ptr(tmp1, data_addr);
     2402    __ ba(false, *update_done);
     2403    __ delayed()->nop();
     2404    __ bind(next_test);
     2405  }
     2406
     2407  // Didn't find receiver; find next empty slot and fill it in
     2408  for (i = 0; i < VirtualCallData::row_limit(); i++) {
     2409    Label next_test;
     2410    Address recv_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)) -
     2411                      mdo_offset_bias);
     2412    __ ld_ptr(recv_addr, tmp1);
     2413    __ br_notnull(tmp1, false, Assembler::pt, next_test);
     2414    __ delayed()->nop();
     2415    __ st_ptr(recv, recv_addr);
     2416    __ set(DataLayout::counter_increment, tmp1);
     2417    __ st_ptr(tmp1, mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i)) -
     2418              mdo_offset_bias);
     2419    __ ba(false, *update_done);
     2420    __ delayed()->nop();
     2421    __ bind(next_test);
     2422  }
     2423}
     2424
     2425
     2426void LIR_Assembler::setup_md_access(ciMethod* method, int bci,
     2427                                    ciMethodData*& md, ciProfileData*& data, int& mdo_offset_bias) {
     2428  md = method->method_data_or_null();
     2429  assert(md != NULL, "Sanity");
     2430  data = md->bci_to_data(bci);
     2431  assert(data != NULL,       "need data for checkcast");
     2432  assert(data->is_ReceiverTypeData(), "need ReceiverTypeData for type check");
     2433  if (!Assembler::is_simm13(md->byte_offset_of_slot(data, DataLayout::header_offset()) + data->size_in_bytes())) {
     2434    // The offset is large so bias the mdo by the base of the slot so
     2435    // that the ld can use simm13s to reference the slots of the data
     2436    mdo_offset_bias = md->byte_offset_of_slot(data, DataLayout::header_offset());
     2437  }
     2438}
     2439
     2440void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, Label* failure, Label* obj_is_null) {
     2441  // we always need a stub for the failure case.
     2442  CodeStub* stub = op->stub();
     2443  Register obj = op->object()->as_register();
     2444  Register k_RInfo = op->tmp1()->as_register();
     2445  Register klass_RInfo = op->tmp2()->as_register();
     2446  Register dst = op->result_opr()->as_register();
     2447  Register Rtmp1 = op->tmp3()->as_register();
     2448  ciKlass* k = op->klass();
     2449
     2450
     2451  if (obj == k_RInfo) {
     2452    k_RInfo = klass_RInfo;
     2453    klass_RInfo = obj;
     2454  }
     2455
     2456  ciMethodData* md;
     2457  ciProfileData* data;
     2458  int mdo_offset_bias = 0;
     2459  if (op->should_profile()) {
     2460    ciMethod* method = op->profiled_method();
     2461    assert(method != NULL, "Should have method");
     2462    setup_md_access(method, op->profiled_bci(), md, data, mdo_offset_bias);
     2463
     2464    Label not_null;
     2465    __ br_notnull(obj, false, Assembler::pn, not_null);
     2466    __ delayed()->nop();
     2467    Register mdo      = k_RInfo;
     2468    Register data_val = Rtmp1;
     2469    jobject2reg(md->constant_encoding(), mdo);
     2470    if (mdo_offset_bias > 0) {
     2471      __ set(mdo_offset_bias, data_val);
     2472      __ add(mdo, data_val, mdo);
     2473    }
     2474    Address flags_addr(mdo, md->byte_offset_of_slot(data, DataLayout::flags_offset()) - mdo_offset_bias);
     2475    __ ldub(flags_addr, data_val);
     2476    __ or3(data_val, BitData::null_seen_byte_constant(), data_val);
     2477    __ stb(data_val, flags_addr);
     2478    __ ba(false, *obj_is_null);
     2479    __ delayed()->nop();
     2480    __ bind(not_null);
     2481  } else {
     2482    __ br_null(obj, false, Assembler::pn, *obj_is_null);
     2483    __ delayed()->nop();
     2484  }
     2485
     2486  Label profile_cast_failure, profile_cast_success;
     2487  Label *failure_target = op->should_profile() ? &profile_cast_failure : failure;
     2488  Label *success_target = op->should_profile() ? &profile_cast_success : success;
     2489
     2490  // patching may screw with our temporaries on sparc,
     2491  // so let's do it before loading the class
     2492  if (k->is_loaded()) {
     2493    jobject2reg(k->constant_encoding(), k_RInfo);
     2494  } else {
     2495    jobject2reg_with_patching(k_RInfo, op->info_for_patch());
     2496  }
     2497  assert(obj != k_RInfo, "must be different");
     2498
     2499  // get object class
     2500  // not a safepoint as obj null check happens earlier
     2501  __ load_klass(obj, klass_RInfo);
     2502  if (op->fast_check()) {
     2503    assert_different_registers(klass_RInfo, k_RInfo);
     2504    __ cmp(k_RInfo, klass_RInfo);
     2505    __ brx(Assembler::notEqual, false, Assembler::pt, *failure_target);
     2506    __ delayed()->nop();
     2507  } else {
     2508    bool need_slow_path = true;
     2509    if (k->is_loaded()) {
     2510      if (k->super_check_offset() != sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes())
     2511        need_slow_path = false;
     2512      // perform the fast part of the checking logic
     2513      __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, noreg,
     2514                                       (need_slow_path ? success_target : NULL),
     2515                                       failure_target, NULL,
     2516                                       RegisterOrConstant(k->super_check_offset()));
     2517    } else {
     2518      // perform the fast part of the checking logic
     2519      __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, O7, success_target,
     2520                                       failure_target, NULL);
     2521    }
     2522    if (need_slow_path) {
     2523      // call out-of-line instance of __ check_klass_subtype_slow_path(...):
     2524      assert(klass_RInfo == G3 && k_RInfo == G1, "incorrect call setup");
     2525      __ call(Runtime1::entry_for(Runtime1::slow_subtype_check_id), relocInfo::runtime_call_type);
     2526      __ delayed()->nop();
     2527      __ cmp(G3, 0);
     2528      __ br(Assembler::equal, false, Assembler::pn, *failure_target);
     2529      __ delayed()->nop();
     2530      // Fall through to success case
     2531    }
     2532  }
     2533
     2534  if (op->should_profile()) {
     2535    Register mdo  = klass_RInfo, recv = k_RInfo, tmp1 = Rtmp1;
     2536    assert_different_registers(obj, mdo, recv, tmp1);
     2537    __ bind(profile_cast_success);
     2538    jobject2reg(md->constant_encoding(), mdo);
     2539    if (mdo_offset_bias > 0) {
     2540      __ set(mdo_offset_bias, tmp1);
     2541      __ add(mdo, tmp1, mdo);
     2542    }
     2543    __ load_klass(obj, recv);
     2544    type_profile_helper(mdo, mdo_offset_bias, md, data, recv, tmp1, success);
     2545    // Jump over the failure case
     2546    __ ba(false, *success);
     2547    __ delayed()->nop();
     2548    // Cast failure case
     2549    __ bind(profile_cast_failure);
     2550    jobject2reg(md->constant_encoding(), mdo);
     2551    if (mdo_offset_bias > 0) {
     2552      __ set(mdo_offset_bias, tmp1);
     2553      __ add(mdo, tmp1, mdo);
     2554    }
     2555    Address data_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()) - mdo_offset_bias);
     2556    __ ld_ptr(data_addr, tmp1);
     2557    __ sub(tmp1, DataLayout::counter_increment, tmp1);
     2558    __ st_ptr(tmp1, data_addr);
     2559    __ ba(false, *failure);
     2560    __ delayed()->nop();
     2561  }
     2562  __ ba(false, *success);
     2563  __ delayed()->nop();
     2564}
     2565
    24282566void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
    24292567  LIR_Code code = op->code();
     
    24362574
    24372575    __ verify_oop(value);
    2438 
    24392576    CodeStub* stub = op->stub();
    2440     Label done;
    2441     __ cmp(value, 0);
    2442     __ br(Assembler::equal, false, Assembler::pn, done);
    2443     __ delayed()->nop();
    2444     load(array, oopDesc::klass_offset_in_bytes(), k_RInfo, T_OBJECT, op->info_for_exception());
    2445     load(value, oopDesc::klass_offset_in_bytes(), klass_RInfo, T_OBJECT, NULL);
     2577    // check if it needs to be profiled
     2578    ciMethodData* md;
     2579    ciProfileData* data;
     2580    int mdo_offset_bias = 0;
     2581    if (op->should_profile()) {
     2582      ciMethod* method = op->profiled_method();
     2583      assert(method != NULL, "Should have method");
     2584      setup_md_access(method, op->profiled_bci(), md, data, mdo_offset_bias);
     2585    }
     2586    Label profile_cast_success, profile_cast_failure, done;
     2587    Label *success_target = op->should_profile() ? &profile_cast_success : &done;
     2588    Label *failure_target = op->should_profile() ? &profile_cast_failure : stub->entry();
     2589
     2590    if (op->should_profile()) {
     2591      Label not_null;
     2592      __ br_notnull(value, false, Assembler::pn, not_null);
     2593      __ delayed()->nop();
     2594      Register mdo      = k_RInfo;
     2595      Register data_val = Rtmp1;
     2596      jobject2reg(md->constant_encoding(), mdo);
     2597      if (mdo_offset_bias > 0) {
     2598        __ set(mdo_offset_bias, data_val);
     2599        __ add(mdo, data_val, mdo);
     2600      }
     2601      Address flags_addr(mdo, md->byte_offset_of_slot(data, DataLayout::flags_offset()) - mdo_offset_bias);
     2602      __ ldub(flags_addr, data_val);
     2603      __ or3(data_val, BitData::null_seen_byte_constant(), data_val);
     2604      __ stb(data_val, flags_addr);
     2605      __ ba(false, done);
     2606      __ delayed()->nop();
     2607      __ bind(not_null);
     2608    } else {
     2609      __ br_null(value, false, Assembler::pn, done);
     2610      __ delayed()->nop();
     2611    }
     2612    add_debug_info_for_null_check_here(op->info_for_exception());
     2613    __ load_klass(array, k_RInfo);
     2614    __ load_klass(value, klass_RInfo);
    24462615
    24472616    // get instance klass
    2448     load(k_RInfo, objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc), k_RInfo, T_OBJECT, NULL);
     2617    __ ld_ptr(Address(k_RInfo, objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)), k_RInfo);
    24492618    // perform the fast part of the checking logic
    2450     __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, O7, &done, stub->entry(), NULL);
     2619    __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, O7, success_target, failure_target, NULL);
    24512620
    24522621    // call out-of-line instance of __ check_klass_subtype_slow_path(...):
     
    24552624    __ delayed()->nop();
    24562625    __ cmp(G3, 0);
    2457     __ br(Assembler::equal, false, Assembler::pn, *stub->entry());
     2626    __ br(Assembler::equal, false, Assembler::pn, *failure_target);
    24582627    __ delayed()->nop();
     2628    // fall through to the success case
     2629
     2630    if (op->should_profile()) {
     2631      Register mdo  = klass_RInfo, recv = k_RInfo, tmp1 = Rtmp1;
     2632      assert_different_registers(value, mdo, recv, tmp1);
     2633      __ bind(profile_cast_success);
     2634      jobject2reg(md->constant_encoding(), mdo);
     2635      if (mdo_offset_bias > 0) {
     2636        __ set(mdo_offset_bias, tmp1);
     2637        __ add(mdo, tmp1, mdo);
     2638      }
     2639      __ load_klass(value, recv);
     2640      type_profile_helper(mdo, mdo_offset_bias, md, data, recv, tmp1, &done);
     2641      __ ba(false, done);
     2642      __ delayed()->nop();
     2643      // Cast failure case
     2644      __ bind(profile_cast_failure);
     2645      jobject2reg(md->constant_encoding(), mdo);
     2646      if (mdo_offset_bias > 0) {
     2647        __ set(mdo_offset_bias, tmp1);
     2648        __ add(mdo, tmp1, mdo);
     2649      }
     2650      Address data_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()) - mdo_offset_bias);
     2651      __ ld_ptr(data_addr, tmp1);
     2652      __ sub(tmp1, DataLayout::counter_increment, tmp1);
     2653      __ st_ptr(tmp1, data_addr);
     2654      __ ba(false, *stub->entry());
     2655      __ delayed()->nop();
     2656    }
    24592657    __ bind(done);
    2460   } else if (op->code() == lir_checkcast) {
    2461     // we always need a stub for the failure case.
    2462     CodeStub* stub = op->stub();
     2658  } else if (code == lir_checkcast) {
    24632659    Register obj = op->object()->as_register();
    2464     Register k_RInfo = op->tmp1()->as_register();
    2465     Register klass_RInfo = op->tmp2()->as_register();
    24662660    Register dst = op->result_opr()->as_register();
    2467     Register Rtmp1 = op->tmp3()->as_register();
    2468     ciKlass* k = op->klass();
    2469 
    2470     if (obj == k_RInfo) {
    2471       k_RInfo = klass_RInfo;
    2472       klass_RInfo = obj;
    2473     }
    2474     if (op->profiled_method() != NULL) {
    2475       ciMethod* method = op->profiled_method();
    2476       int bci          = op->profiled_bci();
    2477 
    2478       // We need two temporaries to perform this operation on SPARC,
    2479       // so to keep things simple we perform a redundant test here
    2480       Label profile_done;
    2481       __ cmp(obj, 0);
    2482       __ br(Assembler::notEqual, false, Assembler::pn, profile_done);
    2483       __ delayed()->nop();
    2484       // Object is null; update methodDataOop
    2485       ciMethodData* md = method->method_data();
    2486       if (md == NULL) {
    2487         bailout("out of memory building methodDataOop");
    2488         return;
    2489       }
    2490       ciProfileData* data = md->bci_to_data(bci);
    2491       assert(data != NULL,       "need data for checkcast");
    2492       assert(data->is_BitData(), "need BitData for checkcast");
    2493       Register mdo      = k_RInfo;
    2494       Register data_val = Rtmp1;
    2495       jobject2reg(md->constant_encoding(), mdo);
    2496 
    2497       int mdo_offset_bias = 0;
    2498       if (!Assembler::is_simm13(md->byte_offset_of_slot(data, DataLayout::header_offset()) + data->size_in_bytes())) {
    2499         // The offset is large so bias the mdo by the base of the slot so
    2500         // that the ld can use simm13s to reference the slots of the data
    2501         mdo_offset_bias = md->byte_offset_of_slot(data, DataLayout::header_offset());
    2502         __ set(mdo_offset_bias, data_val);
    2503         __ add(mdo, data_val, mdo);
    2504       }
    2505 
    2506 
    2507       Address flags_addr(mdo, md->byte_offset_of_slot(data, DataLayout::flags_offset()) - mdo_offset_bias);
    2508       __ ldub(flags_addr, data_val);
    2509       __ or3(data_val, BitData::null_seen_byte_constant(), data_val);
    2510       __ stb(data_val, flags_addr);
    2511       __ bind(profile_done);
    2512     }
    2513 
    2514     Label done;
    2515     // patching may screw with our temporaries on sparc,
    2516     // so let's do it before loading the class
    2517     if (k->is_loaded()) {
    2518       jobject2reg(k->constant_encoding(), k_RInfo);
    2519     } else {
    2520       jobject2reg_with_patching(k_RInfo, op->info_for_patch());
    2521     }
    2522     assert(obj != k_RInfo, "must be different");
    2523     __ cmp(obj, 0);
    2524     __ br(Assembler::equal, false, Assembler::pn, done);
    2525     __ delayed()->nop();
    2526 
    2527     // get object class
    2528     // not a safepoint as obj null check happens earlier
    2529     load(obj, oopDesc::klass_offset_in_bytes(), klass_RInfo, T_OBJECT, NULL);
    2530     if (op->fast_check()) {
    2531       assert_different_registers(klass_RInfo, k_RInfo);
    2532       __ cmp(k_RInfo, klass_RInfo);
    2533       __ br(Assembler::notEqual, false, Assembler::pt, *stub->entry());
    2534       __ delayed()->nop();
    2535       __ bind(done);
    2536     } else {
    2537       bool need_slow_path = true;
    2538       if (k->is_loaded()) {
    2539         if (k->super_check_offset() != sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes())
    2540           need_slow_path = false;
    2541         // perform the fast part of the checking logic
    2542         __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, noreg,
    2543                                          (need_slow_path ? &done : NULL),
    2544                                          stub->entry(), NULL,
    2545                                          RegisterOrConstant(k->super_check_offset()));
    2546       } else {
    2547         // perform the fast part of the checking logic
    2548         __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, O7,
    2549                                          &done, stub->entry(), NULL);
    2550       }
    2551       if (need_slow_path) {
    2552         // call out-of-line instance of __ check_klass_subtype_slow_path(...):
    2553         assert(klass_RInfo == G3 && k_RInfo == G1, "incorrect call setup");
    2554         __ call(Runtime1::entry_for(Runtime1::slow_subtype_check_id), relocInfo::runtime_call_type);
    2555         __ delayed()->nop();
    2556         __ cmp(G3, 0);
    2557         __ br(Assembler::equal, false, Assembler::pn, *stub->entry());
    2558         __ delayed()->nop();
    2559       }
    2560       __ bind(done);
    2561     }
     2661    Label success;
     2662    emit_typecheck_helper(op, &success, op->stub()->entry(), &success);
     2663    __ bind(success);
    25622664    __ mov(obj, dst);
    25632665  } else if (code == lir_instanceof) {
    25642666    Register obj = op->object()->as_register();
    2565     Register k_RInfo = op->tmp1()->as_register();
    2566     Register klass_RInfo = op->tmp2()->as_register();
    25672667    Register dst = op->result_opr()->as_register();
    2568     Register Rtmp1 = op->tmp3()->as_register();
    2569     ciKlass* k = op->klass();
    2570 
    2571     Label done;
    2572     if (obj == k_RInfo) {
    2573       k_RInfo = klass_RInfo;
    2574       klass_RInfo = obj;
    2575     }
    2576     // patching may screw with our temporaries on sparc,
    2577     // so let's do it before loading the class
    2578     if (k->is_loaded()) {
    2579       jobject2reg(k->constant_encoding(), k_RInfo);
    2580     } else {
    2581       jobject2reg_with_patching(k_RInfo, op->info_for_patch());
    2582     }
    2583     assert(obj != k_RInfo, "must be different");
    2584     __ cmp(obj, 0);
    2585     __ br(Assembler::equal, true, Assembler::pn, done);
    2586     __ delayed()->set(0, dst);
    2587 
    2588     // get object class
    2589     // not a safepoint as obj null check happens earlier
    2590     load(obj, oopDesc::klass_offset_in_bytes(), klass_RInfo, T_OBJECT, NULL);
    2591     if (op->fast_check()) {
    2592       __ cmp(k_RInfo, klass_RInfo);
    2593       __ br(Assembler::equal, true, Assembler::pt, done);
    2594       __ delayed()->set(1, dst);
    2595       __ set(0, dst);
    2596       __ bind(done);
    2597     } else {
    2598       bool need_slow_path = true;
    2599       if (k->is_loaded()) {
    2600         if (k->super_check_offset() != sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes())
    2601           need_slow_path = false;
    2602         // perform the fast part of the checking logic
    2603         __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, O7, noreg,
    2604                                          (need_slow_path ? &done : NULL),
    2605                                          (need_slow_path ? &done : NULL), NULL,
    2606                                          RegisterOrConstant(k->super_check_offset()),
    2607                                          dst);
    2608       } else {
    2609         assert(dst != klass_RInfo && dst != k_RInfo, "need 3 registers");
    2610         // perform the fast part of the checking logic
    2611         __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, O7, dst,
    2612                                          &done, &done, NULL,
    2613                                          RegisterOrConstant(-1),
    2614                                          dst);
    2615       }
    2616       if (need_slow_path) {
    2617         // call out-of-line instance of __ check_klass_subtype_slow_path(...):
    2618         assert(klass_RInfo == G3 && k_RInfo == G1, "incorrect call setup");
    2619         __ call(Runtime1::entry_for(Runtime1::slow_subtype_check_id), relocInfo::runtime_call_type);
    2620         __ delayed()->nop();
    2621         __ mov(G3, dst);
    2622       }
    2623       __ bind(done);
    2624     }
     2668    Label success, failure, done;
     2669    emit_typecheck_helper(op, &success, &failure, &failure);
     2670    __ bind(failure);
     2671    __ set(0, dst);
     2672    __ ba(false, done);
     2673    __ delayed()->nop();
     2674    __ bind(success);
     2675    __ set(1, dst);
     2676    __ bind(done);
    26252677  } else {
    26262678    ShouldNotReachHere();
     
    26432695    __ mov(cmp_value_lo, t1);
    26442696    __ mov(new_value_lo, t2);
     2697    // perform the compare and swap operation
     2698    __ casx(addr, t1, t2);
     2699    // generate condition code - if the swap succeeded, t2 ("new value" reg) was
     2700    // overwritten with the original value in "addr" and will be equal to t1.
     2701    __ cmp(t1, t2);
    26452702#else
    26462703    // move high and low halves of long values into single registers
     
    26512708    __ srl(new_value_lo, 0, new_value_lo);
    26522709    __ or3(t2, new_value_lo, t2);          // t2 holds 64-bit value to swap
    2653 #endif
    26542710    // perform the compare and swap operation
    26552711    __ casx(addr, t1, t2);
    26562712    // generate condition code - if the swap succeeded, t2 ("new value" reg) was
    26572713    // overwritten with the original value in "addr" and will be equal to t1.
    2658     __ cmp(t1, t2);
    2659 
     2714    // Produce icc flag for 32bit.
     2715    __ sub(t1, t2, t2);
     2716    __ srlx(t2, 32, t1);
     2717    __ orcc(t2, t1, G0);
     2718#endif
    26602719  } else if (op->code() == lir_cas_int || op->code() == lir_cas_obj) {
    26612720    Register addr = op->addr()->as_pointer_register();
     
    26662725    __ mov(cmp_value, t1);
    26672726    __ mov(new_value, t2);
    2668 #ifdef _LP64
    26692727    if (op->code() == lir_cas_obj) {
    2670       __ casx(addr, t1, t2);
    2671     } else
    2672 #endif
    2673       {
     2728      if (UseCompressedOops) {
     2729        __ encode_heap_oop(t1);
     2730        __ encode_heap_oop(t2);
    26742731        __ cas(addr, t1, t2);
    2675       }
     2732      } else {
     2733        __ cas_ptr(addr, t1, t2);
     2734      }
     2735    } else {
     2736      __ cas(addr, t1, t2);
     2737    }
    26762738    __ cmp(t1, t2);
    26772739  } else {
     
    27702832
    27712833  // Update counter for all call types
    2772   ciMethodData* md = method->method_data();
    2773   if (md == NULL) {
    2774     bailout("out of memory building methodDataOop");
    2775     return;
    2776   }
     2834  ciMethodData* md = method->method_data_or_null();
     2835  assert(md != NULL, "Sanity");
    27772836  ciProfileData* data = md->bci_to_data(bci);
    27782837  assert(data->is_CounterData(), "need CounterData for calls");
    27792838  assert(op->mdo()->is_single_cpu(),  "mdo must be allocated");
     2839  Register mdo  = op->mdo()->as_register();
     2840#ifdef _LP64
     2841  assert(op->tmp1()->is_double_cpu(), "tmp1 must be allocated");
     2842  Register tmp1 = op->tmp1()->as_register_lo();
     2843#else
    27802844  assert(op->tmp1()->is_single_cpu(), "tmp1 must be allocated");
    2781   Register mdo  = op->mdo()->as_register();
    27822845  Register tmp1 = op->tmp1()->as_register();
     2846#endif
    27832847  jobject2reg(md->constant_encoding(), mdo);
    27842848  int mdo_offset_bias = 0;
     
    27972861  // invokeinterface bytecodes
    27982862  if ((bc == Bytecodes::_invokevirtual || bc == Bytecodes::_invokeinterface) &&
    2799       Tier1ProfileVirtualCalls) {
     2863      C1ProfileVirtualCalls) {
    28002864    assert(op->recv()->is_single_cpu(), "recv must be allocated");
    28012865    Register recv = op->recv()->as_register();
     
    28032867    assert(data->is_VirtualCallData(), "need VirtualCallData for virtual calls");
    28042868    ciKlass* known_klass = op->known_holder();
    2805     if (Tier1OptimizeVirtualCallProfiling && known_klass != NULL) {
     2869    if (C1OptimizeVirtualCallProfiling && known_klass != NULL) {
    28062870      // We know the type that will be seen at this call site; we can
    28072871      // statically update the methodDataOop rather than needing to do
     
    28182882                                                         VirtualCallData::receiver_count_offset(i)) -
    28192883                            mdo_offset_bias);
    2820           __ lduw(data_addr, tmp1);
     2884          __ ld_ptr(data_addr, tmp1);
    28212885          __ add(tmp1, DataLayout::counter_increment, tmp1);
    2822           __ stw(tmp1, data_addr);
     2886          __ st_ptr(tmp1, data_addr);
    28232887          return;
    28242888        }
     
    28392903          Address data_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i)) -
    28402904                            mdo_offset_bias);
    2841           __ lduw(data_addr, tmp1);
     2905          __ ld_ptr(data_addr, tmp1);
    28422906          __ add(tmp1, DataLayout::counter_increment, tmp1);
    2843           __ stw(tmp1, data_addr);
     2907          __ st_ptr(tmp1, data_addr);
    28442908          return;
    28452909        }
    28462910      }
    28472911    } else {
    2848       load(Address(recv, oopDesc::klass_offset_in_bytes()), recv, T_OBJECT);
     2912      __ load_klass(recv, recv);
    28492913      Label update_done;
    2850       uint i;
    2851       for (i = 0; i < VirtualCallData::row_limit(); i++) {
    2852         Label next_test;
    2853         // See if the receiver is receiver[n].
    2854         Address receiver_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_offset(i)) -
    2855                               mdo_offset_bias);
    2856         __ ld_ptr(receiver_addr, tmp1);
    2857         __ verify_oop(tmp1);
    2858         __ cmp(recv, tmp1);
    2859         __ brx(Assembler::notEqual, false, Assembler::pt, next_test);
    2860         __ delayed()->nop();
    2861         Address data_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i)) -
    2862                           mdo_offset_bias);
    2863         __ lduw(data_addr, tmp1);
    2864         __ add(tmp1, DataLayout::counter_increment, tmp1);
    2865         __ stw(tmp1, data_addr);
    2866         __ br(Assembler::always, false, Assembler::pt, update_done);
    2867         __ delayed()->nop();
    2868         __ bind(next_test);
    2869       }
    2870 
    2871       // Didn't find receiver; find next empty slot and fill it in
    2872       for (i = 0; i < VirtualCallData::row_limit(); i++) {
    2873         Label next_test;
    2874         Address recv_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_offset(i)) -
    2875                           mdo_offset_bias);
    2876         load(recv_addr, tmp1, T_OBJECT);
    2877         __ tst(tmp1);
    2878         __ brx(Assembler::notEqual, false, Assembler::pt, next_test);
    2879         __ delayed()->nop();
    2880         __ st_ptr(recv, recv_addr);
    2881         __ set(DataLayout::counter_increment, tmp1);
    2882         __ st_ptr(tmp1, mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i)) -
    2883                   mdo_offset_bias);
    2884         __ br(Assembler::always, false, Assembler::pt, update_done);
    2885         __ delayed()->nop();
    2886         __ bind(next_test);
    2887       }
     2914      type_profile_helper(mdo, mdo_offset_bias, md, data, recv, tmp1, &update_done);
    28882915      // Receiver did not match any saved receiver and there is no empty row for it.
    28892916      // Increment total counter to indicate polymorphic case.
    2890       __ lduw(counter_addr, tmp1);
     2917      __ ld_ptr(counter_addr, tmp1);
    28912918      __ add(tmp1, DataLayout::counter_increment, tmp1);
    2892       __ stw(tmp1, counter_addr);
     2919      __ st_ptr(tmp1, counter_addr);
    28932920
    28942921      __ bind(update_done);
     
    28962923  } else {
    28972924    // Static call
    2898     __ lduw(counter_addr, tmp1);
     2925    __ ld_ptr(counter_addr, tmp1);
    28992926    __ add(tmp1, DataLayout::counter_increment, tmp1);
    2900     __ stw(tmp1, counter_addr);
    2901   }
    2902 }
    2903 
     2927    __ st_ptr(tmp1, counter_addr);
     2928  }
     2929}
    29042930
    29052931void LIR_Assembler::align_backward_branch_target() {
     
    30783104    // use normal move for all other volatiles since they don't need
    30793105    // special handling to remain atomic.
    3080     move_op(src, dest, type, lir_patch_none, info, false, false);
     3106    move_op(src, dest, type, lir_patch_none, info, false, false, false);
    30813107  }
    30823108}
     
    30953121}
    30963122
    3097 // Macro to Pack two sequential registers containing 32 bit values
     3123// Pack two sequential registers containing 32 bit values
    30983124// into a single 64 bit register.
    3099 // rs and rs->successor() are packed into rd
    3100 // rd and rs may be the same register.
    3101 // Note: rs and rs->successor() are destroyed.
    3102 void LIR_Assembler::pack64( Register rs, Register rd ) {
     3125// src and src->successor() are packed into dst
     3126// src and dst may be the same register.
     3127// Note: src is destroyed
     3128void LIR_Assembler::pack64(LIR_Opr src, LIR_Opr dst) {
     3129  Register rs = src->as_register();
     3130  Register rd = dst->as_register_lo();
    31033131  __ sllx(rs, 32, rs);
    31043132  __ srl(rs->successor(), 0, rs->successor());
     
    31063134}
    31073135
    3108 // Macro to unpack a 64 bit value in a register into
     3136// Unpack a 64 bit value in a register into
    31093137// two sequential registers.
    3110 // rd is unpacked into rd and rd->successor()
    3111 void LIR_Assembler::unpack64( Register rd ) {
    3112   __ mov(rd, rd->successor());
    3113   __ srax(rd, 32, rd);
    3114   __ sra(rd->successor(), 0, rd->successor());
     3138// src is unpacked into dst and dst->successor()
     3139void LIR_Assembler::unpack64(LIR_Opr src, LIR_Opr dst) {
     3140  Register rs = src->as_register_lo();
     3141  Register rd = dst->as_register_hi();
     3142  assert_different_registers(rs, rd, rd->successor());
     3143  __ srlx(rs, 32, rd);
     3144  __ srl (rs,  0, rd->successor());
    31153145}
    31163146
     
    31193149  LIR_Address* addr = addr_opr->as_address_ptr();
    31203150  assert(addr->index()->is_illegal() && addr->scale() == LIR_Address::times_1 && Assembler::is_simm13(addr->disp()), "can't handle complex addresses yet");
    3121   __ add(addr->base()->as_register(), addr->disp(), dest->as_register());
     3151
     3152  __ add(addr->base()->as_pointer_register(), addr->disp(), dest->as_pointer_register());
    31223153}
    31233154
     
    31903221          }
    31913222#endif
    3192           continue;
     3223        } else {
     3224          LIR_Op* delay_op = new LIR_OpDelay(new LIR_Op0(lir_nop), op->as_OpJavaCall()->info());
     3225          inst->insert_before(i + 1, delay_op);
     3226          i++;
    31933227        }
    31943228
    3195         LIR_Op* delay_op = new LIR_OpDelay(new LIR_Op0(lir_nop), op->as_OpJavaCall()->info());
    3196         inst->insert_before(i + 1, delay_op);
     3229#if defined(TIERED) && !defined(_LP64)
     3230        // fixup the return value from G1 to O0/O1 for long returns.
     3231        // It's done here instead of in LIRGenerator because there's
     3232        // such a mismatch between the single reg and double reg
     3233        // calling convention.
     3234        LIR_OpJavaCall* callop = op->as_OpJavaCall();
     3235        if (callop->result_opr() == FrameMap::out_long_opr) {
     3236          LIR_OpJavaCall* call;
     3237          LIR_OprList* arguments = new LIR_OprList(callop->arguments()->length());
     3238          for (int a = 0; a < arguments->length(); a++) {
     3239            arguments[a] = callop->arguments()[a];
     3240          }
     3241          if (op->code() == lir_virtual_call) {
     3242            call = new LIR_OpJavaCall(op->code(), callop->method(), callop->receiver(), FrameMap::g1_long_single_opr,
     3243                                      callop->vtable_offset(), arguments, callop->info());
     3244          } else {
     3245            call = new LIR_OpJavaCall(op->code(), callop->method(), callop->receiver(), FrameMap::g1_long_single_opr,
     3246                                      callop->addr(), arguments, callop->info());
     3247          }
     3248          inst->at_put(i - 1, call);
     3249          inst->insert_before(i + 1, new LIR_Op1(lir_unpack64, FrameMap::g1_long_single_opr, callop->result_opr(),
     3250                                                 T_LONG, lir_patch_none, NULL));
     3251        }
     3252#endif
    31973253        break;
    31983254      }
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_C1_LIRASSEMBLER_SPARC_HPP
     26#define CPU_SPARC_VM_C1_LIRASSEMBLER_SPARC_HPP
     27
    2528 private:
    2629
     
    3841  //
    3942
    40   // some load/store variants return the code_offset for proper positioning of debug info for null checks
     43  int store(LIR_Opr from_reg, Register base, int offset, BasicType type, bool wide, bool unaligned);
     44  int store(LIR_Opr from_reg, Register base, Register disp, BasicType type, bool wide);
    4145
    42   // load/store with 32 bit displacement
    43   int load(Register s, int disp, Register d, BasicType ld_type, CodeEmitInfo* info = NULL);
    44   void store(Register value, Register base, int offset, BasicType type, CodeEmitInfo *info = NULL);
    45 
    46   // loadf/storef with 32 bit displacement
    47   void load(Register s, int disp, FloatRegister d, BasicType ld_type, CodeEmitInfo* info = NULL);
    48   void store(FloatRegister d, Register s1, int disp, BasicType st_type, CodeEmitInfo* info = NULL);
    49 
    50   // convienence methods for calling load/store with an Address
    51   void load(const Address& a, Register d, BasicType ld_type, CodeEmitInfo* info = NULL, int offset = 0);
    52   void store(Register d, const Address& a, BasicType st_type, CodeEmitInfo* info = NULL, int offset = 0);
    53   void load(const Address& a, FloatRegister d, BasicType ld_type, CodeEmitInfo* info = NULL, int offset = 0);
    54   void store(FloatRegister d, const Address& a, BasicType st_type, CodeEmitInfo* info = NULL, int offset = 0);
    55 
    56   // convienence methods for calling load/store with an LIR_Address
    57   void load(LIR_Address* a, Register d, BasicType ld_type, CodeEmitInfo* info = NULL);
    58   void store(Register d, LIR_Address* a, BasicType st_type, CodeEmitInfo* info = NULL);
    59   void load(LIR_Address* a, FloatRegister d, BasicType ld_type, CodeEmitInfo* info = NULL);
    60   void store(FloatRegister d, LIR_Address* a, BasicType st_type, CodeEmitInfo* info = NULL);
    61 
    62   int store(LIR_Opr from_reg, Register base, int offset, BasicType type, bool unaligned = false);
    63   int store(LIR_Opr from_reg, Register base, Register disp, BasicType type);
    64 
    65   int load(Register base, int offset, LIR_Opr to_reg, BasicType type, bool unaligned = false);
    66   int load(Register base, Register disp, LIR_Opr to_reg, BasicType type);
     46  int load(Register base, int offset, LIR_Opr to_reg, BasicType type, bool wide, bool unaligned);
     47  int load(Register base, Register disp, LIR_Opr to_reg, BasicType type, bool wide);
    6748
    6849  void monitorexit(LIR_Opr obj_opr, LIR_Opr lock_opr, Register hdr, int monitor_no);
     
    7253  static bool is_single_instruction(LIR_Op* op);
    7354
     55  // Record the type of the receiver in ReceiverTypeData
     56  void type_profile_helper(Register mdo, int mdo_offset_bias,
     57                           ciMethodData *md, ciProfileData *data,
     58                           Register recv, Register tmp1, Label* update_done);
     59  // Setup pointers to MDO, MDO slot, also compute offset bias to access the slot.
     60  void setup_md_access(ciMethod* method, int bci,
     61                       ciMethodData*& md, ciProfileData*& data, int& mdo_offset_bias);
    7462 public:
    75   void pack64( Register rs, Register rd );
    76   void unpack64( Register rd );
     63  void   pack64(LIR_Opr src, LIR_Opr dst);
     64  void unpack64(LIR_Opr src, LIR_Opr dst);
    7765
    7866enum {
     
    8472         exception_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(10*4),
    8573         deopt_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(10*4) };
     74
     75#endif // CPU_SPARC_VM_C1_LIRASSEMBLER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_c1_LIRGenerator_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "c1/c1_Compilation.hpp"
     27#include "c1/c1_FrameMap.hpp"
     28#include "c1/c1_Instruction.hpp"
     29#include "c1/c1_LIRAssembler.hpp"
     30#include "c1/c1_LIRGenerator.hpp"
     31#include "c1/c1_Runtime1.hpp"
     32#include "c1/c1_ValueStack.hpp"
     33#include "ci/ciArray.hpp"
     34#include "ci/ciObjArrayKlass.hpp"
     35#include "ci/ciTypeArrayKlass.hpp"
     36#include "runtime/sharedRuntime.hpp"
     37#include "runtime/stubRoutines.hpp"
     38#include "vmreg_sparc.inline.hpp"
    2739
    2840#ifdef ASSERT
     
    228240}
    229241
    230 
    231 void LIRGenerator::increment_counter(address counter, int step) {
     242LIR_Opr LIRGenerator::load_immediate(int x, BasicType type) {
     243  LIR_Opr r;
     244  if (type == T_LONG) {
     245    r = LIR_OprFact::longConst(x);
     246  } else if (type == T_INT) {
     247    r = LIR_OprFact::intConst(x);
     248  } else {
     249    ShouldNotReachHere();
     250  }
     251  if (!Assembler::is_simm13(x)) {
     252    LIR_Opr tmp = new_register(type);
     253    __ move(r, tmp);
     254    return tmp;
     255  }
     256  return r;
     257}
     258
     259void LIRGenerator::increment_counter(address counter, BasicType type, int step) {
    232260  LIR_Opr pointer = new_pointer_register();
    233261  __ move(LIR_OprFact::intptrConst(counter), pointer);
    234   LIR_Address* addr = new LIR_Address(pointer, T_INT);
     262  LIR_Address* addr = new LIR_Address(pointer, type);
    235263  increment_counter(addr, step);
    236264}
    237265
    238266void LIRGenerator::increment_counter(LIR_Address* addr, int step) {
    239   LIR_Opr temp = new_register(T_INT);
     267  LIR_Opr temp = new_register(addr->type());
    240268  __ move(addr, temp);
    241   LIR_Opr c = LIR_OprFact::intConst(step);
    242   if (Assembler::is_simm13(step)) {
    243     __ add(temp, c, temp);
    244   } else {
    245     LIR_Opr temp2 = new_register(T_INT);
    246     __ move(c, temp2);
    247     __ add(temp, temp2, temp);
    248   }
     269  __ add(temp, load_immediate(step, addr->type()), temp);
    249270  __ move(temp, addr);
    250271}
    251 
    252272
    253273void LIRGenerator::cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info) {
     
    304324
    305325void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
    306   assert(x->is_root(),"");
     326  assert(x->is_pinned(),"");
    307327  bool needs_range_check = true;
    308328  bool use_length = x->length() != NULL;
     
    379399
    380400void LIRGenerator::do_MonitorEnter(MonitorEnter* x) {
    381   assert(x->is_root(),"");
     401  assert(x->is_pinned(),"");
    382402  LIRItem obj(x->obj(), this);
    383403  obj.load_item();
     
    391411  CodeEmitInfo* info_for_exception = NULL;
    392412  if (x->needs_null_check()) {
    393     info_for_exception = state_for(x, x->lock_stack_before());
     413    info_for_exception = state_for(x);
    394414  }
    395415
     
    402422
    403423void LIRGenerator::do_MonitorExit(MonitorExit* x) {
    404   assert(x->is_root(),"");
     424  assert(x->is_pinned(),"");
    405425  LIRItem obj(x->obj(), this);
    406426  obj.dont_load_item();
     
    612632  right.load_item();
    613633  LIR_Opr reg = rlock_result(x);
    614 
    615634  if (x->x()->type()->is_float_kind()) {
    616635    Bytecodes::Code code = x->op();
     
    644663  // generate conditional move of boolean result
    645664  LIR_Opr result = rlock_result(x);
    646   __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result);
     665  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result, T_LONG);
    647666}
    648667
     
    681700    ShouldNotReachHere();
    682701  }
    683 
    684702  // generate conditional move of boolean result
    685703  LIR_Opr result = rlock_result(x);
    686   __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result);
     704  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),
     705           result, as_BasicType(type));
    687706  if (type == objectType) {  // Write-barrier needed for Object fields.
    688707    // Precise card mark since could either be object or array
     
    865884  // O0 as result register.
    866885  const LIR_Opr reg = result_register_for(x->type());
    867 
     886#ifndef PRODUCT
    868887  if (PrintNotLoaded && !x->klass()->is_loaded()) {
    869     tty->print_cr("   ###class not loaded at new bci %d", x->bci());
    870   }
     888    tty->print_cr("   ###class not loaded at new bci %d", x->printable_bci());
     889  }
     890#endif
    871891  CodeEmitInfo* info = state_for(x, x->state());
    872892  LIR_Opr tmp1 = FrameMap::G1_oop_opr;
     
    10121032  LIR_Opr out_reg = rlock_result(x);
    10131033  CodeStub* stub;
    1014   CodeEmitInfo* info_for_exception = state_for(x, x->state()->copy_locks());
     1034  CodeEmitInfo* info_for_exception = state_for(x);
    10151035
    10161036  if (x->is_incompatible_class_change_check()) {
     
    10411061  LIR_Opr tmp2 = FrameMap::G3_oop_opr;
    10421062  LIR_Opr tmp3 = FrameMap::G4_oop_opr;
    1043   __ instanceof(out_reg, obj.result(), x->klass(), tmp1, tmp2, tmp3,  x->direct_compare(), patching_info);
     1063  __ instanceof(out_reg, obj.result(), x->klass(), tmp1, tmp2, tmp3,
     1064                x->direct_compare(), patching_info,
     1065                x->profiled_method(), x->profiled_bci());
    10441066}
    10451067
     
    10901112  if (x->is_safepoint()) {
    10911113    // increment backedge counter if needed
    1092     increment_backedge_counter(state_for(x, x->state_before()));
    1093 
     1114    increment_backedge_counter(state_for(x, x->state_before()), x->profiled_bci());
    10941115    __ safepoint(new_register(T_INT), state_for(x, x->state_before()));
    10951116  }
    10961117
    10971118  __ cmp(lir_cond(cond), left, right);
     1119  // Generate branch profiling. Profiling code doesn't kill flags.
    10981120  profile_branch(x, cond);
    10991121  move_to_phi(x->state());
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_LinearScan_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_c1_LinearScan_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "c1/c1_Instruction.hpp"
     27#include "c1/c1_LinearScan.hpp"
     28#include "utilities/bitMap.inline.hpp"
    2729
    2830void LinearScan::allocate_fpu_stack() {
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_LinearScan_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_C1_LINEARSCAN_SPARC_HPP
     26#define CPU_SPARC_VM_C1_LINEARSCAN_SPARC_HPP
    2427
    2528inline bool LinearScan::is_processed_reg_num(int reg_num) {
     
    6568    _last_reg = pd_last_callee_saved_reg;
    6669    return true;
    67   } else if (cur->type() == T_INT || cur->type() == T_LONG || cur->type() == T_OBJECT) {
     70  } else if (cur->type() == T_INT || cur->type() == T_LONG || cur->type() == T_OBJECT || cur->type() == T_ADDRESS) {
    6871    _first_reg = pd_first_cpu_reg;
    6972    _last_reg = pd_last_allocatable_cpu_reg;
     
    7275  return false;
    7376}
     77
     78#endif // CPU_SPARC_VM_C1_LINEARSCAN_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp

    r278 r309  
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_c1_MacroAssembler_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "c1/c1_MacroAssembler.hpp"
     27#include "c1/c1_Runtime1.hpp"
     28#include "classfile/systemDictionary.hpp"
     29#include "gc_interface/collectedHeap.hpp"
     30#include "interpreter/interpreter.hpp"
     31#include "oops/arrayOop.hpp"
     32#include "oops/markOop.hpp"
     33#include "runtime/basicLock.hpp"
     34#include "runtime/biasedLocking.hpp"
     35#include "runtime/os.hpp"
     36#include "runtime/stubRoutines.hpp"
    2737
    2838void C1_MacroAssembler::inline_cache_check(Register receiver, Register iCache) {
     
    3141  // Note: needs more testing of out-of-line vs. inline slow case
    3242  verify_oop(receiver);
    33   ld_ptr(receiver, oopDesc::klass_offset_in_bytes(), temp_reg);
     43  load_klass(receiver, temp_reg);
    3444  cmp(temp_reg, iCache);
    3545  brx(Assembler::equal, true, Assembler::pt, L);
     
    157167  Register var_size_in_bytes,          // object size in bytes if unknown at compile time; invalid otherwise
    158168  int      con_size_in_bytes,          // object size in bytes if   known at compile time
    159   Register t1,                         // temp register
     169  Register t1,                         // temp register, must be global register for incr_allocated_bytes
    160170  Register t2,                         // temp register
    161171  Label&   slow_case                   // continuation point if fast allocation fails
    162172) {
     173  RegisterOrConstant size_in_bytes = var_size_in_bytes->is_valid()
     174    ? RegisterOrConstant(var_size_in_bytes) : RegisterOrConstant(con_size_in_bytes);
    163175  if (UseTLAB) {
    164176    tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
    165177  } else {
    166178    eden_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
     179    incr_allocated_bytes(size_in_bytes, t1, t2);
    167180  }
    168181}
     
    176189    set((intx)markOopDesc::prototype(), t1);
    177190  }
    178   st_ptr(t1  , obj, oopDesc::mark_offset_in_bytes       ());
    179   st_ptr(klass, obj, oopDesc::klass_offset_in_bytes      ());
    180   if (len->is_valid()) st(len  , obj, arrayOopDesc::length_offset_in_bytes());
     191  st_ptr(t1, obj, oopDesc::mark_offset_in_bytes());
     192  if (UseCompressedOops) {
     193    // Save klass
     194    mov(klass, t1);
     195    encode_heap_oop_not_null(t1);
     196    stw(t1, obj, oopDesc::klass_offset_in_bytes());
     197  } else {
     198    st_ptr(klass, obj, oopDesc::klass_offset_in_bytes());
     199  }
     200  if (len->is_valid()) st(len, obj, arrayOopDesc::length_offset_in_bytes());
     201  else if (UseCompressedOops) {
     202    store_klass_gap(G0, obj);
     203  }
    181204}
    182205
     
    195218  Register obj,                        // result: pointer to object after successful allocation
    196219  Register t1,                         // temp register
    197   Register t2,                         // temp register
     220  Register t2,                         // temp register, must be a global register for try_allocate
    198221  Register t3,                         // temp register
    199222  int      hdr_size,                   // object header size in words
     
    226249  Register t2                          // temp register
    227250  ) {
    228   const int hdr_size_in_bytes = instanceOopDesc::base_offset_in_bytes();
     251  const int hdr_size_in_bytes = instanceOopDesc::header_size() * HeapWordSize;
    229252
    230253  initialize_header(obj, klass, noreg, t1, t2);
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_C1_MACROASSEMBLER_SPARC_HPP
     26#define CPU_SPARC_VM_C1_MACROASSEMBLER_SPARC_HPP
    2427
    2528  void pd_init() { /* nothing to do */ }
     
    8588  void invalidate_registers(bool iregisters, bool lregisters, bool oregisters,
    8689                            Register preserve1 = noreg, Register preserve2 = noreg);
     90
     91#endif // CPU_SPARC_VM_C1_MACROASSEMBLER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_c1_Runtime1_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "c1/c1_Defs.hpp"
     27#include "c1/c1_MacroAssembler.hpp"
     28#include "c1/c1_Runtime1.hpp"
     29#include "interpreter/interpreter.hpp"
     30#include "nativeInst_sparc.hpp"
     31#include "oops/compiledICHolderOop.hpp"
     32#include "oops/oop.inline.hpp"
     33#include "prims/jvmtiExport.hpp"
     34#include "register_sparc.hpp"
     35#include "runtime/sharedRuntime.hpp"
     36#include "runtime/signature.hpp"
     37#include "runtime/vframeArray.hpp"
     38#include "vmreg_sparc.inline.hpp"
    2739
    2840// Implementation of StubAssembler
     
    332344
    333345  restore_live_registers(sasm);
    334   __ restore();
    335   __ br(Assembler::always, false, Assembler::pt, deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type);
    336   __ delayed()->nop();
     346
     347  AddressLiteral dest(deopt_blob->unpack_with_reexecution());
     348  __ jump_to(dest, O0);
     349  __ delayed()->restore();
    337350
    338351  __ bind(no_deopt);
     
    437450          // get the instance size
    438451          __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size);
     452
    439453          __ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path);
     454
    440455          __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
    441456          __ verify_oop(O0_obj);
     
    448463          __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size);
    449464          __ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path);
     465          __ incr_allocated_bytes(G1_obj_size, G3_t1, G4_t2);
     466
    450467          __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
    451468          __ verify_oop(O0_obj);
     
    466483      break;
    467484
    468 #ifdef TIERED
    469485    case counter_overflow_id:
    470         // G4 contains bci
    471       oop_maps = generate_stub_call(sasm, noreg, CAST_FROM_FN_PTR(address, counter_overflow), G4);
    472       break;
    473 #endif // TIERED
     486        // G4 contains bci, G5 contains method
     487      oop_maps = generate_stub_call(sasm, noreg, CAST_FROM_FN_PTR(address, counter_overflow), G4, G5);
     488      break;
    474489
    475490    case new_type_array_id:
     
    564579
    565580          __ eden_allocate(O0_obj, G1_arr_size, 0, G3_t1, O1_t2, slow_path);  // preserves G1_arr_size
     581          __ incr_allocated_bytes(G1_arr_size, G3_t1, O1_t2);
    566582
    567583          __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2);
     
    603619        Label register_finalizer;
    604620        Register t = O1;
    605         __ ld_ptr(O0, oopDesc::klass_offset_in_bytes(), t);
     621        __ load_klass(O0, t);
    606622        __ ld(t, Klass::access_flags_offset_in_bytes() + sizeof(oopDesc), t);
    607623        __ set(JVM_ACC_HAS_FINALIZER, G3);
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_C1_GLOBALS_SPARC_HPP
     26#define CPU_SPARC_VM_C1_GLOBALS_SPARC_HPP
     27
     28#include "utilities/globalDefinitions.hpp"
     29#include "utilities/macros.hpp"
     30
    2531// Sets the default values for platform dependent flags used by the client compiler.
    2632// (see c1_globals.hpp)
     
    3541define_pd_global(bool, TieredCompilation,            false);
    3642define_pd_global(intx, CompileThreshold,             1000 ); // Design center runs on 1.3.1
    37 define_pd_global(intx, Tier2CompileThreshold,        1500 );
    38 define_pd_global(intx, Tier3CompileThreshold,        2000 );
    39 define_pd_global(intx, Tier4CompileThreshold,        2500 );
    40 
    4143define_pd_global(intx, BackEdgeThreshold,            100000);
    42 define_pd_global(intx, Tier2BackEdgeThreshold,       100000);
    43 define_pd_global(intx, Tier3BackEdgeThreshold,       100000);
    44 define_pd_global(intx, Tier4BackEdgeThreshold,       100000);
    4544
    4645define_pd_global(intx, OnStackReplacePercentage,     1400 );
     
    6968
    7069define_pd_global(intx, SafepointPollOffset,          0    );
     70
     71#endif // CPU_SPARC_VM_C1_GLOBALS_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_C2_GLOBALS_SPARC_HPP
     26#define CPU_SPARC_VM_C2_GLOBALS_SPARC_HPP
     27
     28#include "utilities/globalDefinitions.hpp"
     29#include "utilities/macros.hpp"
     30
    2531// Sets the default values for platform dependent flags used by the server compiler.
    2632// (see c2_globals.hpp).  Alpha-sorted.
     
    3844#endif // CC_INTERP
    3945define_pd_global(bool, TieredCompilation,            false);
    40 #ifdef TIERED
    41 define_pd_global(intx, CompileThreshold,             1000);
    42 define_pd_global(intx, BackEdgeThreshold,            14000);
    43 #else
    4446define_pd_global(intx, CompileThreshold,             10000);
    4547define_pd_global(intx, BackEdgeThreshold,            140000);
    46 #endif // TIERED
    47 
    48 define_pd_global(intx, Tier2CompileThreshold,        10000); // unused level
    49 define_pd_global(intx, Tier3CompileThreshold,        10000);
    50 define_pd_global(intx, Tier4CompileThreshold,        40000);
    51 
    52 define_pd_global(intx, Tier2BackEdgeThreshold,       100000);
    53 define_pd_global(intx, Tier3BackEdgeThreshold,       100000);
    54 define_pd_global(intx, Tier4BackEdgeThreshold,       100000);
    5548
    5649define_pd_global(intx, OnStackReplacePercentage,     140);
     
    10295// Ergonomics related flags
    10396define_pd_global(bool, NeverActAsServerClassMachine, false);
     97
     98#endif // CPU_SPARC_VM_C2_GLOBALS_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/c2_init_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_c2_init_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "opto/compile.hpp"
     27#include "opto/node.hpp"
    2728
    2829// processor dependent initialization for sparc
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/codeBuffer_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_CODEBUFFER_SPARC_HPP
     26#define CPU_SPARC_VM_CODEBUFFER_SPARC_HPP
     27
    2528private:
    2629  void pd_initialize() {}
     
    3134  // Heuristic for pre-packing the pt/pn bit of a predicted branch.
    3235  bool is_backward_branch(Label& L) {
    33     return L.is_bound() && code_end() <= locator_address(L.loc());
     36    return L.is_bound() && insts_end() <= locator_address(L.loc());
    3437  }
     38
     39#endif // CPU_SPARC_VM_CODEBUFFER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/copy_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_COPY_SPARC_HPP
     26#define CPU_SPARC_VM_COPY_SPARC_HPP
    2427
    2528// Inline functions for memory copy and fill.
     
    187190  (void)memset(to, 0, count);
    188191}
     192
     193#endif // CPU_SPARC_VM_COPY_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/cppInterpreterGenerator_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_CPPINTERPRETERGENERATOR_SPARC_HPP
     26#define CPU_SPARC_VM_CPPINTERPRETERGENERATOR_SPARC_HPP
     27
    2528  static address frame_manager_return;
    2629  static address frame_manager_sync_return;
     
    3336                                          const Register prev_state,
    3437                                          bool native);
     38
     39#endif // CPU_SPARC_VM_CPPINTERPRETERGENERATOR_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_cppInterpreter_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "asm/assembler.hpp"
     27#include "interpreter/bytecodeHistogram.hpp"
     28#include "interpreter/cppInterpreter.hpp"
     29#include "interpreter/interpreter.hpp"
     30#include "interpreter/interpreterGenerator.hpp"
     31#include "interpreter/interpreterRuntime.hpp"
     32#include "oops/arrayOop.hpp"
     33#include "oops/methodDataOop.hpp"
     34#include "oops/methodOop.hpp"
     35#include "oops/oop.inline.hpp"
     36#include "prims/jvmtiExport.hpp"
     37#include "prims/jvmtiThreadState.hpp"
     38#include "runtime/arguments.hpp"
     39#include "runtime/deoptimization.hpp"
     40#include "runtime/frame.inline.hpp"
     41#include "runtime/interfaceSupport.hpp"
     42#include "runtime/sharedRuntime.hpp"
     43#include "runtime/stubRoutines.hpp"
     44#include "runtime/synchronizer.hpp"
     45#include "runtime/timer.hpp"
     46#include "runtime/vframeArray.hpp"
     47#include "utilities/debug.hpp"
     48#ifdef SHARK
     49#include "shark/shark_globals.hpp"
     50#endif
    2751
    2852#ifdef CC_INTERP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.hpp

    r278 r309  
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_CPPINTERPRETER_SPARC_HPP
     26#define CPU_SPARC_VM_CPPINTERPRETER_SPARC_HPP
     27
    2528  // Size of interpreter code.  Increase if too small.  Interpreter will
    2629  // fail with a guarantee ("not enough space for interpreter generation");
     
    3841  const static int InterpreterCodeSize = 180 * K;
    3942#endif
     43
     44#endif // CPU_SPARC_VM_CPPINTERPRETER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/debug_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_debug_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "code/codeCache.hpp"
     27#include "code/nmethod.hpp"
     28#include "runtime/frame.hpp"
     29#include "runtime/init.hpp"
     30#include "runtime/os.hpp"
     31#include "utilities/debug.hpp"
     32#include "utilities/top.hpp"
    2733
    2834#ifndef PRODUCT
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/depChecker_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_depChecker_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "compiler/disassembler.hpp"
     27#include "depChecker_sparc.hpp"
    2728
    2829// Nothing to do on Sparc
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/depChecker_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_DEPCHECKER_SPARC_HPP
     26#define CPU_SPARC_VM_DEPCHECKER_SPARC_HPP
     27
    2528// Nothing to do on Sparc
     29
     30#endif // CPU_SPARC_VM_DEPCHECKER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/disassembler_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_DISASSEMBLER_SPARC_HPP
     26#define CPU_SPARC_VM_DISASSEMBLER_SPARC_HPP
     27
    2528  static int pd_instruction_alignment() {
    2629    return sizeof(int);
     
    3134            (VM_Version::v8_instructions_work()? "" : "v9only") : "v8only");
    3235  }
     36
     37#endif // CPU_SPARC_VM_DISASSEMBLER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/dump_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_dump_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "assembler_sparc.inline.hpp"
     27#include "memory/compactingPermGenGen.hpp"
     28#include "memory/generation.inline.hpp"
     29#include "memory/space.inline.hpp"
    2730
    2831
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/frame_sparc.cpp

    r278 r309  
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_frame_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "interpreter/interpreter.hpp"
     27#include "memory/resourceArea.hpp"
     28#include "oops/markOop.hpp"
     29#include "oops/methodOop.hpp"
     30#include "oops/oop.inline.hpp"
     31#include "runtime/frame.inline.hpp"
     32#include "runtime/handles.inline.hpp"
     33#include "runtime/javaCalls.hpp"
     34#include "runtime/monitorChunk.hpp"
     35#include "runtime/signature.hpp"
     36#include "runtime/stubCodeGenerator.hpp"
     37#include "runtime/stubRoutines.hpp"
     38#include "vmreg_sparc.inline.hpp"
     39#ifdef COMPILER1
     40#include "c1/c1_Runtime1.hpp"
     41#include "runtime/vframeArray.hpp"
     42#endif
    2743
    2844void RegisterMap::pd_clear() {
     
    254270
    255271    // Could just be some random pointer within the codeBlob
    256     if (!sender.cb()->instructions_contains(sender_pc)) return false;
     272    if (!sender.cb()->code_contains(sender_pc)) {
     273      return false;
     274    }
    257275
    258276    // We should never be able to see an adapter if the current frame is something from code cache
    259 
    260     if ( sender_blob->is_adapter_blob()) {
     277    if (sender_blob->is_adapter_blob()) {
    261278      return false;
    262279    }
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/frame_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_FRAME_SPARC_HPP
     26#define CPU_SPARC_VM_FRAME_SPARC_HPP
     27
     28#include "runtime/synchronizer.hpp"
     29#include "utilities/top.hpp"
    2430
    2531// A frame represents a physical stack frame (an activation).  Frames can be
     
    264270
    265271 private:
    266 
    267   constantPoolCacheOop* frame::interpreter_frame_cpoolcache_addr() const;
     272  constantPoolCacheOop* interpreter_frame_cpoolcache_addr() const;
    268273
    269274#ifndef CC_INTERP
     
    311316#endif
    312317  }
     318
     319#endif // CPU_SPARC_VM_FRAME_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_FRAME_SPARC_INLINE_HPP
     26#define CPU_SPARC_VM_FRAME_SPARC_INLINE_HPP
    2427
    2528// Inline functions for SPARC frames:
     
    296299  *((oop*) map->location(O0->as_VMReg())) = obj;
    297300}
     301
     302#endif // CPU_SPARC_VM_FRAME_SPARC_INLINE_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_GLOBALDEFINITIONS_SPARC_HPP
     26#define CPU_SPARC_VM_GLOBALDEFINITIONS_SPARC_HPP
     27
    2528// Size of Sparc Instructions
    2629const int BytesPerInstWord = 4;
    2730
    2831const int StackAlignmentInBytes = (2*wordSize);
     32
     33#endif // CPU_SPARC_VM_GLOBALDEFINITIONS_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/globals_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_GLOBALS_SPARC_HPP
     26#define CPU_SPARC_VM_GLOBALS_SPARC_HPP
     27
     28#include "utilities/globalDefinitions.hpp"
     29#include "utilities/macros.hpp"
    2430
    2531// Sets the default values for platform dependent flags used by the runtime system.
     
    6369define_pd_global(bool, RewriteBytecodes,     true);
    6470define_pd_global(bool, RewriteFrequentPairs, true);
     71
     72define_pd_global(bool, UseMembar,            false);
     73
     74#endif // CPU_SPARC_VM_GLOBALS_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/icBuffer_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_icBuffer_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "asm/assembler.hpp"
     27#include "assembler_sparc.inline.hpp"
     28#include "code/icBuffer.hpp"
     29#include "gc_interface/collectedHeap.inline.hpp"
     30#include "interpreter/bytecodes.hpp"
     31#include "memory/resourceArea.hpp"
     32#include "nativeInst_sparc.hpp"
     33#include "oops/oop.inline.hpp"
     34#include "oops/oop.inline2.hpp"
    2735
    2836int InlineCacheBuffer::ic_stub_code_size() {
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/icache_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_icache_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "assembler_sparc.inline.hpp"
     27#include "runtime/icache.hpp"
    2728
    2829#define __ _masm->
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/icache_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_ICACHE_SPARC_HPP
     26#define CPU_SPARC_VM_ICACHE_SPARC_HPP
     27
    2528// Interface for updating the instruction cache.  Whenever the VM modifies
    2629// code, part of the processor instruction cache potentially has to be flushed.
     
    3740  // Use default implementation
    3841};
     42
     43#endif // CPU_SPARC_VM_ICACHE_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_interp_masm_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "interp_masm_sparc.hpp"
     27#include "interpreter/interpreter.hpp"
     28#include "interpreter/interpreterRuntime.hpp"
     29#include "oops/arrayOop.hpp"
     30#include "oops/markOop.hpp"
     31#include "oops/methodDataOop.hpp"
     32#include "oops/methodOop.hpp"
     33#include "prims/jvmtiExport.hpp"
     34#include "prims/jvmtiRedefineClassesTrace.hpp"
     35#include "prims/jvmtiThreadState.hpp"
     36#include "runtime/basicLock.hpp"
     37#include "runtime/biasedLocking.hpp"
     38#include "runtime/sharedRuntime.hpp"
     39#ifdef TARGET_OS_FAMILY_linux
     40# include "thread_linux.inline.hpp"
     41#endif
     42#ifdef TARGET_OS_FAMILY_solaris
     43# include "thread_solaris.inline.hpp"
     44#endif
    2745
    2846#ifndef CC_INTERP
     
    12781296// specified register to its value.
    12791297
    1280 void InterpreterMacroAssembler::set_method_data_pointer_offset(Register Roff) {
     1298void InterpreterMacroAssembler::set_method_data_pointer() {
    12811299  assert(ProfileInterpreter, "must be profiling interpreter");
    12821300  Label get_continue;
     
    12851303  test_method_data_pointer(get_continue);
    12861304  add(ImethodDataPtr, in_bytes(methodDataOopDesc::data_offset()), ImethodDataPtr);
    1287   if (Roff != noreg)
    1288     // Roff contains a method data index ("mdi").  It defaults to zero.
    1289     add(ImethodDataPtr, Roff, ImethodDataPtr);
    12901305  bind(get_continue);
    12911306}
     
    12981313
    12991314  // Test MDO to avoid the call if it is NULL.
    1300   ld_ptr(Lmethod, methodOopDesc::method_data_offset(), ImethodDataPtr);
     1315  ld_ptr(Lmethod, in_bytes(methodOopDesc::method_data_offset()), ImethodDataPtr);
    13011316  test_method_data_pointer(zero_continue);
    13021317  call_VM_leaf(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), Lmethod, Lbcp);
    1303   set_method_data_pointer_offset(O0);
     1318  add(ImethodDataPtr, in_bytes(methodDataOopDesc::data_offset()), ImethodDataPtr);
     1319  add(ImethodDataPtr, O0, ImethodDataPtr);
    13041320  bind(zero_continue);
    13051321}
     
    13521368
    13531369void InterpreterMacroAssembler::test_invocation_counter_for_mdp(Register invocation_count,
    1354                                                                 Register cur_bcp,
    13551370                                                                Register Rtmp,
    13561371                                                                Label &profile_continue) {
     
    13831398
    13841399  // Build it now.
    1385   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method), cur_bcp);
    1386   set_method_data_pointer_offset(O0);
     1400  call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
     1401  set_method_data_pointer_for_bcp();
    13871402  ba(false, profile_continue);
    13881403  delayed()->nop();
     
    24322447#endif // CC_INTERP
    24332448}
     2449
     2450// Jump if ((*counter_addr += increment) & mask) satisfies the condition.
     2451void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr,
     2452                                                        int increment, int mask,
     2453                                                        Register scratch1, Register scratch2,
     2454                                                        Condition cond, Label *where) {
     2455  ld(counter_addr, scratch1);
     2456  add(scratch1, increment, scratch1);
     2457  if (is_simm13(mask)) {
     2458    andcc(scratch1, mask, G0);
     2459  } else {
     2460    set(mask, scratch2);
     2461    andcc(scratch1, scratch2,  G0);
     2462  }
     2463  br(cond, false, Assembler::pn, *where);
     2464  delayed()->st(scratch1, counter_addr);
     2465}
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/interp_masm_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_INTERP_MASM_SPARC_HPP
     26#define CPU_SPARC_VM_INTERP_MASM_SPARC_HPP
     27
     28#include "assembler_sparc.inline.hpp"
     29#include "interpreter/invocationCounter.hpp"
    2430
    2531// This file specializes the assember with interpreter-specific macros
     
    264270#ifndef CC_INTERP
    265271  // Interpreter profiling operations
    266   void set_method_data_pointer() { set_method_data_pointer_offset(noreg); }
     272  void set_method_data_pointer();
    267273  void set_method_data_pointer_for_bcp();
    268   void set_method_data_pointer_offset(Register mdi_reg);
    269274  void test_method_data_pointer(Label& zero_continue);
    270275  void verify_method_data_pointer();
    271   void test_invocation_counter_for_mdp(Register invocation_count, Register cur_bcp, Register Rtmp, Label &profile_continue);
     276  void test_invocation_counter_for_mdp(Register invocation_count, Register Rtmp, Label &profile_continue);
    272277
    273278  void set_mdp_data_at(int constant, Register value);
     
    279284                             Register bumped_count, Register scratch2,
    280285                             bool decrement = false);
     286  void increment_mask_and_jump(Address counter_addr,
     287                               int increment, int mask,
     288                               Register scratch1, Register scratch2,
     289                               Condition cond, Label *where);
    281290  void set_mdp_flag_at(int flag_constant, Register scratch);
    282291  void test_mdp_data_at(int offset, Register value, Label& not_equal_continue,
     
    322331  void save_return_value(TosState state, bool is_native_call);
    323332  void restore_return_value(TosState state, bool is_native_call);
     333
    324334};
     335
     336#endif // CPU_SPARC_VM_INTERP_MASM_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/interpreterGenerator_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_INTERPRETERGENERATOR_SPARC_HPP
     26#define CPU_SPARC_VM_INTERPRETERGENERATOR_SPARC_HPP
     27
    2528 friend class AbstractInterpreterGenerator;
    2629
     
    4043  void generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue);
    4144  void generate_counter_overflow(Label& Lcontinue);
     45
     46#endif // CPU_SPARC_VM_INTERPRETERGENERATOR_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp

    r278 r309  
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_interpreterRT_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "interpreter/interpreter.hpp"
     27#include "interpreter/interpreterRuntime.hpp"
     28#include "memory/allocation.inline.hpp"
     29#include "memory/universe.inline.hpp"
     30#include "oops/methodOop.hpp"
     31#include "oops/oop.inline.hpp"
     32#include "runtime/handles.inline.hpp"
     33#include "runtime/icache.hpp"
     34#include "runtime/interfaceSupport.hpp"
     35#include "runtime/signature.hpp"
    2736
    2837
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_INTERPRETERRT_SPARC_HPP
     26#define CPU_SPARC_VM_INTERPRETERRT_SPARC_HPP
     27
     28#include "memory/allocation.hpp"
    2429
    2530static int binary_search(int key, LookupswitchPair* array, int n);
     
    5560  void generate( uint64_t fingerprint );
    5661};
     62
     63#endif // CPU_SPARC_VM_INTERPRETERRT_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp

    r278 r309  
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_interpreter_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "asm/assembler.hpp"
     27#include "interpreter/bytecodeHistogram.hpp"
     28#include "interpreter/interpreter.hpp"
     29#include "interpreter/interpreterGenerator.hpp"
     30#include "interpreter/interpreterRuntime.hpp"
     31#include "interpreter/templateTable.hpp"
     32#include "oops/arrayOop.hpp"
     33#include "oops/methodDataOop.hpp"
     34#include "oops/methodOop.hpp"
     35#include "oops/oop.inline.hpp"
     36#include "prims/jvmtiExport.hpp"
     37#include "prims/jvmtiThreadState.hpp"
     38#include "prims/methodHandles.hpp"
     39#include "runtime/arguments.hpp"
     40#include "runtime/deoptimization.hpp"
     41#include "runtime/frame.inline.hpp"
     42#include "runtime/sharedRuntime.hpp"
     43#include "runtime/stubRoutines.hpp"
     44#include "runtime/synchronizer.hpp"
     45#include "runtime/timer.hpp"
     46#include "runtime/vframeArray.hpp"
     47#include "utilities/debug.hpp"
     48#ifdef COMPILER1
     49#include "c1/c1_Runtime1.hpp"
     50#endif
    2751
    2852
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/interpreter_sparc.hpp

    r278 r309  
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_INTERPRETER_SPARC_HPP
     26#define CPU_SPARC_VM_INTERPRETER_SPARC_HPP
     27
    2528 public:
    2629
     
    3538    return stackElementWords * i;
    3639  }
     40
     41#endif // CPU_SPARC_VM_INTERPRETER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/javaFrameAnchor_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_JAVAFRAMEANCHOR_SPARC_HPP
     26#define CPU_SPARC_VM_JAVAFRAMEANCHOR_SPARC_HPP
    2427
    2528private:
     
    98101    OrderAccess::fence();
    99102  }
     103
     104#endif // CPU_SPARC_VM_JAVAFRAMEANCHOR_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/jniFastGetField_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_jniFastGetField_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "assembler_sparc.inline.hpp"
     27#include "memory/resourceArea.hpp"
     28#include "prims/jniFastGetField.hpp"
     29#include "prims/jvm_misc.hpp"
     30#include "runtime/safepoint.hpp"
    2731
    2832// TSO ensures that loads are blocking and ordered with respect to
     
    5155  }
    5256  ResourceMark rm;
    53   BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
    54   address fast_entry = b->instructions_begin();
    55   CodeBuffer cbuf(fast_entry, b->instructions_size());
     57  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
     58  CodeBuffer cbuf(blob);
    5659  MacroAssembler* masm = new MacroAssembler(&cbuf);
     60  address fast_entry = __ pc();
    5761
    5862  Label label1, label2;
     
    130134  const char *name = "jni_fast_GetLongField";
    131135  ResourceMark rm;
    132   BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
    133   address fast_entry = b->instructions_begin();
    134   CodeBuffer cbuf(fast_entry, b->instructions_size());
     136  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
     137  CodeBuffer cbuf(blob);
    135138  MacroAssembler* masm = new MacroAssembler(&cbuf);
     139  address fast_entry = __ pc();
    136140
    137141  Label label1, label2;
     
    202206  }
    203207  ResourceMark rm;
    204   BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
    205   address fast_entry = b->instructions_begin();
    206   CodeBuffer cbuf(fast_entry, b->instructions_size());
     208  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
     209  CodeBuffer cbuf(blob);
    207210  MacroAssembler* masm = new MacroAssembler(&cbuf);
     211  address fast_entry = __ pc();
    208212
    209213  Label label1, label2;
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/jniTypes_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_JNITYPES_SPARC_HPP
     26#define CPU_SPARC_VM_JNITYPES_SPARC_HPP
     27
     28#include "memory/allocation.hpp"
     29#include "oops/oop.hpp"
     30#include "prims/jni.h"
    2431
    2532// This file holds platform-dependent routines used to write primitive jni
     
    107114
    108115};
     116
     117#endif // CPU_SPARC_VM_JNITYPES_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/jni_sparc.h

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_methodHandles_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "interpreter/interpreter.hpp"
     27#include "memory/allocation.inline.hpp"
     28#include "prims/methodHandles.hpp"
    2729
    2830#define __ _masm->
     31
     32#ifdef PRODUCT
     33#define BLOCK_COMMENT(str) /* nothing */
     34#else
     35#define BLOCK_COMMENT(str) __ block_comment(str)
     36#endif
     37
     38#define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
    2939
    3040address MethodHandleEntry::start_compiled_entry(MacroAssembler* _masm,
     
    6373// Code generation
    6474address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* _masm) {
    65   // I5_savedSP: sender SP (must preserve)
     75  // I5_savedSP/O5_savedSP: sender SP (must preserve)
    6676  // G4 (Gargs): incoming argument list (must preserve)
    67   // G5_method:  invoke methodOop; becomes method type.
     77  // G5_method:  invoke methodOop
    6878  // G3_method_handle: receiver method handle (must load from sp[MethodTypeForm.vmslots])
    69   // O0, O1: garbage temps, blown away
    70   Register O0_argslot = O0;
     79  // O0, O1, O2, O3, O4: garbage temps, blown away
     80  Register O0_mtype  = O0;
    7181  Register O1_scratch = O1;
     82  Register O2_scratch = O2;
     83  Register O3_scratch = O3;
     84  Register O4_argslot = O4;
     85  Register O4_argbase = O4;
    7286
    7387  // emit WrongMethodType path first, to enable back-branch from main path
    7488  Label wrong_method_type;
    7589  __ bind(wrong_method_type);
     90  Label invoke_generic_slow_path;
     91  assert(methodOopDesc::intrinsic_id_size_in_bytes() == sizeof(u1), "");;
     92  __ ldub(Address(G5_method, methodOopDesc::intrinsic_id_offset_in_bytes()), O1_scratch);
     93  __ cmp(O1_scratch, (int) vmIntrinsics::_invokeExact);
     94  __ brx(Assembler::notEqual, false, Assembler::pt, invoke_generic_slow_path);
     95  __ delayed()->nop();
     96  __ mov(O0_mtype, G5_method_type);  // required by throw_WrongMethodType
     97  // mov(G3_method_handle, G3_method_handle);  // already in this register
    7698  __ jump_to(AddressLiteral(Interpreter::throw_WrongMethodType_entry()), O1_scratch);
    7799  __ delayed()->nop();
     
    81103  address entry_point = __ pc();
    82104
    83   // fetch the MethodType from the method handle into G5_method_type
     105  // fetch the MethodType from the method handle
    84106  {
    85107    Register tem = G5_method;
    86     assert(tem == G5_method_type, "yes, it's the same register");
    87108    for (jint* pchase = methodOopDesc::method_type_offsets_chain(); (*pchase) != -1; pchase++) {
    88       __ ld_ptr(Address(tem, *pchase), G5_method_type);
     109      __ ld_ptr(Address(tem, *pchase), O0_mtype);
     110      tem = O0_mtype;          // in case there is another indirection
    89111    }
    90112  }
    91113
    92114  // given the MethodType, find out where the MH argument is buried
    93   __ ld_ptr(Address(G5_method_type, __ delayed_value(java_dyn_MethodType::form_offset_in_bytes, O1_scratch)),        O0_argslot);
    94   __ ldsw(  Address(O0_argslot,     __ delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, O1_scratch)), O0_argslot);
    95   __ ld_ptr(__ argument_address(O0_argslot), G3_method_handle);
    96 
    97   __ check_method_handle_type(G5_method_type, G3_method_handle, O1_scratch, wrong_method_type);
     115  __ load_heap_oop(Address(O0_mtype,   __ delayed_value(java_dyn_MethodType::form_offset_in_bytes,        O1_scratch)), O4_argslot);
     116  __ ldsw(         Address(O4_argslot, __ delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, O1_scratch)), O4_argslot);
     117  __ add(Gargs, __ argument_offset(O4_argslot, 1), O4_argbase);
     118  // Note: argument_address uses its input as a scratch register!
     119  __ ld_ptr(Address(O4_argbase, -Interpreter::stackElementSize), G3_method_handle);
     120
     121  trace_method_handle(_masm, "invokeExact");
     122
     123  __ check_method_handle_type(O0_mtype, G3_method_handle, O1_scratch, wrong_method_type);
    98124  __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
     125
     126  // for invokeGeneric (only), apply argument and result conversions on the fly
     127  __ bind(invoke_generic_slow_path);
     128#ifdef ASSERT
     129  { Label L;
     130    __ ldub(Address(G5_method, methodOopDesc::intrinsic_id_offset_in_bytes()), O1_scratch);
     131    __ cmp(O1_scratch, (int) vmIntrinsics::_invokeGeneric);
     132    __ brx(Assembler::equal, false, Assembler::pt, L);
     133    __ delayed()->nop();
     134    __ stop("bad methodOop::intrinsic_id");
     135    __ bind(L);
     136  }
     137#endif //ASSERT
     138
     139  // make room on the stack for another pointer:
     140  insert_arg_slots(_masm, 2 * stack_move_unit(), _INSERT_REF_MASK, O4_argbase, O1_scratch, O2_scratch, O3_scratch);
     141  // load up an adapter from the calling type (Java weaves this)
     142  Register O2_form    = O2_scratch;
     143  Register O3_adapter = O3_scratch;
     144  __ load_heap_oop(Address(O0_mtype, __ delayed_value(java_dyn_MethodType::form_offset_in_bytes,               O1_scratch)), O2_form);
     145  // load_heap_oop(Address(O2_form,  __ delayed_value(java_dyn_MethodTypeForm::genericInvoker_offset_in_bytes, O1_scratch)), O3_adapter);
     146  // deal with old JDK versions:
     147  __ add(          Address(O2_form,  __ delayed_value(java_dyn_MethodTypeForm::genericInvoker_offset_in_bytes, O1_scratch)), O3_adapter);
     148  __ cmp(O3_adapter, O2_form);
     149  Label sorry_no_invoke_generic;
     150  __ brx(Assembler::lessUnsigned, false, Assembler::pn, sorry_no_invoke_generic);
     151  __ delayed()->nop();
     152
     153  __ load_heap_oop(Address(O3_adapter, 0), O3_adapter);
     154  __ tst(O3_adapter);
     155  __ brx(Assembler::zero, false, Assembler::pn, sorry_no_invoke_generic);
     156  __ delayed()->nop();
     157  __ st_ptr(O3_adapter, Address(O4_argbase, 1 * Interpreter::stackElementSize));
     158  // As a trusted first argument, pass the type being called, so the adapter knows
     159  // the actual types of the arguments and return values.
     160  // (Generic invokers are shared among form-families of method-type.)
     161  __ st_ptr(O0_mtype,   Address(O4_argbase, 0 * Interpreter::stackElementSize));
     162  // FIXME: assert that O3_adapter is of the right method-type.
     163  __ mov(O3_adapter, G3_method_handle);
     164  trace_method_handle(_masm, "invokeGeneric");
     165  __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
     166
     167  __ bind(sorry_no_invoke_generic); // no invokeGeneric implementation available!
     168  __ mov(O0_mtype, G5_method_type);  // required by throw_WrongMethodType
     169  // mov(G3_method_handle, G3_method_handle);  // already in this register
     170  __ jump_to(AddressLiteral(Interpreter::throw_WrongMethodType_entry()), O1_scratch);
     171  __ delayed()->nop();
    99172
    100173  return entry_point;
     
    106179  // Verify that argslot lies within (Gargs, FP].
    107180  Label L_ok, L_bad;
     181  BLOCK_COMMENT("{ verify_argslot");
    108182#ifdef _LP64
    109183  __ add(FP, STACK_BIAS, temp_reg);
     
    120194  __ stop(error_message);
    121195  __ bind(L_ok);
     196  BLOCK_COMMENT("} verify_argslot");
    122197}
    123198#endif
     
    176251  //     temp[-size] = temp[0]
    177252  //   argslot -= size;
     253  BLOCK_COMMENT("insert_arg_slots {");
    178254  RegisterOrConstant offset = __ regcon_sll_ptr(arg_slots, LogBytesPerWord, temp3_reg);
    179255
     
    188264  {
    189265    Label loop;
    190     __ bind(loop);
     266    __ BIND(loop);
    191267    // pull one word down each time through the loop
    192268    __ ld_ptr(Address(temp_reg, 0), temp2_reg);
     
    200276  // Now move the argslot down, to point to the opened-up space.
    201277  __ add(argslot_reg, offset, argslot_reg);
     278  BLOCK_COMMENT("} insert_arg_slots");
    202279}
    203280
     
    236313#endif // ASSERT
    237314
     315  BLOCK_COMMENT("remove_arg_slots {");
    238316  // Pull up everything shallower than argslot.
    239317  // Then remove the excess space on the stack.
     
    247325  {
    248326    Label loop;
    249     __ bind(loop);
     327    __ BIND(loop);
    250328    // pull one word up each time through the loop
    251329    __ ld_ptr(Address(temp_reg, 0), temp2_reg);
     
    266344  RegisterOrConstant masked_offset = __ regcon_andn_ptr(offset, TwoWordAlignmentMask, temp_reg);
    267345  __ add(SP, masked_offset, SP);
     346  BLOCK_COMMENT("} remove_arg_slots");
    268347}
    269348
     
    272351extern "C" void print_method_handle(oop mh);
    273352void trace_method_handle_stub(const char* adaptername,
    274                               oop mh) {
    275 #if 0
    276                               intptr_t* entry_sp,
    277                               intptr_t* saved_sp,
    278                               intptr_t* saved_bp) {
    279   // called as a leaf from native code: do not block the JVM!
    280   intptr_t* last_sp = (intptr_t*) saved_bp[frame::interpreter_frame_last_sp_offset];
    281   intptr_t* base_sp = (intptr_t*) saved_bp[frame::interpreter_frame_monitor_block_top_offset];
    282   printf("MH %s mh="INTPTR_FORMAT" sp=("INTPTR_FORMAT"+"INTX_FORMAT") stack_size="INTX_FORMAT" bp="INTPTR_FORMAT"\n",
    283          adaptername, (intptr_t)mh, (intptr_t)entry_sp, (intptr_t)(saved_sp - entry_sp), (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp);
    284   if (last_sp != saved_sp)
    285     printf("*** last_sp="INTPTR_FORMAT"\n", (intptr_t)last_sp);
    286 #endif
    287 
     353                              oopDesc* mh) {
    288354  printf("MH %s mh="INTPTR_FORMAT"\n", adaptername, (intptr_t) mh);
    289355  print_method_handle(mh);
     356}
     357void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
     358  if (!TraceMethodHandles)  return;
     359  BLOCK_COMMENT("trace_method_handle {");
     360  // save: Gargs, O5_savedSP
     361  __ save_frame(16);
     362  __ set((intptr_t) adaptername, O0);
     363  __ mov(G3_method_handle, O1);
     364  __ mov(G3_method_handle, L3);
     365  __ mov(Gargs, L4);
     366  __ mov(G5_method_type, L5);
     367  __ call_VM_leaf(L7, CAST_FROM_FN_PTR(address, trace_method_handle_stub));
     368
     369  __ mov(L3, G3_method_handle);
     370  __ mov(L4, Gargs);
     371  __ mov(L5, G5_method_type);
     372  __ restore();
     373  BLOCK_COMMENT("} trace_method_handle");
    290374}
    291375#endif // PRODUCT
     
    319403  // - O5_savedSP: sender SP (must preserve)
    320404
    321   Register O0_argslot = O0;
    322   Register O1_scratch = O1;
    323   Register O2_scratch = O2;
    324   Register O3_scratch = O3;
    325   Register G5_index   = G5;
     405  const Register O0_argslot = O0;
     406  const Register O1_scratch = O1;
     407  const Register O2_scratch = O2;
     408  const Register O3_scratch = O3;
     409  const Register G5_index   = G5;
     410
     411  // Argument registers for _raise_exception.
     412  const Register O0_code     = O0;
     413  const Register O1_actual   = O1;
     414  const Register O2_required = O2;
    326415
    327416  guarantee(java_dyn_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets");
     
    349438
    350439  address interp_entry = __ pc();
    351   if (UseCompressedOops)  __ unimplemented("UseCompressedOops");
    352 
    353 #ifndef PRODUCT
    354   if (TraceMethodHandles) {
    355     // save: Gargs, O5_savedSP
    356     __ save(SP, -16*wordSize, SP);
    357     __ set((intptr_t) entry_name(ek), O0);
    358     __ mov(G3_method_handle, O1);
    359     __ call_VM_leaf(Lscratch, CAST_FROM_FN_PTR(address, trace_method_handle_stub));
    360     __ restore(SP, 16*wordSize, SP);
    361   }
    362 #endif // PRODUCT
     440
     441  trace_method_handle(_masm, entry_name(ek));
    363442
    364443  switch ((int) ek) {
     
    366445    {
    367446      // Not a real MH entry, but rather shared code for raising an
    368       // exception.  Extra local arguments are passed in scratch
    369       // registers, as required type in O3, failing object (or NULL)
    370       // in O2, failing bytecode type in O1.
     447      // exception.  Since we use a C2I adapter to set up the
     448      // interpreter state, arguments are expected in compiler
     449      // argument registers.
     450      assert(raise_exception_method(), "must be set");
     451      address c2i_entry = raise_exception_method()->get_c2i_entry();
     452      assert(c2i_entry, "method must be linked");
    371453
    372454      __ mov(O5_savedSP, SP);  // Cut the stack back to where the caller started.
    373455
    374       // Push arguments as if coming from the interpreter.
    375       Register O0_scratch = O0_argslot;
    376       int stackElementSize = Interpreter::stackElementSize;
    377 
    378       // Make space on the stack for the arguments and set Gargs
    379       // correctly.
    380       __ sub(SP, 4*stackElementSize, SP);  // Keep stack aligned.
    381       __ add(SP, (frame::varargs_offset)*wordSize - 1*Interpreter::stackElementSize + STACK_BIAS + BytesPerWord, Gargs);
    382 
    383       // void raiseException(int code, Object actual, Object required)
    384       __ st(    O1_scratch, Address(Gargs, 2*stackElementSize));  // code
    385       __ st_ptr(O2_scratch, Address(Gargs, 1*stackElementSize));  // actual
    386       __ st_ptr(O3_scratch, Address(Gargs, 0*stackElementSize));  // required
    387 
    388       Label no_method;
     456      Label L_no_method;
    389457      // FIXME: fill in _raise_exception_method with a suitable sun.dyn method
    390458      __ set(AddressLiteral((address) &_raise_exception_method), G5_method);
    391459      __ ld_ptr(Address(G5_method, 0), G5_method);
    392460      __ tst(G5_method);
    393       __ brx(Assembler::zero, false, Assembler::pn, no_method);
     461      __ brx(Assembler::zero, false, Assembler::pn, L_no_method);
    394462      __ delayed()->nop();
    395463
    396       int jobject_oop_offset = 0;
     464      const int jobject_oop_offset = 0;
    397465      __ ld_ptr(Address(G5_method, jobject_oop_offset), G5_method);
    398466      __ tst(G5_method);
    399       __ brx(Assembler::zero, false, Assembler::pn, no_method);
     467      __ brx(Assembler::zero, false, Assembler::pn, L_no_method);
    400468      __ delayed()->nop();
    401469
    402470      __ verify_oop(G5_method);
    403       __ jump_indirect_to(G5_method_fie, O1_scratch);
     471      __ jump_to(AddressLiteral(c2i_entry), O3_scratch);
    404472      __ delayed()->nop();
    405473
    406474      // If we get here, the Java runtime did not do its job of creating the exception.
    407475      // Do something that is at least causes a valid throw from the interpreter.
    408       __ bind(no_method);
    409       __ unimplemented("_raise_exception no method");
     476      __ bind(L_no_method);
     477      __ unimplemented("call throw_WrongMethodType_entry");
    410478    }
    411479    break;
     
    414482  case _invokespecial_mh:
    415483    {
    416       __ ld_ptr(G3_mh_vmtarget, G5_method);  // target is a methodOop
     484      __ load_heap_oop(G3_mh_vmtarget, G5_method);  // target is a methodOop
    417485      __ verify_oop(G5_method);
    418486      // Same as TemplateTable::invokestatic or invokespecial,
     
    469537      __ load_method_handle_vmslots(O0_argslot, G3_method_handle, O1_scratch);
    470538      Register O1_intf  = O1_scratch;
    471       __ ld_ptr(G3_mh_vmtarget, O1_intf);
     539      __ load_heap_oop(G3_mh_vmtarget, O1_intf);
    472540      __ ldsw(G3_dmh_vmindex, G5_index);
    473541      __ ld_ptr(__ argument_address(O0_argslot, -1), G3_method_handle);
     
    497565      // For historical reasons, it will be IncompatibleClassChangeError.
    498566      __ unimplemented("not tested yet");
    499       __ ld_ptr(Address(O1_intf, java_mirror_offset), O3_scratch);  // required interface
    500       __ mov(O0_klass, O2_scratch);  // bad receiver
    501       __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O0_argslot);
    502       __ delayed()->mov(Bytecodes::_invokeinterface, O1_scratch);  // who is complaining?
     567      __ ld_ptr(Address(O1_intf, java_mirror_offset), O2_required);  // required interface
     568      __ mov(   O0_klass,                             O1_actual);    // bad receiver
     569      __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O3_scratch);
     570      __ delayed()->mov(Bytecodes::_invokeinterface,  O0_code);      // who is complaining?
    503571    }
    504572    break;
     
    524592
    525593      // Store bound argument into the new stack slot:
    526       __ ld_ptr(G3_bmh_argument, O1_scratch);
     594      __ load_heap_oop(G3_bmh_argument, O1_scratch);
    527595      if (arg_type == T_OBJECT) {
    528596        __ st_ptr(O1_scratch, Address(O0_argslot, 0));
     
    542610
    543611      if (direct_to_method) {
    544         __ ld_ptr(G3_mh_vmtarget, G5_method);  // target is a methodOop
     612        __ load_heap_oop(G3_mh_vmtarget, G5_method);  // target is a methodOop
    545613        __ verify_oop(G5_method);
    546614        __ jump_indirect_to(G5_method_fie, O1_scratch);
    547615        __ delayed()->nop();
    548616      } else {
    549         __ ld_ptr(G3_mh_vmtarget, G3_method_handle);  // target is a methodOop
     617        __ load_heap_oop(G3_mh_vmtarget, G3_method_handle);  // target is a methodOop
    550618        __ verify_oop(G3_method_handle);
    551619        __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
     
    557625  case _adapter_retype_raw:
    558626    // Immediately jump to the next MH layer:
    559     __ ld_ptr(G3_mh_vmtarget, G3_method_handle);
     627    __ load_heap_oop(G3_mh_vmtarget, G3_method_handle);
    560628    __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
    561629    // This is OK when all parameter types widen.
     
    573641
    574642      // What class are we casting to?
    575       __ ld_ptr(G3_amh_argument, G5_klass);  // This is a Class object!
    576       __ ld_ptr(Address(G5_klass, java_lang_Class::klass_offset_in_bytes()), G5_klass);
     643      __ load_heap_oop(G3_amh_argument, G5_klass);  // This is a Class object!
     644      __ load_heap_oop(Address(G5_klass, java_lang_Class::klass_offset_in_bytes()), G5_klass);
    577645
    578646      Label done;
     
    590658
    591659      // If we get here, the type check failed!
    592       __ ldsw(G3_amh_vmargslot, O0_argslot);  // reload argslot field
    593       __ ld_ptr(G3_amh_argument, O3_scratch);  // required class
    594       __ ld_ptr(vmarg, O2_scratch);  // bad object
    595       __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O0_argslot);
    596       __ delayed()->mov(Bytecodes::_checkcast, O1_scratch);  // who is complaining?
     660      __ load_heap_oop(G3_amh_argument,        O2_required);  // required class
     661      __ ld_ptr(       vmarg,                  O1_actual);    // bad object
     662      __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O3_scratch);
     663      __ delayed()->mov(Bytecodes::_checkcast, O0_code);      // who is complaining?
    597664
    598665      __ bind(done);
    599666      // Get the new MH:
    600       __ ld_ptr(G3_mh_vmtarget, G3_method_handle);
     667      __ load_heap_oop(G3_mh_vmtarget, G3_method_handle);
    601668      __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
    602669    }
     
    616683      // Perform an in-place conversion to int or an int subword.
    617684      __ ldsw(G3_amh_vmargslot, O0_argslot);
     685      Address value;
    618686      Address vmarg = __ argument_address(O0_argslot);
    619       Address value;
    620687      bool value_left_justified = false;
    621688
    622689      switch (ek) {
    623690      case _adapter_opt_i2i:
     691        value = vmarg;
     692        break;
    624693      case _adapter_opt_l2i:
    625         __ unimplemented(entry_name(ek));
    626         value = vmarg;
     694        {
     695          // just delete the extra slot
     696#ifdef _LP64
     697          // In V9, longs are given 2 64-bit slots in the interpreter, but the
     698          // data is passed in only 1 slot.
     699          // Keep the second slot.
     700          __ add(Gargs, __ argument_offset(O0_argslot, -1), O0_argslot);
     701          remove_arg_slots(_masm, -stack_move_unit(), O0_argslot, O1_scratch, O2_scratch, O3_scratch);
     702          value = Address(O0_argslot, 4);  // Get least-significant 32-bit of 64-bit value.
     703          vmarg = Address(O0_argslot, Interpreter::stackElementSize);
     704#else
     705          // Keep the first slot.
     706          __ add(Gargs, __ argument_offset(O0_argslot), O0_argslot);
     707          remove_arg_slots(_masm, -stack_move_unit(), O0_argslot, O1_scratch, O2_scratch, O3_scratch);
     708          value = Address(O0_argslot, 0);
     709          vmarg = value;
     710#endif
     711        }
    627712        break;
    628713      case _adapter_opt_unboxi:
     
    677762
    678763      // Get the new MH:
    679       __ ld_ptr(G3_mh_vmtarget, G3_method_handle);
     764      __ load_heap_oop(G3_mh_vmtarget, G3_method_handle);
    680765      __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
    681766    }
     
    722807      }
    723808
    724       __ ld_ptr(G3_mh_vmtarget, G3_method_handle);
     809      __ load_heap_oop(G3_mh_vmtarget, G3_method_handle);
    725810      __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
    726811    }
     
    852937      }
    853938
    854       __ ld_ptr(G3_mh_vmtarget, G3_method_handle);
     939      __ load_heap_oop(G3_mh_vmtarget, G3_method_handle);
    855940      __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
    856941    }
     
    896981      __ delayed()->nop();  // FILLME
    897982
    898       __ ld_ptr(G3_mh_vmtarget, G3_method_handle);
     983      __ load_heap_oop(G3_mh_vmtarget, G3_method_handle);
    899984      __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
    900985    }
     
    914999      remove_arg_slots(_masm, G5_stack_move, O0_argslot, O1_scratch, O2_scratch, O3_scratch);
    9151000
    916       __ ld_ptr(G3_mh_vmtarget, G3_method_handle);
     1001      __ load_heap_oop(G3_mh_vmtarget, G3_method_handle);
    9171002      __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
    9181003    }
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp

    r278 r309  
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_nativeInst_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "assembler_sparc.inline.hpp"
     27#include "memory/resourceArea.hpp"
     28#include "nativeInst_sparc.hpp"
     29#include "oops/oop.inline.hpp"
     30#include "runtime/handles.hpp"
     31#include "runtime/sharedRuntime.hpp"
     32#include "runtime/stubRoutines.hpp"
     33#include "utilities/ostream.hpp"
     34#ifdef COMPILER1
     35#include "c1/c1_Runtime1.hpp"
     36#endif
    2737
    2838
     
    194204  a->call( a->pc(), relocInfo::none );
    195205  a->delayed()->nop();
    196   nc = nativeCall_at( cb.code_begin() );
     206  nc = nativeCall_at( cb.insts_begin() );
    197207  nc->print();
    198208
    199209  nc = nativeCall_overwriting_at( nc->next_instruction_address() );
    200210  for (idx = 0; idx < ARRAY_SIZE(offsets); idx++) {
    201     nc->set_destination( cb.code_begin() + offsets[idx] );
    202     assert(nc->destination() == (cb.code_begin() + offsets[idx]), "check unit test");
     211    nc->set_destination( cb.insts_begin() + offsets[idx] );
     212    assert(nc->destination() == (cb.insts_begin() + offsets[idx]), "check unit test");
    203213    nc->print();
    204214  }
    205215
    206   nc = nativeCall_before( cb.code_begin() + 8 );
     216  nc = nativeCall_before( cb.insts_begin() + 8 );
    207217  nc->print();
    208218
     
    369379  a->add(O2, al2.low10(), O2);
    370380
    371   nm = nativeMovConstReg_at( cb.code_begin() );
     381  nm = nativeMovConstReg_at( cb.insts_begin() );
    372382  nm->print();
    373383
     
    481491  a->add(O2, al2.low10(), O2);
    482492
    483   nm = nativeMovConstRegPatching_at( cb.code_begin() );
     493  nm = nativeMovConstRegPatching_at( cb.insts_begin() );
    484494  nm->print();
    485495
     
    617627  a->stf( FloatRegisterImpl::S, F15, O0, I3 ); idx++;
    618628
    619   nm = nativeMovRegMem_at( cb.code_begin() );
     629  nm = nativeMovRegMem_at( cb.insts_begin() );
    620630  nm->print();
    621631  nm->set_offset( low10(0) );
     
    761771  a->stf( FloatRegisterImpl::S, F15, O0, I3 ); idx++;
    762772
    763   nm = nativeMovRegMemPatching_at( cb.code_begin() );
     773  nm = nativeMovRegMemPatching_at( cb.insts_begin() );
    764774  nm->print();
    765775  nm->set_offset( low10(0) );
     
    850860  a->delayed()->nop();
    851861
    852   nj = nativeJump_at( cb.code_begin() );
     862  nj = nativeJump_at( cb.insts_begin() );
    853863  nj->print();
    854864
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_NATIVEINST_SPARC_HPP
     26#define CPU_SPARC_VM_NATIVEINST_SPARC_HPP
     27
     28#include "asm/assembler.hpp"
     29#include "memory/allocation.hpp"
     30#include "runtime/icache.hpp"
     31#include "runtime/os.hpp"
     32#include "utilities/top.hpp"
    2433
    2534// We have interface for the following instructions:
     
    914923  static void insert(address code_pos);
    915924};
     925
     926#endif // CPU_SPARC_VM_NATIVEINST_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/registerMap_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_REGISTERMAP_SPARC_HPP
     26#define CPU_SPARC_VM_REGISTERMAP_SPARC_HPP
    2427
    2528// machine-dependent implemention for register maps
     
    5255  // When popping out of compiled frames, we make all IRegs disappear.
    5356  void make_integer_regs_unsaved() { _location_valid[0] = 0; }
     57
     58#endif // CPU_SPARC_VM_REGISTERMAP_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp

    r278 r309  
    2626#define DONT_USE_REGISTER_DEFINES
    2727
    28 #include "incls/_precompiled.incl"
    29 #include "incls/_register_definitions_sparc.cpp.incl"
     28#include "precompiled.hpp"
     29#include "asm/assembler.hpp"
     30#include "asm/register.hpp"
     31#include "interp_masm_sparc.hpp"
     32#include "register_sparc.hpp"
    3033
    3134REGISTER_DEFINITION(Register, noreg);
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/register_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_register_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "register_sparc.hpp"
    2727
    2828const int ConcreteRegisterImpl::max_gpr = RegisterImpl::number_of_registers << 1;
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/register_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_REGISTER_SPARC_HPP
     26#define CPU_SPARC_VM_REGISTER_SPARC_HPP
     27
     28#include "asm/register.hpp"
     29#include "vm_version_sparc.hpp"
    2430
    2531// forward declaration
     
    441447  }
    442448};
     449
     450#endif // CPU_SPARC_VM_REGISTER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_relocInfo_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "asm/assembler.inline.hpp"
     27#include "assembler_sparc.inline.hpp"
     28#include "code/relocInfo.hpp"
     29#include "nativeInst_sparc.hpp"
     30#include "oops/oop.inline.hpp"
     31#include "runtime/safepoint.hpp"
    2732
    2833void Relocation::pd_set_data_value(address x, intptr_t o) {
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/relocInfo_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_RELOCINFO_SPARC_HPP
     26#define CPU_SPARC_VM_RELOCINFO_SPARC_HPP
    2427
    2528  // machine-dependent parts of class relocInfo
     
    5053// 1.9 99/07/16 11:12:11 relocInfo_i486.hpp
    5154//End
     55
     56#endif // CPU_SPARC_VM_RELOCINFO_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/runtime_sparc.cpp

    r278 r309  
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_runtime_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#ifdef COMPILER2
     27#include "asm/assembler.hpp"
     28#include "assembler_sparc.inline.hpp"
     29#include "classfile/systemDictionary.hpp"
     30#include "code/vmreg.hpp"
     31#include "interpreter/interpreter.hpp"
     32#include "nativeInst_sparc.hpp"
     33#include "opto/runtime.hpp"
     34#include "runtime/interfaceSupport.hpp"
     35#include "runtime/sharedRuntime.hpp"
     36#include "runtime/stubRoutines.hpp"
     37#include "runtime/vframeArray.hpp"
     38#include "utilities/globalDefinitions.hpp"
     39#include "vmreg_sparc.inline.hpp"
     40#endif
    2741
    2842
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp

    r278 r309  
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_sharedRuntime_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "asm/assembler.hpp"
     27#include "assembler_sparc.inline.hpp"
     28#include "code/debugInfoRec.hpp"
     29#include "code/icBuffer.hpp"
     30#include "code/vtableStubs.hpp"
     31#include "interpreter/interpreter.hpp"
     32#include "oops/compiledICHolderOop.hpp"
     33#include "prims/jvmtiRedefineClassesTrace.hpp"
     34#include "runtime/sharedRuntime.hpp"
     35#include "runtime/vframeArray.hpp"
     36#include "vmreg_sparc.inline.hpp"
     37#ifdef COMPILER1
     38#include "c1/c1_Runtime1.hpp"
     39#endif
     40#ifdef COMPILER2
     41#include "opto/runtime.hpp"
     42#endif
     43#ifdef SHARK
     44#include "compiler/compileBroker.hpp"
     45#include "shark/sharkCompiler.hpp"
     46#endif
    2747
    2848#define __ masm->
     
    33323352#if !defined(_LP64)
    33333353#if defined(COMPILER2)
    3334   if (!TieredCompilation) {
    3335     // 32-bit 1-register longs return longs in G1
    3336     __ stx(Greturn1, saved_Greturn1_addr);
    3337   }
     3354  // 32-bit 1-register longs return longs in G1
     3355  __ stx(Greturn1, saved_Greturn1_addr);
    33383356#endif
    33393357  __ set_last_Java_frame(SP, noreg);
     
    33483366  __ ldf(FloatRegisterImpl::D, saved_Freturn0_addr, Freturn0);
    33493367
    3350   // In tiered we never use C2 to compile methods returning longs so
    3351   // the result is where we expect it already.
    3352 
    33533368#if !defined(_LP64) && defined(COMPILER2)
    33543369  // In 32 bit, C2 returns longs in G1 so restore the saved G1 into
    3355   // I0/I1 if the return value is long.  In the tiered world there is
    3356   // a mismatch between how C1 and C2 return longs compiles and so
    3357   // currently compilation of methods which return longs is disabled
    3358   // for C2 and so is this code.  Eventually C1 and C2 will do the
    3359   // same thing for longs in the tiered world.
    3360   if (!TieredCompilation) {
    3361     Label not_long;
    3362     __ cmp(O0,T_LONG);
    3363     __ br(Assembler::notEqual, false, Assembler::pt, not_long);
    3364     __ delayed()->nop();
    3365     __ ldd(saved_Greturn1_addr,I0);
    3366     __ bind(not_long);
    3367   }
     3370  // I0/I1 if the return value is long.
     3371  Label not_long;
     3372  __ cmp(O0,T_LONG);
     3373  __ br(Assembler::notEqual, false, Assembler::pt, not_long);
     3374  __ delayed()->nop();
     3375  __ ldd(saved_Greturn1_addr,I0);
     3376  __ bind(not_long);
    33683377#endif
    33693378  __ ret();
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/sparc.ad

    r278 r309  
    11//
    2 // Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
     2// Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
    33// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44//
     
    576576int MachCallRuntimeNode::ret_addr_offset() {
    577577#ifdef _LP64
    578   return NativeFarCall::instruction_size;  // farcall; delay slot
     578  if (MacroAssembler::is_far_target(entry_point())) {
     579    return NativeFarCall::instruction_size;
     580  } else {
     581    return NativeCall::instruction_size;
     582  }
    579583#else
    580584  return NativeCall::instruction_size;  // call; delay slot
     
    668672}
    669673
     674static inline jdouble replicate_immI(int con, int count, int width) {
     675  // Load a constant replicated "count" times with width "width"
     676  int bit_width = width * 8;
     677  jlong elt_val = con;
     678  elt_val &= (((jlong) 1) << bit_width) - 1;  // mask off sign bits
     679  jlong val = elt_val;
     680  for (int i = 0; i < count - 1; i++) {
     681    val <<= bit_width;
     682    val |= elt_val;
     683  }
     684  jdouble dval = *((jdouble*) &val);  // coerce to double type
     685  return dval;
     686}
     687
    670688// Standard Sparc opcode form2 field breakdown
    671689static inline void emit2_19(CodeBuffer &cbuf, int f30, int f29, int f25, int f22, int f20, int f19, int f0 ) {
     
    678696           (f19 << 19) |
    679697           (f0  <<  0);
    680   *((int*)(cbuf.code_end())) = op;
    681   cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     698  cbuf.insts()->emit_int32(op);
    682699}
    683700
     
    690707           (f22 << 22) |
    691708           (f0  <<  0);
    692   *((int*)(cbuf.code_end())) = op;
    693   cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     709  cbuf.insts()->emit_int32(op);
    694710}
    695711
     
    702718           (f5  <<  5) |
    703719           (f0  <<  0);
    704   *((int*)(cbuf.code_end())) = op;
    705   cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     720  cbuf.insts()->emit_int32(op);
    706721}
    707722
     
    715730           (1   << 13) | // bit to indicate immediate-mode
    716731           (simm13<<0);
    717   *((int*)(cbuf.code_end())) = op;
    718   cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     732  cbuf.insts()->emit_int32(op);
    719733}
    720734
     
    911925  }
    912926
    913   uint *code = (uint*)cbuf.code_end();
    914   *code = instr;
    915   cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     927  cbuf.insts()->emit_int32(instr);
    916928
    917929#ifdef ASSERT
     
    934946}
    935947
    936 void emit_call_reloc(CodeBuffer &cbuf, intptr_t entry_point, relocInfo::relocType rtype, bool preserve_g2 = false, bool force_far_call = false) {
     948void emit_call_reloc(CodeBuffer &cbuf, intptr_t entry_point, relocInfo::relocType rtype, bool preserve_g2 = false) {
    937949  // The method which records debug information at every safepoint
    938950  // expects the call to be the first instruction in the snippet as
     
    956968#endif /* ASSERT */
    957969
    958 #ifdef _LP64
    959   // Calls to the runtime or native may not be reachable from compiled code,
    960   // so we generate the far call sequence on 64 bit sparc.
    961   // This code sequence is relocatable to any address, even on LP64.
    962   if ( force_far_call ) {
    963     __ relocate(rtype);
    964     AddressLiteral dest(entry_point);
    965     __ jumpl_to(dest, O7, O7);
    966   }
    967   else
    968 #endif
    969   {
    970      __ call((address)entry_point, rtype);
    971   }
     970  __ call((address)entry_point, rtype);
    972971
    973972  if (preserve_g2)   __ delayed()->mov(G2, L7);
     
    10151014
    10161015//=============================================================================
     1016const bool Matcher::constant_table_absolute_addressing = false;
     1017const RegMask& MachConstantBaseNode::_out_RegMask = PTR_REG_mask;
     1018
     1019void MachConstantBaseNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const {
     1020  Compile* C = ra_->C;
     1021  Compile::ConstantTable& constant_table = C->constant_table();
     1022  MacroAssembler _masm(&cbuf);
     1023
     1024  Register r = as_Register(ra_->get_encode(this));
     1025  CodeSection* cs = __ code()->consts();
     1026  int consts_size = cs->align_at_start(cs->size());
     1027
     1028  if (UseRDPCForConstantTableBase) {
     1029    // For the following RDPC logic to work correctly the consts
     1030    // section must be allocated right before the insts section.  This
     1031    // assert checks for that.  The layout and the SECT_* constants
     1032    // are defined in src/share/vm/asm/codeBuffer.hpp.
     1033    assert(CodeBuffer::SECT_CONSTS + 1 == CodeBuffer::SECT_INSTS, "must be");
     1034    int offset = __ offset();
     1035    int disp;
     1036
     1037    // If the displacement from the current PC to the constant table
     1038    // base fits into simm13 we set the constant table base to the
     1039    // current PC.
     1040    if (__ is_simm13(-(consts_size + offset))) {
     1041      constant_table.set_table_base_offset(-(consts_size + offset));
     1042      disp = 0;
     1043    } else {
     1044      // If the offset of the top constant (last entry in the table)
     1045      // fits into simm13 we set the constant table base to the actual
     1046      // table base.
     1047      if (__ is_simm13(constant_table.top_offset())) {
     1048        constant_table.set_table_base_offset(0);
     1049        disp = consts_size + offset;
     1050      } else {
     1051        // Otherwise we set the constant table base in the middle of the
     1052        // constant table.
     1053        int half_consts_size = consts_size / 2;
     1054        assert(half_consts_size * 2 == consts_size, "sanity");
     1055        constant_table.set_table_base_offset(-half_consts_size);  // table base offset gets added to the load displacement.
     1056        disp = half_consts_size + offset;
     1057      }
     1058    }
     1059
     1060    __ rdpc(r);
     1061
     1062    if (disp != 0) {
     1063      assert(r != O7, "need temporary");
     1064      __ sub(r, __ ensure_simm13_or_reg(disp, O7), r);
     1065    }
     1066  }
     1067  else {
     1068    // Materialize the constant table base.
     1069    assert(constant_table.size() == consts_size, err_msg("must be: %d == %d", constant_table.size(), consts_size));
     1070    address baseaddr = cs->start() + -(constant_table.table_base_offset());
     1071    RelocationHolder rspec = internal_word_Relocation::spec(baseaddr);
     1072    AddressLiteral base(baseaddr, rspec);
     1073    __ set(base, r);
     1074  }
     1075}
     1076
     1077uint MachConstantBaseNode::size(PhaseRegAlloc*) const {
     1078  if (UseRDPCForConstantTableBase) {
     1079    // This is really the worst case but generally it's only 1 instruction.
     1080    return (1 /*rdpc*/ + 1 /*sub*/ + MacroAssembler::worst_case_insts_for_set()) * BytesPerInstWord;
     1081  } else {
     1082    return MacroAssembler::worst_case_insts_for_set() * BytesPerInstWord;
     1083  }
     1084}
     1085
     1086#ifndef PRODUCT
     1087void MachConstantBaseNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
     1088  char reg[128];
     1089  ra_->dump_register(this, reg);
     1090  if (UseRDPCForConstantTableBase) {
     1091    st->print("RDPC   %s\t! constant table base", reg);
     1092  } else {
     1093    st->print("SET    &constanttable,%s\t! constant table base", reg);
     1094  }
     1095}
     1096#endif
     1097
     1098
     1099//=============================================================================
    10171100
    10181101#ifndef PRODUCT
     
    11491232int MachEpilogNode::safepoint_offset() const {
    11501233  assert( do_polling(), "no return for this epilog node");
    1151   return MacroAssembler::size_of_sethi(os::get_polling_page());
     1234  return MacroAssembler::insts_for_sethi(os::get_polling_page()) * BytesPerInstWord;
    11521235}
    11531236
     
    15331616  // jmp -1
    15341617
    1535   address mark = cbuf.inst_mark();  // get mark within main instrs section
     1618  address mark = cbuf.insts_mark();  // get mark within main instrs section
    15361619
    15371620  MacroAssembler _masm(&cbuf);
     
    16331716int emit_exception_handler(CodeBuffer& cbuf) {
    16341717  Register temp_reg = G3;
    1635   AddressLiteral exception_blob(OptoRuntime::exception_blob()->instructions_begin());
     1718  AddressLiteral exception_blob(OptoRuntime::exception_blob()->entry_point());
    16361719  MacroAssembler _masm(&cbuf);
    16371720
     
    18481931bool Matcher::is_spillable_arg( int reg ) {
    18491932  return can_be_java_arg(reg);
     1933}
     1934
     1935bool Matcher::use_asm_for_ldiv_by_con( jlong divisor ) {
     1936  // Use hardware SDIVX instruction when it is
     1937  // faster than a code which use multiply.
     1938  return VM_Version::has_fast_idiv();
    18501939}
    18511940
     
    22482337  %}
    22492338
    2250   enc_class jump_enc( iRegX switch_val, o7RegI table) %{
    2251     MacroAssembler _masm(&cbuf);
    2252 
    2253     Register switch_reg       = as_Register($switch_val$$reg);
    2254     Register table_reg        = O7;
    2255 
    2256     address table_base = __ address_table_constant(_index2label);
    2257     RelocationHolder rspec = internal_word_Relocation::spec(table_base);
    2258 
    2259     // Move table address into a register.
    2260     __ set(table_base, table_reg, rspec);
    2261 
    2262     // Jump to base address + switch value
    2263     __ ld_ptr(table_reg, switch_reg, table_reg);
    2264     __ jmp(table_reg, G0);
    2265     __ delayed()->nop();
    2266 
    2267   %}
    2268 
    22692339  enc_class enc_ba( Label labl ) %{
    22702340    MacroAssembler _masm(&cbuf);
     
    22932363             ($pcc$$constant << 11) |       // cc1, cc0 bits for 'icc' or 'xcc'
    22942364             ($src$$reg << 0);
    2295     *((int*)(cbuf.code_end())) = op;
    2296     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     2365    cbuf.insts()->emit_int32(op);
    22972366  %}
    22982367
     
    23072376             ($pcc$$constant << 11) |       // cc1, cc0 bits for 'icc'
    23082377             (simm11 << 0);
    2309     *((int*)(cbuf.code_end())) = op;
    2310     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     2378    cbuf.insts()->emit_int32(op);
    23112379  %}
    23122380
     
    23202388             ($fcc$$reg << 11) |            // cc1, cc0 bits for fcc0-fcc3
    23212389             ($src$$reg << 0);
    2322     *((int*)(cbuf.code_end())) = op;
    2323     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     2390    cbuf.insts()->emit_int32(op);
    23242391  %}
    23252392
     
    23342401             ($fcc$$reg << 11) |            // cc1, cc0 bits for fcc0-fcc3
    23352402             (simm11 << 0);
    2336     *((int*)(cbuf.code_end())) = op;
    2337     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     2403    cbuf.insts()->emit_int32(op);
    23382404  %}
    23392405
     
    23482414             ($primary << 5) |              // select single, double or quad
    23492415             ($src$$reg << 0);
    2350     *((int*)(cbuf.code_end())) = op;
    2351     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     2416    cbuf.insts()->emit_int32(op);
    23522417  %}
    23532418
     
    23612426             ($primary << 5) |              // select single, double or quad
    23622427             ($src$$reg << 0);
    2363     *((int*)(cbuf.code_end())) = op;
    2364     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     2428    cbuf.insts()->emit_int32(op);
    23652429  %}
    23662430
     
    23762440             (0 << 11) |                    // cc1, cc0 bits for 'icc'
    23772441             ($src$$reg << 0);
    2378     *((int*)(cbuf.code_end())) = op;
    2379     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     2442    cbuf.insts()->emit_int32(op);
    23802443  %}
    23812444
     
    23892452             (0 << 11) |                    // cc1, cc0 bits for 'icc'
    23902453             ($src$$reg << 0);
    2391     *((int*)(cbuf.code_end())) = op;
    2392     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
    2393   %}
    2394 
    2395   // Utility encoding for loading a 64 bit Pointer into a register
    2396   // The 64 bit pointer is stored in the generated code stream
    2397   enc_class SetPtr( immP src, iRegP rd ) %{
    2398     Register dest = reg_to_register_object($rd$$reg);
    2399     MacroAssembler _masm(&cbuf);
    2400     // [RGV] This next line should be generated from ADLC
    2401     if ( _opnds[1]->constant_is_oop() ) {
    2402       intptr_t val = $src$$constant;
    2403       __ set_oop_constant((jobject)val, dest);
    2404     } else {          // non-oop pointers, e.g. card mark base, heap top
    2405       __ set($src$$constant, dest);
    2406     }
     2454    cbuf.insts()->emit_int32(op);
    24072455  %}
    24082456
     
    24182466    MacroAssembler _masm(&cbuf);
    24192467    __ set($src$$constant, reg_to_register_object($rd$$reg));
    2420   %}
    2421 
    2422   enc_class SetNull( iRegI rd ) %{
    2423     emit3_simm13( cbuf, Assembler::arith_op, $rd$$reg, Assembler::or_op3, 0, 0 );
    24242468  %}
    24252469
     
    24552499    // The user of this is responsible for ensuring that R_L7 is empty (killed).
    24562500    emit_call_reloc(cbuf, $meth$$method, relocInfo::runtime_call_type,
    2457                     /*preserve_g2=*/true, /*force far call*/true);
     2501                    /*preserve_g2=*/true);
    24582502  %}
    24592503
     
    27872831  %}
    27882832
    2789   enc_class LdImmL (immL src, iRegL dst, o7RegL tmp) %{   // Load Immediate
    2790     MacroAssembler _masm(&cbuf);
    2791     Register dest = reg_to_register_object($dst$$reg);
    2792     Register temp = reg_to_register_object($tmp$$reg);
    2793     __ set64( $src$$constant, dest, temp );
    2794   %}
    2795 
    2796   enc_class LdReplImmI(immI src, regD dst, o7RegP tmp, int count, int width) %{
    2797     // Load a constant replicated "count" times with width "width"
    2798     int bit_width = $width$$constant * 8;
    2799     jlong elt_val = $src$$constant;
    2800     elt_val  &= (((jlong)1) << bit_width) - 1; // mask off sign bits
    2801     jlong val = elt_val;
    2802     for (int i = 0; i < $count$$constant - 1; i++) {
    2803         val <<= bit_width;
    2804         val |= elt_val;
    2805     }
    2806     jdouble dval = *(jdouble*)&val; // coerce to double type
    2807     MacroAssembler _masm(&cbuf);
    2808     address double_address = __ double_constant(dval);
    2809     RelocationHolder rspec = internal_word_Relocation::spec(double_address);
    2810     AddressLiteral addrlit(double_address, rspec);
    2811 
    2812     __ sethi(addrlit, $tmp$$Register);
    2813     // XXX This is a quick fix for 6833573.
    2814     //__ ldf(FloatRegisterImpl::D, $tmp$$Register, addrlit.low10(), $dst$$FloatRegister, rspec);
    2815     __ ldf(FloatRegisterImpl::D, $tmp$$Register, addrlit.low10(), as_DoubleFloatRegister($dst$$reg), rspec);
    2816   %}
    2817 
    28182833  // Compiler ensures base is doubleword aligned and cnt is count of doublewords
    28192834  enc_class enc_Clear_Array(iRegX cnt, iRegP base, iRegX temp) %{
     
    30563071
    30573072  enc_class enc_rethrow() %{
    3058     cbuf.set_inst_mark();
     3073    cbuf.set_insts_mark();
    30593074    Register temp_reg = G3;
    30603075    AddressLiteral rethrow_stub(OptoRuntime::rethrow_stub());
     
    30773092  enc_class emit_mem_nop() %{
    30783093    // Generates the instruction LDUXA [o6,g0],#0x82,g0
    3079     unsigned int *code = (unsigned int*)cbuf.code_end();
    3080     *code = (unsigned int)0xc0839040;
    3081     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     3094    cbuf.insts()->emit_int32((unsigned int) 0xc0839040);
    30823095  %}
    30833096
    30843097  enc_class emit_fadd_nop() %{
    30853098    // Generates the instruction FMOVS f31,f31
    3086     unsigned int *code = (unsigned int*)cbuf.code_end();
    3087     *code = (unsigned int)0xbfa0003f;
    3088     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     3099    cbuf.insts()->emit_int32((unsigned int) 0xbfa0003f);
    30893100  %}
    30903101
    30913102  enc_class emit_br_nop() %{
    30923103    // Generates the instruction BPN,PN .
    3093     unsigned int *code = (unsigned int*)cbuf.code_end();
    3094     *code = (unsigned int)0x00400000;
    3095     cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
     3104    cbuf.insts()->emit_int32((unsigned int) 0x00400000);
    30963105  %}
    30973106
     
    35363545%}
    35373546
     3547#ifdef _LP64
     3548// Pointer Immediate: 64-bit
     3549operand immP_set() %{
     3550  predicate(!VM_Version::is_niagara_plus());
     3551  match(ConP);
     3552
     3553  op_cost(5);
     3554  // formats are generated automatically for constants and base registers
     3555  format %{ %}
     3556  interface(CONST_INTER);
     3557%}
     3558
     3559// Pointer Immediate: 64-bit
     3560// From Niagara2 processors on a load should be better than materializing.
     3561operand immP_load() %{
     3562  predicate(VM_Version::is_niagara_plus() && (n->bottom_type()->isa_oop_ptr() || (MacroAssembler::insts_for_set(n->get_ptr()) > 3)));
     3563  match(ConP);
     3564
     3565  op_cost(5);
     3566  // formats are generated automatically for constants and base registers
     3567  format %{ %}
     3568  interface(CONST_INTER);
     3569%}
     3570
     3571// Pointer Immediate: 64-bit
     3572operand immP_no_oop_cheap() %{
     3573  predicate(VM_Version::is_niagara_plus() && !n->bottom_type()->isa_oop_ptr() && (MacroAssembler::insts_for_set(n->get_ptr()) <= 3));
     3574  match(ConP);
     3575
     3576  op_cost(5);
     3577  // formats are generated automatically for constants and base registers
     3578  format %{ %}
     3579  interface(CONST_INTER);
     3580%}
     3581#endif
     3582
    35383583operand immP13() %{
    35393584  predicate((-4096 < n->get_ptr()) && (n->get_ptr() <= 4095));
     
    36243669operand immL_32bits() %{
    36253670  predicate(n->get_long() == 0xFFFFFFFFL);
     3671  match(ConL);
     3672  op_cost(0);
     3673
     3674  format %{ %}
     3675  interface(CONST_INTER);
     3676%}
     3677
     3678// Long Immediate: cheap (materialize in <= 3 instructions)
     3679operand immL_cheap() %{
     3680  predicate(!VM_Version::is_niagara_plus() || MacroAssembler::insts_for_set64(n->get_long()) <= 3);
     3681  match(ConL);
     3682  op_cost(0);
     3683
     3684  format %{ %}
     3685  interface(CONST_INTER);
     3686%}
     3687
     3688// Long Immediate: expensive (materialize in > 3 instructions)
     3689operand immL_expensive() %{
     3690  predicate(VM_Version::is_niagara_plus() && MacroAssembler::insts_for_set64(n->get_long()) > 3);
    36263691  match(ConL);
    36273692  op_cost(0);
     
    59966061%}
    59976062
    5998 instruct loadConP(iRegP dst, immP src) %{
    5999   match(Set dst src);
     6063#ifndef _LP64
     6064instruct loadConP(iRegP dst, immP con) %{
     6065  match(Set dst con);
    60006066  ins_cost(DEFAULT_COST * 3/2);
    6001   format %{ "SET    $src,$dst\t!ptr" %}
    6002   // This rule does not use "expand" unlike loadConI because then
    6003   // the result type is not known to be an Oop.  An ADLC
    6004   // enhancement will be needed to make that work - not worth it!
    6005 
    6006   ins_encode( SetPtr( src, dst ) );
     6067  format %{ "SET    $con,$dst\t!ptr" %}
     6068  ins_encode %{
     6069    // [RGV] This next line should be generated from ADLC
     6070    if (_opnds[1]->constant_is_oop()) {
     6071      intptr_t val = $con$$constant;
     6072      __ set_oop_constant((jobject) val, $dst$$Register);
     6073    } else {          // non-oop pointers, e.g. card mark base, heap top
     6074      __ set($con$$constant, $dst$$Register);
     6075    }
     6076  %}
    60076077  ins_pipe(loadConP);
    6008 
    6009 %}
     6078%}
     6079#else
     6080instruct loadConP_set(iRegP dst, immP_set con) %{
     6081  match(Set dst con);
     6082  ins_cost(DEFAULT_COST * 3/2);
     6083  format %{ "SET    $con,$dst\t! ptr" %}
     6084  ins_encode %{
     6085    // [RGV] This next line should be generated from ADLC
     6086    if (_opnds[1]->constant_is_oop()) {
     6087      intptr_t val = $con$$constant;
     6088      __ set_oop_constant((jobject) val, $dst$$Register);
     6089    } else {          // non-oop pointers, e.g. card mark base, heap top
     6090      __ set($con$$constant, $dst$$Register);
     6091    }
     6092  %}
     6093  ins_pipe(loadConP);
     6094%}
     6095
     6096instruct loadConP_load(iRegP dst, immP_load con) %{
     6097  match(Set dst con);
     6098  ins_cost(MEMORY_REF_COST);
     6099  format %{ "LD     [$constanttablebase + $constantoffset],$dst\t! load from constant table: ptr=$con" %}
     6100  ins_encode %{
     6101    RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset($con), $dst$$Register);
     6102    __ ld_ptr($constanttablebase, con_offset, $dst$$Register);
     6103  %}
     6104  ins_pipe(loadConP);
     6105%}
     6106
     6107instruct loadConP_no_oop_cheap(iRegP dst, immP_no_oop_cheap con) %{
     6108  match(Set dst con);
     6109  ins_cost(DEFAULT_COST * 3/2);
     6110  format %{ "SET    $con,$dst\t! non-oop ptr" %}
     6111  ins_encode %{
     6112    __ set($con$$constant, $dst$$Register);
     6113  %}
     6114  ins_pipe(loadConP);
     6115%}
     6116#endif // _LP64
    60106117
    60116118instruct loadConP0(iRegP dst, immP0 src) %{
     
    60146121  size(4);
    60156122  format %{ "CLR    $dst\t!ptr" %}
    6016   ins_encode( SetNull( dst ) );
     6123  ins_encode %{
     6124    __ clr($dst$$Register);
     6125  %}
    60176126  ins_pipe(ialu_imm);
    60186127%}
     
    60346143  size(4);
    60356144  format %{ "CLR    $dst\t! compressed NULL ptr" %}
    6036   ins_encode( SetNull( dst ) );
     6145  ins_encode %{
     6146    __ clr($dst$$Register);
     6147  %}
    60376148  ins_pipe(ialu_imm);
    60386149%}
     
    60496160%}
    60506161
    6051 instruct loadConL(iRegL dst, immL src, o7RegL tmp) %{
    6052   // %%% maybe this should work like loadConD
    6053   match(Set dst src);
     6162// Materialize long value (predicated by immL_cheap).
     6163instruct loadConL_set64(iRegL dst, immL_cheap con, o7RegL tmp) %{
     6164  match(Set dst con);
    60546165  effect(KILL tmp);
    6055   ins_cost(DEFAULT_COST * 4);
    6056   format %{ "SET64   $src,$dst KILL $tmp\t! long" %}
    6057   ins_encode( LdImmL(src, dst, tmp) );
     6166  ins_cost(DEFAULT_COST * 3);
     6167  format %{ "SET64   $con,$dst KILL $tmp\t! cheap long" %}
     6168  ins_encode %{
     6169    __ set64($con$$constant, $dst$$Register, $tmp$$Register);
     6170  %}
     6171  ins_pipe(loadConL);
     6172%}
     6173
     6174// Load long value from constant table (predicated by immL_expensive).
     6175instruct loadConL_ldx(iRegL dst, immL_expensive con) %{
     6176  match(Set dst con);
     6177  ins_cost(MEMORY_REF_COST);
     6178  format %{ "LDX     [$constanttablebase + $constantoffset],$dst\t! load from constant table: long=$con" %}
     6179  ins_encode %{
     6180      RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset($con), $dst$$Register);
     6181    __ ldx($constanttablebase, con_offset, $dst$$Register);
     6182  %}
    60586183  ins_pipe(loadConL);
    60596184%}
     
    60786203%}
    60796204
    6080 instruct loadConF(regF dst, immF src, o7RegP tmp) %{
    6081   match(Set dst src);
     6205instruct loadConF(regF dst, immF con, o7RegI tmp) %{
     6206  match(Set dst con);
    60826207  effect(KILL tmp);
    6083 
    6084 #ifdef _LP64
    6085   size(8*4);
    6086 #else
    6087   size(2*4);
    6088 #endif
    6089 
    6090   format %{ "SETHI  hi(&$src),$tmp\t!get float $src from table\n\t"
    6091             "LDF    [$tmp+lo(&$src)],$dst" %}
     6208  format %{ "LDF    [$constanttablebase + $constantoffset],$dst\t! load from constant table: float=$con" %}
    60926209  ins_encode %{
    6093     address float_address = __ float_constant($src$$constant);
    6094     RelocationHolder rspec = internal_word_Relocation::spec(float_address);
    6095     AddressLiteral addrlit(float_address, rspec);
    6096 
    6097     __ sethi(addrlit, $tmp$$Register);
    6098     __ ldf(FloatRegisterImpl::S, $tmp$$Register, addrlit.low10(), $dst$$FloatRegister, rspec);
     6210      RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset($con), $tmp$$Register);
     6211    __ ldf(FloatRegisterImpl::S, $constanttablebase, con_offset, $dst$$FloatRegister);
    60996212  %}
    61006213  ins_pipe(loadConFD);
    61016214%}
    61026215
    6103 instruct loadConD(regD dst, immD src, o7RegP tmp) %{
    6104   match(Set dst src);
     6216instruct loadConD(regD dst, immD con, o7RegI tmp) %{
     6217  match(Set dst con);
    61056218  effect(KILL tmp);
    6106 
    6107 #ifdef _LP64
    6108   size(8*4);
    6109 #else
    6110   size(2*4);
    6111 #endif
    6112 
    6113   format %{ "SETHI  hi(&$src),$tmp\t!get double $src from table\n\t"
    6114             "LDDF   [$tmp+lo(&$src)],$dst" %}
     6219  format %{ "LDDF   [$constanttablebase + $constantoffset],$dst\t! load from constant table: double=$con" %}
    61156220  ins_encode %{
    6116     address double_address = __ double_constant($src$$constant);
    6117     RelocationHolder rspec = internal_word_Relocation::spec(double_address);
    6118     AddressLiteral addrlit(double_address, rspec);
    6119 
    6120     __ sethi(addrlit, $tmp$$Register);
    61216221    // XXX This is a quick fix for 6833573.
    6122     //__ ldf(FloatRegisterImpl::D, $tmp$$Register, addrlit.low10(), $dst$$FloatRegister, rspec);
    6123     __ ldf(FloatRegisterImpl::D, $tmp$$Register, addrlit.low10(), as_DoubleFloatRegister($dst$$reg), rspec);
     6222    //__ ldf(FloatRegisterImpl::D, $constanttablebase, $constantoffset($con), $dst$$FloatRegister);
     6223    RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset($con), $tmp$$Register);
     6224    __ ldf(FloatRegisterImpl::D, $constanttablebase, con_offset, as_DoubleFloatRegister($dst$$reg));
    61246225  %}
    61256226  ins_pipe(loadConFD);
     
    80258126#endif
    80268127
     8128instruct cmpLTMask0( iRegI dst, iRegI src, immI0 zero, flagsReg ccr ) %{
     8129  match(Set dst (CmpLTMask src zero));
     8130  effect(KILL ccr);
     8131  size(4);
     8132  format %{ "SRA    $src,#31,$dst\t# cmpLTMask0" %}
     8133  ins_encode %{
     8134    __ sra($src$$Register, 31, $dst$$Register);
     8135  %}
     8136  ins_pipe(ialu_reg_imm);
     8137%}
     8138
    80278139instruct cmpLTMask_reg_reg( iRegI dst, iRegI p, iRegI q, flagsReg ccr ) %{
    80288140  match(Set dst (CmpLTMask p q));
     
    80448156  format %{ "SUBcc  $p,$q,$p\t! p' = p-q\n\t"
    80458157            "ADD    $p,$y,$tmp\t! g3=p-q+y\n\t"
    8046             "MOVl   $tmp,$p\t! p' < 0 ? p'+y : p'" %}
    8047   ins_encode( enc_cadd_cmpLTMask(p, q, y, tmp) );
    8048   ins_pipe( cadd_cmpltmask );
    8049 %}
    8050 
    8051 instruct cadd_cmpLTMask2( iRegI p, iRegI q, iRegI y, iRegI tmp, flagsReg ccr ) %{
    8052   match(Set p (AddI (SubI p q) (AndI (CmpLTMask p q) y)));
    8053   effect( KILL ccr, TEMP tmp);
    8054   ins_cost(DEFAULT_COST*3);
    8055 
    8056   format %{ "SUBcc  $p,$q,$p\t! p' = p-q\n\t"
    8057             "ADD    $p,$y,$tmp\t! g3=p-q+y\n\t"
    8058             "MOVl   $tmp,$p\t! p' < 0 ? p'+y : p'" %}
     8158            "MOVlt  $tmp,$p\t! p' < 0 ? p'+y : p'" %}
    80598159  ins_encode( enc_cadd_cmpLTMask(p, q, y, tmp) );
    80608160  ins_pipe( cadd_cmpltmask );
     
    85738673
    85748674// Replicate scalar constant to packed byte values in Double register
    8575 instruct Repl8B_immI(regD dst, immI13 src, o7RegP tmp) %{
    8576   match(Set dst (Replicate8B src));
    8577 #ifdef _LP64
    8578   size(36);
    8579 #else
    8580   size(8);
    8581 #endif
    8582   format %{ "SETHI  hi(&Repl8($src)),$tmp\t!get Repl8B($src) from table\n\t"
    8583             "LDDF   [$tmp+lo(&Repl8($src))],$dst" %}
    8584   ins_encode( LdReplImmI(src, dst, tmp, (8), (1)) );
     8675instruct Repl8B_immI(regD dst, immI13 con, o7RegI tmp) %{
     8676  match(Set dst (Replicate8B con));
     8677  effect(KILL tmp);
     8678  format %{ "LDDF   [$constanttablebase + $constantoffset],$dst\t! load from constant table: Repl8B($con)" %}
     8679  ins_encode %{
     8680    // XXX This is a quick fix for 6833573.
     8681    //__ ldf(FloatRegisterImpl::D, $constanttablebase, $constantoffset(replicate_immI($con$$constant, 8, 1)), $dst$$FloatRegister);
     8682    RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset(replicate_immI($con$$constant, 8, 1)), $tmp$$Register);
     8683    __ ldf(FloatRegisterImpl::D, $constanttablebase, con_offset, as_DoubleFloatRegister($dst$$reg));
     8684  %}
    85858685  ins_pipe(loadConFD);
    85868686%}
     
    86098709
    86108710// Replicate scalar constant to packed char values in Double register
    8611 instruct Repl4C_immI(regD dst, immI src, o7RegP tmp) %{
    8612   match(Set dst (Replicate4C src));
    8613 #ifdef _LP64
    8614   size(36);
    8615 #else
    8616   size(8);
    8617 #endif
    8618   format %{ "SETHI  hi(&Repl4($src)),$tmp\t!get Repl4C($src) from table\n\t"
    8619             "LDDF   [$tmp+lo(&Repl4($src))],$dst" %}
    8620   ins_encode( LdReplImmI(src, dst, tmp, (4), (2)) );
     8711instruct Repl4C_immI(regD dst, immI con, o7RegI tmp) %{
     8712  match(Set dst (Replicate4C con));
     8713  effect(KILL tmp);
     8714  format %{ "LDDF   [$constanttablebase + $constantoffset],$dst\t! load from constant table: Repl4C($con)" %}
     8715  ins_encode %{
     8716    // XXX This is a quick fix for 6833573.
     8717    //__ ldf(FloatRegisterImpl::D, $constanttablebase, $constantoffset(replicate_immI($con$$constant, 4, 2)), $dst$$FloatRegister);
     8718    RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset(replicate_immI($con$$constant, 4, 2)), $tmp$$Register);
     8719    __ ldf(FloatRegisterImpl::D, $constanttablebase, con_offset, as_DoubleFloatRegister($dst$$reg));
     8720  %}
    86218721  ins_pipe(loadConFD);
    86228722%}
     
    86458745
    86468746// Replicate scalar constant to packed short values in Double register
    8647 instruct Repl4S_immI(regD dst, immI src, o7RegP tmp) %{
    8648   match(Set dst (Replicate4S src));
    8649 #ifdef _LP64
    8650   size(36);
    8651 #else
    8652   size(8);
    8653 #endif
    8654   format %{ "SETHI  hi(&Repl4($src)),$tmp\t!get Repl4S($src) from table\n\t"
    8655             "LDDF   [$tmp+lo(&Repl4($src))],$dst" %}
    8656   ins_encode( LdReplImmI(src, dst, tmp, (4), (2)) );
     8747instruct Repl4S_immI(regD dst, immI con, o7RegI tmp) %{
     8748  match(Set dst (Replicate4S con));
     8749  effect(KILL tmp);
     8750  format %{ "LDDF   [$constanttablebase + $constantoffset],$dst\t! load from constant table: Repl4S($con)" %}
     8751  ins_encode %{
     8752    // XXX This is a quick fix for 6833573.
     8753    //__ ldf(FloatRegisterImpl::D, $constanttablebase, $constantoffset(replicate_immI($con$$constant, 4, 2)), $dst$$FloatRegister);
     8754    RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset(replicate_immI($con$$constant, 4, 2)), $tmp$$Register);
     8755    __ ldf(FloatRegisterImpl::D, $constanttablebase, con_offset, as_DoubleFloatRegister($dst$$reg));
     8756  %}
    86578757  ins_pipe(loadConFD);
    86588758%}
     
    86798779
    86808780// Replicate scalar zero constant to packed int values in Double register
    8681 instruct Repl2I_immI(regD dst, immI src, o7RegP tmp) %{
    8682   match(Set dst (Replicate2I src));
    8683 #ifdef _LP64
    8684   size(36);
    8685 #else
    8686   size(8);
    8687 #endif
    8688   format %{ "SETHI  hi(&Repl2($src)),$tmp\t!get Repl2I($src) from table\n\t"
    8689             "LDDF   [$tmp+lo(&Repl2($src))],$dst" %}
    8690   ins_encode( LdReplImmI(src, dst, tmp, (2), (4)) );
     8781instruct Repl2I_immI(regD dst, immI con, o7RegI tmp) %{
     8782  match(Set dst (Replicate2I con));
     8783  effect(KILL tmp);
     8784  format %{ "LDDF   [$constanttablebase + $constantoffset],$dst\t! load from constant table: Repl2I($con)" %}
     8785  ins_encode %{
     8786    // XXX This is a quick fix for 6833573.
     8787    //__ ldf(FloatRegisterImpl::D, $constanttablebase, $constantoffset(replicate_immI($con$$constant, 2, 4)), $dst$$FloatRegister);
     8788    RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset(replicate_immI($con$$constant, 2, 4)), $tmp$$Register);
     8789    __ ldf(FloatRegisterImpl::D, $constanttablebase, con_offset, as_DoubleFloatRegister($dst$$reg));
     8790  %}
    86918791  ins_pipe(loadConFD);
    86928792%}
     
    89449044  ins_cost(350);
    89459045
    8946   format %{  "SETHI  [hi(table_base)],O7\n\t"
    8947              "ADD    O7, lo(table_base), O7\n\t"
    8948              "LD     [O7+$switch_val], O7\n\t"
     9046  format %{  "ADD    $constanttablebase, $constantoffset, O7\n\t"
     9047             "LD     [O7 + $switch_val], O7\n\t"
    89499048             "JUMP   O7"
    89509049         %}
    8951   ins_encode( jump_enc( switch_val, table) );
     9050  ins_encode %{
     9051    // Calculate table address into a register.
     9052    Register table_reg;
     9053    Register label_reg = O7;
     9054    if (constant_offset() == 0) {
     9055      table_reg = $constanttablebase;
     9056    } else {
     9057      table_reg = O7;
     9058      RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset, O7);
     9059      __ add($constanttablebase, con_offset, table_reg);
     9060    }
     9061
     9062    // Jump to base address + switch value
     9063    __ ld_ptr(table_reg, $switch_val$$Register, label_reg);
     9064    __ jmp(label_reg, G0);
     9065    __ delayed()->nop();
     9066  %}
    89529067  ins_pc_relative(1);
    89539068  ins_pipe(ialu_reg_reg);
     
    95319646    Register Rsrc = $src$$Register;
    95329647    Register Rtmp = $tmp$$Register;
    9533     __ srl(Rsrc, 1, Rtmp);
    9534     __ srl(Rsrc, 0, Rdst);
     9648    __ srl(Rsrc, 1,    Rtmp);
     9649    __ srl(Rsrc, 0,    Rdst);
    95359650    __ or3(Rdst, Rtmp, Rdst);
    9536     __ srl(Rdst, 2, Rtmp);
     9651    __ srl(Rdst, 2,    Rtmp);
    95379652    __ or3(Rdst, Rtmp, Rdst);
    9538     __ srl(Rdst, 4, Rtmp);
     9653    __ srl(Rdst, 4,    Rtmp);
    95399654    __ or3(Rdst, Rtmp, Rdst);
    9540     __ srl(Rdst, 8, Rtmp);
     9655    __ srl(Rdst, 8,    Rtmp);
    95419656    __ or3(Rdst, Rtmp, Rdst);
    9542     __ srl(Rdst, 16, Rtmp);
     9657    __ srl(Rdst, 16,   Rtmp);
    95439658    __ or3(Rdst, Rtmp, Rdst);
    95449659    __ popc(Rdst, Rdst);
     
    95499664%}
    95509665
    9551 instruct countLeadingZerosL(iRegI dst, iRegL src, iRegL tmp, flagsReg cr) %{
     9666instruct countLeadingZerosL(iRegIsafe dst, iRegL src, iRegL tmp, flagsReg cr) %{
    95529667  predicate(UsePopCountInstruction);  // See Matcher::match_rule_supported
    95539668  match(Set dst (CountLeadingZerosL src));
     
    95809695    Register Rsrc = $src$$Register;
    95819696    Register Rtmp = $tmp$$Register;
    9582     __ srlx(Rsrc, 1, Rtmp);
    9583     __ or3(Rsrc, Rtmp, Rdst);
    9584     __ srlx(Rdst, 2, Rtmp);
    9585     __ or3(Rdst, Rtmp, Rdst);
    9586     __ srlx(Rdst, 4, Rtmp);
    9587     __ or3(Rdst, Rtmp, Rdst);
    9588     __ srlx(Rdst, 8, Rtmp);
    9589     __ or3(Rdst, Rtmp, Rdst);
    9590     __ srlx(Rdst, 16, Rtmp);
    9591     __ or3(Rdst, Rtmp, Rdst);
    9592     __ srlx(Rdst, 32, Rtmp);
    9593     __ or3(Rdst, Rtmp, Rdst);
     9697    __ srlx(Rsrc, 1,    Rtmp);
     9698    __ or3( Rsrc, Rtmp, Rdst);
     9699    __ srlx(Rdst, 2,    Rtmp);
     9700    __ or3( Rdst, Rtmp, Rdst);
     9701    __ srlx(Rdst, 4,    Rtmp);
     9702    __ or3( Rdst, Rtmp, Rdst);
     9703    __ srlx(Rdst, 8,    Rtmp);
     9704    __ or3( Rdst, Rtmp, Rdst);
     9705    __ srlx(Rdst, 16,   Rtmp);
     9706    __ or3( Rdst, Rtmp, Rdst);
     9707    __ srlx(Rdst, 32,   Rtmp);
     9708    __ or3( Rdst, Rtmp, Rdst);
    95949709    __ popc(Rdst, Rdst);
    95959710    __ mov(BitsPerLong, Rtmp);
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp

    r278 r309  
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_stubGenerator_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "asm/assembler.hpp"
     27#include "assembler_sparc.inline.hpp"
     28#include "interpreter/interpreter.hpp"
     29#include "nativeInst_sparc.hpp"
     30#include "oops/instanceOop.hpp"
     31#include "oops/methodOop.hpp"
     32#include "oops/objArrayKlass.hpp"
     33#include "oops/oop.inline.hpp"
     34#include "prims/methodHandles.hpp"
     35#include "runtime/frame.inline.hpp"
     36#include "runtime/handles.inline.hpp"
     37#include "runtime/sharedRuntime.hpp"
     38#include "runtime/stubCodeGenerator.hpp"
     39#include "runtime/stubRoutines.hpp"
     40#include "utilities/top.hpp"
     41#ifdef TARGET_OS_FAMILY_linux
     42# include "thread_linux.inline.hpp"
     43#endif
     44#ifdef TARGET_OS_FAMILY_solaris
     45# include "thread_solaris.inline.hpp"
     46#endif
     47#ifdef COMPILER2
     48#include "opto/runtime.hpp"
     49#endif
    2750
    2851// Declaration and definition of StubGenerator (no .hpp file).
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_stubRoutines_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "runtime/deoptimization.hpp"
     27#include "runtime/frame.inline.hpp"
     28#include "runtime/stubRoutines.hpp"
     29#ifdef TARGET_OS_FAMILY_linux
     30# include "thread_linux.inline.hpp"
     31#endif
     32#ifdef TARGET_OS_FAMILY_solaris
     33# include "thread_solaris.inline.hpp"
     34#endif
    2735
    2836// Implementation of the platform-specific part of StubRoutines - for
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp

    r278 r309  
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_STUBROUTINES_SPARC_HPP
     26#define CPU_SPARC_VM_STUBROUTINES_SPARC_HPP
     27
    2528// This file holds the platform specific parts of the StubRoutines
    2629// definition. See stubRoutines.hpp for a description on how to
     
    4447// MethodHandles adapters
    4548enum method_handles_platform_dependent_constants {
    46   method_handles_adapters_code_size = 6000
     49  method_handles_adapters_code_size = 15000
    4750};
    4851
     
    101104  static address partial_subtype_check()                  { return _partial_subtype_check; }
    102105};
     106
     107#endif // CPU_SPARC_VM_STUBROUTINES_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_TEMPLATEINTERPRETERGENERATOR_SPARC_HPP
     26#define CPU_SPARC_VM_TEMPLATEINTERPRETERGENERATOR_SPARC_HPP
     27
    2528  protected:
    2629
     
    2831  void generate_stack_overflow_check(Register Rframe_size, Register Rscratch,
    2932                                     Register Rscratch2);
     33
     34#endif // CPU_SPARC_VM_TEMPLATEINTERPRETERGENERATOR_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_templateInterpreter_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "asm/assembler.hpp"
     27#include "interpreter/bytecodeHistogram.hpp"
     28#include "interpreter/interpreter.hpp"
     29#include "interpreter/interpreterGenerator.hpp"
     30#include "interpreter/interpreterRuntime.hpp"
     31#include "interpreter/templateTable.hpp"
     32#include "oops/arrayOop.hpp"
     33#include "oops/methodDataOop.hpp"
     34#include "oops/methodOop.hpp"
     35#include "oops/oop.inline.hpp"
     36#include "prims/jvmtiExport.hpp"
     37#include "prims/jvmtiThreadState.hpp"
     38#include "runtime/arguments.hpp"
     39#include "runtime/deoptimization.hpp"
     40#include "runtime/frame.inline.hpp"
     41#include "runtime/sharedRuntime.hpp"
     42#include "runtime/stubRoutines.hpp"
     43#include "runtime/synchronizer.hpp"
     44#include "runtime/timer.hpp"
     45#include "runtime/vframeArray.hpp"
     46#include "utilities/debug.hpp"
    2747
    2848#ifndef CC_INTERP
     
    295315//
    296316void InterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) {
    297   // Update standard invocation counters
    298   __ increment_invocation_counter(O0, G3_scratch);
    299   if (ProfileInterpreter) {  // %%% Merge this into methodDataOop
    300     Address interpreter_invocation_counter(Lmethod, methodOopDesc::interpreter_invocation_counter_offset());
    301     __ ld(interpreter_invocation_counter, G3_scratch);
    302     __ inc(G3_scratch);
    303     __ st(G3_scratch, interpreter_invocation_counter);
    304   }
    305 
    306   if (ProfileInterpreter && profile_method != NULL) {
    307     // Test to see if we should create a method data oop
    308     AddressLiteral profile_limit(&InvocationCounter::InterpreterProfileLimit);
    309     __ sethi(profile_limit, G3_scratch);
    310     __ ld(G3_scratch, profile_limit.low10(), G3_scratch);
     317  // Note: In tiered we increment either counters in methodOop or in MDO depending if we're profiling or not.
     318  if (TieredCompilation) {
     319    const int increment = InvocationCounter::count_increment;
     320    const int mask = ((1 << Tier0InvokeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
     321    Label no_mdo, done;
     322    if (ProfileInterpreter) {
     323      // If no method data exists, go to profile_continue.
     324      __ ld_ptr(Lmethod, methodOopDesc::method_data_offset(), G4_scratch);
     325      __ br_null(G4_scratch, false, Assembler::pn, no_mdo);
     326      __ delayed()->nop();
     327      // Increment counter
     328      Address mdo_invocation_counter(G4_scratch,
     329                                     in_bytes(methodDataOopDesc::invocation_counter_offset()) +
     330                                     in_bytes(InvocationCounter::counter_offset()));
     331      __ increment_mask_and_jump(mdo_invocation_counter, increment, mask,
     332                                 G3_scratch, Lscratch,
     333                                 Assembler::zero, overflow);
     334      __ ba(false, done);
     335      __ delayed()->nop();
     336    }
     337
     338    // Increment counter in methodOop
     339    __ bind(no_mdo);
     340    Address invocation_counter(Lmethod,
     341                               in_bytes(methodOopDesc::invocation_counter_offset()) +
     342                               in_bytes(InvocationCounter::counter_offset()));
     343    __ increment_mask_and_jump(invocation_counter, increment, mask,
     344                               G3_scratch, Lscratch,
     345                               Assembler::zero, overflow);
     346    __ bind(done);
     347  } else {
     348    // Update standard invocation counters
     349    __ increment_invocation_counter(O0, G3_scratch);
     350    if (ProfileInterpreter) {  // %%% Merge this into methodDataOop
     351      Address interpreter_invocation_counter(Lmethod,in_bytes(methodOopDesc::interpreter_invocation_counter_offset()));
     352      __ ld(interpreter_invocation_counter, G3_scratch);
     353      __ inc(G3_scratch);
     354      __ st(G3_scratch, interpreter_invocation_counter);
     355    }
     356
     357    if (ProfileInterpreter && profile_method != NULL) {
     358      // Test to see if we should create a method data oop
     359      AddressLiteral profile_limit((address)&InvocationCounter::InterpreterProfileLimit);
     360      __ load_contents(profile_limit, G3_scratch);
     361      __ cmp(O0, G3_scratch);
     362      __ br(Assembler::lessUnsigned, false, Assembler::pn, *profile_method_continue);
     363      __ delayed()->nop();
     364
     365      // if no method data exists, go to profile_method
     366      __ test_method_data_pointer(*profile_method);
     367    }
     368
     369    AddressLiteral invocation_limit((address)&InvocationCounter::InterpreterInvocationLimit);
     370    __ load_contents(invocation_limit, G3_scratch);
    311371    __ cmp(O0, G3_scratch);
    312     __ br(Assembler::lessUnsigned, false, Assembler::pn, *profile_method_continue);
     372    __ br(Assembler::greaterEqualUnsigned, false, Assembler::pn, *overflow);
    313373    __ delayed()->nop();
    314 
    315     // if no method data exists, go to profile_method
    316     __ test_method_data_pointer(*profile_method);
    317   }
    318 
    319   AddressLiteral invocation_limit(&InvocationCounter::InterpreterInvocationLimit);
    320   __ sethi(invocation_limit, G3_scratch);
    321   __ ld(G3_scratch, invocation_limit.low10(), G3_scratch);
    322   __ cmp(O0, G3_scratch);
    323   __ br(Assembler::greaterEqualUnsigned, false, Assembler::pn, *overflow);
    324   __ delayed()->nop();
     374  }
    325375
    326376}
     
    13151365      __ bind(profile_method);
    13161366
    1317       __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method), Lbcp, true);
    1318 
    1319 #ifdef ASSERT
    1320       __ tst(O0);
    1321       __ breakpoint_trap(Assembler::notEqual);
    1322 #endif
    1323 
    1324       __ set_method_data_pointer();
    1325 
     1367      __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
     1368      __ set_method_data_pointer_for_bcp();
    13261369      __ ba(false, profile_method_continue);
    13271370      __ delayed()->nop();
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.hpp

    r278 r309  
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_TEMPLATEINTERPRETER_SPARC_HPP
     26#define CPU_SPARC_VM_TEMPLATEINTERPRETER_SPARC_HPP
     27
    2528
    2629  protected:
     
    3942  const static int InterpreterCodeSize = 180 * K;
    4043#endif
     44
     45#endif // CPU_SPARC_VM_TEMPLATEINTERPRETER_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_templateTable_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "interpreter/interpreter.hpp"
     27#include "interpreter/interpreterRuntime.hpp"
     28#include "interpreter/templateTable.hpp"
     29#include "memory/universe.inline.hpp"
     30#include "oops/methodDataOop.hpp"
     31#include "oops/objArrayKlass.hpp"
     32#include "oops/oop.inline.hpp"
     33#include "prims/methodHandles.hpp"
     34#include "runtime/sharedRuntime.hpp"
     35#include "runtime/stubRoutines.hpp"
     36#include "runtime/synchronizer.hpp"
    2737
    2838#ifndef CC_INTERP
     
    342352
    343353  __ verify_oop(Otos_i);
     354
     355  Label L_done;
     356  const Register Rcon_klass = G3_scratch;  // same as Rcache
     357  const Register Rarray_klass = G4_scratch;  // same as Rscratch
     358  __ load_klass(Otos_i, Rcon_klass);
     359  AddressLiteral array_klass_addr((address)Universe::systemObjArrayKlassObj_addr());
     360  __ load_contents(array_klass_addr, Rarray_klass);
     361  __ cmp(Rarray_klass, Rcon_klass);
     362  __ brx(Assembler::notEqual, false, Assembler::pt, L_done);
     363  __ delayed()->nop();
     364  __ ld(Address(Otos_i, arrayOopDesc::length_offset_in_bytes()), Rcon_klass);
     365  __ tst(Rcon_klass);
     366  __ brx(Assembler::zero, true, Assembler::pt, L_done);
     367  __ delayed()->clr(Otos_i);    // executed only if branch is taken
     368
     369  // Load the exception from the system-array which wraps it:
     370  __ load_heap_oop(Otos_i, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Otos_i);
     371  __ throw_if_not_x(Assembler::never, Interpreter::throw_exception_entry(), G3_scratch);
     372
     373  __ bind(L_done);
    344374}
    345375
     
    15811611  __ mov( Lbcp, O0_cur_bcp );
    15821612
     1613
    15831614  bool increment_invocation_counter_for_backward_branches = UseCompiler && UseLoopCounter;
    15841615  if ( increment_invocation_counter_for_backward_branches ) {
     
    15891620    __ delayed()->add( O1_disp, Lbcp, Lbcp );     // add to bc addr
    15901621
    1591     // Update Backedge branch separately from invocations
    1592     const Register G4_invoke_ctr = G4;
    1593     __ increment_backedge_counter(G4_invoke_ctr, G1_scratch);
    1594     if (ProfileInterpreter) {
    1595       __ test_invocation_counter_for_mdp(G4_invoke_ctr, Lbcp, G3_scratch, Lforward);
    1596       if (UseOnStackReplacement) {
    1597         __ test_backedge_count_for_osr(O2_bumped_count, O0_cur_bcp, G3_scratch);
     1622    if (TieredCompilation) {
     1623      Label Lno_mdo, Loverflow;
     1624      int increment = InvocationCounter::count_increment;
     1625      int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
     1626      if (ProfileInterpreter) {
     1627        // If no method data exists, go to profile_continue.
     1628        __ ld_ptr(Lmethod, methodOopDesc::method_data_offset(), G4_scratch);
     1629        __ br_null(G4_scratch, false, Assembler::pn, Lno_mdo);
     1630        __ delayed()->nop();
     1631
     1632        // Increment backedge counter in the MDO
     1633        Address mdo_backedge_counter(G4_scratch, in_bytes(methodDataOopDesc::backedge_counter_offset()) +
     1634                                                 in_bytes(InvocationCounter::counter_offset()));
     1635        __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, G3_scratch, Lscratch,
     1636                                   Assembler::notZero, &Lforward);
     1637        __ ba(false, Loverflow);
     1638        __ delayed()->nop();
    15981639      }
     1640
     1641      // If there's no MDO, increment counter in methodOop
     1642      __ bind(Lno_mdo);
     1643      Address backedge_counter(Lmethod, in_bytes(methodOopDesc::backedge_counter_offset()) +
     1644                                        in_bytes(InvocationCounter::counter_offset()));
     1645      __ increment_mask_and_jump(backedge_counter, increment, mask, G3_scratch, Lscratch,
     1646                                 Assembler::notZero, &Lforward);
     1647      __ bind(Loverflow);
     1648
     1649      // notify point for loop, pass branch bytecode
     1650      __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), O0_cur_bcp);
     1651
     1652      // Was an OSR adapter generated?
     1653      // O0 = osr nmethod
     1654      __ br_null(O0, false, Assembler::pn, Lforward);
     1655      __ delayed()->nop();
     1656
     1657      // Has the nmethod been invalidated already?
     1658      __ ld(O0, nmethod::entry_bci_offset(), O2);
     1659      __ cmp(O2, InvalidOSREntryBci);
     1660      __ br(Assembler::equal, false, Assembler::pn, Lforward);
     1661      __ delayed()->nop();
     1662
     1663      // migrate the interpreter frame off of the stack
     1664
     1665      __ mov(G2_thread, L7);
     1666      // save nmethod
     1667      __ mov(O0, L6);
     1668      __ set_last_Java_frame(SP, noreg);
     1669      __ call_VM_leaf(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin), L7);
     1670      __ reset_last_Java_frame();
     1671      __ mov(L7, G2_thread);
     1672
     1673      // move OSR nmethod to I1
     1674      __ mov(L6, I1);
     1675
     1676      // OSR buffer to I0
     1677      __ mov(O0, I0);
     1678
     1679      // remove the interpreter frame
     1680      __ restore(I5_savedSP, 0, SP);
     1681
     1682      // Jump to the osr code.
     1683      __ ld_ptr(O1, nmethod::osr_entry_point_offset(), O2);
     1684      __ jmp(O2, G0);
     1685      __ delayed()->nop();
     1686
    15991687    } else {
    1600       if (UseOnStackReplacement) {
    1601         __ test_backedge_count_for_osr(G4_invoke_ctr, O0_cur_bcp, G3_scratch);
     1688      // Update Backedge branch separately from invocations
     1689      const Register G4_invoke_ctr = G4;
     1690      __ increment_backedge_counter(G4_invoke_ctr, G1_scratch);
     1691      if (ProfileInterpreter) {
     1692        __ test_invocation_counter_for_mdp(G4_invoke_ctr, G3_scratch, Lforward);
     1693        if (UseOnStackReplacement) {
     1694          __ test_backedge_count_for_osr(O2_bumped_count, O0_cur_bcp, G3_scratch);
     1695        }
     1696      } else {
     1697        if (UseOnStackReplacement) {
     1698          __ test_backedge_count_for_osr(G4_invoke_ctr, O0_cur_bcp, G3_scratch);
     1699        }
    16021700      }
    16031701    }
     
    32063304  __ ld_ptr(Rtemp, Rret, Rret);  // get return address
    32073305
    3208   __ ld_ptr(G5_callsite, __ delayed_value(java_dyn_CallSite::target_offset_in_bytes, Rscratch), G3_method_handle);
     3306  __ load_heap_oop(G5_callsite, __ delayed_value(java_dyn_CallSite::target_offset_in_bytes, Rscratch), G3_method_handle);
    32093307  __ null_check(G3_method_handle);
    32103308
     
    32963394
    32973395    if (allow_shared_alloc) {
    3298     // Check if tlab should be discarded (refill_waste_limit >= free)
    3299     __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
    3300     __ sub(RendValue, RoldTopValue, RfreeValue);
     3396      // Check if tlab should be discarded (refill_waste_limit >= free)
     3397      __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
     3398      __ sub(RendValue, RoldTopValue, RfreeValue);
    33013399#ifdef _LP64
    3302     __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
     3400      __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
    33033401#else
    3304     __ srl(RfreeValue, LogHeapWordSize, RfreeValue);
     3402      __ srl(RfreeValue, LogHeapWordSize, RfreeValue);
    33053403#endif
    3306     __ cmp(RtlabWasteLimitValue, RfreeValue);
    3307     __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, slow_case); // tlab waste is small
    3308     __ delayed()->nop();
    3309 
    3310     // increment waste limit to prevent getting stuck on this slow path
    3311     __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
    3312     __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
     3404      __ cmp(RtlabWasteLimitValue, RfreeValue);
     3405      __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, slow_case); // tlab waste is small
     3406      __ delayed()->nop();
     3407
     3408      // increment waste limit to prevent getting stuck on this slow path
     3409      __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
     3410      __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
    33133411    } else {
    33143412      // No allocation in the shared eden.
     
    33483446    __ brx(Assembler::notEqual, false, Assembler::pn, retry);
    33493447    __ delayed()->nop();
     3448
     3449    // bump total bytes allocated by this thread
     3450    // RoldTopValue and RtopAddr are dead, so can use G1 and G3
     3451    __ incr_allocated_bytes(Roffset, G1_scratch, G3_scratch);
    33503452  }
    33513453
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/templateTable_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_TEMPLATETABLE_SPARC_HPP
     26#define CPU_SPARC_VM_TEMPLATETABLE_SPARC_HPP
     27
    2528  // helper function
    2629  static void invokevfinal_helper(Register Rcache, Register Rret);
     
    3033  static void generate_vtable_call(Register Rrecv, Register Rindex, Register Rret);
    3134  static void volatile_barrier(Assembler::Membar_mask_bits order_constraint);
     35
     36#endif // CPU_SPARC_VM_TEMPLATETABLE_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_VMSTRUCTS_SPARC_HPP
     26#define CPU_SPARC_VM_VMSTRUCTS_SPARC_HPP
    2427
    2528// These are the CPU-specific fields, types and integer
     
    98101  /* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must */
    99102  /* be present there)                                                      */
     103
     104#endif // CPU_SPARC_VM_VMSTRUCTS_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_vm_version_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "assembler_sparc.inline.hpp"
     27#include "memory/resourceArea.hpp"
     28#include "runtime/java.hpp"
     29#include "runtime/stubCodeGenerator.hpp"
     30#include "vm_version_sparc.hpp"
     31#ifdef TARGET_OS_FAMILY_linux
     32# include "os_linux.inline.hpp"
     33#endif
     34#ifdef TARGET_OS_FAMILY_solaris
     35# include "os_solaris.inline.hpp"
     36#endif
    2737
    2838int VM_Version::_features = VM_Version::unknown_m;
    2939const char* VM_Version::_features_str = "";
    30 
    31 bool VM_Version::is_niagara1_plus() {
    32   // This is a placeholder until the real test is determined.
    33   return is_niagara1() &&
    34     (os::processor_count() > maximum_niagara1_processor_count());
    35 }
    3640
    3741void VM_Version::initialize() {
     
    6064  _supports_cx8               = has_v9();
    6165
    62   if (is_niagara1()) {
     66  if (is_niagara()) {
    6367    // Indirect branch is the same cost as direct
    6468    if (FLAG_IS_DEFAULT(UseInlineCaches)) {
    6569      FLAG_SET_DEFAULT(UseInlineCaches, false);
     70    }
     71    // Align loops on a single instruction boundary.
     72    if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
     73      FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
     74    }
     75    // When using CMS, we cannot use memset() in BOT updates because
     76    // the sun4v/CMT version in libc_psr uses BIS which exposes
     77    // "phantom zeros" to concurrent readers. See 6948537.
     78    if (FLAG_IS_DEFAULT(UseMemSetInBOT) && UseConcMarkSweepGC) {
     79      FLAG_SET_DEFAULT(UseMemSetInBOT, false);
    6680    }
    6781#ifdef _LP64
     
    8094      FLAG_SET_DEFAULT(InteriorEntryAlignment, 4);
    8195    }
    82     if (is_niagara1_plus()) {
    83       if (AllocatePrefetchStyle > 0 && FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
     96    if (is_niagara_plus()) {
     97      if (has_blk_init() && AllocatePrefetchStyle > 0 &&
     98          FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
    8499        // Use BIS instruction for allocation prefetch.
    85100        FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
     
    95110    }
    96111#endif
    97     if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
    98       FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
    99     }
    100     // When using CMS, we cannot use memset() in BOT updates because
    101     // the sun4v/CMT version in libc_psr uses BIS which exposes
    102     // "phantom zeros" to concurrent readers. See 6948537.
    103     if (FLAG_IS_DEFAULT(UseMemSetInBOT) && UseConcMarkSweepGC) {
    104       FLAG_SET_DEFAULT(UseMemSetInBOT, false);
    105     }
    106112  }
    107113
     
    119125
    120126  char buf[512];
    121   jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s",
     127  jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
    122128               (has_v8() ? ", has_v8" : ""),
    123129               (has_v9() ? ", has_v9" : ""),
     
    125131               (has_vis1() ? ", has_vis1" : ""),
    126132               (has_vis2() ? ", has_vis2" : ""),
     133               (has_vis3() ? ", has_vis3" : ""),
     134               (has_blk_init() ? ", has_blk_init" : ""),
    127135               (is_ultra3() ? ", is_ultra3" : ""),
    128136               (is_sun4v() ? ", is_sun4v" : ""),
    129                (is_niagara1() ? ", is_niagara1" : ""),
    130                (is_niagara1_plus() ? ", is_niagara1_plus" : ""),
     137               (is_niagara() ? ", is_niagara" : ""),
     138               (is_niagara_plus() ? ", is_niagara_plus" : ""),
     139               (is_sparc64() ? ", is_sparc64" : ""),
    131140               (!has_hardware_mul32() ? ", no-mul32" : ""),
    132141               (!has_hardware_div32() ? ", no-div32" : ""),
     
    178187  }
    179188
    180   if (UseNiagaraInstrs) {
    181     if (is_niagara1(features)) {
     189  assert(is_T_family(features) == is_niagara(features), "Niagara should be T series");
     190  if (UseNiagaraInstrs) { // Force code generation for Niagara
     191    if (is_T_family(features)) {
    182192      // Happy to accomodate...
    183193    } else {
    184194      NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Niagara");)
    185       features = niagara1_m;
     195      features |= T_family_m;
    186196    }
    187197  } else {
    188     if (is_niagara1(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
     198    if (is_T_family(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
    189199      NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Not-Niagara");)
    190       features &= ~niagara1_unique_m;
     200      features &= ~(T_family_m | T1_model_m);
    191201    } else {
    192202      // Happy to accomodate...
     
    210220unsigned int VM_Version::calc_parallel_worker_threads() {
    211221  unsigned int result;
    212   if (is_niagara1_plus()) {
     222  if (is_niagara_plus()) {
    213223    result = nof_parallel_worker_threads(5, 16, 8);
    214224  } else {
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_VM_VERSION_SPARC_HPP
     26#define CPU_SPARC_VM_VM_VERSION_SPARC_HPP
     27
     28#include "runtime/globals_extension.hpp"
     29#include "runtime/vm_version.hpp"
     30
    2531class VM_Version: public Abstract_VM_Version {
    2632protected:
     
    3440    vis1_instructions  = 6,
    3541    vis2_instructions  = 7,
    36     sun4v_instructions = 8
     42    sun4v_instructions = 8,
     43    blk_init_instructions = 9,
     44    fmaf_instructions  = 10,
     45    fmau_instructions  = 11,
     46    vis3_instructions  = 12,
     47    sparc64_family     = 13,
     48    T_family           = 14,
     49    T1_model           = 15
    3750  };
    3851
     
    5063    vis2_instructions_m = 1 << vis2_instructions,
    5164    sun4v_m             = 1 << sun4v_instructions,
     65    blk_init_instructions_m = 1 << blk_init_instructions,
     66    fmaf_instructions_m = 1 << fmaf_instructions,
     67    fmau_instructions_m = 1 << fmau_instructions,
     68    vis3_instructions_m = 1 << vis3_instructions,
     69    sparc64_family_m    = 1 << sparc64_family,
     70    T_family_m          = 1 << T_family,
     71    T1_model_m          = 1 << T1_model,
    5272
    5373    generic_v8_m        = v8_instructions_m | hardware_mul32_m | hardware_div32_m | hardware_fsmuld_m,
     
    6787  static int  platform_features(int features);
    6888
    69   static bool is_niagara1(int features) { return (features & sun4v_m) != 0; }
     89  // Returns true if the platform is in the niagara line (T series)
     90  static bool is_T_family(int features) { return (features & T_family_m) != 0; }
     91  static bool is_niagara() { return is_T_family(_features); }
     92  DEBUG_ONLY( static bool is_niagara(int features)  { return (features & sun4v_m) != 0; } )
     93
     94  // Returns true if it is niagara1 (T1).
     95  static bool is_T1_model(int features) { return is_T_family(features) && ((features & T1_model_m) != 0); }
    7096
    7197  static int maximum_niagara1_processor_count() { return 32; }
    72   // Returns true if the platform is in the niagara line and
    73   // newer than the niagara1.
    74   static bool is_niagara1_plus();
    7598
    7699public:
     
    87110  static bool has_vis1()                { return (_features & vis1_instructions_m) != 0; }
    88111  static bool has_vis2()                { return (_features & vis2_instructions_m) != 0; }
     112  static bool has_vis3()                { return (_features & vis3_instructions_m) != 0; }
     113  static bool has_blk_init()            { return (_features & blk_init_instructions_m) != 0; }
    89114
    90115  static bool supports_compare_and_exchange()
     
    93118  static bool is_ultra3()               { return (_features & ultra3_m) == ultra3_m; }
    94119  static bool is_sun4v()                { return (_features & sun4v_m) != 0; }
    95   static bool is_niagara1()             { return is_niagara1(_features); }
     120  // Returns true if the platform is in the niagara line (T series)
     121  // and newer than the niagara1.
     122  static bool is_niagara_plus()         { return is_T_family(_features) && !is_T1_model(_features); }
     123  // Fujitsu SPARC64
     124  static bool is_sparc64()              { return (_features & sparc64_family_m) != 0; }
    96125
    97   static bool has_fast_fxtof()          { return has_v9() && !is_ultra3(); }
     126  static bool has_fast_fxtof()          { return is_niagara() || is_sparc64() || has_v9() && !is_ultra3(); }
     127  static bool has_fast_idiv()           { return is_niagara_plus() || is_sparc64(); }
    98128
    99129  static const char* cpu_features()     { return _features_str; }
     
    145175  static unsigned int calc_parallel_worker_threads();
    146176};
     177
     178#endif // CPU_SPARC_VM_VM_VERSION_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/vmreg_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_vmreg_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "asm/assembler.hpp"
     27#include "code/vmreg.hpp"
    2728
    2829
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/vmreg_sparc.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef CPU_SPARC_VM_VMREG_SPARC_HPP
     26#define CPU_SPARC_VM_VMREG_SPARC_HPP
     27
    2528  bool is_Register();
    2629  Register as_Register();
     
    2831  bool is_FloatRegister();
    2932  FloatRegister as_FloatRegister();
     33
     34#endif // CPU_SPARC_VM_VMREG_SPARC_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/vmreg_sparc.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef CPU_SPARC_VM_VMREG_SPARC_INLINE_HPP
     26#define CPU_SPARC_VM_VMREG_SPARC_INLINE_HPP
    2427
    2528inline VMReg RegisterImpl::as_VMReg() {
     
    6164  return false;
    6265}
     66
     67#endif // CPU_SPARC_VM_VMREG_SPARC_INLINE_HPP
  • trunk/openjdk/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_vtableStubs_sparc.cpp.incl"
     25#include "precompiled.hpp"
     26#include "asm/assembler.hpp"
     27#include "assembler_sparc.inline.hpp"
     28#include "code/vtableStubs.hpp"
     29#include "interp_masm_sparc.hpp"
     30#include "memory/resourceArea.hpp"
     31#include "oops/instanceKlass.hpp"
     32#include "oops/klassVtable.hpp"
     33#include "runtime/sharedRuntime.hpp"
     34#include "vmreg_sparc.inline.hpp"
     35#ifdef COMPILER2
     36#include "opto/runtime.hpp"
     37#endif
    2738
    2839// machine-dependent part of VtableStubs: create vtableStub of correct size and
Note: See TracChangeset for help on using the changeset viewer.