US2015186165A1PendingUtilityA1

Emulating pointers

Assignee: MICROSOFT TECHNOLOGY LICENSING LLCPriority: Dec 27, 2010Filed: Mar 17, 2015Published: Jul 2, 2015
Est. expiryDec 27, 2030(~4.4 yrs left)· nominal 20-yr term from priority
G06F 9/455G06F 8/434
47
PatentIndex Score
0
Cited by
0
References
0
Claims

Abstract

The present invention extends to methods, systems, and computer program products for emulating pointers. Pointers can be emulated by replacing the pointers with a variable offset pair and replacing each dereference site with a switch on the tag and a switch body that executes the emulated pointer access on the corresponding variable the pointer points to. Data flow optimizations can be used to reduce the number of switches and/or reduce the number of cases which need be considered at each emulated pointer access sites.

Claims

exact text as granted — not AI-modified
What is claimed is: 
     
         1 . A computing system comprising:
 at least one processor; and   at least one storage device having stored computer-executable instructions which, when executed by the at least one processor, implement a method for emulating pointers by causing the computing system to perform the following:
 accessing a plurality of lower level instructions of lower level code translated from corresponding statements and expressions of higher level code, the plurality of lower level instructions including lower level instructions representing statements and expressions from the higher level code that define a plurality of different variables, the plurality of variables including one or more pointers, a set of local variables, a set of shared memory variables, and global memory resources, the plurality of lower level instructions also including instructions representing statements and expressions from the higher level code that assign to or dereference pointers from among the one or more pointers; 
 inlining the plurality of lower level instructions into a single function, the single function configured to provide a processor kernel with direct knowledge of the set of local variables, the set of shared memory variables, and the global memory resources when executed at the processor; 
 generating lower level pointer emulation instructions, the lower level pointer emulation instructions representing each of the one or more pointers by defining a pair of corresponding variables and using at least one value from the pair of values to either emulate assigning an address value to one of the one or more pointers or to emulate dereferencing the one or more pointers; and 
 replacing the inlined lower level instructions representing statements and expressions from the higher level code that define at least the one or more pointers and that assign to or dereference pointers from among the one or more pointers with the lower level pointer emulation instructions. 
   
     
     
         2 . The computing system of  claim 1 , wherein the method further includes defining a tag variable for storing a tag value to identify an array or a global memory resource and an offset variable for storing an offset value to identify a position within the array or global memory resources which are used to either emulate assigning an address value to one of the one or more pointers or to emulate dereferencing the one or more pointers. 
     
     
         3 . The computing system as recited in  claim 1 , wherein generating lower level pointer emulation instructions comprises an act of generating lower level instructions defining a local array and a shared memory array, the local array for storing the set of local variables, the shared memory array for storing the set of shared memory variables. 
     
     
         4 . The computing system as recited in  claim 3 , wherein the method further includes assigning the set of local variables into the local array and assigning the set of shared memory variables into the shared memory array. 
     
     
         5 . The computing system as recited in  claim 1 , wherein the act of generating lower level pointer emulation instructions includes defining a first local array and a second local array, the first local array for storing local variables from the set of local variables that are dereferenced using known offsets, the second local array for storing other local variables from the set of local variables. 
     
     
         6 . The computing system as recited in  claim 5 , wherein the method further includes assigning the local variables that are dereferenced using known offsets into the first local array and assigning the other local variables into the second local array. 
     
     
         7 . The computing system as recited in  claim 1 , wherein generating lower level pointer emulation instructions includes defining a first shared memory array and a second shared memory array, the first shared memory array for storing shared memory variables from the set of shared memory variables that are dereferenced using known offsets, the second shared memory array for storing other shared memory variables from the set of shared memory variables. 
     
     
         8 . The computing system as recited in  claim 1 , wherein the act of generating lower level pointer emulation instructions includes defining a unique local array for each local variable in the set of local variables and a unique shared memory array for each shared memory variable in the set of share memory variables. 
     
     
         9 . The computing system as recited in  claim 1 , wherein the act of generating lower level pointer emulation instructions includes defining a shared memory array for the set of shared memory variables and a unique local array for each local variable in the set of local variables. 
     
     
         10 . The computing system as recited in  claim 9 , wherein the act of generating lower level pointer emulation instructions further includes defining a local array for all local variables that are dereferenced using known offsets. 
     
     
         11 . The computing system as recited in  claim 1 , wherein the method further includes emulating a dereferencing the one or more pointer by at least generating a switch statement structure that switches on tag values of one or more tag variables. 
     
     
         12 . The computing system as recited in  claim 11 , further comprising an act of optimizing the switch statement structure by removing at least one switch case from the switch statement structure. 
     
     
         13 . A method implemented by a computing system that includes at least one processor and stored computer-executable instructions which, when executed by the at least one processor, implement the method, the method comprising:
 the computing system accessing a plurality of lower level instructions of lower level code translated from corresponding statements and expressions of higher level code, the plurality of lower level instructions including lower level instructions representing statements and expressions from the higher level code that define a plurality of different variables, the plurality of variables including one or more pointers, a set of local variables, a set of shared memory variables, and global memory resources, the plurality of lower level instructions also including instructions representing statements and expressions from the higher level code that assign to or dereference pointers from among the one or more pointers;   the computing system inlining the plurality of lower level instructions into a single function, the single function configured to provide a processor kernel with direct knowledge of the set of local variables, the set of shared memory variables, and the global memory resources when executed at the processor;   the computing system generating lower level pointer emulation instructions, the lower level pointer emulation instructions representing each of the one or more pointers by defining a pair of corresponding variables and using at least one value from the pair of values to either emulate assigning an address value to one of the one or more pointers or to emulate dereferencing the one or more pointers; and   the computing system replacing the inlined lower level instructions representing statements and expressions from the higher level code that define at least the one or more pointers and that assign to or dereference pointers from among the one or more pointers with the lower level pointer emulation instructions.   
     
     
         14 . The method of  claim 13 , wherein the method further includes defining a tag variable for storing a tag value to identify an array or a global memory resource and an offset variable for storing an offset value to identify a position within the array or global memory resources which are used to either emulate assigning an address value to one of the one or more pointers or to emulate dereferencing the one or more pointers. 
     
     
         15 . The method as recited in  claim 13 , wherein generating lower level pointer emulation instructions comprises an act of generating lower level instructions defining a local array and a shared memory array, the local array storing the set of local variables, the shared memory array storing the set of shared memory variables. 
     
     
         16 . The method as recited in  claim 13 , wherein the act of generating lower level pointer emulation instructions includes defining a first local array and a second local array, the first local array storing local variables from the set of local variables that are dereferenced using known offsets, the second local array storing other local variables from the set of local variables. 
     
     
         17 . The method as recited in  claim 13 , wherein the method further includes emulating a dereferencing the one or more pointer by at least generating a switch statement structure that switches on tag values of one or more tag variables and thereafter optimizing the switch statement structure by removing at least one switch case from the switch statement structure. 
     
     
         18 . The method as recited in  claim 13 , wherein the method further includes defining one or more arrays for grouping variables that are dereferenced using known offsets. 
     
     
         19 . A computer program product for use at a computer system, the computer program product for implementing a method for emulating pointers, the computer program comprising one or more computer hardware storage devices having stored thereon computer-executable instructions that, when executed at a processor, cause the computer system to perform the following:
 accessing a plurality of lower level instructions of lower level code translated from corresponding statements and expressions of higher level code, the plurality of lower level instructions including lower level instructions representing statements and expressions from the higher level code that define a plurality of different variables, the plurality of variables including one or more pointers, a set of local variables, a set of shared memory variables, and global memory resources, the plurality of lower level instructions also including instructions representing statements and expressions from the higher level code that assign to or dereference pointers from among the one or more pointers;   inlining the plurality of lower level instructions into a single function, the single function configured to provide a processor kernel with direct knowledge of the set of local variables, the set of shared memory variables, and the global memory resources when executed at the processor;   generating lower level pointer emulation instructions, the lower level pointer emulation instructions representing each of the one or more pointers by defining a pair of corresponding variables and using at least one value from the pair of values to either emulate assigning an address value to one of the one or more pointers or to emulate dereferencing the one or more pointers; and   replacing the inlined lower level instructions representing statements and expressions from the higher level code that define at least the one or more pointers and that assign to or dereference pointers from among the one or more pointers with the lower level pointer emulation instructions.   
     
     
         20 . The computer program product as recited in  claim 19 , wherein the method further includes defining one or more arrays for grouping variables that are dereferenced using known offsets.

Join the waitlist — get patent alerts

Track US2015186165A1 — get alerts on status changes and closely related new filings.

We store only your email — no account needed. See our privacy policy.