Class BddPeepholeVisitor
java.lang.Object
software.amazon.awssdk.codegen.poet.rules.RewriteRuleExpressionVisitor
software.amazon.awssdk.codegen.poet.rules.bdd.BddPeepholeVisitor
- All Implemented Interfaces:
RuleExpressionVisitor<RuleExpression>
BDD-only peephole optimization pass. Rewrites endpoint rule expressions into synthetic function
calls that the BDD code generators emit as allocation-free native Java.
This runs before PrepareForCodegenVisitor on
the BDD path only, so the tree-based rules code generation is unaffected.
Optimizations applied:
stringEquals(coalesce(substring(str, X, Y, reverse), ""), literal)→RulesFunctions.substringEquals(str, X, Y, reverse, literal), which compares in place instead of allocating the substring and the coalesce varargs array. The helper reproducessubstring's semantics exactly, including its rejection of non-ASCII input, so the rewrite cannot change which branch a rule takes.coalesce(boolExpr, boolLiteral)→__coalesceBoolean(expr, default)ite(cond, ifTrue, ifFalse)→__ite(cond, ifTrue, ifFalse)isValidHostLabel(str, boolLiteral)→__isValidHostLabel(str, allowDots)
Synthetic function names are prefixed with __ so they cannot collide with endpoint
rule standard library function names. Those in isCustomEmitted(String) are emitted as
inline Java by the code generators; __substringEquals is instead registered as a real
function in RuleRuntimeTypeMirror and emitted by the ordinary static-call path.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisCustomEmitted(String functionName) Returns true for synthetic functions that the BDD code generator emits as inline Java rather than as a plain static call.Methods inherited from class software.amazon.awssdk.codegen.poet.rules.RewriteRuleExpressionVisitor
visitBooleanAndExpression, visitBooleanNotExpression, visitEndpointExpression, visitErrorExpression, visitHeadersExpression, visitIndexedAccessExpression, visitLetExpression, visitListExpression, visitLiteralBooleanExpression, visitLiteralIntegerExpression, visitLiteralStringExpression, visitMemberAccessExpression, visitMethodCallExpression, visitPropertiesExpression, visitRuleSetExpression, visitStringConcatExpression, visitVariableReferenceExpression
-
Field Details
-
ITE
- See Also:
-
COALESCE_BOOL
- See Also:
-
IS_VALID_HOST_LABEL
- See Also:
-
-
Constructor Details
-
BddPeepholeVisitor
public BddPeepholeVisitor()
-
-
Method Details
-
isCustomEmitted
Returns true for synthetic functions that the BDD code generator emits as inline Java rather than as a plain static call.RuleRuntimeTypeMirror.SUBSTRING_EQUALS_FNis deliberately absent: it is registered as a real function and so needs no custom emitter. -
visitFunctionCallExpression
- Specified by:
visitFunctionCallExpressionin interfaceRuleExpressionVisitor<RuleExpression>- Overrides:
visitFunctionCallExpressionin classRewriteRuleExpressionVisitor
-