# US 2018/0024823 A1 · Enhanced local commoning

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

- Number: US 2018/0024823 A1
- Document ID: US20180024823A1
- Status: Published application
- Kind: A1
- Application number: 15/214,879
- Filed: 2016-07-20
- Published: 2018-01-25
- Earliest claimed: 2016-07-20
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Andrew J. Craik; Patrick R. Doyle; Vijay Sundaresan
- Web page: https://patentgrep.com/patent/US20180024823A1

## CPC

- G06F 9/4552: {Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM}
- G06F 8/443: {Optimisation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and system for enhanced local commoning optimization of compilation of a program. Commoning of volatiles within an extended block for a particular memory model associated with a particular programming language is performed, using a two pass approach. Within a first pass, a determination is made as to where in the program to evaluate volatile expressions that can be commoned. In a second pass, all remaining expressions that are not volatile expressions are commoned.

## Claims

### Claim 1

A method for enhanced local commoning optimization of compilation of a program, said method comprising:
performing, by one or more processors of a computer system, commoning of volatiles within an extended block for a particular memory model associated with a particular programming language, using a two pass approach by:
determining, by the one or more processors, within a first pass, where in the program to evaluate volatile expressions that can be commoned; and
commoning, by the one or more processors, in a second pass, all remaining expressions that are not volatile expressions.

### Claim 2 (depends on 1)

The method of claim 1, wherein said determining within the first pass where in the program to evaluate volatile expressions that can be commoned comprises:
analyzing each extended basic block in the program according to a set of predetermined criteria in the first pass, to common all volatile fields, wherein the first pass tracks opportunities for commoning local variables and final fields in addition to tracking opportunities to common the volatile fields, and wherein only the volatile fields are commoned in the first pass.

### Claim 3 (depends on 2)

The method of claim 2, wherein said analyzing each extended basic block according to the set of predetermined criteria in the first pass comprises:
identifying locations in the program of the volatile expressions to be evaluated, wherein the volatile expressions determine ordering constraints with respect to other volatile and non-volatile expressions; and
reducing a number of volatile loads in an extended basic block in the program during the first pass, which increases opportunities for the second pass to common non-volatile expressions over a scope of the extended basic block.

### Claim 4 (depends on 1)

The method of claim 1, wherein said commoning all remaining expressions that are not volatile expressions in the second pass comprises:
analyzing each extended basic block in the program using the set of predetermined criteria in the second pass, to common all expressions that are not volatile including local variables and final fields, wherein no volatile fields are communed in the second pass.

### Claim 5 (depends on 1)

The method of claim 1, wherein a volatile expression that is a static field or an instance field dependent solely on local variables or final fields can be commoned within a scope of an extended block per the particular memory model when (i) there is no other volatile expression in between and (ii) remaining predetermined conditions for commoning are also satisfied.

### Claim 6 (depends on 1)

The method of claim 1, wherein the particular memory model associated with the particular programming language is selected from a group consisting of a managed runtime language, a scripting environment language, and a procedural language.

### Claim 7

A computer program product, comprising one or more computer readable hardware storage devices having compute readable program instructions stored therein, said program instructions executable by one or more processors of a computer system to implement a method for enhanced local commoning optimization of compilation of a program, said method comprising:
performing, by the one or more processors, commoning of volatiles within an extended block for a particular memory model associated with a particular programming language, using a two pass approach by:
determining, by the one or more processors, within a first pass, where in the program to evaluate volatile expressions that can be commoned; and
commoning, by the one or more processors, in a second pass, all remaining expressions that are not volatile expressions.

### Claim 8 (depends on 7)

The computer program product of claim 7, wherein said determining within the first pass where in the program to evaluate volatile expressions that can be commoned comprises:
analyzing each extended basic block in the program according to a set of predetermined criteria in the first pass, to common all volatile fields, wherein the first pass tracks opportunities for commoning local variables and final fields in addition to tracking opportunities to common the volatile fields, and wherein only the volatile fields are commoned in the first pass.

### Claim 9 (depends on 8)

The computer program product of claim 8, wherein said analyzing each extended basic block according to the set of predetermined criteria in the first pass comprises:
identifying locations in the program of the volatile expressions to be evaluated, wherein the volatile expressions determine ordering constraints with respect to other volatile and non-volatile expressions; and
reducing a number of volatile loads in an extended basic block in the program during the first pass, which increases opportunities for the second pass to common non-volatile expressions over a scope of the extended basic block.

### Claim 10 (depends on 7)

The computer program product of claim 7, wherein said commoning all remaining expressions that are not volatile expressions in the second pass comprises:
analyzing each extended basic block in the program using the set of predetermined criteria in the second pass, to common all expressions that are not volatile including local variables and final fields, wherein no volatile fields are communed in the second pass.

### Claim 11 (depends on 7)

The computer program product of claim 7, wherein a volatile expression that is a static field or an instance field dependent solely on local variables or final fields can be commoned within a scope of an extended block per the particular memory model when (i) there is no other volatile expression in between and (ii) remaining predetermined conditions for commoning are also satisfied.

### Claim 12 (depends on 7)

The computer program product of claim 7, wherein the particular memory model associated with the particular programming language is selected from a group consisting of a managed runtime language, a scripting environment language, and a procedural language.

### Claim 13

A computer system, comprising one or more processors, one or more memories, and one or more computer readable hardware storage devices, said one or more hardware storage device containing program instructions executable by the one or more processors via the one or more memories to implement a method for enhanced local commoning optimization of compilation of a program, said method comprising:
performing, by the one or more processors, commoning of volatiles within an extended block for a particular memory model associated with a particular programming language, using a two pass approach by:
determining, by the one or more processors, within a first pass, where in the program to evaluate volatile expressions that can be commoned; and
commoning, by the one or more processors, in a second pass, all remaining expressions that are not volatile expressions.

### Claim 14 (depends on 13)

The computer system of claim 13, wherein said determining within the first pass where in the program to evaluate volatile expressions that can be commoned comprises:
analyzing each extended basic block in the program according to a set of predetermined criteria in the first pass, to common all volatile fields, wherein the first pass tracks opportunities for commoning local variables and final fields in addition to tracking opportunities to common the volatile fields, and wherein only the volatile fields are commoned in the first pass.

### Claim 15 (depends on 14)

The computer system of claim 14, wherein said analyzing each extended basic block according to the set of predetermined criteria in the first pass comprises:
identifying locations in the program of the volatile expressions to be evaluated, wherein the volatile expressions determine ordering constraints with respect to other volatile and non-volatile expressions; and
reducing a number of volatile loads in an extended basic block in the program during the first pass, which increases opportunities for the second pass to common non-volatile expressions over a scope of the extended basic block.

### Claim 16 (depends on 13)

The computer system of claim 13, wherein said commoning all remaining expressions that are not volatile expressions in the second pass comprises:
analyzing each extended basic block in the program using the set of predetermined criteria in the second pass, to common all expressions that are not volatile including local variables and final fields, wherein no volatile fields are commoned in the second pass.

### Claim 17 (depends on 13)

The computer system of claim 13, wherein a volatile expression that is a static field or an instance field dependent solely on local variables or final fields can be commoned within a scope of an extended block per the particular memory model when (i) there is no other volatile expression in between and (ii) remaining predetermined conditions for commoning are also satisfied.

### Claim 18 (depends on 13)

The computer system of claim 13, wherein the particular memory model associated with the particular programming language is selected from a group consisting of a managed runtime language, a scripting environment language, and a procedural language.
