Revocation operation method and device, computer device, storage medium and program product

CN122547540APending Publication Date: 2026-08-11EMPYREAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-25
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0004]然而,相关技术中代码冗余、可扩展性差,并且会显著增加内存

Benefits of technology

对象实例头部存储类型标识符而非虚指针,使得每个对象实例无需额外存储占用内存较大的虚指针,在电子设计自动化软件中可显著降低内存占用。以类型标识符作为索引直接访问全局虚表数组,避免了相关技术中通过条件判断逐一匹配类型的线性查找开销,降低撤销操作的时间复杂度。虚表对象指针指向的虚表对象包括用于返回撤销成员函数指针的虚函数,使得新增对象类型时仅需定义新的虚表对象并注册到全局虚表数组,无需修改撤销框架代码,从而提升可扩展性。根据后进先出的顺序释放内存块,与对象实例的存储顺序相匹配,避免了内存碎片的产生,从而提高了内存的复用效率。如此,可以在保证撤销操作可扩展性的同时,降低内存占用并提高撤销操作的执行效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122547540A_ABST
    Figure CN122547540A_ABST
Patent Text Reader

Abstract

This invention relates to a method, apparatus, computer device, storage medium, and program product for undoing operations. The undoing operation method includes: obtaining a type identifier from the header of an object instance; storing the object instance within a memory block of a circular linked list, with the object instance stored in a last-in-first-out (LIFO) order; using the type identifier as an index, searching for the pointer to the virtual table object stored in the array element corresponding to the index in the global virtual table array; calling the undo member function pointed to by the virtual table object pointer to perform the undo operation, wherein the virtual table object pointed to by the virtual table object pointer includes a virtual function that returns a pointer to the undo member function; and releasing the memory block in a LIFO order. This invention can reduce memory usage and improve the execution efficiency of undo operations while ensuring the scalability of the undo operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic design automation software, and more specifically to a method, apparatus, computer equipment, storage medium, and program product for undoing operations. Background Technology

[0002] In electronic design automation (EDA) software, undo and redo are core functions that users frequently use. EDA software typically manages a large number of different types of objects, and each type of object needs to restore its state in a different way when undoing.

[0003] Two common approaches are used in related technologies. One approach involves using numerous conditional statements within the undo framework to differentiate object types and call the corresponding undo function to achieve the undo operation. The other approach leverages C++'s virtual function mechanism, using inheritance and polymorphism to dynamically dispatch undo operations. This virtual function mechanism adds virtual pointer overhead for each object.

[0004] However, the related technologies suffer from code redundancy, poor scalability, and significant memory usage. Summary of the Invention

[0005] To overcome the problems existing in related technologies, the present invention provides a method, apparatus, computer equipment, storage medium and program product for canceling operations.

[0006] According to a first aspect of the present invention, a method for undoing an operation is provided, the method comprising: Obtain the type identifier from the header of the object instance; the object instance is stored inside the memory block of the circular linked list, and the storage order of the object instance is last-in-first-out; Using the type identifier as an index, search for the pointer to the virtual table object stored in the array element corresponding to the index in the global virtual table array; The undo operation is performed by calling the undo member function pointed to by the virtual table object pointer. The virtual table object pointed to by the virtual table object pointer includes a virtual function for returning a pointer to the undo member function. Release memory blocks according to the Last-In-First-Out (LIFO) order.

[0007] In some exemplary embodiments, the step of calling the undo member function pointed to by the virtual table object pointer to perform the undo operation includes: The corresponding virtual function is called based on the virtual table object pointer to obtain the member cancellation function pointer; The undo operation is performed by calling the undo member function pointed to by the undo member function pointer.

[0008] In some exemplary embodiments, the step of calling the corresponding virtual function based on the virtual table object pointer to obtain the undo member function pointer includes: The virtual table object is determined based on the virtual table object pointer; Call the virtual function included in the virtual table object; Obtain the pointer to the undo member function returned by the virtual function.

[0009] In some exemplary embodiments, the byte length occupied by the type identifier is matched to the alignment boundary of the memory block to avoid padding bytes when the object instances are arranged in the memory block.

[0010] In some exemplary embodiments, each element of the global virtual table array stores a pointer to the virtual table object at compile time.

[0011] In some exemplary embodiments, the virtual table object is a static constant object.

[0012] According to a second aspect of the present invention, a reversal operation device is provided, the reversal operation device comprising: The acquisition module is configured to acquire the type identifier of the object instance header; the object instance is stored inside the memory block of the circular linked list, and the storage order of the object instance is last-in-first-out; The lookup module is configured to use the type identifier as an index to search for the pointer to the virtual table object stored in the array element corresponding to the index in the global virtual table array; The undo module is configured to call the undo member function pointer based on the virtual table object pointer to perform an undo operation, wherein the virtual table object pointed to by the virtual table object pointer includes a virtual function for returning the undo member function pointer; The release module is configured to release memory blocks in a last-in-first-out (LIFO) order.

[0013] According to a third aspect of the present invention, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the undo operation method as described in the first aspect.

[0014] According to a fourth aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the undo operation method as described in the first aspect.

[0015] According to a fifth aspect of the present invention, a computer program is provided, including a computer program or instructions, which, when executed by a processor, implement the undo operation method as described in the first aspect.

[0016] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects: Instead of storing virtual pointers, object instance headers store type identifiers, eliminating the need for each object instance to store memory-intensive virtual pointers, significantly reducing memory usage in electronic design automation software. Using type identifiers as indexes to directly access the global virtual table array avoids the linear lookup overhead of conditionally matching types, reducing the time complexity of undo operations. The virtual table objects pointed to by the virtual table object pointers include virtual functions that return pointers to undo member functions, meaning that adding new object types only requires defining new virtual table objects and registering them in the global virtual table array, without modifying the undo framework code, thus improving scalability. Releasing memory blocks in a last-in-first-out (LIFO) order matches the storage order of object instances, avoiding memory fragmentation and improving memory reuse efficiency. In this way, undo operation scalability can be maintained while reducing memory usage and improving execution efficiency.

[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0019] Figure 1 This is a flowchart illustrating the undo operation method according to a first exemplary embodiment.

[0020] Figure 2 This is a flowchart illustrating the undo operation method according to a second exemplary embodiment.

[0021] Figure 3 This is a flowchart illustrating the undo operation method according to a third exemplary embodiment.

[0022] Figure 4 This is a flowchart illustrating the undo operation method according to the fourth exemplary embodiment.

[0023] Figure 5 This is a schematic diagram of the structure of the cancellation operation device according to the second exemplary embodiment.

[0024] Figure 6 This is a block diagram of a computer device according to an exemplary embodiment.

[0025] In the picture: 100 - Computer equipment; 101 - Computing unit; 102 - ROM; 103 - RAM; 104 - Bus; 105 - Input / output interface; 106 - Input unit; 107 - Output unit; 108 - Storage unit; 109 - Communication unit. Detailed Implementation

[0026] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of methods consistent with some aspects of the invention as detailed in the appended claims. It should also be understood that the term "and / or" as used in this invention refers to any or all possible combinations comprising one or more of the associated listed items.

[0027] In electronic design automation (EDA) software, undo and redo are core functions that users frequently use. EDA software typically manages a large number of different types of objects, and each type of object needs to restore its state in a different way when undoing.

[0028] Two common approaches are used in related technologies. One approach involves using numerous conditional statements within the undo framework to differentiate object types and call the corresponding undo function to achieve the undo operation. The other approach leverages C++'s virtual function mechanism, using inheritance and polymorphism to dynamically dispatch undo operations. This virtual function mechanism adds virtual pointer overhead for each object.

[0029] However, the related technologies suffer from code redundancy, poor scalability, and significant memory usage.

[0030] Based on this, the present invention provides an undo operation method. The object instance header stores a type identifier instead of a virtual pointer, eliminating the need for each object instance to store a memory-intensive virtual pointer, significantly reducing memory usage in electronic design automation software. Using the type identifier as an index to directly access the global virtual table array avoids the linear lookup overhead of conditionally matching types in related technologies, reducing the time complexity of the undo operation. The virtual table object pointer points to a virtual table object including virtual functions that return pointers to undo member functions. This means that when adding a new object type, only a new virtual table object needs to be defined and registered in the global virtual table array, without modifying the undo framework code, thus improving scalability. Releasing memory blocks according to a last-in-first-out (LIFO) order matches the storage order of object instances, avoiding memory fragmentation and improving memory reuse efficiency. Thus, while ensuring the scalability of the undo operation, memory usage is reduced and the execution efficiency of the undo operation is improved.

