Software stack data processing method and device, chip, equipment and medium

By making consistency judgment and processing based on bytecode data types in the software stack of the virtual machine, the problem of data leakage in the virtual machine is solved, reducing the risk of data leakage and improving operational efficiency.

CN118981806APending Publication Date: 2024-11-19BEIJING SMARTCHIP MICROELECTRONICS TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410892501.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

The prior art is difficult to effectively reduce the probability of data breaches in virtual machines, especially when executing bytecode, whereby external attackers can forge data types and lead to sensitive data breaches.

Method used

By making consistency judgments based on the data types of the incoming and outgoing bytecodes in the virtual machine software stack, if they are consistent, the corresponding value data will be stacked to ensure consistency of the data type to prevent leakage.

Benefits of technology

Reduces the probability of data leakage, improves data security, and improves program operation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118981806A_ABST
    Figure CN118981806A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data processing method and device of a software stack, computer equipment and a storage medium. The method is applied to a virtual machine configured with a software stack, value data and corresponding first type data are stored in the software stack, the first type data are used for describing the data type of the value data, the value data are stacked under the condition that a stacking byte code is executed, and the first type data are used for describing the data type of the value data under the condition that the stacking byte code is executed. According to the data type of the in-stack byte code, determining the in-stack byte code; the method comprises the following steps: acquiring first type data from a software stack under the condition of execution of a stack-out byte code; if the first type of data is the same as the second type of data corresponding to the popping byte code, popping value data corresponding to the first type of data in the software stack; wherein the second type of data is determined according to the data type of the out-of-stack byte code, so that the data of the software stack in the virtual machine can be protected, and the probability of data leakage is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present specification relate to the field of computer technology, and specifically to a data processing method, apparatus, chip, device and medium of a software stack. Background Art

[0002] With the widespread use of virtual machines, the data security of virtual machines has become increasingly important. In related technologies, the bytecode in the method frame is usually executed based on the stack frame boundary of the program or programming language method to control the access to the stack frame data, or a checksum is added to the method frame, and a security check is performed based on the checksum in the method frame to ensure the data integrity of the method frame. However, in related technologies, the probability of data leakage when executing bytecode still needs to be reduced.

[0003] Therefore, there is an urgent need to provide a data processing method for a software stack to protect the data of the software stack in the virtual machine and reduce the probability of data leakage. Summary of the invention

[0004] In view of this, multiple embodiments of this specification are dedicated to providing a data processing method, apparatus, chip, device and medium of a software stack to reduce the probability of data leakage.

[0005] An embodiment of the present specification provides a data processing method for a software stack, which is applied to a virtual machine, wherein the virtual machine is configured with a software stack, and the software stack stores value data and first type data corresponding to the value data; wherein the first type data is used to describe the data type of the value data; the value data is pushed onto the stack when a push bytecode is executed; the first type data is determined and pushed onto the stack according to the data type of the push bytecode when the push bytecode is executed; the method comprises: when a pop bytecode is executed, obtaining the first type data from the software stack; if the first type data is the same as the second type data corresponding to the pop bytecode, popping the value data corresponding to the first type data in the software stack; wherein the second type data is determined according to the data type of the pop bytecode.

[0006] Further, the stack space of the software stack is divided into multiple first storage units; the first type data occupies a corresponding first specified number of first storage units in the stack space; the value data occupies a corresponding second specified number of first storage units in the stack space; wherein, the first specified number is equal to or different from the second specified number; popping the value data corresponding to the first type data in the software stack includes: according to a pop pointer, popping the value data corresponding to the first type data in the software stack; wherein, the pop pointer is determined according to the first specified number of first storage units corresponding to the first type data after popping the first type data in the software stack; and updating the pop pointer based on the second specified number of first storage units corresponding to the value data.

[0007] Furthermore, before the pop bytecode is executed, the method also includes: when the push bytecode is executed, pushing the value data into the software stack according to a push pointer; updating the push pointer according to a second specified number of first storage units corresponding to the value data; determining the first type of data according to the data type of the push bytecode, and pushing the data into the software stack according to the updated push pointer; and updating the updated push pointer again based on the first specified number of first storage units corresponding to the first type of data.

[0008] Further, the software stack includes a data stack and a type stack; the value data is pushed onto the data stack when a push bytecode is executed; the first type data is determined according to the data type of the push bytecode and pushed onto the type stack when the push bytecode is executed; obtaining the first type data from the software stack includes: obtaining the first type data from the type stack; popping the value data corresponding to the first type data in the software stack includes: popping the value data corresponding to the first type data in the data stack.

[0009] Further, the stack space of the data stack is divided into multiple first storage units, and the stack space of the type stack is divided into multiple second storage units; the second storage unit is smaller than the first storage unit; the value data occupies a second specified number of first storage units in the stack space of the data stack; the first type data occupies a third specified number of second storage units in the stack space of the type stack; obtaining the first type data from the type stack includes: popping the first type data in the type stack according to a type pop pointer; updating the type pop pointer according to the third specified number of second storage units corresponding to the first type data; accordingly, popping the value data corresponding to the first type data in the data stack includes: popping the value data corresponding to the first type data in the data stack according to the data pop pointer; updating the data pop pointer according to the second specified number of first storage units corresponding to the value data.

[0010] Furthermore, before the pop bytecode is executed, the method also includes: when the data push bytecode is executed, according to the data push pointer, pushing the value data into the data stack; updating the data push pointer according to the second specified number of first storage units corresponding to the value data; determining the first type data according to the data type of the push bytecode, and pushing the first type data into the type stack according to the type push pointer; and updating the type push pointer based on the third specified number of second storage units corresponding to the first type data.

[0011] Furthermore, the method further includes: if the first type of data is different from the second type of data corresponding to the pop bytecode, executing an exception handling process.

[0012] An embodiment of the present specification provides a data processing method for a software stack, which is applied to a virtual machine, wherein the virtual machine is configured with a software stack; the method comprises: when a push bytecode is executed, pushing value data corresponding to the push bytecode to the software stack; determining first type data for describing the data type of the value data according to the data type of the push bytecode, and pushing the first type data to the software stack; when a pop bytecode is executed, obtaining the first type data from the software stack; if the first type data is the same as the second type data corresponding to the pop bytecode, popping the value data corresponding to the first type data in the software stack; wherein the second type data is determined according to the data type of the pop bytecode.

[0013] An embodiment of the present specification provides a data processing device for a software stack, which is applied to a virtual machine, wherein the virtual machine is configured with a software stack, and the software stack stores value data and first type data corresponding to the value data; wherein the first type data is used to describe the data type of the value data; the value data is pushed onto the stack when a push bytecode is executed; the first type data is determined and pushed onto the stack according to the data type of the push bytecode when the push bytecode is executed; the device comprises: a first pop module, which is used to obtain the first type data from the software stack when the pop bytecode is executed; a second pop module, which is used to pop the value data corresponding to the first type data in the software stack if the first type data is the same as the second type data corresponding to the pop bytecode; wherein the second type data is determined according to the data type of the pop bytecode.

