Skip to content

Commit

Permalink
Ignore multiplication with unit in JIT compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
shoops committed Jan 18, 2023
1 parent c614014 commit 821091b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions copasi/math/CJitCompilerImplementation.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 821091b

Please sign in to comment.