Temporary object management method and device, electronic equipment, chip and storage medium

By obtaining the structure size of the template object in Java card technology and allocating storage space in volatile memory, copying and generating temporary objects, the problem of limited usage scenarios of temporary objects is solved, and execution efficiency and system flexibility are improved.

CN118550462APending Publication Date: 2024-08-27SHENZHEN GOODIX TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410619603.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-17
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

The creation and management of temporary objects in existing Java card technology has poor flexibility, resulting in low execution efficiency, limited usage scenarios, and lack of effective solutions.

Method used

By obtaining the structure size of the template object, allocate the target storage space in volatile memory, copy the template object and generate the target temporary object. The object header of the target temporary object includes a temporary object tag to replace the use of the template object.

Benefits of technology

It achieves flexible management of temporary objects, expands the scope of its usage scenarios, improves execution efficiency, and enhances system flexibility and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550462A
    Figure CN118550462A
Patent Text Reader

Abstract

The invention provides a temporary object management method and device, electronic equipment, a chip and a storage medium, and the method comprises the steps: obtaining the size of a template object structure body of a template object, and distributing a target storage space in a temporary object storage region based on the size of the template object structure body, the size of the target storage space is the same as that of the template object structure body, and the temporary object storage area is located in a volatile memory; copying the template object into the target storage space to obtain a copied temporary object; based on the copied temporary object, a target temporary object is generated in the target storage space, an object head of the target temporary object comprises a temporary object mark, and the target temporary object is used for replacing the template object. According to the embodiment of the invention, the temporary object can be flexibly managed to improve the use scene range of the temporary object, so that the execution efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Java cards, and in particular to a temporary object management method, device, electronic device, chip and storage medium. Background Art

[0002] Java (an object-oriented programming language) Card (Java Card) technology is applicable to the Java platform and can be applied to smart cards and other types of electronic devices in highly specialized environments with strict memory and processing constraints. With the help of Java Card technology, the system platform of related equipment products can complete card transactions, identification and authentication operations based on the valuable and sensitive data information (such as electronic cash balance, personal information, etc.) carried in the device through applications running on it (such as applets (a small program based on Java Card technology)). Therefore, the security performance, execution efficiency and support for the development of high-performance applets of the system platform based on Java Card technology are very important for the application and promotion of products.

[0003] Accordingly, when persistent objects and transient objects are created and / or used, multiple write operations to non-volatile memory (such as Electrically Erasable Programmable Read-Only Memory (EEPROM) or Flash, etc.) are involved, resulting in low execution efficiency; in response to this, relevant technologies support the creation of short-life objects (i.e., temporary objects) whose object headers and object data fields are both in volatile memory (Random Access Memory, RAM) to improve efficiency. However, since the creation and management of temporary objects are deeply coupled with the system platform, after the system platform is built, only temporary objects pre-defined by the platform can be used, resulting in limited usage scenarios of temporary objects and poor flexibility. Based on this, there is currently no good solution for how to flexibly manage temporary objects to increase the scope of usage scenarios of temporary objects and improve execution efficiency. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a temporary object management method, device, electronic device, chip and storage medium to solve problems such as temporary object restrictions; that is, an embodiment of the present invention can flexibly manage temporary objects to increase the scope of usage scenarios of temporary objects, thereby effectively improving execution efficiency.

[0005] According to one aspect of an embodiment of the present invention, a temporary object management method is provided, the method comprising:

[0006] Obtaining the size of a template object structure of a template object, and based on the size of the template object structure, allocating a target storage space in a temporary object storage area, wherein the size of the target storage space is the same as the size of the template object structure, and the temporary object storage area is located in a volatile memory;

[0007] Copying the template object to the target storage space to obtain a copy temporary object;

[0008] Based on the copied temporary object, a target temporary object is generated in the target storage space, the object header of the target temporary object includes a temporary object tag, and the target temporary object is used to replace the template object.

[0009] According to another aspect of an embodiment of the present invention, a temporary object management device is provided, the device comprising:

[0010] An acquisition unit is used to obtain the size of the template object structure of the template object;

[0011] A processing unit, configured to allocate a target storage space in a temporary object storage area based on the size of the template object structure, wherein the size of the target storage space is the same as the size of the template object structure, and the temporary object storage area is located in a volatile memory;

[0012] The processing unit is further used to copy the template object to the target storage space to obtain a copy temporary object;

[0013] The processing unit is further used to generate a target temporary object in the target storage space based on the copied temporary object, the object header of the target temporary object includes a temporary object mark, and the target temporary object is used to replace the template object.

[0014] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising a processor and a memory storing a program, wherein the program comprises instructions, which, when executed by the processor, enable the processor to perform the above-mentioned method.

[0015] According to another aspect of an embodiment of the present invention, a chip is provided, the chip comprising a processor and a memory, the memory being used to store a computer program, the computer program causing the processor to perform the above-mentioned method when executed by the processor.

[0016] According to another aspect of an embodiment of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above-mentioned method.

[0017] After obtaining the size of the template object structure of the template object, the embodiment of the present invention can allocate a target storage space in the temporary object storage area based on the size of the template object structure. The size of the target storage space is the same as the size of the template object structure, and the temporary object storage area is located in the volatile memory; then, the template object can be copied to the target storage space to obtain a copy temporary object, so that a copy temporary object of any template object can be obtained to flexibly create a copy temporary object of the template object; further, based on the copy temporary object, a target temporary object can be generated in the target storage space, and the object header of the target temporary object includes a temporary object tag, and the target temporary object is used to replace the template object. It can be seen that the embodiment of the present invention can flexibly generate a target temporary object by copying a temporary object, so as to effectively improve the execution efficiency by using the target temporary object; that is, the embodiment of the present invention can flexibly manage temporary objects to increase the scope of usage scenarios of temporary objects, thereby effectively improving the execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Further details, features and advantages of the invention are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:

[0019] Figure 1 A schematic diagram showing an object structure according to an exemplary embodiment of the present invention is shown;

[0020] Figure 2 A schematic flow chart of a temporary object management method according to an exemplary embodiment of the present invention is shown;

[0021] Figure 3 A schematic diagram of a temporary object management table according to an exemplary embodiment of the present invention is shown;

[0022] Figure 4 A schematic flow chart of another temporary object management method according to an exemplary embodiment of the present invention is shown;

[0023] Figure 5a A schematic diagram showing a temporary object storage area according to an exemplary embodiment of the present invention is shown;

[0024] Figure 5b A schematic diagram showing another temporary object storage area according to an exemplary embodiment of the present invention;

[0025] Figure 6a A schematic diagram showing a temporary object storage area after memory compaction according to an exemplary embodiment of the present invention is shown;

[0026] Figure 6b A schematic diagram showing another temporary object storage area after memory compaction according to an exemplary embodiment of the present invention is shown;

[0027] Figure 7 A schematic block diagram of a temporary object management device according to an exemplary embodiment of the present invention is shown;

[0028] Figure 8 A block diagram of an exemplary electronic device that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0029] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.

[0030] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0031] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0032] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.

[0034] It should be noted that the execution subject of the temporary object management method provided in the embodiment of the present invention can be an electronic device. The electronic device mentioned here refers to an electronic device equipped with a Java Card technology platform system (Chip Operating System, COS, also known as an on-chip operating system). Correspondingly, the electronic device may also include a target application, which may be any application (such as an applet); optionally, the electronic device may include a chip, and the temporary object management method provided in the embodiment of the present invention may be executed by the chip in the electronic device, or by a module other than the chip in the electronic device (such as the target application and / or on-chip operating system), or by the electronic device and the chip in the electronic device (i.e., the module other than the chip in the electronic device and the chip in the electronic device are executed together), etc. The embodiment of the present invention does not limit this. Among them, Java Card technology is a platform-independent multi-application technology that allows multiple applications to run on the platform at the same time while ensuring security.

[0035] Among them, the electronic device can be a terminal (DH, Device Host) or a server. Accordingly, the terminals mentioned here can include but are not limited to: smart phones, bracelets, tablet computers, laptops, desktop computers, smart watches, intelligent voice interaction devices, smart cards, car keys, etc. The server mentioned here can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing (cloud computing), cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms, etc.

[0036] Before introducing the embodiments of the present invention, a brief introduction is first given to the Java objects in the on-chip operating system (also referred to as the COS platform):

[0037] According to the Java Card API (JCAPI; a subset of the Java API) specification and the Java Card Virtual Machine (JCVM; a subset of the Java programming language and a Java-compatible virtual machine for smart cards that can act as an engine for loading Java classes and executing them), the COS platform can create objects that are tightly coupled with the platform implementation (also called platform-coupled objects) and user-defined objects; wherein the API (Application Programming Interface) defines the calling conventions for applications to access the operating system and other services. Optionally, the platform-coupled objects can be special objects created through the standard JCAPI, such as key objects, algorithm class objects, array objects, view class temporary objects (a platform-recoverable temporary object), and one-time algorithm class temporary objects (an application-recoverable temporary object), etc., whose internal structures and method implementations are tightly coupled with the COS platform; correspondingly, the user-defined objects can be objects instantiated by application-defined classes, or can be ordinary objects created through new bytecode (a way to create objects); wherein the bytecode is machine-independent code generated by the compiler and executed by the Java virtual machine.

[0038] It should be noted that, according to the JCVM specification, the Java object in the on-chip operating system may include an object header and member variable storage space. The object header includes but is not limited to the object type (may include at least one object type field, and an object type field may be used to indicate a method of classifying an object type), object context information (such as the application to which it belongs), object class information, etc.; accordingly, the COS platform can confirm the object type by parsing the data in the object header, access the class method of the object, and find the member variable storage space (such as the storage start address, etc.), etc. Among them, the platform coupling object can be created through the specified interface defined by the JCAPI specification, and its object header is stored in the non-volatile memory. According to the type of the created object, the object data domain may exist in the volatile memory and / or the non-volatile memory; accordingly, the object header and member variable storage space of the user-defined object are allocated in the non-volatile memory. Optionally, the object data domain can be the part of an object other than the object header, and the object member variables (i.e., member variables) are located in the object data domain of the corresponding object.

