From 821091b8d6d6c91e8f8645b9a1586aa800730b18 Mon Sep 17 00:00:00 2001 From: Stefan Hoops Date: Wed, 18 Jan 2023 16:30:24 -0500 Subject: [PATCH] Ignore multiplication with unit in JIT compilation. --- copasi/math/CJitCompilerImplementation.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/copasi/math/CJitCompilerImplementation.cpp b/copasi/math/CJitCompilerImplementation.cpp index dca17ec1a6..c66716bdf8 100644 --- a/copasi/math/CJitCompilerImplementation.cpp +++ b/copasi/math/CJitCompilerImplementation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2021 - 2022 by Pedro Mendes, Rector and Visitors of the +// Copyright (C) 2021 - 2023 by Pedro Mendes, Rector and Visitors of the // University of Virginia, University of Heidelberg, and University // of Connecticut School of Medicine. // All rights reserved. @@ -236,7 +236,8 @@ CJitCompilerImplementation::Function CJitCompilerImplementation::compile(const C break; } - if (pNode == NULL) + if (pNode == NULL + && itNode->mainType() != CEvaluationNode::MainType::UNIT) { // CCopasiMessage(CCopasiMessage::WARNING, MCJitCompilation + 2, mathExpression.getInfix().c_str()); break; @@ -442,7 +443,13 @@ CJitCompilerImplementation::Node * CJitCompilerImplementation::compile(const CEv break; case CEvaluationNode::SubType::MULTIPLY: - pNodeJIT = &mpExpression->Mul(*static_cast< NativeJIT::Node< C_FLOAT64 > * >(context[0]), *static_cast< NativeJIT::Node< C_FLOAT64 > * >(context[1])); + + if (pNode->getRight() != NULL + && pNode->getRight()->mainType() == CEvaluationNode::MainType::UNIT) + pNodeJIT = context[0]; + else + pNodeJIT = &mpExpression->Mul(*static_cast< NativeJIT::Node< C_FLOAT64 > * >(context[0]), *static_cast< NativeJIT::Node< C_FLOAT64 > * >(context[1])); + break; case CEvaluationNode::SubType::DIVIDE: