# US 11,029,930 B2 · Code optimization conversations for connected managed runtime environments

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 11,029,930 B2
- Document ID: US11029930B2
- Status: Granted
- Kind: B2
- Application number: 16/710,790
- Filed: 2019-12-11
- Published: 2020-04-16
- Granted: 2021-06-08
- Earliest claimed: 2017-06-09
- Assignees: Azul Systems, Inc.
- Applicants: Azul Systems, Inc.
- Inventors: Gil Tene; Philip Reames
- Web page: https://patentgrep.com/patent/US11029930B2

## CPC

- G06F 11/3612: {by runtime analysis (performance monitoring G06F11/3466)}
- G06F 8/443: {Optimisation}
- G06F 8/447: {Target code generation}
- G06F 8/71: Version control (security arrangements therefor G06F21/57); Configuration management
- G06F 8/75: Structural analysis for program understanding
- G06F 8/427: {Parsing}
- G06F 8/4434: {Reducing the memory space required by the program code}
- G06F 8/4441: {Reducing the execution time required by the program code}
- G06F 9/30072: {to perform conditional operations, e.g. using predicates or guards}
- G06F 9/4552: {Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method of providing by a code optimization service an optimized version of a code unit to a managed runtime environment is disclosed. Information related to one or more runtime conditions associated with the managed runtime environment that is executing in a different process than that of the code optimization service is obtained, wherein the one or more runtime conditions are subject to change during the execution of the code unit. The optimized version of the code unit and a corresponding set of one or more speculative assumptions are provided to the managed runtime environment, wherein the optimized version of the code unit produces the same logical results as the code unit unless at least one of the set of one or more speculative assumptions is not true, wherein the set of one or more speculative assumptions are based on the information related to the one or more runtime conditions.

## Claims

### Claim 1

A method of providing an optimized version of a code unit to a managed runtime environment on a device by a code optimization service, comprising:
obtaining information related to one or more runtime conditions associated with the managed runtime environment that is executing in a different process than that of the code optimization service, and wherein the one or more runtime conditions are subject to change during the execution of the code unit, wherein obtaining the information related to the one or more runtime conditions comprises:
conducting a code optimization conversation between the code optimization service and the managed runtime environment, and wherein the code optimization conversation comprises one or more iterations, and wherein an iteration in the one or more iterations comprises a question and an answer, and wherein the question and the answer are related to at least one of the one or more runtime conditions associated with the managed runtime environment; and
providing to the managed runtime environment the optimized version of the code unit and a corresponding set of one or more speculative assumptions, wherein the optimized version of the code unit produces the same logical results as the code unit unless at least one of the set of one or more speculative assumptions is not true, and wherein the set of one or more speculative assumptions are based on the information related to the one or more runtime conditions; and
wherein the code optimization conversation is stored in a code optimization query cache, wherein the code optimization conversation is replayable to the managed runtime environment or another different managed runtime environment, wherein replaying of the code optimization conversation comprises:
conducting the code optimization conversation between the code optimization query cache and the managed runtime environment or the another different managed runtime environment; and
providing by the code optimization query cache an optimized version of the code unit and a corresponding set of one or more speculative assumptions to the managed runtime environment or the another different managed runtime environment.

### Claim 2 (depends on 1)

The method of claim 1, wherein the question is posed by the code optimization service, and wherein the answer is provided by the managed runtime environment.

### Claim 3 (depends on 1)

The method of claim 1, wherein the code optimization conversation comprises two or more iterations, and wherein in between two of the two or more iterations, the code optimization conversation is paused for a period of time, and wherein the code optimization conversation is subsequently resumed with another iteration.

### Claim 4 (depends on 1)

The method of claim 1, further comprising:
after one iteration, determining whether a different version of optimized code of the code unit is derived based on the information obtained from the answer of the iteration.

### Claim 5 (depends on 4)

The method of claim 4, wherein in the event that there is a different version of optimized code of the code unit, the method further comprising:
providing the different version of optimized code of the code unit to the managed runtime environment, and wherein the managed runtime environment replaces a currently running version of the code unit with the different version of optimized code of the code unit.

### Claim 6 (depends on 4)

The method of claim 4, wherein in the event that there is not a different version of optimized code of the code unit, the method further comprising:
notifying the managed runtime environment that a different version of optimized code of the code unit is not available.

### Claim 7 (depends on 4)

The method of claim 4, wherein the code optimization query cache is located locally on the device or remotely from the device in a cloud storage.

### Claim 8 (depends on 7)

The method of claim 7, wherein the stored code optimization conversation is stored as a tree data structure, and wherein the tree data structure comprises one or more of the following: node or state transition information, the questions in the one or more iterations, and the different versions of optimized code of the code unit associated with each node.

### Claim 9 (depends on 1)

The method of claim 1, wherein a runtime condition comprises a field or method of an object or a class associated with the code unit.

### Claim 10 (depends on 1)

The method of claim 1, wherein the code optimization service comprises a code optimizer, and wherein the code optimizer is executing in a different process than that of the managed runtime environment.

### Claim 11

A code optimization service for providing an optimized version of a code unit to a managed runtime environment on a device, comprising:
a processor; and
a memory coupled with the processor, wherein the memory is configured to provide the processor with instructions which when executed cause the processor to:
obtain information related to one or more runtime conditions associated with the managed runtime environment that is executing in a different process than that of the code optimization service, and wherein the one or more runtime conditions are subject to change during the execution of the code unit, wherein obtaining the information related to the one or more runtime conditions comprises:
conducting a code optimization conversation between the code optimization service and the managed runtime environment, and wherein the code optimization conversation comprises one or more iterations, and wherein an iteration in the one or more iterations comprises a question and an answer, and wherein the question and the answer are related to at least one of the one or more runtime conditions associated with the managed runtime environment; and
provide to the managed runtime environment the optimized version of the code unit and a corresponding set of one or more speculative assumptions, wherein the optimized version of the code unit produces the same logical results as the code unit unless at least one of the set of one or more speculative assumptions is not true, and wherein the set of one or more speculative assumptions are based on the information related to the one or more runtime conditions; and
wherein the code optimization conversation is stored in a code optimization query cache, wherein the code optimization conversation is replayable to the managed runtime environment or another different managed runtime environment, wherein replaying of the code optimization conversation comprises:
conducting the code optimization conversation between the code optimization query cache and the managed runtime environment or the another different managed runtime environment; and
providing by the code optimization query cache an optimized version of the code unit and a corresponding set of one or more speculative assumptions to the managed runtime environment or the another different managed runtime environment.

### Claim 12 (depends on 11)

The code optimization service of claim 11, wherein the question is posed by the code optimization service, and wherein the answer is provided by the managed runtime environment.

### Claim 13 (depends on 11)

The code optimization service of claim 11, wherein the code optimization conversation comprises two or more iterations, and wherein in between two of the two or more iterations, the code optimization conversation is paused for a period of time, and wherein the code optimization conversation is subsequently resumed with another iteration.

### Claim 14 (depends on 11)

The code optimization service of claim 11, wherein the memory is further configured to provide the processor with instructions which when executed cause the processor to:
after one iteration, determine whether a different version of optimized code of the code unit is derived based on the information obtained from the answer of the iteration.

### Claim 15 (depends on 14)

The code optimization service of claim 14, wherein in the event that there is a different version of optimized code of the code unit, wherein the memory is further configured to provide the processor with instructions which when executed cause the processor to:
provide the different version of optimized code of the code unit to the managed runtime environment, and wherein the managed runtime environment replaces a currently running version of the code unit with the different version of optimized code of the code unit.

### Claim 16 (depends on 14)

The code optimization service of claim 14, wherein in the event that there is not a different version of optimized code of the code unit, wherein the memory is further configured to provide the processor with instructions which when executed cause the processor to:
notify the managed runtime environment that a different version of optimized code of the code unit is not available.

### Claim 17 (depends on 14)

The code optimization service of claim 14, wherein the code optimization query cache is located locally on the device or remotely from the device in a cloud storage.

### Claim 18 (depends on 17)

The code optimization service of claim 17, wherein the stored code optimization conversation is stored as a tree data structure, and wherein the tree data structure comprises one or more of the following: node or state transition information, the questions in the one or more iterations, and the different versions of optimized code of the code unit associated with each node.

### Claim 19 (depends on 11)

The code optimization service of claim 11, wherein a runtime condition comprises a field or method of an object or a class associated with the code unit.

### Claim 20 (depends on 11)

The code optimization service of claim 11, wherein the code optimization service comprises a code optimizer, and wherein the code optimizer is executing in a different process than that of the managed runtime environment.

### Claim 21

A computer program product for providing an optimized version of a code unit to a managed runtime environment on a device, the computer program product being embodied in a tangible computer readable storage medium and comprising computer instructions for:
obtaining information related to one or more runtime conditions associated with the managed runtime environment that is executing in a different process than that of the code optimization service, and wherein the one or more runtime conditions are subject to change during the execution of the code unit, wherein obtaining the information related to the one or more runtime conditions comprises:
conducting a code optimization conversation between the code optimization service and the managed runtime environment, and wherein the code optimization conversation comprises one or more iterations, and wherein an iteration in the one or more iterations comprises a question and an answer, and wherein the question and the answer are related to at least one of the one or more runtime conditions associated with the managed runtime environment; and providing to the managed runtime environment the optimized version of the code unit and a corresponding set of one or more speculative assumptions, wherein the optimized version of the code unit produces the same logical results as the code unit unless at least one of the set of one or more speculative assumptions is not true, and wherein the set of one or more speculative assumptions are based on the information related to the one or more runtime conditions; and
wherein the code optimization conversation is stored in a code optimization query cache, wherein the code optimization conversation is replayable to the managed runtime environment or another different managed runtime environment, wherein replaying of the code optimization conversation comprises:
conducting the code optimization conversation between the code optimization query cache and the managed runtime environment or the another different managed runtime environment; and
providing by the code optimization query cache an optimized version of the code unit and a corresponding set of one or more speculative assumptions to the managed runtime environment or the another different managed runtime environment.