[0039] In one embodiment, one object type field in at least one object type field may be used to indicate any of the following object types: object A (persistent object, which may be created using the new bytecode, and whose object header and object member variable storage space are continuously stored in the non-volatile memory), object B (persistent object, which may be created using the new bytecode, whose object header and object member variable storage space are continuously stored in the non-volatile memory, and whose object member variables may store indexes of objects whose object headers are in the non-volatile memory), object C (persistent object, which may be created using the JCAPI interface, and whose object header and object data domain storage area (i.e., storage space) are continuously stored in the non-volatile memory), and object D (transient object, which may be created using the JCAPI interface, and whose object header and object data domain storage area are continuously stored in the non-volatile memory, and whose object data domain 1 contains The following are examples of the following: object A (a persistent object that can be created using the JCAPI interface, with the object header and object data field 1 storage area continuously stored in the non-volatile memory, and the object header containing information that can be mapped to the object data field 2 in the non-volatile memory), object F (a transient object that can be created using the JCAPI interface, with the object header stored in the non-volatile memory, and the object header containing information that can be mapped to the object data field in the volatile memory), object G (a temporary object that can be created using the JCAPI interface, with its object header and object member variable storage area continuously stored in the volatile memory), object H (a transient object that can be created using the JCAPI interface, with the object header and object data field 1 storage area continuously stored in the non-volatile memory, and the object header containing information that can be mapped to the object data field 2 in the volatile memory), etc. Figure 1 shown.

[0040] In another implementation, one object type field in at least one object type field may be used to indicate any of the following object types: common object, key object, algorithm object, view temporary object, and temporary object, etc., which is not limited in this embodiment of the present invention.

[0041] Based on the above description, an embodiment of the present invention proposes a temporary object management method, which can be executed by the electronic device mentioned above; specifically, the temporary object management method can be executed by a chip in the electronic device, or by a module other than the chip in the electronic device, or by the electronic device and the chip in the electronic device together, etc. For the sake of convenience, the following description will be given by taking the electronic device executing the temporary object management method as an example; Figure 2 As shown, the temporary object management method may include the following steps S201-S203:

[0042] S201, obtaining the template object structure size of the template object, and based on the template object structure size, allocating target storage space in a temporary object storage area, the size of the target storage space is the same as the template object structure size, and the temporary object storage area is located in a volatile memory.

[0043] In the embodiment of the present invention, the template object can be any instantiated custom object, or any platform coupling object (such as a temporary view object, etc.), etc.; the embodiment of the present invention does not limit this. Optionally, the COS platform in the electronic device may include a custom copy API (i.e., a copy interface), and the template object may be determined by the copy interface, that is, the object indicated by the object index passed into the copy interface may be used as the template object; wherein the copy interface can be used to implement the object copy function.

[0044] Optionally, the electronic device may include a target application, and the target application may include a command processing method. In the process of processing a command by the target application (i.e., the process of executing the command processing method, which may also be referred to as the instruction processing process), the replication interface may be called, and the object index of the target object may be passed into the replication interface as a parameter, so that the target object may be used as a template object, and the object index of the template object may be the object index of the target object; optionally, the target object may be any object (such as any instantiated custom object or any platform coupling object), so that the template object may be any object. Optionally, the target application may be any applet, and the target application may include an applet.process method (a command processing method); wherein the applet.process method may be called by a Java Card Runtime Environment (Java Card Runtime Environment, JCRE; composed of a Java Card virtual machine, an application framework, and related native methods) to process external input commands.

[0045] In an embodiment of the present invention, the object management table corresponding to the template object may store management information of the template object (that is, the object table entry where the template object is located may record management information of the template object). The management information of an object may include but is not limited to the object structure size and storage address (such as storage start address and / or storage end address) of the corresponding object, etc., and the embodiment of the present invention is not limited to this; optionally, an object management table may include multiple object table entries, and an object table entry can be used to record management information of an object, that is, an object management table can be used to record management information of each of multiple objects, and multiple object table entries in an object management table can correspond to multiple object indexes one by one in the order of arrangement, that is, one object table entry can correspond to one object index.

[0046] Then, correspondingly, when obtaining the size of the template object structure of the template object, the electronic device can obtain the object index of the template object; it should be understood that the electronic device can obtain the object index of the target object and pass the object index of the target object to the replication interface, so that after passing the object index of the target object as a parameter to the replication interface, the object index of the target object is used as the object index of the template object to obtain the object index of the template object. Based on this, the replication interface can be called, and the management information of the template object can be parsed based on the object index of the template object to obtain the template object structure size of the template object from the management information of the template object, and the management information of the template object can include the template object structure size.

[0047] Optionally, the management information of the template object may also include the storage address of the template object (such as the storage start address and / or the storage end address), and the storage address of an object may be used to indicate the storage space of the corresponding object. Based on this, the electronic device may also parse the template object header of the template object based on the storage address of the template object; then, the first firewall check may be performed on the template object based on the template object header, and when the template object fails to pass the first firewall check, the replication interface may be exited and / or the first error message may be output. Optionally, both the first firewall check and the first error message may be set according to experience or according to actual needs, and the embodiment of the present invention is not limited to this; illustratively, the first firewall check may include a belonging application check, such as checking the context information of the object to determine whether it belongs to the target application. It should be understood that after the template object passes the first firewall check, the replication interface may continue to run.

[0048] Optionally, the electronic device may also obtain the template object type of the template object from the template object header of the template object, wherein the object type of an object may include at least one object type field; if the template object type indicates that the template object is a temporary object of the view class (i.e., an object type field in the template object type indicates that the template object is a temporary object of the view class), the view class input parameter may be determined, and the view class input parameter may be subjected to a validity check; when the view class input parameter fails to pass the validity check, the copy interface may be exited and / or a second error message may be output; when the view class input parameter passes the validity check, the copy interface may continue to run. Optionally, the view class input parameter may include, but is not limited to: a parent array object (such as an object index of the parent array object), an offset on the parent array object (i.e., the starting offset address of the pop-up window corresponding to the temporary object of the view class, which may also be referred to as a window offset), a view length, and a view attribute (such as readable, read-only, and readable and writable, etc.), etc.; the embodiment of the present invention does not limit this. Optionally, the second error message may be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this.

[0049] Exemplarily, the above-mentioned legality check may include, but is not limited to: a legality check on the accessibility of the pointed parent array object, a legality check on the offset and view length (such as checking whether the window position under the offset and view length exceeds the parent array object), and a legality check on the view attributes (such as whether the view attribute is readable, read-only, and readable and writable), etc.; the embodiment of the present invention is not limited to this.

[0050] Optionally, the electronic device may also search for a temporary object management table, which may be used to record management information of temporary objects to achieve recording of temporary objects; optionally, the temporary objects recorded in the temporary object management table may all be application-recyclable temporary objects. An object table entry (also referred to as a record entry or table entry, etc.) in the temporary object management table may correspond to a temporary object index.

[0051] Based on this, the electronic device can also determine whether there is a temporary object index that supports allocation according to the temporary object management table; if it is determined that there is a temporary object index that supports allocation, then determine the target index, the target index is any temporary object index in the temporary object index that supports allocation, and the target index supports being the object index of the following target temporary object; if it is determined that there is no temporary object index that supports allocation, then exit the copy interface and / or output the third error message. Optionally, the third error message can be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this.

[0052] In one embodiment, the temporary object management table may also include the number of created temporary objects, such as Figure 3 As shown; then the electronic device can obtain the number of created temporary objects from the temporary object management table. If the number of created temporary objects is equal to the number of object table entries in the temporary object management table, it can be determined that there is no temporary object index that supports allocation; if the number of created temporary objects is less than the number of object table entries in the temporary object management table, it can be determined that there is a temporary object index that supports allocation. Accordingly, the electronic device can determine the target index based on the temporary object management table; optionally, it can traverse each object table entry in the temporary object management table in order from the beginning to the end or from the end to the beginning, and use the temporary object index corresponding to the first object table entry with empty record content as the target index.

[0053] In another embodiment, the electronic device may traverse each object table item in the temporary object management table in order from the beginning to the end or from the end to the beginning. If an object table item with empty record content is traversed, it can be determined that there is a temporary object index that supports allocation, and the traversal can be stopped; if after traversing each table item in the temporary object management table, an object table item with empty record content is still not traversed, it can be determined that there is no temporary object index that supports allocation. In this case, if it is determined that there is a temporary object index that supports allocation, the temporary object index corresponding to the traversed object table item with empty record can be used as the target index.

[0054] Furthermore, the target storage space may be allocated through a copy interface; the electronic device may also determine the total storage space size of the temporary object storage area, and determine the size of the space occupied by the created temporary object based on the temporary object management table; optionally, the temporary object management table may also store the size of the space occupied by the created temporary object, in which case the size of the space occupied by the created temporary object may be directly determined from the temporary object management table, or an object table entry in the temporary object management table may record the object structure size of the corresponding temporary object, then the object structure size of each temporary object recorded in the temporary object management table may be summed to obtain the size of the space occupied by the created temporary object, and so on.

[0055] Based on this, the electronic device can calculate the remaining storage space size of the temporary object storage area based on the total storage space size and the space size occupied by the created temporary objects; and based on the remaining storage space size and the template object structure size, determine whether the temporary object storage area is sufficient for allocation. In this case, if the template object structure size is less than or equal to the remaining storage space size, it can be determined that the temporary object storage area is sufficient for allocation; if the template object structure size is greater than the remaining storage space size, it can be determined that the temporary object storage area is insufficient for allocation. Correspondingly, if it is determined that the temporary object storage area is insufficient for allocation, the copy interface can be exited and / or the fourth error message can be output; if it is determined that the temporary object storage area is sufficient for allocation, the execution of allocating the target storage space in the temporary object storage area based on the template object structure size can be triggered. Optionally, the fourth error message can be set according to experience or according to actual needs, and the embodiment of the present invention is not limited to this.

[0056] S202, copy the template object to the target storage space to obtain a copy temporary object.

[0057] Specifically, the electronic device may copy the object header and object member variable storage space contents of the template object to the target storage space so that the contents of the copied temporary object are the same as those of the template object, thereby copying the template object to the volatile memory.

[0058] S203: Based on the copy of the temporary object, a target temporary object is generated in the target storage space. The object header of the target temporary object includes a temporary object tag. The target temporary object is used to replace the template object.

[0059] In the embodiment of the present invention, the target temporary object may be generated through a copy interface.

[0060] Optionally, if the object type in the object header of the copied temporary object does not include a temporary object tag (e.g., the object type field used to record the common object tag or the temporary object tag is a common object tag), the object type in the object header of the copied temporary object may be modified to write the temporary object tag into the object header of the copied temporary object, that is, the object type field in the object header of the copied temporary object may be modified to change the common object tag to a temporary object tag. Optionally, both the common object tag and the temporary object tag may be set based on experience or actual needs, which is not limited in the embodiment of the present invention.

[0061] Optionally, if the object type of the template object indicates that the template object is a view class temporary object, the corresponding information in the object header of the copied temporary object can be modified according to the view class input parameters; exemplarily, when the view class input parameters include the parent array object, window offset, view length, and view attributes, the corresponding information in the object header of the copied temporary object can be modified according to the parent array object, window offset, view length, and view attributes, that is, the parent array object, window offset, view length, and view attributes in the object header of the copied temporary object can be modified to the corresponding parameters in the view class input parameters.

[0062] Based on this, the current copy temporary object can be used as the target temporary object to realize the generation of the target temporary object in the target storage space based on the copy temporary object. It should be understood that if the object type in the object header of the copy temporary object includes a temporary object mark, and the object type of the template object does not indicate that the template object is a view class temporary object, then the current copy temporary object is the copy temporary object when it is copied to the target storage space, that is, the copy temporary object is not modified; if the object type in the object header of the copy temporary object does not include a temporary object mark, or the object type of the template object indicates that the template object is a view class temporary object, then the current copy temporary object can be a modified copy temporary object, so as to add a temporary object mark in the current copy temporary object, or save the view class input parameter in the current copy temporary object. It can be seen that when the template object is a common object, except for the temporary object mark, the other contents in the data structure of the target temporary object are consistent with the template object.

[0063] Further, the electronic device can refresh the temporary object management table according to the object index of the target temporary object (i.e., the above-mentioned target index) so that the temporary object management table records the management information of the target temporary object, that is, the management information of the target temporary object can be recorded in the object table item corresponding to the object index of the target temporary object, thereby realizing adding the management information of the target temporary object in the temporary object management table; optionally, the management information of the target temporary object can include the storage address of the target temporary object, and the storage address of the target temporary object can be the storage start address and / or storage end address of the target storage space. Then correspondingly, after completing the refresh of the temporary object management table, the object index of the target temporary object can be output, that is, the object index of the target temporary object can be output through the copy interface; wherein, the object index of the target temporary object supports the use of obtaining the management information of the target temporary object from the temporary object management table. It can be seen that the object index of the target temporary object can be used by the electronic device later; it should be understood that when the temporary object management method mentioned in the embodiment of the present application is executed by the electronic device through the target application, the object index of the target temporary object can be used in the target application later. Optionally, the temporary object management table may also include the number of temporary objects created and / or the size of space occupied by the temporary objects created. In this case, the electronic device may also refresh the number of temporary objects created and / or the size of space occupied by the temporary objects created based on the management information of the target temporary object, thereby increasing the number of temporary objects created and / or the size of space occupied by the temporary objects created, and so on; wherein the number of temporary objects created can be used to indicate the number of temporary objects created recorded in the temporary object management table, and the size of space occupied by temporary objects created can be used to indicate the sum of the object structure sizes of each temporary object created recorded in the temporary object management table.

[0064] In one embodiment, the target temporary object may be generated during the current instruction processing, that is, it may be generated during the target application processing the current command, and the current instruction processing may be executed by a command processing method; then after completing the current instruction processing and exiting from the command processing method, the management information of each created temporary object recorded in the temporary object management table may be cleared to release all created temporary objects. In another embodiment, during the current instruction processing, the specified temporary object indicated by the specified temporary object index may be released, and so on. The specific implementation method of releasing the specified temporary object can be seen as follows, and the embodiments of the present invention will not be repeated here.

[0065] After obtaining the size of the template object structure of the template object, the embodiment of the present invention can allocate a target storage space in the temporary object storage area based on the size of the template object structure. The size of the target storage space is the same as the size of the template object structure, and the temporary object storage area is located in the volatile memory; then, the template object can be copied to the target storage space to obtain a copy temporary object, so that a copy temporary object of any template object can be obtained to flexibly create a copy temporary object of the template object; further, based on the copy temporary object, a target temporary object can be generated in the target storage space, and the object header of the target temporary object includes a temporary object tag, and the target temporary object is used to replace the template object. It can be seen that the embodiment of the present invention can flexibly generate a target temporary object by copying a temporary object, so as to effectively improve the execution efficiency by using the target temporary object; that is, the embodiment of the present invention can flexibly manage temporary objects to increase the scope of usage scenarios of temporary objects, thereby effectively improving the execution efficiency.

[0066] Based on the above description, the embodiment of the present invention also proposes a more specific temporary object management method. Accordingly, the temporary object management method can be executed by the electronic device mentioned above; specifically, the temporary object management method can be executed by a chip in the electronic device, or by a module other than the chip in the electronic device, or by the electronic device and the chip in the electronic device together, etc. For the sake of convenience, the following description will be given by taking the electronic device executing the temporary object management method as an example; please refer to Figure 4 , the temporary object management method may include the following steps S401-S406:

[0067] S401, obtaining the template object structure size of the template object, and based on the template object structure size, allocating target storage space in a temporary object storage area, the size of the target storage space is the same as the template object structure size, and the temporary object storage area is located in a volatile memory.

[0068] The target storage space may be an application-reclaimable temporary object storage space.

[0069] In an embodiment of the present invention, when allocating a target storage space in a temporary object storage area based on the size of a template object structure, the electronic device may determine M allocated temporary object storage spaces in the temporary object storage area, where M is a non-negative integer; and based on the M allocated temporary object storage spaces and the size of the template object structure, allocate the target storage space in the temporary object storage area, the target storage space being continuous with the M allocated temporary object storage spaces; wherein the temporary objects stored in each of the M allocated temporary object storage spaces may be application-reclaimable temporary objects, that is, the target storage space may be continuous with the used application-reclaimable temporary object storage space.

[0070] In one embodiment, the electronic device may allocate the target storage space in the temporary object storage area in the order of storage addresses from low to high; in this case, after the M allocated temporary object storage spaces, a storage space with a storage space size equal to the size of the template object structure may be allocated as the target storage space, and the target storage space may be after the M allocated temporary object storage spaces; for example, Figure 5a As shown, assuming that the M allocated temporary object storage spaces may include the allocated temporary object storage space 1 and the allocated temporary object storage space 2, the target storage space may be located after the allocated temporary object storage space 1 and the allocated temporary object storage space 2. In another embodiment, the electronic device may allocate the target storage space in the temporary object storage area in the order of storage addresses from high to low; in this case, a storage space with a storage space size equal to the size of the template object structure may be allocated before the M allocated temporary object storage spaces as the target storage space, and the target storage space may be before the M allocated temporary object storage spaces; for example, Figure 5b As shown, assuming that the M allocated temporary object storage spaces may include the allocated temporary object storage space 1 and the allocated temporary object storage space 2, the target storage space may be located before the allocated temporary object storage space 1 and the allocated temporary object storage space 2. It can be seen that the electronic device may allocate the target storage space in the temporary object storage area according to the object arrangement order; optionally, the object arrangement order may be an order from low to high storage addresses, or an order from high to low storage addresses, etc., which is not limited in the embodiment of the present invention.

[0071] S402, copy the template object to the target storage space to obtain a copy temporary object.

[0072] S403: Based on the copy of the temporary object, a target temporary object is generated in the target storage space. The object header of the target temporary object includes a temporary object mark. The target temporary object is used to replace the template object.

[0073] In an embodiment of the present invention, the member variables of the target temporary object (i.e., the object member variables) support the storage of the object index of the created temporary object (i.e., the created temporary object). This is because the life cycle of the temporary object is short and is limited to the process of processing a single command in the target application (i.e., the current instruction processing process); and the change of the member variables of the target temporary object does not change the content of the member variables of the template object, that is, the change of the member variables of the temporary object will not affect the content of the member variable field of the template object itself used to create the temporary object. It should be understood that when releasing a created temporary object, it is necessary to determine that the object index of the created temporary object is not stored in the member variable of another created temporary object; accordingly, the embodiment of the present invention complies with the JCRE specification restrictions, and the object index of the temporary object cannot be saved in a common object, an array object data field, or a static field of a class.

[0074] It can be seen that the embodiment of the present invention supports using other temporary objects as member variables of the current temporary object, and can be written into the member variable storage space of the current temporary object.

[0075] S404: Determine a designated temporary object index, and search the temporary object management table for a designated entry corresponding to the designated temporary object index.

[0076] In an embodiment of the present invention, the COS platform may provide a temporary object release function for releasing a temporary object, and the temporary object release function may be used to release a specified temporary object indicated by a specified temporary object index; specifically, the temporary object release function may be used to implement functions such as releasing the specified temporary object index, reclaiming the storage space of the specified temporary object indicated by the specified temporary object index, and compacting the temporary object space. Optionally, the temporary object release function may be a release API (i.e., a release interface), or a close method defined in the JCAPI specification, etc.; the present invention does not limit this.

[0077] Optionally, the specified temporary object index can be the object index of any created temporary object, such as any temporary object created through the copy interface; optionally, the specified temporary object index can be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this; it can be seen that the specified temporary object index can be specified by the target application. Based on this, the specified temporary object index can be passed as a parameter to the release temporary object function to release the specified temporary object indicated by the specified temporary object index, thereby reclaiming system resources. Optionally, when the specified temporary object indicated by the specified temporary object index is a temporary object created by the standard JCAPI, the release temporary object function can be used to release the temporary object created by the standard JCAPI.

[0078] The specified entry may be an object entry corresponding to a specified temporary object index.

[0079] S405: If the record content of the designated entry is not empty, release the designated temporary object indicated by the designated temporary object index.

[0080] It should be understood that when the record content of the specified table entry is not empty, it can be determined that the specified temporary object indicated by the specified temporary object index exists, so that the specified temporary object can be released; when the record content of the specified table entry is empty, it can be determined that the specified temporary object indicated by the specified temporary object index does not exist.

[0081] In an embodiment of the present invention, the specified temporary object may be released by a release temporary object function. Specifically, if the record content of the specified entry is not empty (i.e., the specified temporary object exists), the specified storage address (such as the storage start address) of the specified temporary object may be obtained, and the specified temporary object header information (i.e., the object header of the specified temporary object) may be parsed based on the specified storage address; accordingly, the specified temporary object header information may be used to perform a second firewall check, and when the specified temporary object header information fails to pass the second firewall check, the release temporary object function may be exited and / or the fifth error message may be output, and when the specified temporary object header information passes the second firewall check, the release of the specified temporary object indicated by the specified temporary object index may be triggered. Optionally, the second firewall check and the fifth error message may be set according to experience or according to actual needs, and the embodiment of the present invention does not limit this; illustratively, the second firewall check may include an application check to check whether the specified temporary object is a temporary object created during the current instruction processing, that is, to check whether the specified temporary object belongs to the target application. Optionally, the second firewall check may be the same as or different from the first firewall check, and the embodiment of the present invention does not limit this.

[0082] Optionally, when releasing the designated temporary object indicated by the designated temporary object index, the electronic device may clear the record content of the designated table item; and / or update the number of created temporary objects and / or the size of space occupied by the created temporary objects in the temporary object management table to realize the release of the designated temporary object indicated by the designated temporary object index, in which case the temporary object management table may include the number of created temporary objects and / or the size of space occupied by the created temporary objects. Specifically, when updating the number of created temporary objects and / or the size of space occupied by the created temporary objects in the temporary object management table, the electronic device may reduce the size of space occupied by the created temporary objects according to the object structure size of the designated temporary object to realize the update of the size of space occupied by the created temporary objects (i.e., the size of space occupied by the created temporary objects after the update may be the difference between the size of space occupied by the created temporary objects before the update and the size of the object structure of the designated temporary object), and may reduce the number of created temporary objects to realize the update of the number of created temporary objects (i.e., the number of created temporary objects after the update may be the number of created temporary objects before the update minus the number of designated temporary objects).

[0083] Furthermore, the electronic device may also determine the designated temporary object storage space of the designated temporary object in the temporary object storage area, and determine the order of arrangement of the objects; and determine N allocated temporary object storage spaces from the temporary object storage area, the N allocated temporary object storage spaces including: allocated temporary object storage spaces whose allocation time is later than the allocation time of the designated temporary object storage space, N being a non-negative integer; then, the N allocated temporary object storage spaces may be moved according to the order of arrangement of the objects to obtain the temporary object storage area after memory compaction, so that all currently existing allocated temporary object storage spaces are arranged continuously. It can be seen that the embodiment of the present invention may perform memory compaction on the temporary object storage area according to the content of the temporary object management table to clear the residual data in the unused temporary object storage space (i.e., the storage space of the released temporary object).

[0084] In one embodiment, when the objects are arranged in an order from low to high storage addresses, the N allocated temporary object storage spaces may include: the allocated temporary object storage spaces located after the designated temporary object storage space, that is, the N allocated temporary object storage spaces may include: the allocated temporary object storage spaces whose storage addresses are higher than the storage addresses of the designated temporary object storage spaces (that is, the storage addresses of the designated temporary objects), so that the N allocated temporary object storage spaces may be moved toward the lower address direction in an order from low to high storage addresses to obtain a temporary object storage area after the memory is compacted, such as Figure 6aIn another embodiment, when the objects are arranged in a descending order of storage addresses, the N allocated temporary object storage spaces may include: the allocated temporary object storage space located before the designated temporary object storage space, that is, the N allocated temporary object storage spaces may include: the allocated temporary object storage space whose storage address is lower than the storage address of the designated temporary object storage space, so that the N allocated temporary object storage spaces may be moved toward the high address direction in a descending order of storage addresses to obtain a temporary object storage area after the memory is compacted, as shown in FIG. Figure 6b shown.

[0085] Accordingly, the electronic device can update the temporary object management table based on the starting address of each allocated temporary object storage space in the temporary object storage area after the memory is compacted, so as to update the storage address of the corresponding temporary object in the temporary object management table; that is, the electronic device can refresh the object table entry content in the temporary object management table, so as to write the actual address of the currently existing temporary object into the object table entry corresponding to the temporary object management table.

[0086] It should be noted that the template object can be a platform-recoverable temporary object such as a view class temporary object; it can be seen that the embodiment of the present invention can convert platform-recoverable temporary objects such as a view class temporary object into an application-recoverable temporary object to support the release of platform-recoverable temporary objects during the current instruction processing.

[0087] S406: If the record content of the designated entry is empty, stop releasing.

[0088] Specifically, the electronic device may exit the temporary object release function and / or output the sixth error message, that is, when it is determined that the specified temporary object does not exist, the release may be stopped to exit the temporary object release function and / or output the sixth error message; optionally, the sixth error message may be set according to experience or according to actual needs, which is not limited in the embodiment of the present invention. In this case, the electronic device may also return NULL as the function return value.

[0089] According to an embodiment of the present invention, after obtaining the size of the template object structure of the template object, based on the size of the template object structure, a target storage space is allocated in the temporary object storage area, the size of the target storage space is the same as the size of the template object structure, and the temporary object storage area is located in the volatile memory; and the template object is copied to the target storage space to obtain a copied temporary object, so that a target temporary object can be generated in the target storage space based on the copied temporary object, the object header of the target temporary object includes a temporary object tag, and the target temporary object is used to replace the template object. Furthermore, a designated temporary object index can be determined, and a designated table entry corresponding to the designated temporary object index can be searched from the temporary object management table; if the record content of the designated table entry is not empty, the designated temporary object indicated by the designated temporary object index is released; if the record content of the designated table entry is empty, the release is stopped. It can be seen that the embodiments of the present invention can support the creation of temporary objects customized by the target application. The member variable content of the temporary object can be defined by the target application developer, and can support the release of temporary objects created during the current instruction processing, and complete the refresh of the temporary object management table and the memory compaction of the temporary object, so as to flexibly manage temporary objects, thereby effectively improving the execution efficiency, and effectively saving system resources, so as to facilitate the rational use of limited temporary object storage areas; based on this, the embodiments of the present invention can support the target application developer to copy the target temporary object (at this time, it is a customized temporary object) with the customized object as the template object, thereby expanding the types of temporary objects that can be used, and is no longer limited to creating temporary objects that are tightly coupled with the COS platform, thereby enriching the types of temporary objects.

[0090] Based on the description of the above-mentioned embodiments of the temporary object management method, the embodiment of the present invention further proposes a temporary object management device, which can be a computer program (including program code) running in an electronic device; Figure 7 As shown, the temporary object management device may include an acquisition unit 701 and a processing unit 702. The temporary object management device may execute Figure 2 or Figure 4 The temporary object management method shown, that is, the temporary object management device can run the above-mentioned units:

[0091] An acquisition unit 701 is used to acquire the template object structure size of the template object;

[0092] The processing unit 702 is configured to allocate a target storage space in a temporary object storage area based on the size of the template object structure, wherein the size of the target storage space is the same as the size of the template object structure, and the temporary object storage area is located in a volatile memory;

[0093] The processing unit 702 is further configured to copy the template object to the target storage space to obtain a copy temporary object;

[0094] The processing unit 702 is further configured to generate a target temporary object in the target storage space based on the copied temporary object, wherein the object header of the target temporary object includes a temporary object tag, and the target temporary object is used to replace the template object.

[0095] In one implementation, the target temporary object is generated through a copy interface, and when acquiring the template object structure size of the template object, the acquiring unit 701 may be specifically used to:

[0096] Get the object index of the template object;

[0097] The copy interface is called, and management information of the template object is parsed based on the object index of the template object to obtain the template object structure size of the template object from the management information of the template object, wherein the management information of the template object includes the template object structure size.

[0098] In another implementation manner, the management information of the template object further includes a storage address of the template object, and the processing unit 702 may further be used to:

[0099] Parsing a template object header of the template object based on a storage address of the template object;

[0100] A first firewall check is performed on the template object based on the template object header, and when the template object fails to pass the first firewall check, the replication interface is exited and / or a first error message is output.

[0101] In another implementation, the acquisition unit 701 may also be used to:

[0102] Obtaining a template object type of the template object from a template object header of the template object;

[0103] The processing unit 702 may also be used to:

[0104] If the template object type indicates that the template object is a temporary object of the view class, determining the view class input parameters, and performing a validity check on the view class input parameters;

[0105] When the view class input parameter fails to pass the validity check, the copy interface is exited and / or a second error message is output.

[0106] In another implementation, the processing unit 702 may also be configured to:

[0107] Determine whether there is a temporary object index that supports allocation according to the temporary object management table;

[0108] If it is determined that the temporary object index supporting allocation exists, a target index is determined, where the target index is any temporary object index among the temporary object index supporting allocation, and the target index supports being the object index of the target temporary object;

[0109] If it is determined that the temporary object index supporting allocation does not exist, then exit the copy interface and / or output a third error message.

[0110] In another implementation manner, the target storage space is allocated through a replication interface, and the processing unit 702 may further be used to:

[0111] Determine the total storage space size of the temporary object storage area, and determine the space size occupied by the created temporary objects based on the temporary object management table;

[0112] Calculate the remaining storage space size of the temporary object storage area based on the total storage space size and the space size occupied by the created temporary objects;

[0113] Based on the remaining storage space size and the template object structure size, determining whether the temporary object storage area is sufficient for allocation;

[0114] If it is determined that the temporary object storage area is insufficient for allocation, exiting the copy interface and / or outputting a fourth error message;

[0115] If it is determined that the temporary object storage area is sufficient for allocation, the allocation of target storage space in the temporary object storage area based on the size of the template object structure is triggered.

[0116] In another implementation, when the processing unit 702 allocates the target storage space in the temporary object storage area based on the size of the template object structure, it may be specifically configured to:

[0117] Determine M allocated temporary object storage spaces in the temporary object storage area, where M is a non-negative integer;

[0118] Based on the M allocated temporary object storage spaces and the size of the template object structure, a target storage space is allocated in the temporary object storage area, and the target storage space is continuous with the M allocated temporary object storage spaces.

[0119] In another implementation manner, when the processing unit 702 generates a target temporary object in the target storage space based on the copied temporary object, it may be specifically configured to:

[0120] If the object type in the object header of the copied temporary object does not include the temporary object tag, modifying the object type in the object header of the copied temporary object to write the temporary object tag into the object header of the copied temporary object;

[0121] If the object type of the template object indicates that the template object is a temporary object of the view class, modifying corresponding information in the object header of the copy temporary object according to the view class input parameter;

[0122] The current copy temporary object is used as the target temporary object to achieve the generation of the target temporary object in the target storage space based on the copy temporary object.

[0123] In another implementation, the processing unit 702 may also be configured to:

[0124] Refreshing the temporary object management table according to the object index of the target temporary object, so that the temporary object management table records the management information of the target temporary object;

[0125] After completing the refreshing of the temporary object management table, outputting the object index of the target temporary object;

[0126] The object index support of the target temporary object is used to obtain the management information of the target temporary object from the temporary object management table.

[0127] In another implementation manner, the member variables of the target temporary object support storing the object index of the created temporary object, and the modification of the member variables of the target temporary object does not change the content of the member variables of the template object.

[0128] In another implementation, the target temporary object is generated during a current instruction processing process, and the current instruction processing process is executed by a command processing method. The processing unit 702 may also be used to:

[0129] After completing the current instruction processing process and exiting from the command processing method, the management information of each created temporary object recorded in the temporary object management table is cleared to release all created temporary objects.

[0130] In another implementation, the processing unit 702 may also be configured to:

[0131] Determine a specified temporary object index, and search a temporary object management table for a specified table entry corresponding to the specified temporary object index;

[0132] If the record content of the designated entry is not empty, releasing the designated temporary object indicated by the designated temporary object index;

[0133] If the record content of the designated entry is empty, the release is stopped.

[0134] In another implementation manner, when releasing the designated temporary object indicated by the designated temporary object index, the processing unit 702 may be specifically configured to:

[0135] Clear the record content of the specified entry; and / or,

[0136] The number of created temporary objects and / or the size of space occupied by created temporary objects in the temporary object management table are updated to realize the release of the designated temporary object indicated by the designated temporary object index.

[0137] In another implementation, the processing unit 702 may also be configured to:

[0138] Determine a designated temporary object storage space for the designated temporary object in the temporary object storage area, and determine an object arrangement order;

[0139] Determine N allocated temporary object storage spaces from the temporary object storage area, the N allocated temporary object storage spaces including: allocated temporary object storage spaces whose allocation time is later than the allocation time of the specified temporary object storage space, and N is a non-negative integer;

[0140] Moving the N allocated temporary object storage spaces according to the object arrangement order to obtain a temporary object storage area after memory compaction, so that all currently existing allocated temporary object storage spaces are arranged continuously;

[0141] Based on the starting address of each allocated temporary object storage space in the temporary object storage area after the memory is compacted, the temporary object management table is updated to update the storage address of the corresponding temporary object in the temporary object management table.

[0142] In another implementation manner, the specified temporary object is released by a temporary object release function, and the acquisition unit 701 may also be used to:

[0143] If the record content of the specified entry is not empty, obtaining the specified storage address of the specified temporary object;

[0144] The processing unit 702 may also be used to:

[0145] Parsing the specified temporary object header information based on the specified storage address;

[0146] Perform a second firewall check using the designated temporary object header information, and exit the temporary object release function and / or output a fifth error message when the designated temporary object header information fails to pass the second firewall check, and trigger the release of the designated temporary object indicated by the designated temporary object index when the designated temporary object header information passes the second firewall check;

[0147] When the release is stopped, the processing unit 702 may be specifically used to:

[0148] Exit the temporary object release function and / or output the sixth error message.

[0149] According to one embodiment of the present invention, Figure 2 or Figure 4 Each step involved in the method shown can be Figure 7 The temporary object management device shown in FIG. Figure 2 The step S201 shown in FIG. 1 can be performed by Figure 7 The acquisition unit 701 and the processing unit 702 shown in FIG. 7 are executed together, and steps S202 and S203 can be performed by Figure 7 The processing unit 702 shown in is executed. For example, Figure 4 The step S401 shown in FIG. 4 can be performed by Figure 7 The acquisition unit 701 and the processing unit 702 shown in FIG. 7 are executed together, and steps S402-S406 can be performed by Figure 7 The processing unit 702 shown in executes, and so on.

[0150] According to another embodiment of the present invention, Figure 7 Each unit in the temporary object management device shown can be separately or completely combined into one or several other units to form, or one (some) of the units can be further divided into multiple functionally smaller units to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present invention. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present invention, any temporary object management device can also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0151] According to another embodiment of the present invention, the program can be executed by running a program on a general electronic device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2 or Figure 4A computer program (including program code) for each step involved in the corresponding method shown in Figure 7 The temporary object management device shown in the embodiment of the present invention is used to implement the temporary object management method of the embodiment of the present invention. The computer program can be recorded on a computer storage medium, for example, and loaded into the above electronic device through the computer storage medium and run therein.