[0014] Furthermore, the stack space of the software stack is divided into multiple first storage units; the first type of data occupies a corresponding first specified number of first storage units in the stack space; the value data occupies a corresponding second specified number of first storage units in the stack space; wherein the first specified number is equal to or different from the second specified number; the second pop module includes: a third pop module, used to pop the value data corresponding to the first type of data in the software stack according to a pop pointer; wherein the pop pointer is determined according to the first specified number of first storage units corresponding to the first type of data after the first type of data in the software stack is popped; a fourth pop module, used to update the pop pointer based on the second specified number of first storage units corresponding to the value data.

[0015] Furthermore, the device also includes: a first push module, used to push the value data into the software stack according to a push pointer when the push bytecode is executed; a second push module, used to update the push pointer according to a second specified number of first storage units corresponding to the value data; a third push module, used to determine the first type of data according to the data type of the push bytecode, and push the data into the software stack according to the updated push pointer; and a fourth push module, used to update the updated push pointer again based on the first specified number of first storage units corresponding to the first type of data.

[0016] Furthermore, the software stack includes a data stack and a type stack; the value data is pushed onto the data stack when the push bytecode is executed; the first type data is determined according to the data type of the push bytecode and pushed onto the type stack when the push bytecode is executed; the first pop module includes: a fifth pop module for obtaining the first type data from the type stack; the second pop module includes: a sixth pop module for popping the value data corresponding to the first type data in the data stack.

[0017] Furthermore, the stack space of the data stack is divided into multiple first storage units, and the stack space of the type stack is divided into multiple second storage units; the second storage unit is smaller than the first storage unit; the value data occupies a second specified number of first storage units in the stack space of the data stack; the first type data occupies a third specified number of second storage units in the stack space of the type stack; the fifth pop module includes: a seventh pop module, used to pop the first type data in the type stack according to the type pop pointer; an eighth pop module, used to update the type pop pointer according to the third specified number of second storage units corresponding to the first type data; accordingly, the sixth pop module includes: a ninth pop module, used to pop the value data corresponding to the first type data in the data stack according to the data pop pointer; and a tenth pop module, used to update the data pop pointer according to the second specified number of first storage units corresponding to the value data.

[0018] Furthermore, before the pop bytecode is executed, the device also includes: a fifth push module, used to push the value data into the data stack according to the data push pointer when the data push bytecode is executed; a sixth push module, used to update the data push pointer according to the second specified number of first storage units corresponding to the value data; a seventh push module, used to determine the first type data according to the data type of the push bytecode, and push the first type data into the type stack according to the type push pointer; an eighth push module, used to update the type push pointer based on the third specified number of second storage units corresponding to the first type data.

[0019] Furthermore, the device also includes: an exception handling module, which is used to execute an exception handling process if the first type of data is different from the second type of data corresponding to the pop bytecode.

[0020] An embodiment of the present specification provides a data processing device for a software stack, which is applied to a virtual machine, and the virtual machine is configured with a software stack; the device includes: a value data push module, which is used to push the value data corresponding to the push bytecode to the software stack when the push bytecode is executed; a type data push module, which is used to determine the first type data used to describe the data type of the value data according to the data type of the push bytecode, and push the first type data to the software stack; a type data pop module, which is used to obtain the first type data from the software stack when the pop bytecode is executed; and a value data pop module, which is used to pop the value data corresponding to the first type data in the software stack if the first type data is the same as the second type data corresponding to the pop bytecode; wherein the second type data is determined according to the data type of the pop bytecode.

[0021] An embodiment of the present specification provides a chip, including a storage unit and a processing unit. The storage unit stores a computer program, and the processing unit implements the method described in any of the above embodiments when executing the computer program.

[0022] An embodiment of the present specification provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any of the above embodiments is implemented.

[0023] An embodiment of the present specification provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method described in any of the above embodiments is implemented.

[0024] In multiple implementations provided in this specification, a virtual machine is configured with a software stack, and the software stack stores value data and first type data corresponding to the value data for describing the data type of the value data, wherein the value data is pushed onto the stack when a push bytecode is executed; the first type data is determined and pushed onto the stack based on the data type of the push bytecode when the push bytecode is executed; in multiple implementations, when a pop bytecode is executed, the first type data is obtained from the software stack, and the second type data is determined based on the data type of the pop bytecode. If the first type data is the same as the second type data, the value data corresponding to the first type data in the software stack is popped off. In this way, the data in the software stack of the virtual machine can be protected and the probability of data leakage can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 A flowchart of a data processing method provided in an embodiment of this specification;

[0026] Figure 2 A flowchart of a method for popping a software stack provided in an embodiment of this specification;

[0027] Figure 3 A flowchart of a method for stacking a software stack provided in an embodiment of this specification;

[0028] Figure 4 A schematic diagram of a stack space of a data stack provided for an embodiment of this specification;

[0029] Figure 5 A schematic diagram of a stack space of a type stack provided for an embodiment of this specification;

[0030] Figure 6 A schematic flow chart of a method for popping a type stack provided in an embodiment of this specification;

[0031] Figure 7 A schematic diagram of a flow chart of a method for popping a data stack provided in an embodiment of this specification;

[0032] Figure 8 A schematic diagram of a method for pushing a data stack and a type stack provided in an embodiment of this specification;

[0033] Fig. 9 A flowchart of a method for stacking a software stack provided in an embodiment of this specification;

[0034] Fig.10 A flowchart of a method for popping a software stack provided in an embodiment of this specification;

[0035] Fig.11 A schematic diagram of a data processing device provided for an embodiment of this specification;

[0036] Fig.12 A schematic diagram of a data processing device provided for an embodiment of this specification;

[0037] Fig.13 A schematic diagram of a computer device provided for embodiments of the present specification. DETAILED DESCRIPTION

[0038] In order to enable those skilled in the art to better understand the solution of this specification, the technical solution in the implementation of this specification will be clearly and completely described below in conjunction with the drawings in the implementation of this specification. Obviously, the described implementation is only a part of the implementation of this specification, not all of the implementations. Based on the implementation in this specification, all other implementations obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0039] With the development of information technology, the application of virtual machines has become more and more extensive, such as Java Card virtual machines, Docker containers, VMWare, Kernel-based Virtual Machine (KVM), OVM (OracleVM), Citrix Xen, etc. Exemplarily, the Java Card virtual machine is a virtual machine for executing Java programs on a Java Card, which is a smart card or CPU card that can run Java (an object-oriented programming language) programs. Therefore, the data security of virtual machines has become increasingly important.

[0040] In the related art, the bytecode in the method frame is usually executed based on the stack frame boundary of the method, thereby controlling the access to the stack frame data, or performing a security check based on the checksum in the method frame, thereby ensuring the data integrity of the method frame. For example, the Java Card virtual machine usually executes the bytecode in the method frame based on the stack frame boundary of the Java method, controls the access to the stack frame data through the stack frame boundary, or adds a checksum in the Java object header, and performs a security check based on the checksum in the object header, thereby ensuring the data integrity of the method frame. However, when storing data of different data types, the Java Card stores them in the stack space in binary form. When reading data, it is impossible to physically distinguish the data type of the data in the stack space, so that an external attacker can traverse any data in the stack space based on the standard bytecode instructions defined by the Java Card virtual machine, or display data of a fixed data type as any other data type, thereby causing the leakage of sensitive data. In the related art, when executing bytecode, it is difficult to identify illegal bytecodes with data types as forged features, which easily leads to the access of illegal bytecode instructions, and there is a risk of data leakage.

