Runtime optimization of arithmetic expressions with decimal numbers
AssigneeOracle International Corporation
InventorsAlexey Karyakin, Laurent Daynes
Life of this patent
Estimating the term…
Abstract
A method may include generating, from an expression, an expression tree including an arithmetic operation and conversion operations each converting an operand of the arithmetic operation from an initial decimal format to an optimized decimal format. The initial decimal format may include a shape. The method may further include at runtime, evaluating the arithmetic operation with initial operands represented in the initial decimal format, and specializing one of the conversion operations according to the shape of the corresponding initial operand.
Claims20
A method, comprising:
- generating, from an expression, an expression tree comprising an arithmetic operation and conversion operations each converting an operand of the arithmetic operation from an initial decimal format to an optimized decimal format, the initial decimal format comprising a shape comprising a scale represented as a decimal value, a length, and a sign;
- at runtime, evaluating the arithmetic operation with initial operands represented in the initial decimal format;
- and
- specializing one of the conversion operations according to the shape of the corresponding initial operand to obtain a specialized conversion operation comprising conversion shapes corresponding to shapes represented in the initial decimal format,
- wherein the specialized conversion operation is specialized by:
- at runtime, evaluating the arithmetic operation with next operands represented in the initial decimal format;
- determining that a shape of one of the next operands is not comprised by the conversion shapes;
- determining that the number of conversion shapes is less than a threshold;
- and
- in response to determining that the number of conversion shapes is less than the threshold, specializing the conversion operation according to the shape.
A system, comprising:
- a repository configured to store an expression and an expression tree;
- a memory coupled to a processor;
- an ahead-of-time compiler, executing on the processor and using the memory, configured to:
- generate, from the expression, the expression tree comprising an arithmetic operation and conversion operations each converting an operand of the arithmetic operation from an initial decimal format to an optimized decimal format, the initial decimal format comprising a shape comprising a scale represented as a decimal value, a length, and a sign;
- and
- a just-in-time (JIT) compiler, executing on the processor and using the memory, configured to:
- at runtime, evaluate the arithmetic operation with initial operands represented in the initial decimal format;
- and
- specialize one of the conversion operations according to the shape of the corresponding initial operand to obtain a specialized conversion operation comprising conversion shapes corresponding to shapes represented in the initial decimal format,
- wherein the specialized conversion operation is specialized by:
- at runtime, evaluating the arithmetic operation with next operands represented in the initial decimal format;
- determining that a shape of one of the next operands is not comprised by the conversion shapes;
- determining that the number of conversion shapes is less than a threshold;
- and
- in response to determining that the number of conversion shapes is less than the threshold, specializing the conversion operation according to the shape.
A non-transitory computer readable medium comprising instructions that, when executed by a processor, perform:
- generating, from an expression, an expression tree comprising an arithmetic operation and conversion operations each converting an operand of the arithmetic operation from an initial decimal format to an optimized decimal format, the initial decimal format comprising a shape comprising a scale represented as a decimal value, a length, and a sign;
- at runtime, evaluating the arithmetic operation with initial operands represented in the initial decimal format;
- and
- specializing one of the conversion operations according to the shape of the corresponding initial operand to obtain a specialized conversion operation comprising conversion shapes corresponding to shapes represented in the initial decimal format,
- wherein the specialized conversion operation is specialized by:
- at runtime, evaluating the arithmetic operation with next operands represented in the initial decimal format;
- determining that a shape of one of the next operands is not comprised by the conversion shapes;
- determining that the number of conversion shapes is less than a threshold;
- and
- in response to determining that the number of conversion shapes is less than the threshold, specializing the conversion operation according to the shape.
Dependencies are inferred from the claim text.