[0152] Based on the description of the above method embodiment and device embodiment, the exemplary embodiment of the present invention further provides an electronic device, including: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and the computer program is used to enable the electronic device to perform the method according to the embodiment of the present invention when executed by the at least one processor.

[0153] An exemplary embodiment of the present invention further provides a chip, comprising: a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the processor executes the method according to the embodiment of the present invention.

[0154] Exemplary embodiments of the present invention also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present invention.

[0155] An exemplary embodiment of the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor of a computer, the computer is used to enable the computer to perform a method according to an embodiment of the present invention.

[0156] refer to Figure 8 , a block diagram of an electronic device 800 that can be used as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. Figure 8 As shown, the electronic device 800 may include but is not limited to: underlying hardware 810, an on-chip operating system 820 and applications 830 (such as Applet); wherein the on-chip operating system 820 may include but is not limited to: a kernel (Kernel) 821, a Java card virtual machine 822, a Java card application program interface 823 and a Java card operating environment 824.

[0157] Optionally, in the electronic device 800, the underlying hardware 810 may be a chip. The configuration of the underlying hardware 810 is mainly to ensure the needs of the software running environment in the electronic device 800. The underlying hardware 810 may be configured with a memory 811 and a processor 812; Optionally, the memory 811 may include two types of volatile memory and non-volatile memory; Exemplarily, the volatile memory may be a random access memory (which can be used to store stacks, temporary data during program execution, and as a buffer for data input and output); the non-volatile memory may include a read-only memory (ROM), EEPROM or Flash, etc. The ROM, EEPROM or flash can be used to store key program codes such as on-chip operating systems and applications; the processor 812 may include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. In some high-performance demand scenarios, the electronic device 800 is configured with a high-performance processor 812 to implement functions such as secure data storage and encryption and decryption operations; in this scenario, the underlying hardware 810 can specifically be a security chip, and the electronic device 800 where the security chip 810 is located can be implemented as a security module (Secure Element, SE) product.

