发明名称 Failure profiling for continued code optimization
摘要 A method and an apparatus to continuously re-compile a code are described. The code can be compiled in a speculatively optimized manner from a source code to access an untyped variable according to a type prediction of runtime values for the untyped variable. Failures of the type prediction during the execution can be dynamically tracked. Each failure may be associated a runtime value with a type outside of the type prediction. The type prediction may be adjusted according to the failures tracked for future runtime values of the untyped variable. The source code can be recompiled for execution to optimize the access to the untyped variable for the future runtime values according to the adjusted type prediction.
申请公布号 US9256410(B2) 申请公布日期 2016.02.09
申请号 US201213593411 申请日期 2012.08.23
申请人 Apple Inc. 发明人 Pizlo Filip J.;Barraclough Gavin
分类号 G06F9/44;G06F9/45;G06F11/34 主分类号 G06F9/44
代理机构 Blakely, Sokoloff, Taylor & Zafman LLP 代理人 Blakely, Sokoloff, Taylor & Zafman LLP
主权项 1. A machine-readable non-transitory storage medium having instructions therein, which when executed by a machine, cause the machine to perform a method, the method comprising: executing a code compiled from a source code, the source code including an access of an untyped variable, the compiled code being speculatively optimized according to a type prediction for runtime values of the untyped variable, wherein the type prediction corresponds to a collection of possible types for the untyped variable; collecting a subset of the runtime values into a profile database during the execution; tracking failures of the type prediction during the execution, wherein each tracked failure is associated with an identified type of one of the runtime values, wherein the identified type is outside of the type prediction, and wherein the tracked failures are collected into a profile database; analyzing information stored in the profile database including the collected runtime values and the tracked failures to update a statistics of types of the runtime values, the statistics indicating a certain type of the runtime values causing the tracked failures; determining a failure rate for the type prediction based on the profile database and a runtime status; adjusting the type prediction according to the statistics for future runtime values of the untyped variable, wherein the adjusted type prediction corresponds to a separate collection of possible types for the untyped variable, and wherein adjusting the type prediction further comprises recompiling a recompiled code from the source code if the failure rate exceeds a failure threshold; and executing the recompiled code of the source code to optimize the access to the untyped variable for the future runtime values according to the adjusted type prediction.
地址 Cupertino CA US