|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.saxon.expr.Optimizer
com.saxonica.expr.ee.OptimizerEE
public class OptimizerEE
This class performs a number of optimizations that are specific to the Saxon-EE product. The relevant methods override dummy methods (that generally perform no optimization) in the superclass, which is used by Saxon-HE.
| 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,
PromotionOffer offer)
Extract subexpressions from the body of a function that can be evaluated as global variables |
Expression |
generateMultithreadedInstruction(Expression instruction)
Generate a multi-threaded version of an instruction. |
int |
isIndexableFilter(Expression filter)
Test whether a filter predicate is indexable. |
Expression |
makeConditionalDocumentSorter(DocumentSorter sorter,
PathExpression path)
Make a conditional document sorter. |
void |
makeCopyOperationsExplicit(Expression parent,
Expression child)
In streaming mode, make the copy operation applied to subexpressions of a complex-content sequence constructor into explicit copy-of operations. |
ValueRepresentation |
makeIndexedValue(SequenceIterator iter)
Create an indexed value |
RuleTarget |
makeInversion(Pattern pattern,
Template template,
NodeTest nodeTest)
Generate the inversion of the expression comprising the body of a template rules. |
Expression |
makeStreamingApplyTemplates(ApplyTemplates inst)
Make a streaming applyTemplates instruction. |
Pattern |
makeStreamingPattern(Expression exp,
List<String> reasonForFailure)
Convert an expression that is capable of being evaluated as a filter on an XML event stream into a Selection object which is able to act as the filter |
Expression |
optimizeCopy(Expression select)
Attempt to optimize a copy operation. |
Expression |
optimizeForExpressionForStreaming(ForExpression expr)
In streaming mode, optimizer a ForExpression for streaming. |
Expression |
optimizeQuantifiedExpressionForStreaming(QuantifiedExpression expr)
In streaming mode, optimize a QuantifiedExpression for streaming. |
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)
Identify expressions within a function or template body that can be promoted to be evaluated as global variables. |
BinaryExpression |
simplifyGeneralComparison(GeneralComparison gc,
boolean backwardsCompatible)
Simplify a GeneralComparison expression |
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 (or an XQuery 1.1 switch) into an optimized 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 configuration| Method Detail |
|---|
public BinaryExpression simplifyGeneralComparison(GeneralComparison gc,
boolean backwardsCompatible)
simplifyGeneralComparison in class Optimizergc - the GeneralComparison to be simplifiedbackwardsCompatible - true if in 1.0 compatibility mode
public Expression optimizeCopy(Expression select)
throws XPathException
optimizeCopy in class Optimizerselect - the expression that selects the items to be copied
XPathException
public Expression optimizeStreamingCopy(Expression select)
throws XPathException
select - the select expression to be examined
XPathException
public void makeCopyOperationsExplicit(Expression parent,
Expression child)
throws XPathException
makeCopyOperationsExplicit in class Optimizerparent - The parent expression of the expression that is to be wrapped in an implicit copy-of.child - The expression that is to be wrapped in an implicit copy-of, if it is suitable.
XPathException
public Expression optimizeForExpressionForStreaming(ForExpression expr)
throws XPathException
optimizeForExpressionForStreaming in class Optimizerexpr - the expression to be optimized
XPathException
public Expression optimizeQuantifiedExpressionForStreaming(QuantifiedExpression expr)
throws XPathException
optimizeQuantifiedExpressionForStreaming in class Optimizerexpr - the expression to be optimized
XPathException
public Pattern makeStreamingPattern(Expression exp,
List<String> reasonForFailure)
exp - the expression to be convertedreasonForFailure - a list which will be populated with messages giving reasons why the
expression cannot be converted
XPathException
public Expression convertPathExpressionToKey(PathExpression pathExp,
ExpressionVisitor visitor)
throws XPathException
convertPathExpressionToKey in class OptimizerpathExp - The path expression to be converted.visitor - The expression visitor
XPathException
public Expression tryIndexedFilter(FilterExpression f,
ExpressionVisitor visitor,
boolean indexFirstOperand)
tryIndexedFilter in class Optimizerf - 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 OptimizerpathExp - the path expression to be convertedth - the type hierarchy cache
XPathExceptionpublic int isIndexableFilter(Expression filter)
isIndexableFilter in class Optimizerfilter - the predicate expression
public ValueRepresentation makeIndexedValue(SequenceIterator iter)
throws XPathException
makeIndexedValue in class Optimizeriter - the iterator that delivers the sequence of values to be indexed
XPathException
public Expression makeConditionalDocumentSorter(DocumentSorter sorter,
PathExpression path)
makeConditionalDocumentSorter in class Optimizersorter - 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 OptimizerfunctionCall - the functionCall expressionvisitor - the expression visitorcontextItemType - the static type of the context item
public Expression promoteExpressionsToGlobal(Expression body,
ExpressionVisitor visitor)
throws XPathException
promoteExpressionsToGlobal in class Optimizerbody - the body of the template or functionvisitor - the expression visitor
XPathException
public Expression trySwitch(Choose choose,
StaticContext env)
trySwitch in class Optimizerchoose - the Choose expressionenv - the static context
public Expression extractGlobalVariables(Expression body,
ExpressionVisitor visitor,
PromotionOffer offer)
throws XPathException
extractGlobalVariables in class Optimizerbody - an expression with no dependencies other than on global variables
(already checked by the caller)offer - The PromotionOffer. Will be marked to indicate whether any action was taken
XPathException
public Expression makeStreamingApplyTemplates(ApplyTemplates inst)
throws XPathException
makeStreamingApplyTemplates in class Optimizerinst - the unoptimized applyTemplates instruction
XPathException
public RuleTarget makeInversion(Pattern pattern,
Template template,
NodeTest nodeTest)
throws XPathException
makeInversion in class Optimizerpattern - the match pattern of this template ruletemplate - the template to be invertednodeTest - the static item type of the context node of the template
XPathExceptionpublic Expression generateMultithreadedInstruction(Expression instruction)
generateMultithreadedInstruction in class Optimizerinstruction - the instruction to be multi-threaded
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||