[0158] On top of the underlying hardware 810, Figure 8 The in-chip operating system 820 and application 830 shown are the software architecture of the electronic device 800; in this software framework, the in-chip operating system 820 can be a customized in-chip operating system for the electronic device 800. In the in-chip operating system 820, the in-chip operating system 820 mainly interacts with the underlying hardware 810 through the interface of the kernel 821. The Java Card virtual machine 822 is located above the kernel 821, and the Java Card virtual machine 822 has a corresponding JCVM specification, which defines a subset of the Java programming language and a Java-compatible virtual machine for smart cards, including binary data representation and file formats, and a JCVM instruction set; the Java Card application program interface 823 is located above the Java Card virtual machine 822, and the Java Card application program interface 823 also has a corresponding JCAPI specification, which defines the core framework, extended Java software packages and classes used by the application 830; in addition, as Figure 8As shown, in the on-chip operating system 820, the Java Card runtime environment 824 may include a Java Card virtual machine 822 and classes and supported services of a Java Card application program interface 823. The JCRE specification corresponding to the Java Card runtime environment 824 defines the runtime behaviors required to implement Java Card technology, including storage management, application management, and other runtime features; the application 830 is located on the on-chip operating system 820. Figure 8 As shown, the electronic device 800 can be used to execute multiple applications 830, and each application 830 can be loaded into the on-chip operating system 820 to execute different methods to achieve different functions.