[0041] Therefore, it is necessary to provide a data processing method for a software stack in a virtual machine, which can protect the data of the software stack in the virtual machine through bytecode-based data types, thereby reducing the probability of data leakage in the software stack.

[0042] The implementation manner of this specification provides a scenario example of a virtual machine, and the virtual machine can be configured with a software stack, and the virtual machine can be a Java card virtual machine, a Docker container, VMWare, a Kernel-based Virtual Machine (KVM), an OVM (OracleVM), Citrix Xen, etc. Specifically, the software stack, that is, the operation stack, the virtual machine can push the value data into the software stack based on the data type of the pushed bytecode, and when the data type of the popped bytecode is consistent with the data type of the pushed bytecode corresponding to the value data, the value data in the software stack is popped, so that the data type of the bytecode accessed when the value data is pushed and popped in the software stack is consistent, which can reduce the probability of data leakage in the software stack to a certain extent.

[0043] This specification provides a method for processing data in a software stack. Figure 1 , Figure 1 It is a flowchart of a data processing method of a software stack provided by this embodiment. This embodiment provides method operation steps as shown in the flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one execution method among many step execution sequences, and does not represent the only execution sequence. When the actual system or server product is executed, it can be executed in sequence or in parallel according to the method shown in the embodiment (for example, in a parallel processor or multi-threaded processing environment). The data processing method of the software stack can be applied to virtual machines, specifically as Figure 1 As shown, the data processing method may include the following steps.

[0044] Step S110: when the pop bytecode is executed, obtain the first type of data from the software stack.

[0045] In some cases, the virtual machine is configured with a software stack, and the software stack may store value data and first type data corresponding to the value data. The first type data is used to describe the data type of the value data. Specifically, the value data in the software stack may be pushed into the stack when the push bytecode is executed. The first type data in the software stack may be determined and pushed into the stack according to the data type of the push bytecode when the push bytecode is executed. That is to say, the value data in the software stack is pushed into the software stack based on the data type of the push bytecode.

[0046] The value data may refer to other data related to the push bytecode except the first type of data, that is, the data that the push bytecode actually operates on the stack.

[0047] The push bytecode or pop bytecode is an instruction of a virtual machine execution or method. The software stack is a memory area allocated and released by the compiler of the virtual machine, which is used to store or provide corresponding data when the bytecode is executed.

[0048] Specifically, the virtual machine may obtain the first type of data from the software stack when the pop bytecode is executed, or in other words, pop the first type of data in the software stack.

[0049] Step S120: If the first type of data is the same as the second type of data corresponding to the pop bytecode, the value data corresponding to the first type of data in the software stack is popped; wherein the second type of data is determined according to the data type of the pop bytecode.

[0050] Specifically, the virtual machine can determine the second type of data used to represent the data type of the pop bytecode based on the data type of the pop bytecode, and determine whether the first type of data is equal to the second type of data. If the first type of data is the same as the second type of data, it means that the data type of the pop bytecode is the same or consistent with the data type of the value data in the software stack, that is, the data type of the pop bytecode is consistent with the data type of the push bytecode corresponding to the value data in the software stack when it is pushed. At this time, the value data in the software stack can be popped.

[0051] In the above implementation, the consistency of the data type of the popped bytecode and the data type of the pushed bytecode corresponding to the value data in the software stack is determined, and the value data in the software stack is popped only when the data type of the popped bytecode is consistent with the data type of the pushed bytecode corresponding to the value data in the software stack when it is pushed. In this way, the risk of data leakage caused by illegal bytecode access with the forged data type of the bytecode can be reduced, and the probability of data leakage in the software stack can be reduced. In addition, the verification method in the above implementation is relatively simple, which can improve the running efficiency of the program to a certain extent.

[0052] In some embodiments, the stack space of the software stack can be divided into multiple first storage units, or in other words, the stack space of the software stack is managed based on the first storage unit. The first type of data can occupy a corresponding first specified number of first storage units in the stack space. The value data can occupy a corresponding second specified number of first storage units in the stack space. The first specified number and the second specified number can be equal or different.

[0053] In this implementation, see Figure 2 , popping the value data corresponding to the first type of data in the software stack may include the following steps.

[0054] Step S210: according to the pop pointer, the value data corresponding to the first type of data in the software stack is popped; wherein the pop pointer is determined according to the first specified number of first storage units corresponding to the first type of data after the first type of data in the software stack is popped.

[0055] In some cases, the stack space of a software stack may push value data and first type data used to describe the data type of the value data. The virtual machine may pop the value data and the first type data in the software stack through a pop pointer. The pop pointer of the software stack indicates the memory address of the stack space of the software stack.

[0056] Specifically, the pop pointer may have an initial memory address, pointing to the first storage unit occupied by the first type of data. When the pop bytecode is executed, the virtual machine may pop the first type of data in the software stack according to the initial memory address of the pop pointer; and may update the pop pointer according to the first specified number of first storage units required to be occupied by the first type of data in the stack space of the software stack to re-determine the pop pointer, or in other words, move the pop pointer in the stack space of the software stack by the address length corresponding to the first specified number of first storage units, so that the pop pointer points to the first storage unit occupied by the value data corresponding to the first type of data. Specifically, the virtual machine may pop the value data in the software stack according to the pop pointer pointing to the first storage unit occupied by the value data.

[0057] Exemplarily, the first storage unit may be a byte. Exemplarily, the first specified number may be 1, that is, the first type of data may occupy 1 byte in the stack space. Exemplarily, the second specified number may be 1, 2, or 4, etc., that is, the value data may occupy 1, 2, or 4 bytes in the stack space. As an example, the second specified number may be determined according to the data type of the bytecode pushed onto the stack or according to the first type of data.

[0058] Exemplarily, the first type of data in the software stack may be represented by a flag, which occupies 1 byte in the stack space.

[0059] Exemplarily, the data type of the pushed bytecode may include Boolean, byte, short, int, and reference types. When the data type of the pushed bytecode is boolean or byte, the first type data flag=00, and the value data corresponding to the first type data flag=00 occupies 1 byte in the stack space. When the data type of the pushed bytecode is short, the first type data flag=01, and the value data corresponding to the first type data flag=01 occupies 2 bytes in the stack space. When the data type of the pushed bytecode is int, the first type data flag=02, and the value data corresponding to the first type data flag=02 occupies 4 bytes in the stack space. When the data type of the pushed bytecode is reference, the first type data flag=03, and the value data corresponding to the first type data flag=03 occupies 2 bytes in the stack space.

[0060] For example, the initial memory address of the pop pointer SP may point to the byte occupied by the first type data flag=02. When the pop bytecode is executed, the virtual machine may pop the first type data flag=02 in the stack space according to the pop pointer SP. Since the first type data flag=02 occupies 1 byte in the stack space, the virtual machine may move the pop pointer SP in the stack space by an address length of 1 byte so that the pop pointer SP points to the byte occupied by the value data corresponding to the first type data flag=02, thereby making it possible to pop the value data in the stack space according to the moved pop pointer SP.

[0061] Step S220: updating the pop pointer based on the second specified number of first storage units corresponding to the value data.