[0031] In one exemplary embodiment, such as Figure 1 As shown, the present invention provides a method for undoing an operation, the method comprising: S110. Obtain the type identifier of the object instance header; the object instance is stored inside the memory block of the circular linked list, and the storage order of the object instance is last in first out.

[0032] In step S110 above, the type identifier is a fixed-length integer value stored in the header of an object instance, used to uniquely identify the type to which the object instance belongs. A circular linked list is a circular linked list structure formed by connecting multiple memory blocks via pointers. A memory block is a data storage unit with contiguous memory space. Last-In-First-Out (LIFO) is an access rule where the last stored object instance is removed first.

[0033] S120. Using the type identifier as an index, find the pointer to the virtual table object stored in the array element corresponding to the index in the global virtual table array.

[0034] In step S120 above, the global virtual table array is a globally visible array structure, where each array element stores a pointer to a virtual table object of the corresponding type. The type identifier is directly used as the index of the global virtual table array. Each array element corresponds to an object instance type and stores a pointer to a virtual table object of that type. A virtual table object pointer is a pointer to a virtual table object, which includes virtual functions used to return pointers to member functions. A virtual table object is an object that includes virtual functions; each object type corresponds to one virtual table object, and the virtual table object is a static constant object.

[0035] S130. The undo operation is performed by calling the undo member function pointed to by the virtual table object pointer. The virtual table object pointed to by the virtual table object pointer includes a virtual function that returns a pointer to the undo member function.

[0036] In step S130 above, the `delete member function` refers to the specific function in an object instance used to restore its own state. The `delete member function pointer` is a pointer to the `delete member function`.

[0037] S140. Release memory blocks according to the Last-In-First-Out (LIFO) order.

[0038] In step S140 above, when releasing the memory block, the last-in-first-out (LIFO) order can perfectly match the timing of the undo operation.

[0039] The undo operation method provided by the embodiments of the present invention may include the following beneficial effects: Instead of storing virtual pointers, object instance headers store type identifiers, eliminating the need for each object instance to store memory-intensive virtual pointers, significantly reducing memory usage in electronic design automation software. Using type identifiers as indexes to directly access the global virtual table array avoids the linear lookup overhead of conditionally matching types, reducing the time complexity of undo operations. The virtual table objects pointed to by the virtual table object pointers include virtual functions that return pointers to undo member functions, meaning that adding new object types only requires defining new virtual table objects and registering them in the global virtual table array, without modifying the undo framework code, thus improving scalability. Releasing memory blocks in a last-in-first-out (LIFO) order matches the storage order of object instances, avoiding memory fragmentation and improving memory reuse efficiency. In this way, undo operation scalability can be maintained while reducing memory usage and improving execution efficiency.

[0040] For example, before obtaining the type identifier of the object instance header in step S110 above, the undo operation method further includes: Multiple memory blocks are constructed into a circular linked list, with object instances arranged consecutively in the memory blocks, and the type identifier stored at the head of the object instance.

[0041] Each memory block has a contiguous memory space. Each memory block includes a pointer to the used size, a total size field, a pointer to the next memory block, and a pointer to the previous memory block. All memory blocks are connected end to end in a circular linked list through pointers to the next memory block and pointers to the previous memory block. The most recently used memory block is pointed to by the stack top pointer. When unloading, the unloading starts from the memory block pointed to by the stack top pointer.

[0042] For example, the length of bytes occupied by the type identifier in the above steps can be adjusted according to actual needs, such as 2 bytes.

[0043] In this embodiment, the order of object storage, undo execution, and memory release is consistent, which reduces memory usage and improves undo efficiency.

[0044] For example, before obtaining the type identifier of the object instance header in step S110 above, the undo operation method further includes: Construct a global virtual table array that is statically initialized at compile time; In this array, the indices of the global virtual table array correspond one-to-one with the type identifiers. Each array element of the global virtual table array stores a pointer to a virtual table object of the corresponding type (the virtual table object pointer is also a static constant object). This virtual table object pointer points to the virtual table object, which includes virtual functions. The virtual functions return a pointer to a member function that has been destroyed. The pointer to the member function that has been destroyed points to the member function that has been destroyed.

[0045] In this embodiment, by constructing a global virtual table array that is statically initialized at compile time, the virtual table object pointer is directly obtained by using the type identifier as an index during the undo operation, which achieves table lookup access with low time complexity and avoids runtime dynamic lookup overhead.

[0046] For example, the type of the circular linked list in step S110 above is a doubly linked circular list.