[0159] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0160] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0161] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0162] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0163] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0164] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

[0165] Furthermore, it should be understood that what is disclosed above is only a preferred embodiment of the present invention, and certainly cannot be used to limit the scope of rights of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A temporary object management method, characterized in that: include: Obtaining the size of a template object structure of a template object, and based on the size of the template object structure, allocating a target storage space in a temporary object storage area, wherein the size of the target storage space is the same as the size of the template object structure, and the temporary object storage area is located in a volatile memory; Copying the template object to the target storage space to obtain a copy temporary object; Based on the copied temporary object, a target temporary object is generated in the target storage space, the object header of the target temporary object includes a temporary object tag, and the target temporary object is used to replace the template object.

2. The method according to claim 1, characterized in that The target temporary object is generated by copying the interface, and the step of obtaining the template object structure size of the template object includes: Get the object index of the template object; The copy interface is called, and management information of the template object is parsed based on the object index of the template object to obtain the template object structure size of the template object from the management information of the template object, wherein the management information of the template object includes the template object structure size.

3. The method according to claim 2, characterized in that The management information of the template object also includes a storage address of the template object, and the method further includes: Parsing a template object header of the template object based on a storage address of the template object; A first firewall check is performed on the template object based on the template object header, and when the template object fails to pass the first firewall check, the replication interface is exited and / or a first error message is output.