[0062] Specifically, the virtual machine can update the pop pointer based on the second specified number of first storage units occupied by the value data in the stack space of the software stack to re-determine the pop pointer, or in other words, move the pop pointer in the stack space of the software stack by the address length corresponding to the second specified number of first storage units so that the pop pointer points to the first storage unit occupied by the next first type of data.

[0063] For example, when the first type data flag=02, it indicates that the data type of the pushed bytecode is int, or in other words, the data type of the value data is int, and the value data corresponding to the first type data flag=02 occupies 4 bytes in the stack space. At this time, the virtual machine can update the pop pointer SP based on the 4 bytes that the value data of the int data type needs to occupy in the stack space to re-determine the pop pointer SP, or in other words, move the pop pointer SP in the stack space by an address length of 4 bytes so that the pop pointer SP points to the byte occupied by the next first type data flag.

[0064] In the above implementation, after the first type of data in the software stack is popped, the pop pointer is updated according to the first specified number of first storage units corresponding to the first type of data, and the value data corresponding to the first type of data in the software stack is popped through the updated pop pointer, and based on the second specified number of first storage units corresponding to the value data, the pop pointer is updated again, so that the again updated pop pointer points to the first storage unit occupied by the next first type of data, in this way, the first type of data and the corresponding value data in the stack space are popped in sequence based on the pop pointer, providing a basis for the consistency judgment between the data type of the pop bytecode and the data type of the push bytecode corresponding to the value data in the software stack.

[0065] In some embodiments, see Figure 3 Before the pop bytecode is executed, the data processing method may further include the following steps.

[0066] Step S310: When the push bytecode is executed, the value data is pushed into the software stack according to the push pointer.

[0067] Specifically, the stack pointer may have an initial memory address, and the virtual machine may push the value data into the software stack according to the initial memory address of the data stack pointer when the stack bytecode is executed.

[0068] Step S320: updating the stack pointer according to the second specified number of first storage units corresponding to the value data.

[0069] Specifically, the virtual machine can push the value data into the stack space of the software stack according to the push pointer when the push bytecode is executed, and update the push pointer according to the second specified number of first storage units corresponding to the value data. Exemplarily, the data type of the push bytecode can be int, or the data type of the value data can be int, and the value data occupies 4 bytes in the stack space. After the virtual machine pushes the value data of the int data type into the stack space according to the push pointer SP, the virtual machine can update the push pointer SP according to the 4 bytes that the value data of the int data type needs to occupy in the stack space, or move the push pointer SP in the stack space by an address length of 4 bytes, so that the updated or moved push pointer SP can push the first type data flag used to describe the data type of the value data into the stack space.

[0070] Exemplarily, the data type of the bytecode pushed onto the stack may also be boolean or byte. Accordingly, after the value data is pushed onto the stack, the stack pointer SP is updated according to the address length of 1 byte required by the value data of the boolean or byte data type.

[0071] Exemplarily, the data type of the bytecode pushed onto the stack may also be short or reference. Accordingly, after the value data is pushed onto the stack, the stack pointer SP is updated according to the 2-byte address length required by the value data of the short or reference data type.

[0072] Step S330: Determine the first type of data according to the data type of the pushed bytecode, and push the first type of data into the software stack according to the updated push pointer.

[0073] Exemplarily, when the data type of the pushed bytecode is int, or the data type of the value data is int, the virtual machine can determine the first type data flag=03, and push the first type data flag=03 into the stack space through the stack pointer SP updated based on the 4-byte address length required for the value data of the int data type.

[0074] Exemplarily, when the data type of the pushed bytecode is boolean or byte, or the data type of the value data is boolean or byte, the virtual machine can determine that the first type data = 00, and push the first type data flag = 1 into the stack space through the stack pointer SP updated based on the address length of 1 byte required for the value data of the boolean or byte data type.

[0075] Exemplarily, when the data type of the pushed bytecode is short, or the data type of the value data is short, the virtual machine can determine that the first type data = 01, and push the first type data flag = 01 into the stack space through the stack pointer SP updated based on the 2-byte address length required for the value data of the short data type.

[0076] Exemplarily, when the data type of the pushed bytecode is reference, or the data type of the value data is reference, the virtual machine can determine that the first type data = 04, and push the first type data flag = 04 into the stack space through the stack pointer SP updated based on the 2-byte address length required for the value data of the reference data type.

[0077] Step S340: based on the first specified number of first storage units corresponding to the first type of data, the updated stack pointer is updated again.

[0078] Specifically, the virtual machine can update the push pointer again based on the first specified number of first storage units that the first type of data needs to occupy in the stack space of the software stack to redetermine the push pointer, or in other words, move the push pointer in the stack space of the software stack by the address length corresponding to the first specified number of first storage units, so that the corresponding value data can be pushed to the corresponding first storage unit in the stack space when the next push bytecode is executed. Exemplarily, the first type of data flag = 00, 01, 02 or 03, and the first type of data flag occupies 1 byte in the stack space. At this time, the virtual machine can update the push pointer SP based on the 1 byte that the first type of data needs to occupy in the stack space to redetermine the push pointer SP, or in other words, move the push pointer SP in the stack space by the address length of 1 byte, so that the corresponding value data can be pushed to the corresponding byte in the stack space when the next push bytecode is executed.

[0079] In the above implementation, when the push bytecode is executed, the value data is pushed to the software stack according to the push pointer, and the push pointer is updated according to the second specified number of first storage units corresponding to the value data, and the first type of data is determined according to the data type of the push bytecode, and the first type of data is pushed to the software stack according to the updated push pointer, and then the updated push pointer is updated again based on the first specified number of first storage units corresponding to the first type of data, so that the corresponding value data can be pushed when the next push bytecode is executed. In this way, the sequential stacking of the value data and the corresponding first type of data based on the push pointer is realized, providing a basis for the consistency determination between the data type of the pop bytecode and the data type of the push bytecode corresponding to the value data in the software stack.

[0080] In some embodiments, the software stack may include a data stack and a type stack. The data stack may be used to store value data, and the type stack may be used to store first type data. The value data may be pushed into the data stack when the push bytecode is executed. The first type data may be determined according to the data type of the push bytecode and pushed into the type stack when the push bytecode is executed.

[0081] Specifically, obtaining the first type of data from the software stack may refer to: obtaining the first type of data from the type stack. Correspondingly, popping the value data corresponding to the first type of data in the software stack may refer to: popping the value data corresponding to the first type of data in the data stack.

[0082] In the above implementation, when the push bytecode is executed, the value data is pushed on the data stack, and the first type data is pushed on the type stack, and when the pop bytecode is executed, the first type data in the type stack is popped, and the value data in the data stack is popped. In this way, a basis can be provided for consistency determination between the data type of the pop bytecode and the data type of the push bytecode corresponding to the value data based on the data stack and the type stack.

[0083] In some implementations, the stack space of the data stack may be divided into a plurality of first storage units, and the stack space of the type stack may be divided into a plurality of second storage units, wherein the second storage units may be smaller than the first storage units.

[0084] In some cases, the actual storage space required for the first type of data used to describe the data type of the pushed bytecode, or the first type of data used to describe the data type of the value data, is often relatively small and usually of a fixed size. In order to reduce the storage overhead of the stack space, the first type of data can be pushed into the type stack and stored in a second storage unit that is smaller than the first storage unit of the data stack.

