< prev index next >

src/share/vm/opto/library_call.cpp

Print this page

        

@@ -276,10 +276,12 @@
   bool inline_aescrypt_Block(vmIntrinsics::ID id);
   bool inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id);
   Node* inline_cipherBlockChaining_AESCrypt_predicate(bool decrypting);
   Node* get_key_start_from_aescrypt_object(Node* aescrypt_object);
   Node* get_original_key_start_from_aescrypt_object(Node* aescrypt_object);
+  bool inline_ghash_processBlocks();
+  Node* get_vars_from_ghash_object(Node *ghash_object, const char *var_name);
   bool inline_sha_implCompress(vmIntrinsics::ID id);
   bool inline_digestBase_implCompressMB(int predicate);
   bool inline_sha_implCompressMB(Node* digestBaseObj, ciInstanceKlass* instklass_SHA,
                                  bool long_state, address stubAddr, const char *stubName,
                                  Node* src_start, Node* ofs, Node* limit);

@@ -526,10 +528,14 @@
   case vmIntrinsics::_digestBase_implCompressMB:
     if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) return NULL;
     predicates = 3;
     break;
 
+  case vmIntrinsics::_ghash_processBlocks:
+    if (!UseGHASHIntrinsics) return NULL;
+    break;
+
   case vmIntrinsics::_updateCRC32:
   case vmIntrinsics::_updateBytesCRC32:
   case vmIntrinsics::_updateByteBufferCRC32:
     if (!UseCRC32Intrinsics) return NULL;
     break;

@@ -927,10 +933,13 @@
     return inline_squareToLen();
 
   case vmIntrinsics::_mulAdd:
     return inline_mulAdd();
 
+  case vmIntrinsics::_ghash_processBlocks:
+    return inline_ghash_processBlocks();
+
   case vmIntrinsics::_encodeISOArray:
     return inline_encodeISOArray();
 
   case vmIntrinsics::_updateCRC32:
     return inline_updateCRC32();

@@ -5856,10 +5865,49 @@
 
   record_for_igvn(region);
   return _gvn.transform(region);
 }
 
+//------------------------------get_vars_from_ghash_object-----------------------
+Node * LibraryCallKit::get_vars_from_ghash_object(Node *ghash_object, const char *var_name) {
+  Node* ghash_var = load_field_from_object(ghash_object, var_name, "[J", /*is_exact*/ false);
+  assert (ghash_var != NULL, "wrong version of sun.security.provider.GHASH");
+  if (ghash_var == NULL) return (Node *) NULL;
+
+  // now have the array, need to get the start address of the array
+  Node* var = array_element_address(ghash_var, intcon(0), T_LONG);
+  return var;
+}
+
+//------------------------------inline_ghash_processBlocks
+bool LibraryCallKit::inline_ghash_processBlocks() {
+  address stubAddr;
+  const char *stubName;
+  assert(UseGHASHIntrinsics, "need GHASH intrinsics support");
+
+  stubAddr = StubRoutines::ghash_processBlocks();
+  stubName = "ghash_processBlocks";
+
+  Node* ghash_object   = argument(0);
+  Node* data           = argument(1);
+  Node* offset         = argument(2);
+  Node* len            = argument(3);
+
+  Node* state_start = get_vars_from_ghash_object(ghash_object, "state");
+  assert(state_start, "Unable to load GHASH state");
+  Node* subkeyH_start = get_vars_from_ghash_object(ghash_object, "subkeyH");
+  assert(subkeyH_start, "Unable to load GHASH subkeyH");
+  Node* data_start  = array_element_address(data, offset, T_BYTE);
+  assert(data_start, "data is NULL");
+
+  Node* ghash = make_runtime_call(RC_LEAF|RC_NO_FP,
+                                  OptoRuntime::ghash_processBlocks_Type(),
+                                  stubAddr, stubName, TypePtr::BOTTOM,
+                                  state_start, subkeyH_start, data_start, len);
+  return true;
+}
+
 //------------------------------inline_sha_implCompress-----------------------
 //
 // Calculate SHA (i.e., SHA-1) for single-block byte[] array.
 // void com.sun.security.provider.SHA.implCompress(byte[] buf, int ofs)
 //
< prev index next >