[0047] In this embodiment, the doubly linked circular list's head-to-tail connection allows multiple memory blocks to form a closed circular structure. Once all memory blocks are released, the linked list automatically enters an empty circular state, eliminating the need for additional boundary condition handling. This simplifies memory block management logic and enhances system stability during dynamic memory block allocation and release.

[0048] In one embodiment, the byte length occupied by the type identifier in step S110 above matches the alignment boundary of the memory block to avoid padding bytes when object instances are arranged in the memory block.

[0049] For example, when the type identifier stored in the header of each object instance is 2 bytes, the length of which matches the alignment boundary of the memory block.

[0050] In this embodiment, the byte length of the type identifier is designed to match the alignment boundary of the memory block, so that object instances can be compactly arranged in the memory block and each byte is effectively utilized, thereby eliminating the memory waste caused by padding bytes at the source.

[0051] For example, the type identifier in step S110 is written to the header of the object instance when the object instance is allocated, and is reclaimed along with the memory block when the object instance is released, keeping in sync with the last-in-first-out reclamation mechanism of the memory block.

[0052] In one embodiment, each array element in the global virtual table array in step S120 above stores a pointer to a virtual table object at compile time.

[0053] For example, the pointer to the virtual table object is determined at compile time and populated into the global virtual table array by compile-time constant expressions, without the need for dynamic lookup or loading at runtime.

[0054] In this embodiment, the array elements of the global virtual table array store virtual table object pointers at compile time. When the undo operation is executed, only one data index is needed to obtain the virtual table object pointer, without any runtime lookup or loading operations, thereby reducing the computational overhead of the undo operation.

[0055] In one embodiment, such as Figure 2As shown, step S130 above, which calls the undo member function pointed to by the virtual table object pointer to perform the undo operation, includes: S210. Call the corresponding virtual function based on the virtual table object pointer to obtain the member function pointer for cancellation.

[0056] S220. Call the undo member function pointed to by the undo member function pointer to perform the undo operation.

[0057] In this embodiment, calling virtual functions through virtual table object pointers enables the undo framework to uniformly obtain undo member function pointers for various object instances without needing to concern itself with the specific object type. Calling undo member functions through undo member function pointers allows the undo logic for different types of object instances to be implemented and maintained independently. Thus, the undo operation exhibits polymorphism not only at compile time but also at runtime, maintaining object-oriented polymorphism while avoiding the memory overhead of virtual pointers.

[0058] In one embodiment, such as Figure 3 As shown, step S210 above, which involves calling the corresponding virtual function based on the virtual table object pointer to obtain the member function pointer for cancellation, includes: S310. Determine the virtual table object based on the virtual table object pointer.

[0059] S320. Call the virtual functions included in the virtual table object.

[0060] S330. Obtain the pointer to the dormant member function returned by the virtual function.

[0061] In this embodiment, the virtual table object is determined based on the virtual table object pointer, the virtual functions included in the virtual table object are called, and the undo member function pointer returned by the virtual function is obtained, further refining the path for obtaining the undo member function pointer. The virtual table object is stored as a static constant in the read-only data segment, so that no additional data structures need to be dynamically allocated or initialized when the undo operation is executed, further reducing runtime memory space and time overhead.

[0062] For example, the step S220 above, which calls the undo member function pointed to by the undo member function pointer to perform the undo operation, includes: When the cancellation member function is called, the parameters received include the location index of the object instance in the memory block. The location index is used to calculate the memory address of the object instance in combination with the current memory block base address, so as to quickly locate the storage location of the object instance in the memory block.

[0063] In one embodiment, the virtual table object in step S130 above is a static constant object.

[0064] For example, the virtual table object in step S130 above is stored in a read-only data segment.

[0065] In this embodiment, the virtual table object is a static constant object, whose memory layout and storage location are determined during program compilation, and it does not occupy dynamic memory space on the heap or stack. During program execution, all object instances share the same virtual table object, avoiding the need to repeatedly store virtual table information for each object type. Furthermore, storing it in a read-only data segment prevents the virtual table object from being accidentally modified at runtime, enhancing the system's robustness.

[0066] For example, the step S140 above, which involves releasing memory blocks according to the last-in-first-out (LIFO) order, includes: The allocation and release of memory blocks are performed synchronously with the transaction operations of undoing the stack, as follows: When a new transaction begins, a transaction record is allocated in the current memory block; When a transaction is popped, if the corresponding memory block no longer contains any active objects, the entire memory block is released.