[0085] For example, see Figure 4 , Figure 4 A schematic diagram of the stack space of the data stack is shown. The first storage unit in the data stack may be a byte, and the multiple first storage units of the data stack may be byte0, byte1, byte2, byte3, byte4, ..., byteN.

[0086] For example, see Figure 5 , Figure 5 A schematic diagram of a stack space of a type stack is shown. The second storage unit in the type stack may be a fourth specified number of bits. The fourth specified number of bits is used as a second storage unit to store a first type of data. As an example, the value of the fourth specified number may be 2, that is, a second storage unit in the type stack may be 2 bits. Please continue to refer to Figure 5 The multiple second storage units in the type stack may refer to four second storage units type0, type1, type2, and type3, and each second storage unit type is 2 bits.

[0087] As an example, the stack space of the type stack may also be divided into a plurality of first storage units, and the plurality of first storage units may be divided into a plurality of second storage units. For example, a first storage unit byte in the type stack may include four second storage units type.

[0088] In this embodiment, the value data may occupy a second specified number of first storage units in the stack space of the data stack, and the first type data may occupy a third specified number of second storage units in the stack space of the type stack.

[0089] Specifically, for example, the third specified number may be 1, that is, the first type data may occupy one second storage unit type in the type stack, or in other words, the first type data occupies 2 bits in the type stack.

[0090] Specifically, for example, the second specified number can be determined according to the data type of the pushed bytecode or according to the first type data. As an example, the first type data flag=00 is used to indicate the boolean or byte data type of the pushed bytecode; the first type data flag=01 is used to indicate the short data type of the pushed bytecode; the first type data flag=02 is used to indicate the int data type of the pushed bytecode; the first type data flag=03 is used to indicate the reference data type of the pushed bytecode. As an example, when the first type data flag=00 or the data type of the pushed bytecode is boolean or byte, the second specified number can be 1, that is, the value data of the boolean or byte data type occupies 1 first storage unit byte in the data stack; when the first type data flag=01 or 03, or the data type of the pushed bytecode is short or reference, the second specified number can be 2, that is, the value data of the short or reference data type occupies 2 first storage units byte in the data stack; when the first type data flag=02 or the data type of the pushed bytecode is int, the second specified number can be 4, that is, the value data of the int data type occupies 4 first storage units byte in the data stack.

[0091] In this implementation, see Figure 6 , obtaining first type data from the type stack may include the following steps.

[0092] Step S610: pop the first type of data in the type stack according to the type pop pointer.

[0093] Specifically, the type pop pointer may have an initial memory address pointing to the second storage unit occupied by the first type data in the type stack. When the pop bytecode is executed, the virtual machine may pop the first type data in the type stack according to the initial memory address of the type pop pointer.

[0094] For example, please refer to Figure 5 The initial memory address of the type pop pointer TYPE_SP can point to type0 in byte0 of the type stack, and the virtual machine can pop the first type data flag corresponding to type0 in byte0 of the type stack based on the type pop pointer TYPE_SP.

[0095] Step S620: Update the type pop pointer according to the third specified number of second storage units corresponding to the first type data.

[0096] Specifically, the virtual machine can update the type pop pointer according to the third specified number of second storage units that the first type data needs to occupy in the type stack to re-determine the type pop pointer, or, in other words, move the type pop pointer in the type stack by the address length corresponding to the third specified number of second storage units so that the type pop pointer points to the second storage unit occupied by the next first type data.

[0097] In this implementation, see Figure 7 , popping the value data corresponding to the first type of data in the data stack may include the following steps.

[0098] Step S710: according to the data pop pointer, the value data corresponding to the first type of data in the data stack is popped.

[0099] Among them, the first type data and the value data corresponding to the first type data in the data stack may refer to the value data pushed into the data stack when the push bytecode is executed, and the first type data generated according to the data type of the push bytecode.

[0100] Specifically, the data pop pointer may have an initial memory address, pointing to the first storage unit occupied by the value data in the data stack. When the pop bytecode is executed, the virtual machine may pop the value data in the data stack according to the initial memory address of the data pop pointer.

[0101] For example, please refer to Figure 4 , the initial memory address of the data stack pointer DATA_SP can point to byte0 in the data stack, and the virtual machine can pop the corresponding value data in byte0 in the data stack based on the data stack pointer DATA_SP.

[0102] Step S720: Update the data pop pointer according to the second specified number of first storage units corresponding to the value data.

[0103] Specifically, the virtual machine can update the data pop pointer according to the second specified number of first storage units that the value data needs to occupy in the type stack to re-determine the data pop pointer, or, in other words, move the data pop pointer in the data stack by the address length corresponding to the second specified number of first storage units so that the data pop pointer points to the first storage unit occupied by the next value data.

[0104] In the above implementation, for platforms with scarce storage space, such as chips, the stack space of the software stack configured by the virtual machine is prone to insufficient storage resources. By pushing the first type of data into the type stack and storing the first type of data in a second storage unit that is smaller than the first storage unit of the data stack, the storage overhead of the stack space of the software stack can be reduced while achieving consistency judgment between the data type of the popped bytecode and the data type of the pushed bytecode corresponding to the value data.

[0105] In some embodiments, see Figure 8 Before the pop bytecode is executed, the data processing method may further include the following steps.

[0106] Step S810: When the data push bytecode is executed, the value data is pushed into the data stack according to the data push pointer.

[0107] Specifically, the data push pointer may have an initial memory address, and the virtual machine may push the value data into the data stack according to the initial memory address of the data push pointer when the push bytecode is executed.

[0108] Step S820: updating the data stack pointer according to the second specified number of first storage units corresponding to the value data.

[0109] Specifically, the virtual machine may update the data stack pointer according to a second specified number of first storage units corresponding to or required by the value data.

[0110] For example, please refer to Figure 4 The data type of the pushed bytecode or value data can be int, and the value data occupies 4 bytes in the data stack. The virtual machine can update the data stack pointer DATA_SP according to the 4 bytes that the value data of the int data type needs to occupy in the data stack, or move the data stack pointer DATA_SP by the address length of 4 bytes in the data stack, so that the updated or moved data stack pointer DATA_SP can perform subsequent value data push operations.

[0111] For example, please refer to Figure 4 The data type of the bytecode or value data pushed into the stack can also be boolean or byte. The virtual machine can update the data stack pointer DATA_SP according to the address length of 1 byte that the value data of the boolean or byte data type needs to occupy in the data stack.

[0112] For example, please refer to Figure 4The data type of the bytecode or value data pushed onto the stack can also be short or reference. The virtual machine can update the data stack pointer DATA_SP according to the 2-byte address length that the value data of the short or reference data type needs to occupy on the data stack.

[0113] Step S830: Determine the first type of data according to the data type of the pushed bytecode, and push the data into the type stack according to the type push pointer.

[0114] Specifically, the type push pointer may have an initial memory address, and the virtual machine may push the first type of data into the type stack according to the initial memory address of the type push pointer when the push bytecode is executed.

[0115] Exemplarily, when the data type of the pushed bytecode is int, or the data type of the value data is int, the virtual machine may determine that the first type data flag=02, and push the first type data flag=02 into the type stack.

[0116] Exemplarily, when the data type of the pushed bytecode is boolean or byte, or the data type of the value data is boolean or byte, the virtual machine may determine that the first type data flag=00, and push the first type data flag=00 into the type stack.

