SWDEV-515574: Cache Number_Node static value. (#217)

* Cache Number_Node static value. To avoid value overwriting in consecutive dispatch callbacks.

* Format.

* tests for number_node evaluate.

---------

Co-authored-by: Venkateshwar Reddy Kandula <vkandula@amd.com>
This commit is contained in:
Kandula, Venkateshwar reddy
2025-02-19 19:10:16 -06:00
committed by GitHub
parent b4b81f9095
commit 5cb4ad449f
2 changed files with 27 additions and 3 deletions
@@ -767,7 +767,12 @@ EvaluateAST::evaluate(
case NONE:
case CONSTANT_NODE:
case RANGE_NODE: break;
case NUMBER_NODE: return &_static_value;
case NUMBER_NODE:
{
cache.emplace_back(std::make_unique<std::vector<rocprofiler_record_counter_t>>());
*cache.back() = _static_value;
return cache.back().get();
}
case ADDITION_NODE:
return perform_op([](auto& a, auto& b) {
return rocprofiler_record_counter_t{