|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.expr.Optimizer com.saxonica.extra.OptimizerEE
public class OptimizerEE
This class doesn't actually do any optimization itself, despite the name. Rather, it is intended to act as a factory for implementation classes that perform optimization, so that the appropriate level of optimization can be selected.
Field Summary |
---|
Fields inherited from class net.sf.saxon.expr.Optimizer |
---|
config, FULL_OPTIMIZATION, NO_OPTIMIZATION |
Constructor Summary | |
---|---|
OptimizerEE(Configuration config)
Create the Saxon-EE optimizer |
Method Summary | |
---|---|
Expression |
convertPathExpressionToKey(PathExpression pathExp,
ExpressionVisitor visitor)
Examine a path expression to see whether it can be replaced by a call on the key() function; if so, generate an appropriate key definition and return the call on key(). |
FilterExpression |
convertToFilterExpression(PathExpression pathExp,
TypeHierarchy th)
Convert a path expression such as a/b/c[predicate] into a filter expression of the form (a/b/c)[predicate]. |
Expression |
extractGlobalVariables(Expression body,
ExpressionVisitor visitor)
Extract subexpressions from the body of a function that can be evaluated as global variables |
int |
isIndexableFilter(Expression filter)
Test whether a filter predicate is indexable. |
Value |
makeClosure(Expression expression,
int ref,
XPathContext context)
Make a Closure, given the expected reference count |
Expression |
makeConditionalDocumentSorter(DocumentSorter sorter,
PathExpression path)
Make a conditional document sorter. |
BinaryExpression |
makeGeneralComparison(Expression p0,
int op,
Expression p1,
boolean backwardsCompatible)
Create a GeneralComparison expression |
ValueRepresentation |
makeIndexedValue(SequenceIterator iter)
Create an indexed value |
RuleTarget |
makeInversion(Template template,
NodeTest nodeTest)
Generate the inversion of the expression comprising the body of a template rules. |
ValueRepresentation |
makeSequenceExtent(Expression expression,
int ref,
XPathContext context)
Make a SequenceExtent, given the expected reference count |
Expression |
makeStreamingApplyTemplates(ApplyTemplates inst)
Make a streaming applyTemplates instruction. |
Expression |
optimizeCopy(Expression select)
Attempt to optimize a copy operation. |
Expression |
optimizeStreamingCopy(Expression select)
Given a select expression, determine whether it is a candidate for sequential processing, and if so, return a SequentialCopy expression that does the work. |
Expression |
promoteExpressionsToGlobal(Expression body,
ExpressionVisitor visitor,
boolean notTopLevel)
Identify expressions within a function or template body that can be promoted to be evaluated as global variables. |
Expression |
tryIndexedFilter(FilterExpression f,
ExpressionVisitor visitor,
boolean indexFirstOperand)
Try converting a filter expression to a call on the key function. |
Expression |
tryInlineFunctionCall(UserFunctionCall functionCall,
ExpressionVisitor visitor,
ItemType contextItemType)
Replace a function call by the body of the function, assuming all conditions for inlining the function are satisfied |
Expression |
trySwitch(Choose choose,
StaticContext env)
Try to convert a Choose expression into a switch |
Methods inherited from class net.sf.saxon.expr.Optimizer |
---|
getConfiguration, getOptimizationLevel, isVariableReplaceableByDot, setOptimizationLevel, trace, trace |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OptimizerEE(Configuration config)
config
- the Saxon-EE configurationMethod Detail |
---|
public BinaryExpression makeGeneralComparison(Expression p0, int op, Expression p1, boolean backwardsCompatible)
makeGeneralComparison
in class Optimizer
p0
- the first operandop
- the operatorp1
- the second operandbackwardsCompatible
- true if XPath 1.0 backwards compatibility is in force
public Expression optimizeCopy(Expression select) throws XPathException
optimizeCopy
in class Optimizer
select
- the expression that selects the items to be copied
XPathException
public Expression optimizeStreamingCopy(Expression select) throws XPathException
To qualify, the select expression must be a path expression that starts with a call on doc() or document(), and whose subsequent steps are all axis steps using the child, descendant, and attribute axes only; there must be no predicates; it must match either elements only, or attributes only
select
- the select expression to be examined
XPathException
public Value makeClosure(Expression expression, int ref, XPathContext context) throws XPathException
makeClosure
in class Optimizer
expression
- the expression to be evaluatedref
- the (nominal) number of times the value of the expression is requiredcontext
- the XPath dynamic evaluation context
XPathException
public ValueRepresentation makeSequenceExtent(Expression expression, int ref, XPathContext context) throws XPathException
makeSequenceExtent
in class Optimizer
expression
- the expression to be evaluatedref
- the (nominal) number of times the value of the expression is requiredcontext
- the XPath dynamic evaluation context
XPathException
public Expression convertPathExpressionToKey(PathExpression pathExp, ExpressionVisitor visitor) throws XPathException
convertPathExpressionToKey
in class Optimizer
pathExp
- The path expression to be converted.visitor
- The expression visitor
XPathException
public Expression tryIndexedFilter(FilterExpression f, ExpressionVisitor visitor, boolean indexFirstOperand)
tryIndexedFilter
in class Optimizer
f
- the filter expression to be convertedvisitor
- the expression visitor, which must be currently visiting the filter expression findexFirstOperand
- true if the first operand of the filter comparison is to be indexed;
false if it is the second operand
public FilterExpression convertToFilterExpression(PathExpression pathExp, TypeHierarchy th) throws XPathException
convertToFilterExpression
in class Optimizer
pathExp
- the path expression to be convertedth
- the type hierarchy cache
XPathException
public int isIndexableFilter(Expression filter)
isIndexableFilter
in class Optimizer
filter
- the predicate expression
public ValueRepresentation makeIndexedValue(SequenceIterator iter) throws XPathException
makeIndexedValue
in class Optimizer
iter
- the iterator that delivers the sequence of values to be indexed
XPathException
public Expression makeConditionalDocumentSorter(DocumentSorter sorter, PathExpression path)
makeConditionalDocumentSorter
in class Optimizer
sorter
- an expression that sorts and deduplicates its operandpath
- the path expression that is the operand of the sorter
public Expression tryInlineFunctionCall(UserFunctionCall functionCall, ExpressionVisitor visitor, ItemType contextItemType)
tryInlineFunctionCall
in class Optimizer
functionCall
- the functionCall expressionvisitor
- the expression visitorcontextItemType
- the static type of the context item
public Expression promoteExpressionsToGlobal(Expression body, ExpressionVisitor visitor, boolean notTopLevel) throws XPathException
promoteExpressionsToGlobal
in class Optimizer
body
- the body of the template or functionvisitor
- the expression visitornotTopLevel
- if true, only promote the children of the supplied body expression, not the
entire expression
XPathException
public Expression trySwitch(Choose choose, StaticContext env)
trySwitch
in class Optimizer
choose
- the Choose expressionenv
- the static context
public Expression extractGlobalVariables(Expression body, ExpressionVisitor visitor) throws XPathException
extractGlobalVariables
in class Optimizer
body
- an expression with no dependencies other than on global variables
(already checked by the caller)
XPathException
public Expression makeStreamingApplyTemplates(ApplyTemplates inst) throws XPathException
makeStreamingApplyTemplates
in class Optimizer
inst
- the unoptimized applyTemplates instruction
XPathException
public RuleTarget makeInversion(Template template, NodeTest nodeTest) throws XPathException
makeInversion
in class Optimizer
template
- the template to be invertednodeTest
- the static item type of the context node of the template
XPathException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |