Skip to content

Commit

Permalink
Merge pull request #13213 from gita-omr/pr_vector_api
Browse files Browse the repository at this point in the history
  • Loading branch information
fjeremic committed Aug 30, 2021
2 parents 85f3fe0 + c29d6e6 commit 368d39c
Show file tree
Hide file tree
Showing 9 changed files with 2,257 additions and 3 deletions.
1 change: 1 addition & 0 deletions runtime/compiler/build/files/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ JIT_PRODUCT_BACKEND_SOURCES+=\
compiler/optimizer/UnsafeFastPath.cpp \
compiler/optimizer/VarHandleTransformer.cpp \
compiler/optimizer/MethodHandleTransformer.cpp \
compiler/optimizer/VectorAPIExpansion.cpp \
compiler/optimizer/VPBCDConstraint.cpp \
compiler/optimizer/TreeLowering.cpp \
omr/compiler/codegen/Analyser.cpp \
Expand Down
12 changes: 10 additions & 2 deletions runtime/compiler/codegen/J9RecognizedMethodsEnum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,20 @@
sun_misc_Unsafe_allocateInstance,

jdk_internal_misc_Unsafe_copyMemory0,

jdk_internal_loader_NativeLibraries_load,

First_vector_api_method,
jdk_internal_vm_vector_VectorSupport_load,
jdk_internal_vm_vector_VectorSupport_binaryOp,
jdk_internal_vm_vector_VectorSupport_store,
jdk_internal_vm_vector_VectorSupport_binaryOp,
Last_vector_api_intrinsic_method = jdk_internal_vm_vector_VectorSupport_binaryOp,
jdk_incubator_vector_FloatVector_fromArray,
jdk_incubator_vector_FloatVector_intoArray,
jdk_incubator_vector_FloatVector_fromArray_mask,
jdk_incubator_vector_FloatVector_intoArray_mask,
jdk_incubator_vector_FloatVector_add,
jdk_incubator_vector_VectorSpecies_indexInRange,
Last_vector_api_method,

java_lang_reflect_Array_getLength,
java_lang_reflect_Method_invoke,
Expand Down
27 changes: 27 additions & 0 deletions runtime/compiler/env/j9method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ bool TR_ResolvedJ9Method::isMethodInValidLibrary()
if (!strncmp(this->convertToMethod()->classNameChars(), "com/ibm/gpu/Kernel", 18))
return true;

if (!strncmp(this->convertToMethod()->classNameChars(), "jdk/incubator/vector/", 21))
return true;

#ifdef J9VM_OPT_JAVA_CRYPTO_ACCELERATION
// For IBMJCE Crypto
if (!strncmp(this->convertToMethod()->classNameChars(), "com/ibm/jit/Crypto", 18))
Expand Down Expand Up @@ -2553,6 +2556,27 @@ void TR_ResolvedJ9Method::construct()
{TR::unknownMethod}
};


static X FloatVectorMethods[] =
{
{x(TR::jdk_incubator_vector_FloatVector_fromArray, "fromArray" , "(Ljdk/incubator/vector/VectorSpecies;[FI)Ljdk/incubator/vector/FloatVector;")},
{x(TR::jdk_incubator_vector_FloatVector_intoArray, "intoArray" , "([FI)V")},

{x(TR::jdk_incubator_vector_FloatVector_fromArray_mask, "fromArray" , "(Ljdk/incubator/vector/VectorSpecies;[FILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector;")},
{x(TR::jdk_incubator_vector_FloatVector_intoArray_mask, "intoArray" , "([FILjdk/incubator/vector/VectorMask;)V")},

{x(TR::jdk_incubator_vector_FloatVector_add, "add" , "(Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector;")},

{TR::unknownMethod}
};

static X VectorSpeciesMethods[] =
{
{x(TR::jdk_incubator_vector_VectorSpecies_indexInRange, "indexInRange" , "(II)Ljdk/incubator/vector/VectorMask;")},

{TR::unknownMethod}
};

