Class TokenFieldSolver


  • public class TokenFieldSolver
    extends AbstractExpressionSolver<TokenField>
    Solves expressions of a token (instruction encoding) field Essentially, this just encodes the goal into the field, if it can be represented in the given space and format. Otherwise, there is no solution.
    • Constructor Detail

      • TokenFieldSolver

        public TokenFieldSolver()
    • Method Detail

      • solve

        public AssemblyResolution solve​(TokenField tf,
                                        MaskedLong goal,
                                        java.util.Map<java.lang.String,​java.lang.Long> vals,
                                        java.util.Map<java.lang.Integer,​java.lang.Object> res,
                                        AssemblyResolvedConstructor cur,
                                        java.util.Set<SolverHint> hints,
                                        java.lang.String description)
        Description copied from class: AbstractExpressionSolver
        Attempt to solve an expression for a given value
        Specified by:
        solve in class AbstractExpressionSolver<TokenField>
        Parameters:
        tf - the expression to solve
        goal - the desired value of the expression
        vals - values of defined symbols
        res - the results of subconstructor resolutions (used for lengths)
        hints - describes techniques applied by calling solvers
        description - the description to give to resolved solutions
        Returns:
        the resolution
      • getValue

        public MaskedLong getValue​(TokenField tf,
                                   java.util.Map<java.lang.String,​java.lang.Long> vals,
                                   java.util.Map<java.lang.Integer,​java.lang.Object> res,
                                   AssemblyResolvedConstructor cur)
        Description copied from class: AbstractExpressionSolver
        Attempt to get a constant value for the expression
        Specified by:
        getValue in class AbstractExpressionSolver<TokenField>
        Parameters:
        tf - the expression
        vals - values of defined symbols
        res - the results of subconstructor resolutions (used for lengths)
        Returns:
        the constant value, or null if it depends on a variable
      • getInstructionLength

        public int getInstructionLength​(TokenField tf,
                                        java.util.Map<java.lang.Integer,​java.lang.Object> res)
        Description copied from class: AbstractExpressionSolver
        Determines the length of the subconstructor that would be returned had the expression not depended on an undefined symbol. This is used by the backfilling process to ensure values are written to the correct offset
        Specified by:
        getInstructionLength in class AbstractExpressionSolver<TokenField>
        Parameters:
        tf - the expression
        res - the results of subconstructor resolutions (used for lengths)
        Returns:
        the length of filled in token field(s).