Project

Profile

Help

Bug #4339

closed

XQuery variables seem to get inlined even when optimizations are disabled

Added by Radu Coravu about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2019-10-11
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

For our xquery debugger we set the net.sf.saxon.lib.FeatureKeys.OPTIMIZATION_LEVEL property to be "new OptimizerOptions(0)" meaning no optimizations.

Then we load the associated XQuery and when the execution goes to line 62 we compute the list of local variables with some code which looks like this:

  public static List<Variable> getXQueryLocalVariables(
      XPathContext pathContext,
      InstructionInfo instructionInfo) {

    ArrayList<Variable> localVariables = new ArrayList<Variable>();

    StackFrame stackFrame = pathContext.getStackFrame();
    if (stackFrame != null) {
      SlotManager slotMgr = stackFrame.getStackFrameMap();
      if (slotMgr != null) {        
        List variablesQNames = slotMgr.getVariableMap();
        if (variablesQNames != null) {
          if (logger.isDebugEnabled()) {
            logger.debug("Locals var fingerprints array size : " + variablesQNames.size());
          }
       .............
    return localVariables;
  }

The list of "variablesQNames" obtained with Saxon 9.8 used to be much larger, it reported 19 variables, it reported for example the variable "process_inst" which is declared and used only once. But with Saxon 9.9 only 4 variables are reported: "documentSeq1", "in-xml", "booleanSequence" and "attr"


Files

xqueryDebug.zip (1.43 KB) xqueryDebug.zip Radu Coravu, 2019-10-11 07:17

Please register to edit this issue

Also available in: Atom PDF