[0117] Exemplarily, when the data type of the pushed bytecode is short, or the data type of the value data is short, the virtual machine may determine that the first type data flag=01, and push the first type data flag=01 into the type stack.

[0118] Exemplarily, when the data type of the pushed bytecode is reference, or the data type of the value data is reference, the virtual machine may determine that the first type data flag=03, and push the first type data flag=03 into the type stack.

[0119] Step S840: Based on the third specified number of second storage units corresponding to the first type data, the type stack pointer is updated.

[0120] Exemplarily, when the first type data flag=00, the type stack pointer TYPE_SP is updated according to the address length of 1 byte required by the value data of the boolean or byte data type corresponding to the first type data flag=00.

[0121] Exemplarily, in the case where the first type data flag=01, the type stack pointer TYPE_SP is updated according to the address length of 2 bytes required by the value data of the short data type corresponding to the first type data flag=01.

[0122] Exemplarily, in the case where the first type data flag=02, the type stack pointer TYPE_SP is updated according to the address length of 4 bytes required by the value data of the int data type corresponding to the first type data flag=02.

[0123] Exemplarily, in the case where the first type data flag=03, the type stack pointer TYPE_SP is updated according to the address length of 2 bytes required by the value data of the reference data type corresponding to the first type data flag=03.

[0124] In the above implementation, when the data push bytecode is executed, the value data is pushed into the data stack according to the data push pointer, the data push pointer is updated according to the second specified number of first storage units corresponding to the value data, and the first type of data is determined according to the data type of the push bytecode, and pushed into the type stack according to the type push pointer, and then the type push pointer is updated based on the third specified number of second storage units corresponding to the first type of data. In this way, a basis can be provided for consistency determination between the data type of the pop bytecode and the data type of the push bytecode corresponding to the value data based on the data stack and the type stack.

[0125] In some embodiments, the type stack pointer or the type stack pointer may include a high byte address and a low byte address. The high byte address represents the address of the first storage unit in the type stack, and the low byte address represents the address of the second storage unit of the first storage unit in the type stack. Figure 5 TYPE_SP can represent a type push pointer or a type pop pointer, the high byte address represents the address of the first storage unit byte, and the low byte address represents the address of the second storage unit type within the first storage unit byte.

[0126] In some embodiments, the data processing method may further include: if the first type of data is different from the second type of data corresponding to the pop bytecode, executing an exception handling process. Specifically, if the first type of data is different from the second type of data, exception handling may be performed based on a stack data type error. In this way, the data in the software stack can be effectively protected to prevent access by bytecodes of maliciously modified data types, thereby reducing the probability of data leakage, and when executing bytecodes of maliciously modified data types, exception handling can be performed to further prevent data leakage.

[0127] The embodiment of the present specification provides a data processing method for a software stack, which can be applied to a virtual machine and may include the following steps.

[0128] Step S910: When the push bytecode is executed, the value data corresponding to the push bytecode is pushed into the software stack.

[0129] Specifically, see Fig. 9 , execute the push bytecode, push the value data corresponding to the push bytecode to the software stack, and update the push pointer. Exemplarily, if the data type of the executed push bytecode is boolean or byte, the value data is pushed to the software stack, and the push pointer SP+1 is updated. Exemplarily, if the data type of the executed push bytecode is short, the value data is pushed to the software stack, and the push pointer SP+2 is updated. Exemplarily, if the data type of the executed push bytecode is int, the value data is pushed to the software stack, and the push pointer SP+4 is updated. Exemplarily, if the data type of the executed push bytecode is reference, the value data is pushed to the software stack, and the push pointer SP+2 is updated.

[0130] Step S920: Determine first type data for describing the data type of the value data according to the data type of the pushed bytecode, and push the first type data into the software stack.

[0131] For example, please refer to Fig. 9 If the data type of the pushed bytecode is boolean or byte, the first type data flag=00 is determined, and flag=00 is pushed to the software stack, and the stack pointer +1 is updated.

[0132] Exemplarily, if the data type of the pushed bytecode is short, the first type data flag=01 is determined, and flag=01 is pushed to the software stack, and the stack pointer SP+1 is updated.

[0133] Exemplarily, if the data type of the pushed bytecode is int, the first type data flag=02 is determined, and flag=02 is pushed to the software stack, and the stack pointer SP+1 is updated.

[0134] Exemplarily, if the data type of the pushed bytecode is reference, the first type data flag=03 is determined, and flag=03 is pushed to the software stack, and the stack pointer SP+1 is updated.

[0135] Step S930: when the pop bytecode is executed, obtain the first type of data from the software stack.

[0136] Specifically, see Fig.10 , execute the pop bytecode, obtain the first type of data flag from the software stack, and update the pop pointer SP-1.

[0137] Step S940: If the first type of data is the same as the second type of data corresponding to the pop bytecode, the value data corresponding to the first type of data in the software stack is popped; wherein the second type of data is determined according to the data type of the pop bytecode.

[0138] For details, please continue to see Fig.10 , the second type data typeflag used to describe the data type of the pop bytecode can be determined according to the pop bytecode, so as to be able to compare the consistency with the first type data flag used to describe the data type of the push bytecode in the software stack. Exemplarily, if the data type of the pop bytecode is boolean or byte, the second type data typeflag can be determined to be 00. Exemplarily, if the data type of the pop bytecode is short, the second type data typeflag can be determined to be 01. Exemplarily, if the data type of the pop bytecode is int, the second type data typeflag can be determined to be 02. Exemplarily, if the data type of the pop bytecode is reference, the second type data typeflag can be determined to be 03.

[0139] Specifically, if the first type data flag is equal to the second type data typeflag, the value data corresponding to the first type data flag may be popped out of the stack, and the pop pointer SP may be updated.

[0140] Exemplarily, the value data of the boolean or byte data type corresponding to the first type data flag=00 may be popped from the stack, and the pop pointer SP-1 may be updated.

[0141] Exemplarily, the value data of the short data type corresponding to the first type data flag=01 may be popped from the stack, and the pop pointer SP-2 may be updated.

[0142] Exemplarily, the value data of the int data type corresponding to the first type data flag=02 may be popped from the stack, and the pop pointer SP-4 may be updated.

[0143] Exemplarily, the value data of the reference data type corresponding to the first type data flag=03 may be popped from the stack, and the pop pointer SP-2 may be updated.

[0144] Specifically, if the first type data flag is not equal to the second type data typeflag, it can be determined that the stack data type is wrong, that is, the data type of the executed pop bytecode is wrong, and the corresponding exception handling process can be executed.

[0145] This specification provides a data processing device for a software stack. The device can be applied to a virtual machine. Fig.11 , the data processing device may include a first popping module 1110 and a second popping module 1120.

[0146] The first pop module 1110 is used to obtain the first type of data from the software stack when the pop bytecode is executed; the second pop module 1120 is used to pop the value data corresponding to the first type of data in the software stack if the first type of data is the same as the second type of data corresponding to the pop bytecode; wherein the second type of data is determined according to the data type of the pop bytecode.

