Skip to content

Commit

Permalink
Merge pull request #16379 from Spencer-Comin/crc32c-call-java
Browse files Browse the repository at this point in the history
  • Loading branch information
joransiu committed Jan 16, 2023
2 parents ff74cdf + 2a14647 commit a9d4f14
Show file tree
Hide file tree
Showing 3 changed files with 487 additions and 3 deletions.
28 changes: 27 additions & 1 deletion runtime/compiler/z/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2022 IBM Corp. and others
* Copyright (c) 2000, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -3682,6 +3682,16 @@ J9::Z::CodeGenerator::suppressInliningOfRecognizedMethod(TR::RecognizedMethod me
return true;
}

static bool disableCRC32CAcceleration = (feGetEnv("TR_DisableCRC32CAcceleration") != NULL);
if (!disableCRC32CAcceleration && self()->getSupportsVectorRegisters())
{
if (method == TR::java_util_zip_CRC32C_updateBytes ||
method == TR::java_util_zip_CRC32C_updateDirectByteBuffer)
{
return true;
}
}

if (method == TR::java_lang_Integer_highestOneBit ||
method == TR::java_lang_Integer_numberOfLeadingZeros ||
method == TR::java_lang_Integer_numberOfTrailingZeros ||
Expand Down Expand Up @@ -4066,6 +4076,22 @@ J9::Z::CodeGenerator::inlineDirectCall(
break;
}

static bool disableCRC32CAcceleration = (feGetEnv("TR_DisableCRC32CAcceleration") != NULL);
if (!disableCRC32CAcceleration && self()->getSupportsVectorRegisters())
{
switch (methodSymbol->getRecognizedMethod())
{
case TR::java_util_zip_CRC32C_updateBytes:
resultReg = TR::TreeEvaluator::inlineCRC32CUpdateBytes(node, cg, false);
return true;
case TR::java_util_zip_CRC32C_updateDirectByteBuffer:
resultReg = TR::TreeEvaluator::inlineCRC32CUpdateBytes(node, cg, true);
return true;
default:
break;
}
}

TR::MethodSymbol * symbol = node->getSymbol()->castToMethodSymbol();
if ((symbol->isVMInternalNative() || symbol->isJITInternalNative()) || isKnownMethod(methodSymbol))
{
Expand Down

0 comments on commit a9d4f14

Please sign in to comment.