发明名称 Variable closure
摘要 A system and method for accessing closure variables from a lambda expression in certain program configurations, in which the closure variable is accessed while the closure function is active and the closure variable is within an active runtime frame stack corresponding to an instance of the closure function. In response to entering the closure function, a pointer to each closure variable is stored in a stack pointer table. Each reference to each closure variable from the lambda expression is handled by using the closure variable pointer to locate the closure variable on the runtime stack. Program code may be instrumented to insert invocations to helper functions at locations upon entering the closure function and at each reference to each closure variable from the lambda expression.
申请公布号 US8997040(B2) 申请公布日期 2015.03.31
申请号 US201012730263 申请日期 2010.03.24
申请人 Microsoft Technology Licensing, LLC 发明人 Zinkovsky Igor;Kantamneni Harish
分类号 G06F9/44;G06F3/00;G06F9/455 主分类号 G06F9/44
代理机构 代理人 Sullivan Kevin;Drakos Kate;Minhas Micky
主权项 1. A computer-based method of accessing a closure variable defined in a function of a computer program from a lambda expression that is invoked from a computer program location outside the function while an instance of the function is active, the closure variable stored in a frame on a runtime stack, the frame corresponding to the function instance, comprising: a) in response to entering the function during program execution, storing a pointer to the closure variable in a data structure; b) in response to an instruction to retrieve a value of the closure variable, the instruction in the lambda expression, employing the pointer to locate the closure variable in the frame on the runtime stack and retrieve the variable value: c) automatically inserting a closure creation instruction to create a closure object in response to an invocation of the function; and d) automatically inserting a variable reference instruction to retrieve the closure variable value from within the lambda expression.
地址 Redmond WA US