Skip to content

Commit 22ef60f

Browse files
committed
Postfix for #8499 - fix problems with BLR to source mapping and profiler.
Thanks to Pavel Zotov for reporting.
1 parent 7e48b11 commit 22ef60f

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/dsql/Nodes.h

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,15 +1501,7 @@ class StmtNode : public DmlNode
15011501
: savedTdbb(tdbb),
15021502
oldPool(tdbb->getDefaultPool()),
15031503
oldRequest(tdbb->getRequest()),
1504-
oldTransaction(tdbb->getTransaction()),
1505-
topNode(NULL),
1506-
prevNode(NULL),
1507-
whichEraseTrig(ALL_TRIGS),
1508-
whichStoTrig(ALL_TRIGS),
1509-
whichModTrig(ALL_TRIGS),
1510-
errorPending(false),
1511-
catchDisabled(false),
1512-
exit(false)
1504+
oldTransaction(tdbb->getTransaction())
15131505
{
15141506
savedTdbb->setTransaction(transaction);
15151507
savedTdbb->setRequest(request);
@@ -1525,14 +1517,15 @@ class StmtNode : public DmlNode
15251517
MemoryPool* oldPool; // Save the old pool to restore on exit.
15261518
Request* oldRequest; // Save the old request to restore on exit.
15271519
jrd_tra* oldTransaction; // Save the old transcation to restore on exit.
1528-
const StmtNode* topNode;
1529-
const StmtNode* prevNode;
1530-
WhichTrigger whichEraseTrig;
1531-
WhichTrigger whichStoTrig;
1532-
WhichTrigger whichModTrig;
1533-
bool errorPending; // Is there an error pending to be handled?
1534-
bool catchDisabled; // Catch errors so we can unwind cleanly.
1535-
bool exit; // Exit the looper when true.
1520+
const StmtNode* topNode = nullptr;
1521+
const StmtNode* prevNode = nullptr;
1522+
WhichTrigger whichEraseTrig = ALL_TRIGS;
1523+
WhichTrigger whichStoTrig = ALL_TRIGS;
1524+
WhichTrigger whichModTrig = ALL_TRIGS;
1525+
bool errorPending = false; // Is there an error pending to be handled?
1526+
bool catchDisabled = false; // Catch errors so we can unwind cleanly.
1527+
bool exit = false; // Exit the looper when true.
1528+
bool forceProfileNextEvaluate = false;
15361529
};
15371530

15381531
public:

src/dsql/StmtNodes.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5998,6 +5998,10 @@ void ForRangeNode::genBlr(DsqlCompilerScratch* dsqlScratch)
59985998
dsqlScratch->appendUChar(blr_label);
59995999
fb_assert(dsqlLabelNumber < MAX_UCHAR);
60006000
dsqlScratch->appendUChar((UCHAR) dsqlLabelNumber);
6001+
6002+
if (hasLineColumn)
6003+
dsqlScratch->putDebugSrcInfo(line, column);
6004+
60016005
dsqlScratch->appendUChar(blr_for_range);
60026006

60036007
dsqlScratch->appendUChar(blr_for_range_variable);
@@ -6072,7 +6076,7 @@ ForRangeNode* ForRangeNode::pass2(thread_db* tdbb, CompilerScratch* csb)
60726076
return this;
60736077
}
60746078

6075-
const StmtNode* ForRangeNode::execute(thread_db* tdbb, Request* request, ExeState* /*exeState*/) const
6079+
const StmtNode* ForRangeNode::execute(thread_db* tdbb, Request* request, ExeState* exeState) const
60766080
{
60776081
const auto impure = request->getImpure<Impure>(impureOffset);
60786082

@@ -6162,6 +6166,7 @@ const StmtNode* ForRangeNode::execute(thread_db* tdbb, Request* request, ExeStat
61626166
return parentStmt;
61636167
}
61646168

6169+
exeState->forceProfileNextEvaluate = true;
61656170
request->req_operation = Request::req_evaluate;
61666171
return statement;
61676172
}

src/jrd/exe.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1704,12 +1704,14 @@ const StmtNode* EXE_looper(thread_db* tdbb, Request* request, const StmtNode* no
17041704

17051705
if (node->hasLineColumn &&
17061706
node->isProfileAware() &&
1707-
(!profileNode ||
1707+
(exeState.forceProfileNextEvaluate ||
1708+
!profileNode ||
17081709
!(node->line == profileNode->line && node->column == profileNode->column)))
17091710
{
17101711
profilerLastTicks = profilerCallAfterPsqlLineColumn();
17111712
profilerLastAccumulatedOverhead = profilerManager->getAccumulatedOverhead();
17121713
profileNode = node;
1714+
exeState.forceProfileNextEvaluate = false;
17131715

17141716
profilerManager->beforePsqlLineColumn(request, profileNode->line, profileNode->column);
17151717
}

0 commit comments

Comments
 (0)