From b3c40ab5fcb42648edc3b505ef725b51d30432d3 Mon Sep 17 00:00:00 2001 From: Rahil Shah Date: Wed, 4 Dec 2019 15:40:34 -0500 Subject: [PATCH] Consider callee type in exceptionRaised/OSRPoint query This commit contains mainly following two changes. 1. Create a list of methods calls to which does not yield to OSR and use this information in the query to know if a call node can catch OSR. 2. Method calls which does not have any side-effects are marked as pure function. Calls to those method does not throw an exception. Use this information in query to know if a call can raise exceptions. Signed-off-by: Rahil Shah --- compiler/compile/OMRCompilation.cpp | 5 +++-- compiler/il/OMRMethodSymbol.hpp | 3 ++- compiler/il/OMRNode.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/compiler/compile/OMRCompilation.cpp b/compiler/compile/OMRCompilation.cpp index df1038d971..7b73887df8 100644 --- a/compiler/compile/OMRCompilation.cpp +++ b/compiler/compile/OMRCompilation.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 IBM Corp. and others + * Copyright (c) 2000, 2020 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 @@ -666,7 +666,8 @@ bool OMR::Compilation::isPotentialOSRPoint(TR::Node *node, TR::Node **osrPointNo potentialOSRPoint = true; } else if (callSymRef->getReferenceNumber() >= - self()->getSymRefTab()->getNonhelperIndex(self()->getSymRefTab()->getLastCommonNonhelperSymbol())) + self()->getSymRefTab()->getNonhelperIndex(self()->getSymRefTab()->getLastCommonNonhelperSymbol()) + && !((TR::MethodSymbol*)(callSymRef->getSymbol()))->functionCallDoesNotYieldOSR()) { potentialOSRPoint = (disableGuardedCallOSR == NULL); } diff --git a/compiler/il/OMRMethodSymbol.hpp b/compiler/il/OMRMethodSymbol.hpp index 7e56dcea0d..7ca2147875 100644 --- a/compiler/il/OMRMethodSymbol.hpp +++ b/compiler/il/OMRMethodSymbol.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 IBM Corp. and others + * Copyright (c) 2000, 2020 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 @@ -194,6 +194,7 @@ class OMR_EXTENSIBLE MethodSymbol : public TR::Symbol bool safeToSkipZeroInitializationOnNewarrays() { return false; } bool safeToSkipChecksOnArrayCopies() { return false; } + bool functionCallDoesNotYieldOSR() { return false; } bool isPureFunction() { return false; } protected: diff --git a/compiler/il/OMRNode.cpp b/compiler/il/OMRNode.cpp index c726197320..324a590ed9 100644 --- a/compiler/il/OMRNode.cpp +++ b/compiler/il/OMRNode.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 IBM Corp. and others + * Copyright (c) 2000, 2020 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 @@ -3679,9 +3679,9 @@ OMR::Node::exceptionsRaised() default: if (node->getOpCode().isCall() && !node->isOSRFearPointHelperCall()) { - possibleExceptions |= TR::Block::CanCatchOSR; - if (node->getSymbolReference()->canGCandExcept() - ) + if (!((TR::MethodSymbol*)node->getSymbolReference()->getSymbol())->functionCallDoesNotYieldOSR()) + possibleExceptions |= TR::Block::CanCatchOSR; + if (!node->isPureCall() && node->getSymbolReference()->canGCandExcept()) possibleExceptions |= TR::Block::CanCatchUserThrows; } break;