hotspot/src/share/vm/opto/library_call.cpp
changeset 2255 54abdf3e1055
parent 2131 98f9cef66a34
child 2348 4e71ed4c2709
equal deleted inserted replaced
2254:f13dda645a4b 2255:54abdf3e1055
     1 /*
     1 /*
     2  * Copyright 1999-2008 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   219                                     Node* dest, Node* dest_offset,
   219                                     Node* dest, Node* dest_offset,
   220                                     Node* copy_length);
   220                                     Node* copy_length);
   221   bool inline_unsafe_CAS(BasicType type);
   221   bool inline_unsafe_CAS(BasicType type);
   222   bool inline_unsafe_ordered_store(BasicType type);
   222   bool inline_unsafe_ordered_store(BasicType type);
   223   bool inline_fp_conversions(vmIntrinsics::ID id);
   223   bool inline_fp_conversions(vmIntrinsics::ID id);
       
   224   bool inline_bitCount(vmIntrinsics::ID id);
   224   bool inline_reverseBytes(vmIntrinsics::ID id);
   225   bool inline_reverseBytes(vmIntrinsics::ID id);
   225 };
   226 };
   226 
   227 
   227 
   228 
   228 //---------------------------make_vm_intrinsic----------------------------
   229 //---------------------------make_vm_intrinsic----------------------------
   312     if (!UseNewReflection)  return NULL;
   313     if (!UseNewReflection)  return NULL;
   313     if (!InlineReflectionGetCallerClass)  return NULL;
   314     if (!InlineReflectionGetCallerClass)  return NULL;
   314     if (!JDK_Version::is_gte_jdk14x_version())  return NULL;
   315     if (!JDK_Version::is_gte_jdk14x_version())  return NULL;
   315     break;
   316     break;
   316 
   317 
       
   318   case vmIntrinsics::_bitCount_i:
       
   319   case vmIntrinsics::_bitCount_l:
       
   320     if (!UsePopCountInstruction)  return NULL;
       
   321     break;
       
   322 
   317  default:
   323  default:
   318     break;
   324     break;
   319   }
   325   }
   320 
   326 
   321   // -XX:-InlineClassNatives disables natives from the Class class.
   327   // -XX:-InlineClassNatives disables natives from the Class class.
   614   case vmIntrinsics::_intBitsToFloat:
   620   case vmIntrinsics::_intBitsToFloat:
   615   case vmIntrinsics::_doubleToRawLongBits:
   621   case vmIntrinsics::_doubleToRawLongBits:
   616   case vmIntrinsics::_doubleToLongBits:
   622   case vmIntrinsics::_doubleToLongBits:
   617   case vmIntrinsics::_longBitsToDouble:
   623   case vmIntrinsics::_longBitsToDouble:
   618     return inline_fp_conversions(intrinsic_id());
   624     return inline_fp_conversions(intrinsic_id());
       
   625 
       
   626   case vmIntrinsics::_bitCount_i:
       
   627   case vmIntrinsics::_bitCount_l:
       
   628     return inline_bitCount(intrinsic_id());
   619 
   629 
   620   case vmIntrinsics::_reverseBytes_i:
   630   case vmIntrinsics::_reverseBytes_i:
   621   case vmIntrinsics::_reverseBytes_l:
   631   case vmIntrinsics::_reverseBytes_l:
   622     return inline_reverseBytes((vmIntrinsics::ID) intrinsic_id());
   632     return inline_reverseBytes((vmIntrinsics::ID) intrinsic_id());
   623 
   633 
  1712   } else {
  1722   } else {
  1713     return basic_plus_adr(base, offset);
  1723     return basic_plus_adr(base, offset);
  1714   }
  1724   }
  1715 }
  1725 }
  1716 
  1726 
       
  1727 //----------------------------inline_bitCount_int/long-----------------------
       
  1728 // inline int Integer.bitCount(int)
       
  1729 // inline int Long.bitCount(long)
       
  1730 bool LibraryCallKit::inline_bitCount(vmIntrinsics::ID id) {
       
  1731   assert(id == vmIntrinsics::_bitCount_i || id == vmIntrinsics::_bitCount_l, "not bitCount");
       
  1732   if (id == vmIntrinsics::_bitCount_i && !Matcher::has_match_rule(Op_PopCountI)) return false;
       
  1733   if (id == vmIntrinsics::_bitCount_l && !Matcher::has_match_rule(Op_PopCountL)) return false;
       
  1734   _sp += arg_size();  // restore stack pointer
       
  1735   switch (id) {
       
  1736   case vmIntrinsics::_bitCount_i:
       
  1737     push(_gvn.transform(new (C, 2) PopCountINode(pop())));
       
  1738     break;
       
  1739   case vmIntrinsics::_bitCount_l:
       
  1740     push(_gvn.transform(new (C, 2) PopCountLNode(pop_pair())));
       
  1741     break;
       
  1742   default:
       
  1743     ShouldNotReachHere();
       
  1744   }
       
  1745   return true;
       
  1746 }
       
  1747 
  1717 //----------------------------inline_reverseBytes_int/long-------------------
  1748 //----------------------------inline_reverseBytes_int/long-------------------
  1718 // inline Integer.reverseBytes(int)
  1749 // inline Integer.reverseBytes(int)
  1719 // inline Long.reverseBytes(long)
  1750 // inline Long.reverseBytes(long)
  1720 bool LibraryCallKit::inline_reverseBytes(vmIntrinsics::ID id) {
  1751 bool LibraryCallKit::inline_reverseBytes(vmIntrinsics::ID id) {
  1721   assert(id == vmIntrinsics::_reverseBytes_i || id == vmIntrinsics::_reverseBytes_l, "not reverse Bytes");
  1752   assert(id == vmIntrinsics::_reverseBytes_i || id == vmIntrinsics::_reverseBytes_l, "not reverse Bytes");