public class OptimizerEE extends Optimizer
config, FULL_OPTIMIZATION, NO_OPTIMIZATION| Constructor and Description |
|---|
OptimizerEE(Configuration config)
Create the Saxon-EE optimizer
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkStreamability(XSLTemplate sourceTemplate,
Template compiledTemplate)
Check the streamability of a template
|
Expression |
compileToByteCode(Expression expr,
String objectName,
int evaluationMethods)
Generate Java byte code for an expression
|
Expression |
convertPathExpressionToKey(SlashExpression 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(SlashExpression 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 |
makeCastableToList(Expression operand,
SchemaType targetType,
boolean allowsEmpty)
Make an expression castable check to a union type.
|
FunctionItem |
makeCastToUnion(UnionType type,
NamespaceResolver resolver) |
Expression |
makeConditionalDocumentSorter(DocumentSorter sorter,
SlashExpression 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.
|
Sequence |
makeIndexedValue(SequenceIterator iter)
Create an indexed value
|
Expression |
makeStreamingApplyTemplates(ApplyTemplates inst,
List<String> reasonsForFailure)
Make a streaming applyTemplates instruction.
|
Expression |
optimizeCopy(Expression select)
Attempt to optimize a copy operation.
|
Expression |
optimizeForExpressionForStreaming(ForExpression expr)
In streaming mode, optimize a ForExpression for streaming.
|
BinaryExpression |
optimizeGeneralComparison(GeneralComparison gc,
boolean backwardsCompatible)
Simplify a GeneralComparison expression
|
Expression |
optimizeQuantifiedExpressionForStreaming(QuantifiedExpression expr)
In streaming mode, optimize a QuantifiedExpression for streaming.
|
boolean |
processSwitchCondition(Expression condition,
Expression action,
com.saxonica.ee.optim.OptimizerEE.SwitchCaseInfo switchCaseInfo) |
Expression |
promoteExpressionsToGlobal(Expression body,
GlobalVariableManager globalVariableManager,
ExpressionVisitor visitor)
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,
boolean contextIsDoc)
Try converting a filter expression to a call on the key function.
|
Expression |
tryInlineFunctionCall(UserFunctionCall functionCall,
ExpressionVisitor visitor,
ContextItemStaticInfo 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 3.0 switch) into an optimized switch
|
getConfiguration, getOptimizationLevel, isVariableReplaceableByDot, makeInversion, setOptimizationLevel, trace, tracepublic OptimizerEE(Configuration config)
config - the Saxon-EE configurationpublic FunctionItem makeCastToUnion(UnionType type, NamespaceResolver resolver)
makeCastToUnion in class Optimizerpublic BinaryExpression optimizeGeneralComparison(GeneralComparison gc, boolean backwardsCompatible)
optimizeGeneralComparison in class Optimizergc - the GeneralComparison to be simplifiedbackwardsCompatible - true if in 1.0 compatibility modepublic Expression optimizeCopy(Expression select) throws XPathException
optimizeCopy in class Optimizerselect - the expression that selects the items to be copiedXPathExceptionpublic 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.XPathExceptionpublic void checkStreamability(XSLTemplate sourceTemplate, Template compiledTemplate) throws XPathException
checkStreamability in class OptimizersourceTemplate - the source of the template in the stylesheet treecompiledTemplate - the compiled templateXPathException - if the template is declared streamable but does not satisfy the straming rulespublic Expression makeCastableToList(Expression operand, SchemaType targetType, boolean allowsEmpty)
makeCastableToList in class Optimizerpublic Expression optimizeForExpressionForStreaming(ForExpression expr) throws XPathException
optimizeForExpressionForStreaming in class Optimizerexpr - the expression to be optimizedXPathExceptionpublic Expression optimizeQuantifiedExpressionForStreaming(QuantifiedExpression expr) throws XPathException
optimizeQuantifiedExpressionForStreaming in class Optimizerexpr - the expression to be optimizedXPathExceptionpublic Expression convertPathExpressionToKey(SlashExpression pathExp, ExpressionVisitor visitor) throws XPathException
convertPathExpressionToKey in class OptimizerpathExp - The path expression to be converted.visitor - The expression visitorXPathExceptionpublic Expression tryIndexedFilter(FilterExpression f, ExpressionVisitor visitor, boolean indexFirstOperand, boolean contextIsDoc)
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;contextIsDoc - true if the context item is known to be a document nodepublic FilterExpression convertToFilterExpression(SlashExpression pathExp, TypeHierarchy th) throws XPathException
convertToFilterExpression in class OptimizerpathExp - the path expression to be convertedth - the type hierarchy cacheXPathExceptionpublic int isIndexableFilter(Expression filter)
isIndexableFilter in class Optimizerfilter - the predicate expressionpublic Sequence makeIndexedValue(SequenceIterator iter) throws XPathException
makeIndexedValue in class Optimizeriter - the iterator that delivers the sequence of values to be indexedXPathExceptionpublic Expression makeConditionalDocumentSorter(DocumentSorter sorter, SlashExpression path)
makeConditionalDocumentSorter in class Optimizersorter - an expression that sorts and deduplicates its operandpath - the slash expression that is the operand of the sorterpublic Expression tryInlineFunctionCall(UserFunctionCall functionCall, ExpressionVisitor visitor, ContextItemStaticInfo contextItemType)
tryInlineFunctionCall in class OptimizerfunctionCall - the functionCall expressionvisitor - the expression visitorcontextItemType - the static type of the context itempublic Expression trySwitch(Choose choose, StaticContext env)
public boolean processSwitchCondition(Expression condition, Expression action, com.saxonica.ee.optim.OptimizerEE.SwitchCaseInfo switchCaseInfo)
public Expression promoteExpressionsToGlobal(Expression body, GlobalVariableManager globalVariableManager, ExpressionVisitor visitor) throws XPathException
promoteExpressionsToGlobal in class Optimizerbody - the body of the template or functionvisitor - the expression visitorXPathExceptionpublic 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 takenXPathExceptionpublic Expression makeStreamingApplyTemplates(ApplyTemplates inst, List<String> reasonsForFailure) throws XPathException
makeStreamingApplyTemplates in class Optimizerinst - the unoptimized applyTemplates instructionreasonsForFailure - a list to which diagnostic messages will be addedXPathException - if an error is detectedpublic Expression generateMultithreadedInstruction(Expression instruction)
generateMultithreadedInstruction in class Optimizerinstruction - the instruction to be multi-threadedpublic Expression compileToByteCode(Expression expr, String objectName, int evaluationMethods)
compileToByteCode in class Optimizerexpr - the expression to be compiledobjectName - the name of the object to be compiled, used as a hint for the Java class/method nameevaluationMethods - The evaluation modes for which code is generated. Currently a subset of
Expression.PROCESS_METHOD, Expression.ITERATE_METHOD. If no code is generated for
a given evaluation method, the fallback implementation from the superclass is used.Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.