Patent ID: 9569185
Date: 2017-02-14
CPC Classifications: G06F

Claim:
1. A method for compiling code, comprising: receiving a code section representation comprising a first guard at a first location in the code section representation; placing, at the first location of the first guard, a first triggering condition that defines when to deoptimize the code section representation; relocating, by a compiler, the first guard from the first location to a second location in the code section representation, wherein relocating the first guard reduces an amount of execution time of the code section representation by eliminating redundant instructions associated with one or more guards in the code section representation; transforming the first guard into a first control-split instruction comprising a first deoptimization branch to deoptimize the code section representation and a continue execution branch; placing, in the first deoptimization branch, a deoptimization instruction that transfers execution of the code section representation from compiled machine code to an interpreter; generating a symbolic frame state comprising a data structure that is linked to a first side-effecting instruction, wherein the first side-effecting instruction is the last side-effecting instruction before the first control-split instruction, wherein the symbolic frame state comprises pointers that point to a storage for one or more values of a local frame state at a point in the execution of the code section representation before the first side-effecting instruction, wherein the symbolic frame state further comprises an expression that recalculates the local frame state without re-execution of the first side-effecting instruction; linking, in the code section representation, the deoptimization instruction with the symbolic frame state, wherein, in response to triggering the deoptimization branch during the execution of the code section representation, a portion of the code section representation is interpreted by the interpreter, and wherein the one or more values of the local frame state are recalculated during the interpretation by the interpreter and stored in the symbolic frame state; unlinking, in the code section representation, the symbolic frame state from the first side-effecting instruction; and storing, after the unlinking, the code section representation.