发明名称 Optimized storage of function variables
摘要 Optimized storage of function variables in compiled code is disclosed. It is determined that a variable of a first function is required to be available for use by a second function subsequent to return of the first function. Machine code is generated to escape the variable from a storage location in a stack memory to a storage location in a heap memory, prior to the variable being removed from the stack memory, in connection with return of the first function.
申请公布号 US8898625(B2) 申请公布日期 2014.11.25
申请号 US200812316731 申请日期 2008.12.15
申请人 发明人 Porras Victor Leonel Hernandez;Hoover Roger Scott
分类号 G06F9/45;G06F9/44;G06F9/30 主分类号 G06F9/45
代理机构 Womble Carlyle Sandridge & Rice, LLP 代理人 Womble Carlyle Sandridge & Rice, LLP
主权项 1. A method for processing software code, comprising: while analyzing a high-level code, determining programmatically that: variables of a first function are required to be available for use by a second function subsequent to a return of the first function, andvariables of a third function are not required to be available for use by the second function subsequent to a return of the third function,wherein the determining comprises identifying that the second function continues to reference the variables of the first function, but not the variables of the third function, subsequent to the return of the first function; and when compiling the high-level code into machine code: generating automatically for the first function a first segment of machine code that, when executed, is configured to: copy values of the variables of the first function from a storage location in a stack memory to temporary objects stored in a heap memory prior to the values of the variables of the first function being removed from the stack memory in response to the return of the first function, wherein: during execution of the first function, the temporary objects store pointers to the storage location in the stack memory, and,subsequent to the return of the first function, and during execution of the second function, the temporary objects store the copied values instead of the pointers; andgenerating automatically for the third function a second segment of machine code that, when executed, is configured to cause values of the variables of the third function to be removed from the stack memory when the third function returns.
地址