4. The method according to claim 2, characterized in that: The method further comprises: Obtaining a template object type of the template object from a template object header of the template object; If the template object type indicates that the template object is a temporary object of the view class, determining the view class input parameters, and performing a validity check on the view class input parameters; When the view class input parameter fails to pass the validity check, the copy interface is exited and / or a second error message is output.

5. The method according to claim 2, characterized in that: The method further comprises: Determine whether there is a temporary object index that supports allocation according to the temporary object management table; If it is determined that the temporary object index supporting allocation exists, then determining a target index, where the target index is any temporary object index among the temporary object index supporting allocation, and the target index supports being an object index of the target temporary object; If it is determined that the temporary object index supporting allocation does not exist, then exit the copy interface and / or output a third error message.

6. The method according to any one of claims 1 to 5, characterized in that: The target storage space is allocated through a replication interface, and the method further comprises: Determine the total storage space size of the temporary object storage area, and determine the space size occupied by the created temporary objects based on the temporary object management table; Calculate the remaining storage space size of the temporary object storage area based on the total storage space size and the space size occupied by the created temporary objects; Based on the remaining storage space size and the template object structure size, determining whether the temporary object storage area is sufficient for allocation; If it is determined that the temporary object storage area is insufficient for allocation, exiting the copy interface and / or outputting a fourth error message; If it is determined that the temporary object storage area is sufficient for allocation, the allocation of target storage space in the temporary object storage area based on the size of the template object structure is triggered.

