From 3e3f4857343e6f6130f16768949652c1131bc360 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 9 Nov 2023 17:11:34 -0500 Subject: [PATCH 1/9] Add info statuses for #120. --- .../hybridize/core/analysis/Function.java | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java index 5ee419c27..d360624ec 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java @@ -81,6 +81,19 @@ public class Function { public static final String PLUGIN_ID = FrameworkUtil.getBundle(Function.class).getSymbolicName(); + private final class DecoratorContext extends RefactoringStatusContext { + private final decoratorsType decorator; + + private DecoratorContext(decoratorsType decorator) { + this.decorator = decorator; + } + + @Override + public Object getCorrespondingElement() { + return decorator; + } + } + private final class FunctionStatusContext extends RefactoringStatusContext { @Override public Object getCorrespondingElement() { @@ -796,21 +809,24 @@ public void computeHybridization(IProgressMonitor monitor) throws BadLocationExc if (Util.isGenerated(decorator)) { // Since tf.function isn't generated, skip generated decorators. - LOG.info(String.format( + String msg = String.format( "Encountered potentially generated decorator: %s in selection: %s, module: %s, file: %s, and project; %s.", - decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project)); - // TODO: Add info status here (#120). + decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project); + LOG.info(msg); + this.getStatus().addInfo(containingFileName, new DecoratorContext(decorator)); } else if (Util.isBuiltIn(decorator)) { // Since tf.function isn't built-in, skip built-in decorators. - LOG.info(String.format( + String msg = String.format( "Encountered potentially built-in decorator: %s in selection: %s, module: %s, file: %s, and project; %s.", - decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project)); - // TODO: Add info status here (#120). + decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project); + LOG.info(msg); + this.getStatus().addInfo(msg, new DecoratorContext(decorator)); } else { - LOG.warn(String.format( + String msg = String.format( "Can't determine if decorator: %s in selection: %s, module: %s, file: %s, and project; %s is hybrid.", decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, - nature.getProject()), e); + nature.getProject()); + LOG.warn(msg, e); // TODO: Add a failure status here? (#120). It could just be that we're taking the last defined one. A failure // status entry would fail the entire function. From b43f6cbf81780e831348f7bd5d1c19c25696dfa0 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 9 Nov 2023 17:13:21 -0500 Subject: [PATCH 2/9] Guard hybrid flag. --- .../cuny/hunter/hybridize/core/analysis/Function.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java index d360624ec..b743331cd 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java @@ -882,11 +882,15 @@ private static boolean isHybrid(decoratorsType decorator, String containingModul } public void addFailure(PreconditionFailure failure, String message) { + RefactoringStatusContext context = new FunctionStatusContext(); + this.addFailure(failure, message, context); + } + + public void addFailure(PreconditionFailure failure, String message, RefactoringStatusContext context) { // If is side-effects is filled, we can't set a precondition failure that we can't determine them. assert this.getHasPythonSideEffects() == null || failure != PreconditionFailure.UNDETERMINABLE_SIDE_EFFECTS : "Can't both have side-effects filled and have tem undterminable."; - RefactoringStatusContext context = new FunctionStatusContext(); this.getStatus().addEntry(RefactoringStatus.ERROR, message, context, PLUGIN_ID, failure.getCode(), this); } @@ -899,7 +903,7 @@ public void addWarning(String message) { * Check refactoring preconditions. */ public void check() { - if (!this.getIsHybrid()) { // Eager. Table 1. + if (this.getIsHybrid() != null && !this.getIsHybrid()) { // Eager. Table 1. this.setRefactoring(CONVERT_EAGER_FUNCTION_TO_HYBRID); if (this.getLikelyHasTensorParameter()) { @@ -915,7 +919,7 @@ public void check() { if (this.getHasPythonSideEffects() != null && this.getHasPythonSideEffects()) this.addFailure(PreconditionFailure.HAS_PYTHON_SIDE_EFFECTS, "Can't hybridize a function with Python side-effects."); } - } else { // Hybrid. Use table 2. + } else if (this.isHybrid != null) { // Hybrid. Use table 2. this.setRefactoring(OPTIMIZE_HYBRID_FUNCTION); if (!this.getLikelyHasTensorParameter()) { From 9b3ee1e78e117168e41bd486b63440fbfe303b3f Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 9 Nov 2023 17:29:25 -0500 Subject: [PATCH 3/9] Revert "Add info statuses for #120." This reverts commit 3e3f4857343e6f6130f16768949652c1131bc360. I don't think we need these. --- .../hybridize/core/analysis/Function.java | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java index b743331cd..4ae1b80b4 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java @@ -81,19 +81,6 @@ public class Function { public static final String PLUGIN_ID = FrameworkUtil.getBundle(Function.class).getSymbolicName(); - private final class DecoratorContext extends RefactoringStatusContext { - private final decoratorsType decorator; - - private DecoratorContext(decoratorsType decorator) { - this.decorator = decorator; - } - - @Override - public Object getCorrespondingElement() { - return decorator; - } - } - private final class FunctionStatusContext extends RefactoringStatusContext { @Override public Object getCorrespondingElement() { @@ -809,24 +796,21 @@ public void computeHybridization(IProgressMonitor monitor) throws BadLocationExc if (Util.isGenerated(decorator)) { // Since tf.function isn't generated, skip generated decorators. - String msg = String.format( + LOG.info(String.format( "Encountered potentially generated decorator: %s in selection: %s, module: %s, file: %s, and project; %s.", - decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project); - LOG.info(msg); - this.getStatus().addInfo(containingFileName, new DecoratorContext(decorator)); + decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project)); + // TODO: Add info status here (#120). } else if (Util.isBuiltIn(decorator)) { // Since tf.function isn't built-in, skip built-in decorators. - String msg = String.format( + LOG.info(String.format( "Encountered potentially built-in decorator: %s in selection: %s, module: %s, file: %s, and project; %s.", - decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project); - LOG.info(msg); - this.getStatus().addInfo(msg, new DecoratorContext(decorator)); + decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project)); + // TODO: Add info status here (#120). } else { - String msg = String.format( + LOG.warn(String.format( "Can't determine if decorator: %s in selection: %s, module: %s, file: %s, and project; %s is hybrid.", decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, - nature.getProject()); - LOG.warn(msg, e); + nature.getProject()), e); // TODO: Add a failure status here? (#120). It could just be that we're taking the last defined one. A failure // status entry would fail the entire function. From cd97ce012d7541920b5c70f6fbd5dd127746204d Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 9 Nov 2023 17:30:43 -0500 Subject: [PATCH 4/9] Remove TODOs. --- .../src/edu/cuny/hunter/hybridize/core/analysis/Function.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java index 4ae1b80b4..9e0f2bbde 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java @@ -799,13 +799,11 @@ public void computeHybridization(IProgressMonitor monitor) throws BadLocationExc LOG.info(String.format( "Encountered potentially generated decorator: %s in selection: %s, module: %s, file: %s, and project; %s.", decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project)); - // TODO: Add info status here (#120). } else if (Util.isBuiltIn(decorator)) { // Since tf.function isn't built-in, skip built-in decorators. LOG.info(String.format( "Encountered potentially built-in decorator: %s in selection: %s, module: %s, file: %s, and project; %s.", decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project)); - // TODO: Add info status here (#120). } else { LOG.warn(String.format( "Can't determine if decorator: %s in selection: %s, module: %s, file: %s, and project; %s is hybrid.", From 3c815117303876ad607c4a504a4776272bb1bb1f Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 9 Nov 2023 17:31:46 -0500 Subject: [PATCH 5/9] Add TODO. --- .../refactorings/HybridizeFunctionRefactoringProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java index df93edd3a..5b8046e18 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java @@ -247,7 +247,7 @@ private RefactoringStatus checkFunctions(IProgressMonitor monitor) throws Operat LOG.warn("Unable to infer side-effects of: " + func + ".", e); func.addFailure(PreconditionFailure.UNDETERMINABLE_SIDE_EFFECTS, "Can't infer side-effects, most likely due to a call graph issue caused by a decorator or a missing function call."); - // next function. + // next function. FIXME: Why not continue? status.merge(func.getStatus()); subMonitor.worked(1); return; From d919ad315942a88f08f9f1528d11ff625f22b291 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 9 Nov 2023 18:49:33 -0500 Subject: [PATCH 6/9] Progress. --- .../hybridize/core/analysis/Function.java | 23 +++++++++++-------- .../core/analysis/PreconditionFailure.java | 8 ++++++- .../UndeterminableHybridizationException.java | 7 ++++++ ...HybridizeFunctionRefactoringProcessor.java | 4 ++++ 4 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/UndeterminableHybridizationException.java diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java index 9e0f2bbde..770f2889f 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java @@ -758,13 +758,18 @@ private boolean matches(exprType lhsParamExpr, String lhsParamName, LocalPointer /** * Discovers if this {@link Function} is hybrid. If so, populated this {@link Function}'s {@link HybridizationParameters}. */ - public void computeHybridization(IProgressMonitor monitor) throws BadLocationException { + public void computeHybridization(IProgressMonitor monitor) throws BadLocationException, UndeterminableHybridizationException { // TODO: Consider mechanisms other than decorators (e.g., higher order functions; #3). monitor.beginTask("Computing hybridization ...", IProgressMonitor.UNKNOWN); FunctionDefinition functionDefinition = this.getFunctionDefinition(); decoratorsType[] decoratorArray = functionDefinition.getFunctionDef().decs; + // if this function is decorated with "tf.function." + Boolean hybrid = null; + + boolean issuedInfo = false; + if (decoratorArray != null) { String containingModuleName = this.getContainingModuleName(); File containingFile = this.getContainingFile(); @@ -779,9 +784,6 @@ public void computeHybridization(IProgressMonitor monitor) throws BadLocationExc IDocument document = this.getContainingDocument(); PySelection selection = null; - // if this function is decorated with "tf.function." - boolean hybrid = false; - try { selection = Util.getSelection(decorator, document); hybrid = isHybrid(decorator, containingModuleName, containingFile, selection, nature, monitor); @@ -799,23 +801,21 @@ public void computeHybridization(IProgressMonitor monitor) throws BadLocationExc LOG.info(String.format( "Encountered potentially generated decorator: %s in selection: %s, module: %s, file: %s, and project; %s.", decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project)); + issuedInfo = true; } else if (Util.isBuiltIn(decorator)) { // Since tf.function isn't built-in, skip built-in decorators. LOG.info(String.format( "Encountered potentially built-in decorator: %s in selection: %s, module: %s, file: %s, and project; %s.", decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, project)); - } else { + issuedInfo = true; + } else LOG.warn(String.format( "Can't determine if decorator: %s in selection: %s, module: %s, file: %s, and project; %s is hybrid.", decoratorFunctionRepresentation, selectedText, containingModuleName, containingFileName, nature.getProject()), e); - - // TODO: Add a failure status here? (#120). It could just be that we're taking the last defined one. A failure - // status entry would fail the entire function. - } } - if (hybrid) { + if (hybrid != null && hybrid) { this.setIsHybrid(TRUE); LOG.info(this + " is hybrid."); @@ -831,6 +831,9 @@ public void computeHybridization(IProgressMonitor monitor) throws BadLocationExc } } + if (hybrid == null && !issuedInfo) + throw new UndeterminableHybridizationException(); + this.setIsHybrid(FALSE); LOG.info(this + " is not hybrid."); monitor.done(); diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/PreconditionFailure.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/PreconditionFailure.java index cfe6eb72c..87435be52 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/PreconditionFailure.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/PreconditionFailure.java @@ -14,7 +14,13 @@ public enum PreconditionFailure { HAS_NO_TENSOR_PARAMETERS(6), - HAS_TENSOR_PARAMETERS(7); + HAS_TENSOR_PARAMETERS(7), + + /** + * Can't determine whether the decorator actually refers to the real tf.function. It may not (and we've found cases of this in + * mead-baseline). + */ + UNDETERMINABLE_HYBRID_DECORATOR(8); static { // check that the codes are unique. diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/UndeterminableHybridizationException.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/UndeterminableHybridizationException.java new file mode 100644 index 000000000..5d9c594fd --- /dev/null +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/UndeterminableHybridizationException.java @@ -0,0 +1,7 @@ +package edu.cuny.hunter.hybridize.core.analysis; + +public class UndeterminableHybridizationException extends Exception { + + private static final long serialVersionUID = -7461244972182215002L; + +} diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java index 5b8046e18..4edc7bdc5 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java @@ -43,6 +43,7 @@ import edu.cuny.hunter.hybridize.core.analysis.Function; import edu.cuny.hunter.hybridize.core.analysis.FunctionDefinition; import edu.cuny.hunter.hybridize.core.analysis.PreconditionFailure; +import edu.cuny.hunter.hybridize.core.analysis.UndeterminableHybridizationException; import edu.cuny.hunter.hybridize.core.analysis.UndeterminablePythonSideEffectsException; import edu.cuny.hunter.hybridize.core.descriptors.HybridizeFunctionRefactoringDescriptor; import edu.cuny.hunter.hybridize.core.messages.Messages; @@ -231,6 +232,9 @@ private RefactoringStatus checkFunctions(IProgressMonitor monitor) throws Operat func.computeHybridization(subMonitor.split(IProgressMonitor.UNKNOWN)); } catch (BadLocationException e) { throw new RuntimeException("Could not compute hybridization for: " + func + ".", e); + } catch (UndeterminableHybridizationException e) { + LOG.warn("Unable to infer hybridization of: " + func + ".", e); + func.addFailure(PreconditionFailure.UNDETERMINABLE_HYBRID_DECORATOR, "Can't compute whether " + func + "is hybrid."); } try { From 86adb72c6a4b32fe16124736a6dbaea28d400948 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 9 Nov 2023 20:55:09 -0500 Subject: [PATCH 7/9] Fix bug. --- .../src/edu/cuny/hunter/hybridize/core/analysis/Function.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java index 770f2889f..ea53af1e5 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java @@ -831,7 +831,7 @@ public void computeHybridization(IProgressMonitor monitor) throws BadLocationExc } } - if (hybrid == null && !issuedInfo) + if (decoratorArray != null && decoratorArray.length > 0 && hybrid == null && !issuedInfo) throw new UndeterminableHybridizationException(); this.setIsHybrid(FALSE); From f2970390b73a495c905ff0345aef0679aaa0a0d0 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 9 Nov 2023 21:30:14 -0500 Subject: [PATCH 8/9] Cleanup. --- .../src/edu/cuny/hunter/hybridize/core/analysis/Function.java | 2 +- .../refactorings/HybridizeFunctionRefactoringProcessor.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java index ea53af1e5..b4412fbe8 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java @@ -904,7 +904,7 @@ public void check() { if (this.getHasPythonSideEffects() != null && this.getHasPythonSideEffects()) this.addFailure(PreconditionFailure.HAS_PYTHON_SIDE_EFFECTS, "Can't hybridize a function with Python side-effects."); } - } else if (this.isHybrid != null) { // Hybrid. Use table 2. + } else if (this.getIsHybrid() != null) { // Hybrid. Use table 2. this.setRefactoring(OPTIMIZE_HYBRID_FUNCTION); if (!this.getLikelyHasTensorParameter()) { diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java index 4edc7bdc5..6c64123fa 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java @@ -234,7 +234,7 @@ private RefactoringStatus checkFunctions(IProgressMonitor monitor) throws Operat throw new RuntimeException("Could not compute hybridization for: " + func + ".", e); } catch (UndeterminableHybridizationException e) { LOG.warn("Unable to infer hybridization of: " + func + ".", e); - func.addFailure(PreconditionFailure.UNDETERMINABLE_HYBRID_DECORATOR, "Can't compute whether " + func + "is hybrid."); + func.addFailure(PreconditionFailure.UNDETERMINABLE_HYBRID_DECORATOR, "Can't compute whether " + func + " is hybrid."); } try { From c4ddc1760b584325614370f39afaeabd893f320d Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 9 Nov 2023 21:31:04 -0500 Subject: [PATCH 9/9] Guard hybrid field. --- .../refactorings/HybridizeFunctionRefactoringProcessor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java index 6c64123fa..c07dff94f 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/refactorings/HybridizeFunctionRefactoringProcessor.java @@ -245,7 +245,8 @@ private RefactoringStatus checkFunctions(IProgressMonitor monitor) throws Operat // Check Python side-effects. try { - if (this.getAlwaysCheckPythonSideEffects() || func.getIsHybrid() || func.getLikelyHasTensorParameter()) + if (this.getAlwaysCheckPythonSideEffects() || (func.getIsHybrid() != null && func.getIsHybrid()) + || func.getLikelyHasTensorParameter()) func.inferPythonSideEffects(callGraph, builder.getPointerAnalysis()); } catch (UndeterminablePythonSideEffectsException e) { LOG.warn("Unable to infer side-effects of: " + func + ".", e);