hotspot/src/share/vm/opto/library_call.cpp
changeset 32581 632402f18fe6
parent 32369 ad8f0f5c3717
child 33089 f4e956ed8b43
child 33105 294e48b4f704
equal deleted inserted replaced
32580:b4817ffce063 32581:632402f18fe6
   294   bool inline_updateBytesCRC32();
   294   bool inline_updateBytesCRC32();
   295   bool inline_updateByteBufferCRC32();
   295   bool inline_updateByteBufferCRC32();
   296   Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
   296   Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
   297   bool inline_updateBytesCRC32C();
   297   bool inline_updateBytesCRC32C();
   298   bool inline_updateDirectByteBufferCRC32C();
   298   bool inline_updateDirectByteBufferCRC32C();
       
   299   bool inline_updateBytesAdler32();
       
   300   bool inline_updateByteBufferAdler32();
   299   bool inline_multiplyToLen();
   301   bool inline_multiplyToLen();
   300   bool inline_squareToLen();
   302   bool inline_squareToLen();
   301   bool inline_mulAdd();
   303   bool inline_mulAdd();
   302   bool inline_montgomeryMultiply();
   304   bool inline_montgomeryMultiply();
   303   bool inline_montgomerySquare();
   305   bool inline_montgomerySquare();
   696 
   698 
   697   case vmIntrinsics::_updateBytesCRC32C:
   699   case vmIntrinsics::_updateBytesCRC32C:
   698     return inline_updateBytesCRC32C();
   700     return inline_updateBytesCRC32C();
   699   case vmIntrinsics::_updateDirectByteBufferCRC32C:
   701   case vmIntrinsics::_updateDirectByteBufferCRC32C:
   700     return inline_updateDirectByteBufferCRC32C();
   702     return inline_updateDirectByteBufferCRC32C();
       
   703 
       
   704   case vmIntrinsics::_updateBytesAdler32:
       
   705     return inline_updateBytesAdler32();
       
   706   case vmIntrinsics::_updateByteBufferAdler32:
       
   707     return inline_updateByteBufferAdler32();
   701 
   708 
   702   case vmIntrinsics::_profileBoolean:
   709   case vmIntrinsics::_profileBoolean:
   703     return inline_profileBoolean();
   710     return inline_profileBoolean();
   704   case vmIntrinsics::_isCompileConstant:
   711   case vmIntrinsics::_isCompileConstant:
   705     return inline_isCompileConstant();
   712     return inline_isCompileConstant();
  5545   Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
  5552   Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
  5546   set_result(result);
  5553   set_result(result);
  5547   return true;
  5554   return true;
  5548 }
  5555 }
  5549 
  5556 
       
  5557 //------------------------------inline_updateBytesAdler32----------------------
       
  5558 //
       
  5559 // Calculate Adler32 checksum for byte[] array.
       
  5560 // int java.util.zip.Adler32.updateBytes(int crc, byte[] buf, int off, int len)
       
  5561 //
       
  5562 bool LibraryCallKit::inline_updateBytesAdler32() {
       
  5563   assert(UseAdler32Intrinsics, "Adler32 Instrinsic support need"); // check if we actually need to check this flag or check a different one
       
  5564   assert(callee()->signature()->size() == 4, "updateBytes has 4 parameters");
       
  5565   assert(callee()->holder()->is_loaded(), "Adler32 class must be loaded");
       
  5566   // no receiver since it is static method
       
  5567   Node* crc     = argument(0); // type: int
       
  5568   Node* src     = argument(1); // type: oop
       
  5569   Node* offset  = argument(2); // type: int
       
  5570   Node* length  = argument(3); // type: int
       
  5571 
       
  5572   const Type* src_type = src->Value(&_gvn);
       
  5573   const TypeAryPtr* top_src = src_type->isa_aryptr();
       
  5574   if (top_src  == NULL || top_src->klass()  == NULL) {
       
  5575     // failed array check
       
  5576     return false;
       
  5577   }
       
  5578 
       
  5579   // Figure out the size and type of the elements we will be copying.
       
  5580   BasicType src_elem = src_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
       
  5581   if (src_elem != T_BYTE) {
       
  5582     return false;
       
  5583   }
       
  5584 
       
  5585   // 'src_start' points to src array + scaled offset
       
  5586   Node* src_start = array_element_address(src, offset, src_elem);
       
  5587 
       
  5588   // We assume that range check is done by caller.
       
  5589   // TODO: generate range check (offset+length < src.length) in debug VM.
       
  5590 
       
  5591   // Call the stub.
       
  5592   address stubAddr = StubRoutines::updateBytesAdler32();
       
  5593   const char *stubName = "updateBytesAdler32";
       
  5594 
       
  5595   Node* call = make_runtime_call(RC_LEAF, OptoRuntime::updateBytesAdler32_Type(),
       
  5596                                  stubAddr, stubName, TypePtr::BOTTOM,
       
  5597                                  crc, src_start, length);
       
  5598   Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
       
  5599   set_result(result);
       
  5600   return true;
       
  5601 }
       
  5602 
       
  5603 //------------------------------inline_updateByteBufferAdler32---------------
       
  5604 //
       
  5605 // Calculate Adler32 checksum for DirectByteBuffer.
       
  5606 // int java.util.zip.Adler32.updateByteBuffer(int crc, long buf, int off, int len)
       
  5607 //
       
  5608 bool LibraryCallKit::inline_updateByteBufferAdler32() {
       
  5609   assert(UseAdler32Intrinsics, "Adler32 Instrinsic support need"); // check if we actually need to check this flag or check a different one
       
  5610   assert(callee()->signature()->size() == 5, "updateByteBuffer has 4 parameters and one is long");
       
  5611   assert(callee()->holder()->is_loaded(), "Adler32 class must be loaded");
       
  5612   // no receiver since it is static method
       
  5613   Node* crc     = argument(0); // type: int
       
  5614   Node* src     = argument(1); // type: long
       
  5615   Node* offset  = argument(3); // type: int
       
  5616   Node* length  = argument(4); // type: int
       
  5617 
       
  5618   src = ConvL2X(src);  // adjust Java long to machine word
       
  5619   Node* base = _gvn.transform(new CastX2PNode(src));
       
  5620   offset = ConvI2X(offset);
       
  5621 
       
  5622   // 'src_start' points to src array + scaled offset
       
  5623   Node* src_start = basic_plus_adr(top(), base, offset);
       
  5624 
       
  5625   // Call the stub.
       
  5626   address stubAddr = StubRoutines::updateBytesAdler32();
       
  5627   const char *stubName = "updateBytesAdler32";
       
  5628 
       
  5629   Node* call = make_runtime_call(RC_LEAF, OptoRuntime::updateBytesAdler32_Type(),
       
  5630                                  stubAddr, stubName, TypePtr::BOTTOM,
       
  5631                                  crc, src_start, length);
       
  5632 
       
  5633   Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
       
  5634   set_result(result);
       
  5635   return true;
       
  5636 }
       
  5637 
  5550 //----------------------------inline_reference_get----------------------------
  5638 //----------------------------inline_reference_get----------------------------
  5551 // public T java.lang.ref.Reference.get();
  5639 // public T java.lang.ref.Reference.get();
  5552 bool LibraryCallKit::inline_reference_get() {
  5640 bool LibraryCallKit::inline_reference_get() {
  5553   const int referent_offset = java_lang_ref_Reference::referent_offset;
  5641   const int referent_offset = java_lang_ref_Reference::referent_offset;
  5554   guarantee(referent_offset > 0, "should have already been set");
  5642   guarantee(referent_offset > 0, "should have already been set");