[0067] For example, the step S140 above, which involves releasing memory blocks according to the last-in-first-out (LIFO) order, includes: After the undo operation is completed, the memory block is released or switched according to the Last-In-First-Out (LIFO) principle. When all object instances in the memory block have been released, the entire memory block is released; if there are still active objects in the memory block, processing switches to the previous memory block.

[0068] In one exemplary embodiment, such as Figure 4 As shown, the present invention provides a method for undoing an operation, the method comprising: S410. Obtain the type identifier of the object instance header; the object instance is stored inside the memory block of the circular linked list, and the storage order of the object instance is last in first out.

[0069] S420. Using the type identifier as an index, find the pointer to the virtual table object stored in the array element corresponding to the index in the global virtual table array.

[0070] S430. Determine the virtual table object based on the virtual table object pointer.

[0071] S440, Call the virtual functions included in the virtual table object.

[0072] S450. Obtain the pointer to the undo member function returned by the virtual function.

[0073] S460. Call the undo member function pointed to by the undo member function pointer to perform the undo operation.

[0074] S470: Release memory blocks according to the Last-In-First-Out (LIFO) order.

[0075] The undo operation method provided by the embodiments of the present invention may include the following beneficial effects: The object instance header stores a type identifier instead of a virtual pointer, eliminating the need for each object instance to store a memory-intensive virtual pointer, significantly reducing memory usage in electronic design automation software. Direct access to the global virtual table array using the type identifier as an index avoids the linear lookup overhead of conditional type matching found in related technologies, reducing the time complexity of undo operations. The virtual table object pointer points to a virtual function that returns a pointer to the undo member function, meaning that when adding a new object type, only a new virtual table object needs to be defined and registered in the global virtual table array, without modifying the undo framework code, thus improving scalability. By determining the virtual table object based on the virtual table object pointer, calling the virtual functions included in the virtual table object, and obtaining the undo member function pointer returned by the virtual function, the path for obtaining the undo member function pointer is further refined. The virtual table object is stored as a static constant in the read-only data segment, eliminating the need for dynamic allocation or initialization of any additional data structures during undo operations, further reducing runtime memory and time overhead. Memory blocks are released in a last-in-first-out (LIFO) order, matching the storage order of object instances, avoiding memory fragmentation and improving memory reuse efficiency. In this way, while ensuring the scalability of the undo operation, memory usage can be reduced and the execution efficiency of the undo operation can be improved.

[0076] In one exemplary embodiment, such as Figure 5 As shown, the present invention provides a cancellation operation device, which includes: an acquisition module 1, a search module 2, a cancellation module 3, and a release module 4.

[0077] Module 1 is configured to retrieve the type identifier of the object instance header; the object instance is stored inside the memory block of the circular linked list, and the storage order of the object instance is last-in-first-out.

[0078] Lookup module 2 is configured to use the type identifier as an index to search for the pointer to the virtual table object stored in the array element corresponding to the index in the global virtual table array.

[0079] Undo module 3 is configured to call the undo member function pointer based on the virtual table object pointer to perform the undo operation. The virtual table object pointed to by the virtual table object pointer includes virtual functions that return pointers to the undo member function.

[0080] Release module 4 is configured to release memory blocks in a last-in-first-out (LIFO) order.

[0081] The undo operation device provided in the embodiments of the present invention may have the following beneficial effects: Instead of storing virtual pointers, object instance headers store type identifiers, eliminating the need for each object instance to store memory-intensive virtual pointers, significantly reducing memory usage in electronic design automation software. Using type identifiers as indexes to directly access the global virtual table array avoids the linear lookup overhead of conditionally matching types, reducing the time complexity of undo operations. The virtual table objects pointed to by the virtual table object pointers include virtual functions that return pointers to undo member functions, meaning that adding new object types only requires defining new virtual table objects and registering them in the global virtual table array, without modifying the undo framework code, thus improving scalability. Releasing memory blocks in a last-in-first-out (LIFO) order matches the storage order of object instances, avoiding memory fragmentation and improving memory reuse efficiency. In this way, undo operation scalability can be maintained while reducing memory usage and improving execution efficiency.

[0082] In one exemplary embodiment, a computer device is provided, including a processor and a memory, the memory storing a computer program, and the processor executing the computer program implementing the steps of any of the above-described undo operation methods.