static X BigDecimalMethods[] =
{
{x(TR::java_math_BigDecimal_add, "add", "(Ljava/math/BigDecimal;)Ljava/math/BigDecimal;")},
Expand Down Expand Up @@ -4066,6 +4090,7 @@ void TR_ResolvedJ9Method::construct()
{ "java/lang/invoke/MutableCallSite", MutableCallSiteMethods },
{ "java/lang/invoke/PrimitiveHandle", PrimitiveHandleMethods },
{ "com/ibm/dataaccess/PackedDecimal", DataAccessPackedDecimalMethods },
{ "jdk/incubator/vector/FloatVector", FloatVectorMethods},
{ 0 }
};

Expand All @@ -4083,6 +4108,8 @@ void TR_ResolvedJ9Method::construct()
{ "java/util/concurrent/atomic/Fences", JavaUtilConcurrentAtomicFencesMethods },
{ "com/ibm/Compiler/Internal/Prefetch", PrefetchMethods },
{ "java/lang/invoke/VarHandleInternal", VarHandleMethods },
{ "jdk/incubator/vector/VectorSpecies", VectorSpeciesMethods},

{ 0 }
};

Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/optimizer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ j9jit_files(
optimizer/UnsafeFastPath.cpp
optimizer/VarHandleTransformer.cpp
optimizer/MethodHandleTransformer.cpp
optimizer/VectorAPIExpansion.cpp
optimizer/VPBCDConstraint.cpp
optimizer/TreeLowering.cpp
)
4 changes: 4 additions & 0 deletions runtime/compiler/optimizer/J9Optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
#include "optimizer/StaticFinalFieldFolding.hpp"
#include "optimizer/HandleRecompilationOps.hpp"
#include "optimizer/MethodHandleTransformer.hpp"
#include "optimizer/VectorAPIExpansion.hpp"


static const OptimizationStrategy J9EarlyGlobalOpts[] =
Expand Down Expand Up @@ -747,6 +748,7 @@ static const OptimizationStrategy cheapWarmStrategyOpts[] =
{ OMR::compactNullChecks, OMR::IfEnabled }, // cleanup at the end
{ OMR::deadTreesElimination, OMR::IfEnabled }, // remove dead anchors created by check/store removal
{ OMR::deadTreesElimination, OMR::IfEnabled }, // remove dead RegStores produced by previous deadTrees pass
{ OMR::vectorAPIExpansion },
{ OMR::redundantGotoElimination, OMR::IfEnabledAndNotJitProfiling }, // dead store and dead tree elimination may have left empty blocks
{ OMR::compactLocals, OMR::IfNotJitProfiling }, // analysis results are invalidated by profilingGroup
{ OMR::globalLiveVariablesForGC },
Expand Down Expand Up @@ -859,6 +861,8 @@ J9::Optimizer::Optimizer(TR::Compilation *comp, TR::ResolvedMethodSymbol *method
new (comp->allocator()) TR::OptimizationManager(self(), TR_HandleRecompilationOps::create, OMR::handleRecompilationOps);
_opts[OMR::hotFieldMarking] =
new (comp->allocator()) TR::OptimizationManager(self(), TR_HotFieldMarking::create, OMR::hotFieldMarking);
_opts[OMR::vectorAPIExpansion] =
new (comp->allocator()) TR::OptimizationManager(self(), TR_VectorAPIExpansion::create, OMR::vectorAPIExpansion);
// NOTE: Please add new J9 optimizations here!

// initialize additional J9 optimization groups
Expand Down
3 changes: 2 additions & 1 deletion runtime/compiler/optimizer/Optimizations.enum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corp. and others
* Copyright (c) 2000, 2021 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 @@ -36,3 +36,4 @@
OPTIMIZATION(jProfilingRecompLoopTest)
OPTIMIZATION(handleRecompilationOps)
OPTIMIZATION(hotFieldMarking)
OPTIMIZATION(vectorAPIExpansion)
Loading

0 comments on commit 368d39c

Please sign in to comment.