Class MatrixTurboEvaluator
java.lang.Object
com.github.gbenroscience.parser.turbo.tools.MatrixTurboEvaluator
- All Implemented Interfaces:
TurboExpressionEvaluator
Allocation-free Turbo compiler optimized for ParserNG's flat-array Matrix
implementation. Uses compile-time bound ResultCaches and Zero-Argument
MethodHandle trees to maximize JIT inlining and execution speed.
- Author:
- GBEMIRO
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classHolds the mutable state for a single node in the execution tree. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MathExpression.EvalResult[]compile()Compile a postfix token array into a fast-executing expression.static MathExpression.EvalResultdispatchMatrixFunction(MathExpression.EvalResult[] args, String funcName, MatrixTurboEvaluator.ResultCache cache) static MathExpression.EvalResultdispatchUnaryOp(MathExpression.EvalResult operand, char op, MatrixTurboEvaluator.ResultCache cache) double[]static MathExpression.EvalResultinvokeRegistryMethod(int methodId, MathExpression.EvalResult[] argsValues) booleanvoidsetWillFoldConstants(boolean willFoldConstants)
-
Field Details
-
turboArgs
protected final double[] turboArgs -
slots
protected final int[] slots
-
-
Constructor Details
-
MatrixTurboEvaluator
-
-
Method Details
-
setWillFoldConstants
public void setWillFoldConstants(boolean willFoldConstants) -
isWillFoldConstants
public boolean isWillFoldConstants() -
getTurboArgs
public double[] getTurboArgs() -
invokeRegistryMethod
public static MathExpression.EvalResult invokeRegistryMethod(int methodId, MathExpression.EvalResult[] argsValues) -
compile
Description copied from interface:TurboExpressionEvaluatorCompile a postfix token array into a fast-executing expression.- Specified by:
compilein interfaceTurboExpressionEvaluator- Returns:
- A FastCompositeExpression ready for evaluation
- Throws:
Throwable- if compilation fails
-
collectArgsArray
-
dispatchMatrixFunction
public static MathExpression.EvalResult dispatchMatrixFunction(MathExpression.EvalResult[] args, String funcName, MatrixTurboEvaluator.ResultCache cache) -
dispatchUnaryOp
public static MathExpression.EvalResult dispatchUnaryOp(MathExpression.EvalResult operand, char op, MatrixTurboEvaluator.ResultCache cache)
-