7. The method according to any one of claims 1 to 5, characterized in that: The allocating target storage space in the temporary object storage area based on the size of the template object structure includes: Determine M allocated temporary object storage spaces in the temporary object storage area, where M is a non-negative integer; Based on the M allocated temporary object storage spaces and the size of the template object structure, a target storage space is allocated in the temporary object storage area, and the target storage space is continuous with the M allocated temporary object storage spaces.

8. The method according to any one of claims 1 to 5, characterized in that: The step of generating a target temporary object in the target storage space based on the copied temporary object includes: If the object type in the object header of the copied temporary object does not include the temporary object tag, modifying the object type in the object header of the copied temporary object to write the temporary object tag into the object header of the copied temporary object; If the object type of the template object indicates that the template object is a temporary object of the view class, modifying corresponding information in the object header of the copy temporary object according to the view class input parameter; The current copy temporary object is used as the target temporary object to achieve the generation of the target temporary object in the target storage space based on the copy temporary object.

9. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Refreshing the temporary object management table according to the object index of the target temporary object, so that the temporary object management table records the management information of the target temporary object; After completing the refreshing of the temporary object management table, outputting the object index of the target temporary object; The object index support of the target temporary object is used to obtain the management information of the target temporary object from the temporary object management table.

10. The method according to any one of claims 1 to 5, characterized in that: The member variables of the target temporary object support storing the object index of the created temporary object, and the modification of the member variables of the target temporary object does not change the content of the member variables of the template object.

11. The method according to any one of claims 1 to 5, characterized in that: The target temporary object is generated during a current instruction processing process, and the current instruction processing process is executed by a command processing method, and the method further includes: After completing the current instruction processing process and exiting from the command processing method, the management information of each created temporary object recorded in the temporary object management table is cleared to release all created temporary objects.

12. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Determine a specified temporary object index, and search a temporary object management table for a specified table entry corresponding to the specified temporary object index; If the record content of the designated entry is not empty, releasing the designated temporary object indicated by the designated temporary object index; If the record content of the designated entry is empty, the release is stopped.

13. The method according to claim 12, characterized in that The releasing the designated temporary object indicated by the designated temporary object index comprises: Clear the record content of the specified entry; and / or, The number of created temporary objects and / or the size of space occupied by created temporary objects in the temporary object management table are updated to realize the release of the designated temporary object indicated by the designated temporary object index.

14. The method according to claim 13, characterized in that The method further comprises: Determine a designated temporary object storage space for the designated temporary object in the temporary object storage area, and determine an object arrangement order; Determine N allocated temporary object storage spaces from the temporary object storage area, the N allocated temporary object storage spaces including: allocated temporary object storage spaces whose allocation time is later than the allocation time of the specified temporary object storage space, and N is a non-negative integer; Moving the N allocated temporary object storage spaces according to the object arrangement order to obtain a temporary object storage area after memory compaction, so that all currently existing allocated temporary object storage spaces are arranged continuously; Based on the starting address of each allocated temporary object storage space in the temporary object storage area after the memory is compacted, the temporary object management table is updated to update the storage address of the corresponding temporary object in the temporary object management table.

15. The method according to claim 12, characterized in that The specified temporary object is released by releasing a temporary object function, and the method further comprises: If the record content of the designated table entry is not empty, obtaining the designated storage address of the designated temporary object, and parsing the designated temporary object header information based on the designated storage address; Perform a second firewall check using the designated temporary object header information, and exit the temporary object release function and / or output a fifth error message when the designated temporary object header information fails to pass the second firewall check, and trigger the release of the designated temporary object indicated by the designated temporary object index when the designated temporary object header information passes the second firewall check; The stopping of release includes: Exit the temporary object release function and / or output the sixth error message.

16. A temporary object management device, characterized in that: The device comprises: An acquisition unit is used to obtain the size of the template object structure of the template object; A processing unit, configured to allocate a target storage space in a temporary object storage area based on the size of the template object structure, wherein the size of the target storage space is the same as the size of the template object structure, and the temporary object storage area is located in a volatile memory; The processing unit is further used to copy the template object to the target storage space to obtain a copy temporary object; The processing unit is further used to generate a target temporary object in the target storage space based on the copied temporary object, the object header of the target temporary object includes a temporary object mark, and the target temporary object is used to replace the template object.

17. An electronic device, characterized in that: include: processor; as well as Memory for storing programs, The program comprises instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 15.

18. A chip, characterized in that: include: A processor and a memory, the memory being used to store a computer program, the computer program, when executed by the processor, causing the processor to perform the method according to any one of claims 1-15.

19. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-15.