[0147] In some embodiments, the stack space of the software stack is divided into multiple first storage units; the first type of data occupies a corresponding first specified number of first storage units in the stack space; the value data occupies a corresponding second specified number of first storage units in the stack space; wherein the first specified number is equal to or different from the second specified number. In this embodiment, the second pop module includes a third pop module and a fourth pop module. The third pop module is used to pop the value data corresponding to the first type of data in the software stack according to the pop pointer; wherein the pop pointer is determined according to the first specified number of first storage units corresponding to the first type of data after the first type of data in the software stack is popped. The fourth pop module is used to update the pop pointer based on the second specified number of first storage units corresponding to the value data.

[0148] In some embodiments, the device further includes a first push module, a second push module, a third push module, and a fourth push module. The first push module is used to push the value data to the software stack according to the push pointer when the push bytecode is executed; the second push module is used to update the push pointer according to the second specified number of first storage units corresponding to the value data; the third push module is used to determine the first type of data according to the data type of the push bytecode, and push the data to the software stack according to the updated push pointer; the fourth push module is used to update the updated push pointer again based on the first specified number of first storage units corresponding to the first type of data.

[0149] In some embodiments, the software stack includes a data stack and a type stack. The value data is pushed into the data stack when the push bytecode is executed; the first type data is determined according to the data type of the push bytecode and pushed into the type stack when the push bytecode is executed. In this embodiment, the first pop module includes a fifth pop module.

[0150] The fifth stack popping module is used to obtain the first type of data from the type stack. The second stack popping module includes a sixth stack popping module.

[0151] The sixth pop module is used to pop the value data corresponding to the first type of data in the data stack.

[0152] In some embodiments, the stack space of the data stack is divided into a plurality of first storage units, and the stack space of the type stack is divided into a plurality of second storage units; the second storage unit is smaller than the first storage unit; the value data occupies a second specified number of first storage units in the stack space of the data stack; and the first type of data occupies a third specified number of second storage units in the stack space of the type stack. In this embodiment, the fifth pop module includes a seventh pop module and an eighth pop module. The seventh pop module is used to pop the first type of data in the type stack according to the type pop pointer; the eighth pop module is used to update the type pop pointer according to the third specified number of second storage units corresponding to the first type of data. Accordingly, in this embodiment, the sixth pop module includes a ninth pop module and a tenth pop module. The ninth pop module is used to pop the value data corresponding to the first type of data in the data stack according to the data pop pointer; the tenth pop module is used to update the data pop pointer according to the second specified number of first storage units corresponding to the value data.

[0153] In some embodiments, before the pop bytecode is executed, the device further includes a fifth push module, a sixth push module, a seventh push module, and an eighth push module. The fifth push module is used to push the value data into the data stack according to the data push pointer when the data push bytecode is executed; the sixth push module is used to update the data push pointer according to the second specified number of first storage units corresponding to the value data; the seventh push module is used to determine the first type of data according to the data type of the push bytecode, and push the data into the type stack according to the type push pointer; the eighth push module is used to update the type push pointer based on the third specified number of second storage units corresponding to the first type of data.

[0154] In some embodiments, the device further includes: an exception handling module. The exception handling module is configured to execute an exception handling process if the first type of data is different from the second type of data corresponding to the pop bytecode.

[0155] The present specification also provides a data processing device for a software stack, which can be applied to a virtual machine. Fig.12 The data processing device may include a value data push module 1210 , a type data push module 1220 , a type data pop module 1230 and a value data pop module 1240 .

[0156] Among them, the value data push module 1210 is used to push the value data corresponding to the push bytecode into the software stack when the push bytecode is executed; the type data push module 1220 is used to determine the first type data used to describe the data type of the value data according to the data type of the push bytecode, and push the first type data into the software stack; the type data pop module 1230 is used to obtain the first type data from the software stack when the pop bytecode is executed; the value data pop module 1240 is used to pop the value data corresponding to the first type data in the software stack if the first type data is the same as the second type data corresponding to the pop bytecode; wherein the second type data is determined according to the data type of the pop bytecode.

[0157] The specific functions and effects realized by the data processing device can be explained in other embodiments of this specification, and will not be repeated here. Each module in the data processing device can be implemented in whole or in part by software, hardware, and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0158] The embodiment of the present specification also provides a chip, including a storage unit and a processing unit, wherein the storage unit stores a computer program, and the processing unit executes the data processing method in any of the above embodiments when executing the computer program.

[0159] The embodiments of the present specification also provide a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a computer, the computer executes the data processing method in any of the above embodiments.

[0160] The embodiments of this specification also provide a computer program product including instructions, which, when executed by a computer, enables the computer to execute the data processing method in any of the above embodiments.

[0161] See also Fig.13 In some implementations, a computer device may be provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the data processing method in the above implementation may be implemented.

[0162] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.13 As shown. The computer device includes a processor, a memory, and a communication interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a data processing method is implemented.

[0163] It should be understood that the specific examples herein are only intended to help those skilled in the art to better understand the embodiments of the present specification, rather than to limit the scope of the present invention.

[0164] It can be understood that in the various implementations of this specification, the size of the sequence number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the implementation methods of this specification.

[0165] It can be understood that the various embodiments described in this specification can be implemented individually or in combination, and the embodiments of this specification are not limited to this.

