Deferred constant pool generation
AssigneeApple Inc.
InventorsVictor Leonel Hernandez Porras, Roger Scott Hoover, Christopher Arthur Lattner, Eric Marshall Christopher
Life of this patent
Estimating the term…
Abstract
Deferred constant pool generation is disclosed. Optimization processing is performed with respect to an intermediate representation of a source code. The optimized intermediate representation is used to generate a constant pool. In some embodiments, the source code comprises JavaScript, which is used to generate a low level virtual machine (LLVM) or other intermediate representation (IR), which intermediate representation is optimized prior to a constant pool being generated.
Claims15
A computer-implemented method for compiling software code, comprising:
- generating, at a first stage of a compiler, a byte code representation of a source code, wherein the generating does not include creating a constant pool for the byte code representation of the source code;
- performing, at a second stage of the compiler, two or more optimizations on the byte code representation of the source code to produce an optimized byte code representation, wherein the two or more optimizations could not be performed if the constant pool had been generated along with the byte code representation at the first stage of the compiler;
- identifying, at the second stage of the compiler, and using variable type information included in the optimized byte code representation, a pattern of constant value usage in the optimized byte code representation;
- generating, at the second stage of the compiler, a constant pool based upon the identified pattern of constant value usage;
- and
- generating, at a third stage of the compiler, machine code based upon the optimized byte code representation subsequent to generation of the constant pool.
A system for processing software code, comprising:
- a memory configured to store a source code;
- and
- a processor coupled to the memory and configured to:
- generate, at a first stage of a compiler, a byte code representation of a source code, wherein the generating does not include creating a constant pool for the byte code representation of the source code;
- perform, at a second stage of the compiler, two or more optimizations on the byte code representation of the source code to produce an optimized byte code representation, wherein the two or more optimizations could not be performed if the constant pool had been generated along with the byte code representation at the first stage of the compiler;
- identify, at the second stage of the compiler, and using variable type information included in the optimized byte code representation, a pattern of constant value usage in the optimized byte code representation;
- generate, at the second stage of the compiler, a constant pool based upon the identified pattern of constant value usage;
- and
- generate, at a third stage of the compiler, machine code based upon the optimized byte code representation subsequent to generation of the constant pool.
A non-transitory computer readable storage medium storing instructions that, when executed by a processor included in a computing device, cause the computing device to carry out steps that include:
- generating, at a first stage of a compiler, a byte code representation of a source code, wherein the generating does not include creating a constant pool for the byte code representation of the source code;
- performing, at a second stage of the compiler, two or more optimizations on the byte code representation of the source code to produce an optimized byte code representation, wherein the two or more optimizations could not be performed if the constant pool had been generated along with the byte code representation at the first stage of the compiler;
- identifying, at the second stage of the compiler, using variable type information included in the optimized byte code representation, a pattern of constant value usage in the optimized byte code representation;
- generating, at the second stage of the compiler, a constant pool based upon the identified pattern of constant value usage;
- and
- generating, at a third stage of the compiler, machine code based upon the optimized byte code representation subsequent to generation of the constant pool.
Dependencies are inferred from the claim text.