[0083] In one exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of any of the above-described undo operation methods. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, magnetic tape, a floppy disk, or an optical data storage device, etc.

[0084] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of any of the above-described undo operation methods.

[0085] refer to Figure 6 The following is a structural block diagram of a computer device that can be used as a reference for the present invention. The computer device 100 includes a computing unit 101, which can perform various appropriate actions and processes according to a computer program stored in a ROM 102 or a computer program loaded into a RAM 103 from a storage unit 108. The RAM 103 may also store various programs and data required for the operation of the computer device 100. The computing unit 101, ROM 102, and RAM 103 are interconnected via a bus 104. An input / output (I / O) interface 105 is also connected to the bus 104.

[0086] Multiple components in computer device 100 are connected to I / O interface 105, including: input unit 106, output unit 107, storage unit 108, and communication unit 109. Input unit 106 can be any type of device capable of inputting information into computer device 100. Input unit 106 can receive input numerical or character information and generate key signal inputs related to user settings and / or function control of computer device 100, and may include, but is not limited to, a mouse, keyboard, touchscreen, trackpad, trackball, joystick, microphone, and / or remote control. Output unit 107 can be any type of device capable of presenting information, and may include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 108 may include, but is not limited to, a hard disk and an optical disk. Communication unit 109 allows computer device 100 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth™ devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.

[0087] The computing unit 101 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 101 performs the various methods and processes described above, such as the undo operation method. For example, in some embodiments, the undo operation method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 108. In some embodiments, part or all of the computer program may be loaded and / or installed on the computer device 100 via ROM 102 and / or communication unit 109. When the computer program is loaded into RAM 103 and executed by the computing unit 101, one or more steps of the undo operation method described above may be performed. Alternatively, in other embodiments, the computing unit 101 may be configured to perform the undo operation method by any other suitable means (e.g., by means of firmware).

[0088] Computer device 100 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-described undo operation method.

[0089] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered illustrative only, and the true scope and spirit of the invention are indicated by the claims.

[0090] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A method for undoing an operation, characterized in that, The undo operation method includes: Obtain the type identifier from the header of the object instance; the object instance is stored inside the memory block of the circular linked list, and the storage order of the object instance is last-in-first-out; Using the type identifier as an index, search for the pointer to the virtual table object stored in the array element corresponding to the index in the global virtual table array; The undo operation is performed by calling the undo member function pointed to by the virtual table object pointer. The virtual table object pointed to by the virtual table object pointer includes a virtual function for returning a pointer to the undo member function. Release memory blocks according to the Last-In-First-Out (LIFO) order.

2. The undo operation method according to claim 1, characterized in that, The step of calling the undo member function pointed to by the virtual table object pointer to perform the undo operation includes: The corresponding virtual function is called based on the virtual table object pointer to obtain the member cancellation function pointer; The undo operation is performed by calling the undo member function pointed to by the undo member function pointer.

3. The undo operation method according to claim 1, characterized in that, The step of calling the corresponding virtual function based on the virtual table object pointer to obtain the member function pointer includes: The virtual table object is determined based on the virtual table object pointer; Call the virtual function included in the virtual table object; Obtain the pointer to the undo member function returned by the virtual function.

4. The revocation operation method of claim 1, wherein, The type identifier occupies bytes that match the alignment boundary of the memory block to avoid padding bytes when the object instances are arranged in the memory block.

5. The method of claim 1, wherein, Each element of the global virtual table array stores a pointer to the virtual table object at compile time.

6. The revocation operation method of claim 1, wherein, The virtual table object is a static constant object.

7. A revocation operation device characterized by comprising: The cancellation operation device includes: The acquisition module is configured to acquire the type identifier of the object instance header; the object instance is stored inside the memory block of the circular linked list, and the storage order of the object instance is last-in-first-out; The lookup module is configured to use the type identifier as an index to search for the pointer to the virtual table object stored in the array element corresponding to the index in the global virtual table array; The undo module is configured to call the undo member function pointer based on the virtual table object pointer to perform an undo operation, wherein the virtual table object pointed to by the virtual table object pointer includes a virtual function for returning the undo member function pointer; The release module is configured to release memory blocks in a last-in-first-out (LIFO) order.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the undo operation method as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the undo operation method as described in any one of claims 1 to 6.

10. A computer program product comprising computer programs or instructions, characterized in that, When the computer program or instructions are executed by the processor, the undo operation method as described in any one of claims 1 to 6 is implemented.