[0166] Unless otherwise specified, all technical and scientific terms used in the embodiments of this specification have the same meaning as those generally understood by those skilled in the art of the technical field of this specification. The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the scope of this specification. The term "and / or" used in this specification includes any and all combinations of one or more related listed items. The singular forms of "a", "above", and "the" used in the embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0167] It can be understood that the processor of the embodiment of this specification can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method implementation can be completed by the hardware integrated logic circuit or software instructions in the processor. The above processor can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiment of this specification can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of this specification can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor are combined and executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0168] It is understood that the memory in the embodiments of this specification may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (programmable ROM, PROM), an erasable programmable read-only memory (erasablePROM, EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory may be a random access memory (RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0169] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this specification.

[0170] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method implementation methods and will not be repeated here.

[0171] The above is only a specific implementation of this specification, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this specification, which should be included in the protection scope of this specification. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A data processing method for a software stack, characterized in that: The method is applied to a virtual machine, wherein the virtual machine is configured with a software stack, wherein the software stack stores value data and first type data corresponding to the value data; wherein the first type data is used to describe the data type of the value data; the value data is pushed into the stack when a push bytecode is executed; and the first type data is determined and pushed into the stack according to the data type of the push bytecode when the push bytecode is executed; the method comprises: In the case of pop bytecode execution, obtaining the first type of data from the software stack; If the first type of data is the same as the second type of data corresponding to the pop bytecode, the value data corresponding to the first type of data in the software stack is popped; wherein the second type of data is determined according to the data type of the pop bytecode.

2. The method according to claim 1, characterized in that The stack space of the software stack is divided into a plurality of first storage units; the first type of data occupies a corresponding first specified number of first storage units in the stack space; the value data occupies a corresponding second specified number of first storage units in the stack space; wherein the first specified number is equal to or different from the second specified number; The step of popping the value data corresponding to the first type of data in the software stack includes: According to the pop pointer, the value data corresponding to the first type of data in the software stack is popped; wherein the pop pointer is determined according to the first specified number of first storage units corresponding to the first type of data after the first type of data in the software stack is popped; The pop pointer is updated based on a second specified number of first storage units corresponding to the value data.

3. The method according to claim 2, characterized in that Before the pop bytecode is executed, the method further includes: When the push bytecode is executed, the value data is pushed into the software stack according to the push pointer; updating the stack pointer according to a second specified number of first storage units corresponding to the value data; Determine the first type of data according to the data type of the pushed bytecode, and push the first type of data into the software stack according to the updated push pointer; Based on a first specified number of first storage units corresponding to the first type of data, the updated stack pointer is updated again.

4. The method according to claim 1, characterized in that: The software stack includes a data stack and a type stack; the value data is pushed onto the data stack when the push bytecode is executed; the first type data is determined according to the data type of the push bytecode and pushed onto the type stack when the push bytecode is executed; The obtaining the first type of data from the software stack includes: Acquire the first type of data from the type stack; The step of popping the value data corresponding to the first type of data in the software stack includes: Pop the value data corresponding to the first type of data in the data stack.

5. The method according to claim 4, characterized in that The stack space of the data stack is divided into a plurality of first storage units, and the stack space of the type stack is divided into a plurality of second storage units; the second storage units are smaller than the first storage units; The value data occupies a second specified number of first storage units in the stack space of the data stack; the first type data occupies a third specified number of second storage units in the stack space of the type stack; The acquiring the first type of data from the type stack includes: Popping the first type of data from the type stack according to the type pop pointer; updating the type pop pointer according to a third specified number of second storage units corresponding to the first type data; Correspondingly, popping the value data corresponding to the first type of data in the data stack includes: According to the data pop pointer, the value data corresponding to the first type of data in the data stack is popped; The data pop pointer is updated according to a second specified number of first storage units corresponding to the value data.

6. The method according to claim 5, characterized in that Before the pop bytecode is executed, the method further includes: When the data push bytecode is executed, the value data is pushed into the data stack according to the data push pointer; updating the data stack pointer according to a second specified number of first storage units corresponding to the value data; Determine the first type of data according to the data type of the pushed bytecode, and push the first type of data into the type stack according to the type push pointer; Based on a third specified number of second storage units corresponding to the first type data, the type stack pointer is updated.

7. The method according to claim 1, characterized in that The method further comprises: If the first type of data is different from the second type of data corresponding to the pop bytecode, the exception handling process is executed.

8. A data processing method for a software stack, characterized in that: Applied to a virtual machine, the virtual machine is configured with a software stack; the method comprises: When the push bytecode is executed, the value data corresponding to the push bytecode is pushed into the software stack; Determine first type data for describing the data type of the value data according to the data type of the pushed bytecode, and push the first type data into the software stack; In the case of pop bytecode execution, obtaining the first type of data from the software stack; If the first type of data is the same as the second type of data corresponding to the pop bytecode, the value data corresponding to the first type of data in the software stack is popped; wherein the second type of data is determined according to the data type of the pop bytecode.

9. A data processing device of a software stack, characterized in that: The invention is applied to a virtual machine, wherein the virtual machine is configured with a software stack, wherein the software stack stores value data and first type data corresponding to the value data; wherein the first type data is used to describe the data type of the value data; the value data is pushed into the stack when a push bytecode is executed; and the first type data is determined and pushed into the stack according to the data type of the push bytecode when the push bytecode is executed; the device comprises: A first pop module, configured to obtain the first type of data from the software stack when the pop bytecode is executed; The second pop module is used to pop the value data corresponding to the first type of data in the software stack if the first type of data is the same as the second type of data corresponding to the pop bytecode; wherein the second type of data is determined according to the data type of the pop bytecode.

10. The device according to claim 9, characterized in that The stack space of the software stack is divided into a plurality of first storage units; the first type of data occupies a corresponding first specified number of first storage units in the stack space; the value data occupies a corresponding second specified number of first storage units in the stack space; wherein the first specified number is equal to or different from the second specified number; The second stack popping module includes: a third pop module, configured to pop the value data corresponding to the first type of data in the software stack according to a pop pointer; wherein the pop pointer is determined according to a first specified number of first storage units corresponding to the first type of data after the first type of data in the software stack is popped; The fourth pop module is used to update the pop pointer based on a second specified number of first storage units corresponding to the value data.

11. The device according to claim 10, characterized in that The device also includes: A first push module, configured to push the value data into the software stack according to a push pointer when the push bytecode is executed; A second stacking module, used for updating the stacking pointer according to a second specified number of first storage units corresponding to the value data; A third stacking module, used for determining the first type of data according to the data type of the stacked bytecode, and stacking the first type of data into the software stack according to the updated stack pointer; A fourth stacking module is used to update the updated stacking pointer again based on a first specified number of first storage units corresponding to the first type of data.

12. The device according to claim 9, characterized in that The software stack includes a data stack and a type stack; the value data is pushed onto the data stack when the push bytecode is executed; the first type data is determined according to the data type of the push bytecode and pushed onto the type stack when the push bytecode is executed; The first stack popping module includes: A fifth popping module, configured to obtain the first type of data from the type stack; The second stack popping module includes: The sixth pop module is used to pop the value data corresponding to the first type of data in the data stack.

13. The device according to claim 12, characterized in that The stack space of the data stack is divided into a plurality of first storage units, and the stack space of the type stack is divided into a plurality of second storage units; the second storage units are smaller than the first storage units; The value data occupies a second specified number of first storage units in the stack space of the data stack; The first type of data occupies a third specified number of second storage units in the stack space of the type of stack; The fifth stack popping module comprises: a seventh pop module, configured to pop the first type of data from the type stack according to a type pop pointer; An eighth popping module, configured to update the type popping pointer according to a third specified number of second storage units corresponding to the first type data; Accordingly, the sixth pop module includes: a ninth pop module, configured to pop value data corresponding to the first type of data in the data stack according to a data pop pointer; The tenth pop module is used to update the data pop pointer according to the second specified number of first storage units corresponding to the value data.

14. The device according to claim 13, characterized in that Before the pop bytecode is executed, the device further includes: A fifth stacking module, configured to, when the data stacking bytecode is executed, stack the value data into the data stack according to a data stacking pointer; a sixth stacking module, configured to update the data stacking pointer according to a second specified number of first storage units corresponding to the value data; a seventh stacking module, used for determining the first type of data according to the data type of the stacked bytecode, and stacking the first type of data into the type stack according to the type stacking pointer; An eighth stacking module is used to update the type stacking pointer based on a third specified number of second storage units corresponding to the first type data.

15. The device according to claim 9, characterized in that The device also includes: The exception handling module is used to execute the exception handling process if the first type of data is different from the second type of data corresponding to the pop bytecode.

16. A data processing device of a software stack, characterized in that: Applied to a virtual machine, the virtual machine is configured with a software stack; the device comprises: A value data stacking module, used for stacking the value data corresponding to the push bytecode into the software stack when the push bytecode is executed; A type data stacking module, used for determining first type data for describing the data type of the value data according to the data type of the stacked bytecode, and stacking the first type data into the software stack; A type data pop module, used for obtaining the first type of data from the software stack when the pop bytecode is executed; A value data pop module is used to pop the value data corresponding to the first type data in the software stack if the first type data is the same as the second type data corresponding to the pop bytecode; wherein the second type data is determined according to the data type of the pop bytecode.

17. A chip comprising a storage unit and a processing unit, wherein the storage unit stores a computer program, characterized in that: When the processing unit executes the computer program, the method according to any one of claims 1 to 7 is implemented.

18. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.