Skip to content
Permalink
Browse files
8274730: AArch64: AES/GCM acceleration is broken by the fix for JDK-8…
…273297

Reviewed-by: adinn, roland, kvn
  • Loading branch information
Andrew Haley committed Oct 6, 2021
1 parent 2faced0 commit c74726dbd0767d02abf9535361a86ffb69b646d9
Showing with 19 additions and 9 deletions.
  1. +1 −1 src/hotspot/cpu/aarch64/matcher_aarch64.hpp
  2. +7 −2 src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
  3. +11 −6 src/hotspot/share/opto/library_call.cpp
@@ -56,7 +56,7 @@
static const bool supports_generic_vector_operands = false;

// No support for 48 extra htbl entries in aes-gcm intrinsic
static const int htbl_entries = -1;
static const int htbl_entries = 0;

static constexpr bool isSimpleConstant64(jlong value) {
// Will one (StoreL ConL) be cheaper than two (StoreI ConI)?.
@@ -3094,7 +3094,8 @@ class StubGenerator: public StubCodeGenerator {
// key = c_rarg4
// state = c_rarg5 - GHASH.state
// subkeyHtbl = c_rarg6 - powers of H
// counter = c_rarg7 - pointer to 16 bytes of CTR
// subkeyHtbl_48_entries = c_rarg7 (not used)
// counter = [sp, #0] pointer to 16 bytes of CTR
// return - number of processed bytes
address generate_galoisCounterMode_AESCrypt() {
address ghash_polynomial = __ pc();
@@ -3107,6 +3108,8 @@ class StubGenerator: public StubCodeGenerator {
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "galoisCounterMode_AESCrypt");
address start = __ pc();
__ enter();

const Register in = c_rarg0;
const Register len = c_rarg1;
const Register ct = c_rarg2;
@@ -3118,10 +3121,12 @@ class StubGenerator: public StubCodeGenerator {

const Register subkeyHtbl = c_rarg6;

// Pointer to CTR is passed on the stack before the (fp, lr) pair.
const Address counter_mem(sp, 2 * wordSize);
const Register counter = c_rarg7;
__ ldr(counter, counter_mem);

const Register keylen = r10;
__ enter();
// Save state before entering routine
__ sub(sp, sp, 4 * 16);
__ st1(v12, v13, v14, v15, __ T16B, Address(sp));
@@ -6794,14 +6794,19 @@ bool LibraryCallKit::inline_galoisCounterMode_AESCrypt() {
ciKlass* klass = ciTypeArrayKlass::make(T_LONG);
Node* klass_node = makecon(TypeKlassPtr::make(klass));

// htbl entries is set to 96 only fox x86-64
// Does this target support this intrinsic?
if (Matcher::htbl_entries == -1) return false;

// new array to hold 48 computed htbl entries
Node* subkeyHtbl_48_entries = new_array(klass_node, intcon(Matcher::htbl_entries), 0);
if (subkeyHtbl_48_entries == NULL) return false;

Node* subkeyHtbl_48_entries_start = array_element_address(subkeyHtbl_48_entries, intcon(0), T_LONG);
Node* subkeyHtbl_48_entries_start;
if (Matcher::htbl_entries != 0) {
// new array to hold 48 computed htbl entries
Node* subkeyHtbl_48_entries = new_array(klass_node, intcon(Matcher::htbl_entries), 0);
if (subkeyHtbl_48_entries == NULL) return false;
subkeyHtbl_48_entries_start = array_element_address(subkeyHtbl_48_entries, intcon(0), T_LONG);
} else {
// This target doesn't need the extra-large Htbl.
subkeyHtbl_48_entries_start = ConvL2X(intcon(0));
}

// Call the stub, passing params
Node* gcmCrypt = make_runtime_call(RC_LEAF|RC_NO_FP,

1 comment on commit c74726d

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on c74726d Oct 6, 2021

Please sign in to comment.