Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enables JNI-direct for AOT on Power #14971

Merged
merged 2 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions runtime/compiler/env/VMJ9.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,6 @@ class TR_J9VMBase : public TR_FrontEnd

virtual TR::TreeTop *lowerTree(TR::Compilation *, TR::Node *, TR::TreeTop *);

virtual bool canRelocateDirectNativeCalls() {return true; }

virtual bool storeOffsetToArgumentsInVirtualIndirectThunks() { return false; }


Expand Down Expand Up @@ -1408,7 +1406,6 @@ class TR_J9SharedCacheVM : public TR_J9VM
// replacing calls to isAOT
virtual bool canUseSymbolValidationManager() { return true; }
virtual bool supportsCodeCacheSnippets() { return false; }
virtual bool canRelocateDirectNativeCalls() { return false; }
virtual bool needClassAndMethodPointerRelocations() { return true; }
virtual bool inlinedAllocationsMustBeVerified() { return true; }
virtual bool needRelocationsForHelpers() { return true; }
Expand Down
1 change: 0 additions & 1 deletion runtime/compiler/env/VMJ9Server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ class TR_J9SharedCacheServerVM: public TR_J9ServerVM
// replacing calls to isAOT
virtual bool canUseSymbolValidationManager() override { return true; }
virtual bool supportsCodeCacheSnippets() override { return false; }
virtual bool canRelocateDirectNativeCalls() override { return false; }
virtual bool needClassAndMethodPointerRelocations() override { return true; }
virtual bool inlinedAllocationsMustBeVerified() override { return true; }
virtual bool needRelocationsForHelpers() override { return true; }
Expand Down
5 changes: 3 additions & 2 deletions runtime/compiler/il/J9Node.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2021 IBM Corp. and others
* Copyright (c) 2000, 2022 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 @@ -340,7 +340,8 @@ J9::Node::processJNICall(TR::TreeTop * callNodeTreeTop, TR::ResolvedMethodSymbol
if (((methodSymbol->getRecognizedMethod() == TR::java_util_zip_CRC32_update) ||
(methodSymbol->getRecognizedMethod() == TR::java_util_zip_CRC32_updateBytes) ||
(methodSymbol->getRecognizedMethod() == TR::java_util_zip_CRC32_updateByteBuffer)) &&
!comp->requiresSpineChecks()
!comp->requiresSpineChecks() &&
!comp->compileRelocatableCode()
#ifdef J9VM_OPT_JITSERVER
&& !comp->isOutOfProcessCompilation()
#endif
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/p/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2021 IBM Corp. and others
* Copyright (c) 2000, 2022 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 @@ -747,7 +747,7 @@ J9::Power::CodeGenerator::deriveCallingLinkage(TR::Node *node, bool isIndirect)
static char * disableDirectNativeCall = feGetEnv("TR_DisableDirectNativeCall");

// Clean-up: the fej9 checking seemed unnecessary
if (!isIndirect && callee->isJNI() && fej9->canRelocateDirectNativeCalls() &&
if (!isIndirect && callee->isJNI() &&
(node->isPreparedForDirectJNI() ||
(disableDirectNativeCall == NULL && callee->getResolvedMethodSymbol()->canDirectNativeCall())))
return self()->getLinkage(TR_J9JNILinkage);
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/p/codegen/J9CodeGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class OMR_EXTENSIBLE CodeGenerator : public J9::CodeGenerator
* \brief Determines whether the code generator supports stack allocations
*/
bool supportsStackAllocations() { return true; }
bool supportsDirectJNICallsForAOT() { return true; }

// See J9::CodeGenerator::guaranteesResolvedDirectDispatchForSVM
bool guaranteesResolvedDirectDispatchForSVM() { return true; }
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/p/codegen/PPCJNILinkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ TR::Register *J9::Power::JNILinkage::buildDirectDispatch(TR::Node *callNode)
// The specialCaseJNI shortcut will mangle register dependencies and use system/C dispatch.
// The addresses of the optimized helpers in the server process will not necessarily
// match the client-side addresses, so we can't take this shortcut in JITServer mode.
bool specialCaseJNI = (crc32m1 || crc32m2 || crc32m3) && !comp()->requiresSpineChecks();
bool specialCaseJNI = (crc32m1 || crc32m2 || crc32m3) && !comp()->requiresSpineChecks() && !comp()->compileRelocatableCode();

#ifdef J9VM_OPT_JITSERVER
specialCaseJNI = specialCaseJNI && !comp()->isOutOfProcessCompilation();
Expand Down