Patent ID: 8910136

Claim:
A method comprising: in response to reading a declaration of a function that specifies a name of the function and a type of memory on which the function operates, saving the name of the function, a pointer to the function, and the type of memory to a template, the type of memory being at least one of a plurality of memory types available in a computer system; in response to reading a call statement that specifies the name of the function and an identifier of an object, generating first code that when executed: (a) reads the pointer to the function from a virtual function table pointed to by the object, the virtual function table pointed to by the object being one of a plurality of virtual function tables each assigned to a different respective type of memory, the virtual function table pointed to by the object being assigned to the type of memory for containing the object, (b) finds an entry in the virtual function table pointed to by the object that represents the function, and (c) reads the pointer from the entry in the virtual function table pointed to by the object, wherein the call statement, when executed, requests a call of the function; generating second code that, when executed on said computer system, calls the function using the pointer read from the virtual function table pointed to by the object; in response to a request for allocation of the object, wherein the request specifies the type of the memory in which the object is requested to be allocated, allocating the object in the memory and determining whether the virtual function table assigned to the type of memory exists; and wherein at least one virtual function table of the plurality of virtual function tables is assigned to the type of memory which is either a dynamic random access memory (DRAM) or a phase change memory (PCM).