[go: up one dir, main page]

CN112631724B - A bytecode instruction set simplification method and system - Google Patents

A bytecode instruction set simplification method and system Download PDF

Info

Publication number
CN112631724B
CN112631724B CN202011553334.3A CN202011553334A CN112631724B CN 112631724 B CN112631724 B CN 112631724B CN 202011553334 A CN202011553334 A CN 202011553334A CN 112631724 B CN112631724 B CN 112631724B
Authority
CN
China
Prior art keywords
instruction
instructions
method call
static method
list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011553334.3A
Other languages
Chinese (zh)
Other versions
CN112631724A (en
Inventor
石玉平
郑江东
王幼君
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Watchdata Co ltd
Original Assignee
Beijing Watchdata Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Watchdata Co ltd filed Critical Beijing Watchdata Co ltd
Priority to CN202011553334.3A priority Critical patent/CN112631724B/en
Publication of CN112631724A publication Critical patent/CN112631724A/en
Priority to PCT/CN2021/104735 priority patent/WO2022134536A1/en
Application granted granted Critical
Publication of CN112631724B publication Critical patent/CN112631724B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45516Runtime code conversion or optimisation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

The invention discloses a byte code instruction set simplifying method and a byte code instruction set simplifying system, which are applicable to an instruction set based on an operand stack and a register. The invention replaces the existing instruction or combines a plurality of instructions into one macro instruction, thereby reducing the storage space of byte codes and improving the execution performance.

Description

Byte code instruction set simplifying method and system
Technical Field
The invention relates to the technical field of virtual machine instruction sets, in particular to a byte code instruction set simplifying method and a byte code instruction set simplifying system.
Background
The virtual machine is an abstract computer generated by a software application program or an instruction sequence executed by a processor, the virtual machine can execute an instruction set supported by the virtual machine, the instruction set comprises an operand stack-based instruction set and a register-based instruction set, the Java Card instruction set is based on the operand stack, and the Dalvik virtual machine instruction set is based on the register. The method for simplifying the instruction is simultaneously applicable to the two instruction sets.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a byte code instruction set simplifying method and a byte code instruction set simplifying system, so that virtual machine byte codes are simplified, the storage space of the byte codes is reduced, and the execution performance of the byte codes is improved.
In order to achieve the above purpose, the technical scheme adopted by the invention is as follows:
the invention provides a byte code instruction set simplifying method, which is applicable to an instruction set based on an operand stack and a register, and comprises the following steps:
the existing instruction is converted into a macro instruction or a plurality of instructions are combined into a macro instruction.
Further, in the compacting method as described above, the converting the existing instruction into a macro instruction includes:
Step A1, counting the occurrence times of each existing method call instruction in the API in SE applications of different industry types, and putting the existing method call instructions with the times reaching a first preset threshold value into a candidate list;
step A2, analyzing whether each existing method call instruction in the candidate list meets the applicable condition of converting the existing method call instruction into a macro instruction, and putting the existing method call instruction meeting the applicable condition into a list to be converted;
Step A3, placing the list to be converted into a configuration file;
And A4, searching information of the static method from a constant pool based on a constant pool index of the static method call instruction, searching whether a corresponding static method call instruction exists in the configuration file based on the information of the static method, and converting the static method call instruction into a corresponding macro instruction when determining that the static method call instruction exists in the list to be converted.
Further, according to the compacting method, the applicable conditions include:
1) The existing method call instruction is a static method call instruction;
2) The number of times of the static method call instruction reaches the first preset threshold value;
3) The function implementation of the static method call instruction does not depend on other methods or domains, only processes input parameters, feeds back the execution result of the instruction by a method of outputting parameters or returning values, and is implemented in the form of a byte code or a native method.
Further, in the compacting method as described above, the merging the plurality of instructions into one macro instruction includes:
Step B1, counting and analyzing different byte code instruction sets converted by SE applications of different industry types, identifying at least more than two combinable instructions and putting the at least two combinable instructions into a list to be combined;
Step B2, determining whether to combine or not based on the times of occurrence of the at least more than two combinable instructions in the list to be combined;
Step B3, merging the at least more than two combinable instructions with times reaching a second preset threshold value into a macro instruction;
the at least two or more combinable instructions comprise at least two or more instructions which complete a specific function or have the same function.
Further, in the compacting method, the at least two or more instructions for completing the specific function are:
Constant assignment instruction and array member access instruction for implementing array member access for constant index, or
Constant assignment instructions and static method call instructions for implementing static method calls for a constant parameter.
A bytecode instruction set reduction system adapted for operand stack-based and register-based instruction sets, the reduction system being adapted to:
the existing instruction is converted into a macro instruction or a plurality of instructions are combined into a macro instruction.
Further, in the compacting system as described above, the converting the existing instruction into a macro instruction includes:
counting the occurrence times of each existing method call instruction in the API in SE applications of different industry types, and putting the existing method call instructions with the times reaching a first preset threshold value into a candidate list;
Analyzing whether each existing method call instruction in the candidate list meets the applicable condition for converting the current method call instruction into the macro instruction or not, and placing the existing method call instruction meeting the applicable condition into a list to be converted;
placing the list to be converted into a configuration file;
Searching information of the static method from a constant pool based on a constant pool index of the static method call instruction, searching whether a corresponding static method call instruction exists in the configuration file based on the information of the static method, and converting the static method call instruction into a corresponding macro instruction when determining that the static method call instruction exists in the to-be-converted list.
Further, in the compacting system as described above, the applicable conditions include:
1) The existing method call instruction is a static method call instruction;
2) The number of times that the static method call instruction is called reaches the first preset threshold value;
3) The function implementation of the static method call instruction does not depend on other methods or domains, only processes input parameters, feeds back the execution result of the instruction by a method of outputting parameters or returning values, and is implemented in the form of a byte code or a native method.
Further, in the compacting system as described above, the merging the plurality of instructions into one macro instruction includes:
Counting and analyzing different byte code instruction sets converted by SE applications of different industry types, identifying at least more than two instructions which can be combined and putting the instructions into a list to be combined;
determining whether to combine or not based on the times of occurrence of the at least more than two combinable instructions in the list to be combined;
combining the at least more than two combinable instructions with times reaching a second preset threshold value into a macro instruction;
the at least two or more combinable instructions comprise at least two or more instructions which complete a specific function or have the same function.
Further, in the above-mentioned reduced system, the at least two or more instructions for performing a specific function are:
Constant assignment instruction and array member access instruction for implementing array member access for constant index, or
Constant assignment instructions and static method call instructions for implementing static method calls for a constant parameter.
The invention is suitable for instruction sets based on operand stacks and registers, can combine the adjacent instructions with the same function which appear many times into one macro instruction, combine the adjacent instructions which complete the specific function which appear many times into one macro instruction, replace the static method call which appears many times into one macro instruction, and reduce the storage space of byte codes and improve the execution performance by replacing the existing instructions or combining the instructions into one macro instruction.
Drawings
FIG. 1 is a block flow diagram of a method for simplifying a bytecode instruction set according to an embodiment of the present invention;
fig. 2 is a schematic flow chart illustrating a sub-step procedure of a bytecode instruction set compaction method according to an embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and the detailed description.
The macro instruction is an extension of a standard instruction set, has a byte independent operation code, can have one or more operands, and can convert the existing instruction or combine a plurality of instructions into one macro instruction, thereby reducing the storage space of the byte code and improving the execution performance. Because the macro instruction and the normal instruction need to use one operation code, the operation code of the existing instruction set uses one byte and has limited quantity, and excessively increasing the number of instructions also complicates the implementation of an instruction interpreter of the virtual machine, increases the codes of the virtual machine and occupies more storage space. Therefore, the macro instruction is designed with high frequency, and the complexity of the virtual machine implementation is not obviously increased only when the frequency is high, so that the size of the byte code of the application is reduced, and the execution performance of the application is improved.
The method of the present invention is applicable to the Java Card instruction set, the Dalvik instruction set, and the TGoMOS instruction set simultaneously, and is described below in the TGoMOS instruction set. The TGoMOS instruction set, a reduced instruction set of micro-operating system bytecodes, includes six instructions.
The first instruction comprises an operation code, wherein parameter information of the first instruction is implied in the operation code, the first instruction comprises an instruction which is used for implying an operand and a register number in the operation code, an instruction which is used for implying a constant operand in the operation code, an array member access instruction which is used for implying a member type of an array member in the operation code, and an instruction which is used for implying a type and a parameter of a method call in the operation code.
The second instruction is a high-frequency instruction with multiple instruction formats, and comprises a common arithmetic operation instruction with multiple operation formats, an array member access instruction with a 4-bit register format, a create array instruction which implies the member type of the array member into an operation code, and a branch instruction with multiple instruction formats based on equal and unequal comparison results.
The third instruction comprises instructions with different instruction formats based on different parameter numbers, the third instruction comprises static method calling instructions with different instruction formats based on different parameter numbers, virtual method calling instructions with different instruction formats based on different parameter numbers, and private instance method calling instructions with different instruction formats based on different parameter numbers.
The fourth instruction comprises a common data type instruction and an unusual data type instruction, wherein the common data type instruction has various instruction formats, the unusual data type instruction has one instruction format, the common data type instruction comprises a short data type instruction, and the unusual data type instruction comprises an int data type instruction.
The fifth instruction is an instruction with a single-byte constant pool index, and comprises a static method call instruction with the single-byte constant pool index, a virtual method call instruction with the single-byte constant pool index, a static domain access instruction with the single-byte constant pool index and an instance domain access instruction with the single-byte constant pool index.
And a sixth instruction, the sixth instruction being a macro instruction. The sixth instruction comprises a macro instruction formed by converting a static method call instruction and a macro instruction formed by combining a plurality of instructions.
The embodiment of the invention provides a byte code instruction set simplifying method, which is applicable to an operand stack-based instruction set and a register-based instruction set, and comprises a Java Card instruction set, a Dalvik instruction set and the TGoMOS instruction set (such as a sixth instruction), wherein the simplifying method comprises the following steps:
the existing instruction is converted into a macro instruction or a plurality of instructions are combined into a macro instruction.
As shown in fig. 1, in step a, the converting the existing instruction into a macro instruction includes:
Step A1, counting the occurrence times of each static method call instruction in the API in SE applications of different industry types, and putting the static method call instruction with the times reaching a first preset threshold value into a candidate list;
Step A2, analyzing whether each static method call instruction in the candidate list meets the applicable condition for converting the static method call instruction into the macro instruction, and placing the static method call instruction meeting the applicable condition into a list to be converted;
step A3, placing the list to be converted into a configuration file;
And A4, searching information of the static method from a constant pool based on a constant pool index of the static method call instruction, searching whether a corresponding static method call instruction exists in a configuration file based on the information of the static method, and converting the static method call instruction into a corresponding macro instruction when determining that the static method call instruction exists in a list to be converted.
SE applications in different industries such as finance, telecom, traffic and the like are selected, the applications conform to the industry standards of each industry, different APIs are called to realize business logic, different byte code instruction sets are converted, the difficulty is moderate, the coverage and the representativeness of application scenes are sufficient, and then statistical analysis is carried out on the converted byte code instruction sets to identify instructions with high frequency which can be replaced by macro instructions. Whether the application is realized as a macro instruction or not is determined by evaluating the effect after replacement based on the occurrence frequency and the number of instructions to be added, and can be determined by setting a threshold, for example, if a certain static method call instruction appears for more than 100 times in a plurality of typical applications, the static method called by the application is put into a candidate list. Placing a static method call instruction meeting applicable conditions in a candidate list into a to-be-converted list, wherein the applicable conditions comprise 1) a static method in an API, 2) high application call times of the static method, 3) the function realization of the static method is independent of other methods or domains, only input parameters are processed, the result of executing a method feedback instruction for outputting the parameters or returning values is realized in the form of a byte code or a native method. native methods generally refer to native methods implemented in C language or assembly language. Based on the above applicable conditions, the following static method is preferably converted into macro instructions as shown in table 1.
TABLE 1
As can be seen from Table 1, the advantages of converting static method call instructions in the API into macro instructions include high call times of the instructions, improved execution performance of the application, reduced size of byte codes, and reduced storage space of the application, without paying attention to implementation details of the macro instructions. In terms of instruction storage, without a constant pool index, the size of 1 or 2 bytes can be reduced for each occurrence of an instruction, and if the instruction occurs N times, the size of N or 2N bytes can be reduced. In the aspect of instruction execution, the cost of method calling is reduced, and the speed of instruction execution is improved.
As shown in fig. 2, step B, the merging the plurality of instructions into one macro instruction includes:
Step B1, counting and analyzing different byte code instruction sets converted by SE applications of different industry types, identifying at least more than two combinable instructions and putting the at least two combinable instructions into a list to be combined;
step B2, determining whether to combine or not based on the occurrence times of at least more than two combinable instructions in the list to be combined;
Step B3, merging at least more than two combinable instructions with times reaching a second preset threshold value into a macro instruction;
the at least two or more combinable instructions comprise at least two or more instructions which complete a specific function or have the same function.
SE applications in different industries such as finance, telecom, traffic and the like are selected, the applications meet the industry standards, different byte code instruction sets are converted, the difficulty is moderate, the coverage and the representativeness of application scenes are sufficient, and then statistical analysis is carried out on the converted byte code instruction sets to identify two or more combinable instructions. Whether the instruction is implemented as a macro instruction or not is determined by evaluating the replaced effect based on the occurrence frequency and the number of the instructions to be increased, and the determination can be made by setting a threshold, for example, if the combined instruction appears more than 30 times in a plurality of applications, two or more instructions are identified to be implemented as one macro instruction.
For step B, several instructions are included:
1. the instructions for array member accesses that implement constant indexing are combined into macro instructions.
Accessing a specified member of an array is typically implemented by two instructions, namely a constant assignment instruction and a member access instruction. The two instructions on the left are combined into one instruction on the right for implementation as in table 2.
TABLE 2
As can be seen from Table 2, the const instruction can be removed, reducing by 2 or 3 bytes, while the execution performance of the method can be improved by reducing the execution of one instruction.
2. Instructions for implementing a static method call for a constant parameter are combined into a macro instruction.
For example, in the TGoMOS micro-operating system described above, an application call to the API of Table 3 below may throw an exception.
TABLE 3 Table 3
Method name Function of
tgo.core.ISOException.throwIt(short reason) Throwing out abnormality
tgo.core.SystemException.throwIt(short reason) Throwing out abnormality
tgo.core.UserException.throwIt(short reason) Throwing out abnormality
tgo.core.TransactionException.throwIt(short reason) Throwing out abnormality
tgo.core.CryptoException.throwIt(short reason) Throwing out abnormality
The method in Table 3 is generally converted into two instructions, a constant assignment instruction and a throwIt method call instruction of a specified class, which can be combined into a corresponding macro-instruction implementation, as in Table 4.
TABLE 4 Table 4
As can be seen from table 3, if 292 throwIt method calls occur to an application, the memory space can be saved by 292×3=876 bytes, and the execution time can be saved by 292 const instructions.
3. Adjacent functionally identical instructions are combined into a macro instruction, as shown in table 5.
TABLE 5
As can be seen from Table 5, the macro instruction can reduce the execution time of one instruction, in addition to one byte.
In addition, the virtual machine needs to support the implementation of the following macros, as shown in table 6.
TABLE 6
In order to verify that the simplifying method of the invention has the technical effects of saving storage space and execution time, taking typical financial application as an example, the calling times of the following methods are counted. As can be seen from table 7, the memory space is saved by 561 x 2 = 1122 bytes in total for all method calls.
TABLE 7
Method name Number of calls
makeShort 15
getShort 98
setShort 67
arrayCopy 38
arrayCopyNonAtomic 258
arrayCompare 29
arrayFillNonAtomic 56
Totalizing 561
In order to prove that compared with the prior art, the simple method has more outstanding technical effects, the performance of invoking macro instructions by static methods in TGoMOS instruction sets and Java Card instruction sets is compared, other codes are basically consistent except for the codes of a byte code interpreter in a virtual machine system realized by the same chip, the average time of 1000 execution results is counted for comparison, and the comparison result is shown in a table 8.
TABLE 8
It is apparent from Table 8 that the macro instruction performance obtained using the compaction method of the present invention is better.
The invention also provides a byte code instruction set simplifying system which is applicable to an instruction set based on an operand stack and a register, and comprises:
the existing instruction is converted into a macro instruction or a plurality of instructions are combined into a macro instruction.
Converting the existing instruction into a macro instruction includes:
counting the occurrence times of each existing method call instruction in the API in SE applications of different industry types, and putting the existing method call instructions with the times reaching a first preset threshold value into a candidate list;
Analyzing whether each existing method call instruction in the candidate list meets the applicable condition for converting the current method call instruction into the macro instruction or not, and placing the existing method call instruction meeting the applicable condition into a list to be converted;
placing the list to be converted into a configuration file;
Searching information of the static method from a constant pool based on a constant pool index of the static method call instruction, searching whether a corresponding static method call instruction exists in a configuration file based on the information of the static method, and converting the static method call instruction into a corresponding macro instruction when determining that the static method call instruction exists in a list to be converted.
The applicable conditions include:
1) The existing method call instruction is a static method call instruction;
2) The number of times that the static method calling instruction is called reaches a first preset threshold value;
3) The function implementation of the static method call instruction does not depend on other methods or domains, only processes input parameters, feeds back the execution result of the instruction by the method of outputting parameters or returning values, and is implemented in the form of byte codes or native methods.
Combining the plurality of instructions into a macro instruction includes:
Counting and analyzing different byte code instruction sets converted by SE applications of different industry types, identifying at least more than two instructions which can be combined and putting the instructions into a list to be combined;
determining whether to combine or not based on the times of at least more than two combinable instructions in the list to be combined;
Combining at least more than two combinable instructions with times reaching a second preset threshold value into a macro instruction;
the at least two or more combinable instructions comprise at least two or more instructions which complete specific functions or at least two or more instructions with the same functions.
At least two or more instructions for performing a specific function are:
Constant assignment instruction and array member access instruction for implementing array member access for constant index, or
Constant assignment instructions and static method call instructions for implementing static method calls for a constant parameter.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (8)

1.一种字节码指令集精简方法,适用于基于操作数栈和基于寄存器的指令集,其特征在于,所述精简方法包括:1. A bytecode instruction set simplification method, applicable to an operand stack-based and register-based instruction set, characterized in that the simplification method comprises: 将现有指令转换为一条宏指令或者将多条指令合并为一条宏指令,包括以下步骤:Converting an existing instruction into a macro instruction or merging multiple instructions into a macro instruction includes the following steps: 步骤A1、统计API中的各现有方法调用指令在不同行业类型的SE应用中出现的次数,将次数达到第一预设阈值的现有方法调用指令放入候选列表中;Step A1, counting the number of times each existing method call instruction in the API appears in SE applications of different industry types, and putting the existing method call instructions whose number reaches a first preset threshold into a candidate list; 步骤A2、分析所述候选列表中的各现有方法调用指令是否满足转换为宏指令的适用条件,将符合所述适用条件的现有方法调用指令放入待转换列表中;Step A2, analyzing whether each existing method call instruction in the candidate list meets the applicable conditions for conversion into a macro instruction, and putting the existing method call instructions that meet the applicable conditions into a list to be converted; 步骤A3、将所述待转换列表放入一个配置文件中;Step A3, putting the list to be converted into a configuration file; 步骤A4、基于一静态方法调用指令的常量池索引从常量池中查找该静态方法的信息,基于该静态方法的信息从所述配置文件中查找是否存在对应的静态方法调用指令,当确定该静态方法调用指令存在所述待转换列表中时,将该静态方法调用指令转换为对应的宏指令。Step A4, based on the constant pool index of a static method call instruction, searching for information of the static method from the constant pool, and based on the information of the static method, searching from the configuration file whether there is a corresponding static method call instruction, and when it is determined that the static method call instruction exists in the list to be converted, converting the static method call instruction into a corresponding macro instruction. 2.根据权利要求1所述的精简方法,其特征在于,所述适用条件包括:2. The streamlining method according to claim 1, wherein the applicable conditions include: 1)所述现有方法调用指令为静态方法调用指令;1) The existing method calling instruction is a static method calling instruction; 2)所述静态方法调用指令被调用的次数达到所述第一预设阈值;2) The number of times the static method call instruction is called reaches the first preset threshold; 3)所述静态方法调用指令的功能实现不依赖其他方法或域,只对输入参数进行处理,以输出参数或者返回值的方法反馈指令执行的结果,以字节码或native方法的形式实现。3) The function implementation of the static method call instruction does not rely on other methods or domains. It only processes the input parameters and feeds back the result of the instruction execution by outputting parameters or returning values. It is implemented in the form of bytecode or native method. 3.根据权利要求1所述的精简方法,其特征在于,所述将多条指令合并为一条宏指令包括:3. The streamlining method according to claim 1, wherein merging the multiple instructions into one macro instruction comprises: 步骤B1、统计并分析不同行业类型的SE应用转换出的不同的字节码指令集合,识别出至少两条以上可以合并的指令放入待合并列表中;Step B1: Count and analyze different bytecode instruction sets converted from SE applications of different industry types, identify at least two instructions that can be merged and put them into a list to be merged; 步骤B2、基于所述待合并列表中所述至少两条以上可以合并的指令出现的次数,确定是否进行合并;Step B2: determining whether to merge the at least two instructions that can be merged in the to-be-merged list based on the number of times the at least two instructions that can be merged appear; 步骤B3、将次数达到第二预设阈值的所述至少两条以上可以合并的指令合并为一条宏指令;Step B3, merging the at least two instructions that can be merged and whose number of times reaches a second preset threshold into one macro instruction; 其中,所述至少两条以上可以合并的指令包括至少两条以上完成特定功能或者功能相同的指令。The at least two instructions that can be combined include at least two instructions that complete specific functions or have the same functions. 4.根据权利要求3所述的精简方法,其特征在于,所述至少两条以上完成特定功能的指令为:4. The streamlining method according to claim 3, wherein the at least two instructions for completing specific functions are: 用于实现常数索引的数组成员访问的常数赋值指令和数组成员访问指令;或者A constant assignment instruction and an array member access instruction used to implement constant-indexed array member access; or 用于实现一个常数参数的静态方法调用的常数赋值指令和静态方法调用指令。A constant assignment instruction and a static method call instruction used to implement a static method call with a constant parameter. 5.一种字节码指令集精简系统,适用于基于操作数栈和基于寄存器的指令集,其特征在于,所述精简系统用于:5. A bytecode instruction set condensing system, applicable to operand stack-based and register-based instruction sets, characterized in that the condensing system is used to: 将现有指令转换为一条宏指令或者将多条指令合并为一条宏指令,包括:Convert existing instructions into a macro instruction or combine multiple instructions into a macro instruction, including: 统计API中的各现有方法调用指令在不同行业类型的SE应用中出现的次数,将次数达到第一预设阈值的现有方法调用指令放入候选列表中;Counting the number of times each existing method call instruction in the API appears in SE applications of different industry types, and putting the existing method call instructions whose number reaches a first preset threshold into a candidate list; 分析所述候选列表中的各现有方法调用指令是否满足转换为宏指令的适用条件,将符合所述适用条件的现有方法调用指令放入待转换列表中;Analyze whether each existing method call instruction in the candidate list meets the applicable conditions for conversion into a macro instruction, and put the existing method call instructions that meet the applicable conditions into a list to be converted; 将所述待转换列表放入一个配置文件中;Put the list to be converted into a configuration file; 基于一静态方法调用指令的常量池索引从常量池中查找该静态方法的信息,基于该静态方法的信息从所述配置文件中查找是否存在对应的静态方法调用指令,当确定该静态方法调用指令存在所述待转换列表中时,将该静态方法调用指令转换为对应的宏指令。Based on a constant pool index of a static method calling instruction, information of the static method is searched from a constant pool, and based on the information of the static method, a search is made from the configuration file to determine whether a corresponding static method calling instruction exists. When it is determined that the static method calling instruction exists in the list to be converted, the static method calling instruction is converted into a corresponding macro instruction. 6.根据权利要求5所述的精简系统,其特征在于,所述适用条件包括:6. The streamlined system according to claim 5, wherein the applicable conditions include: 1)所述现有方法调用指令为静态方法调用指令;1) The existing method calling instruction is a static method calling instruction; 2)所述静态方法调用指令被调用的次数达到所述第一预设阈值;2) The number of times the static method call instruction is called reaches the first preset threshold; 3)所述静态方法调用指令的功能实现不依赖其他方法或域,只对输入参数进行处理,以输出参数或者返回值的方法反馈指令执行的结果,以字节码或native方法的形式实现。3) The function implementation of the static method call instruction does not rely on other methods or domains. It only processes the input parameters and feeds back the result of the instruction execution by outputting parameters or returning values. It is implemented in the form of bytecode or native method. 7.根据权利要求5所述的精简系统,其特征在于,所述将多条指令合并为一条宏指令包括:7. The streamlined system according to claim 5, wherein the step of merging multiple instructions into one macro instruction comprises: 统计并分析不同行业类型的SE应用转换出的不同的字节码指令集合,识别出至少两条以上可以合并的指令放入待合并列表中;Count and analyze different bytecode instruction sets converted by SE applications of different industry types, identify at least two instructions that can be merged and put them into the list to be merged; 基于所述待合并列表中所述至少两条以上可以合并的指令出现的次数,确定是否进行合并;Determining whether to merge based on the number of occurrences of the at least two instructions that can be merged in the to-be-merged list; 将次数达到第二预设阈值的所述至少两条以上可以合并的指令合并为一条宏指令;Merging the at least two instructions that can be merged, the number of times of which reaches a second preset threshold, into one macro instruction; 其中,所述至少两条以上可以合并的指令包括至少两条以上完成特定功能或者功能相同的指令。The at least two instructions that can be combined include at least two instructions that complete specific functions or have the same functions. 8.根据权利要求7所述的精简系统,其特征在于,所述至少两条以上完成特定功能的指令为:8. The streamlined system according to claim 7, wherein the at least two instructions for completing specific functions are: 用于实现常数索引的数组成员访问的常数赋值指令和数组成员访问指令;或者A constant assignment instruction and an array member access instruction used to implement constant-indexed array member access; or 用于实现一个常数参数的静态方法调用的常数赋值指令和静态方法调用指令。A constant assignment instruction and a static method call instruction used to implement a static method call with a constant parameter.
CN202011553334.3A 2020-12-24 2020-12-24 A bytecode instruction set simplification method and system Active CN112631724B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011553334.3A CN112631724B (en) 2020-12-24 2020-12-24 A bytecode instruction set simplification method and system
PCT/CN2021/104735 WO2022134536A1 (en) 2020-12-24 2021-07-06 Bytecode instruction set simplification method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011553334.3A CN112631724B (en) 2020-12-24 2020-12-24 A bytecode instruction set simplification method and system

Publications (2)

Publication Number Publication Date
CN112631724A CN112631724A (en) 2021-04-09
CN112631724B true CN112631724B (en) 2025-01-07

Family

ID=75324548

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011553334.3A Active CN112631724B (en) 2020-12-24 2020-12-24 A bytecode instruction set simplification method and system

Country Status (2)

Country Link
CN (1) CN112631724B (en)
WO (1) WO2022134536A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112631723A (en) * 2020-12-24 2021-04-09 北京握奇数据股份有限公司 Byte code simplified instruction set and resource limited device of micro-operation system
CN112631724B (en) * 2020-12-24 2025-01-07 北京握奇数据股份有限公司 A bytecode instruction set simplification method and system
CN114428639B (en) * 2021-12-24 2024-11-15 北京握奇数据股份有限公司 A method and system for simplifying bytecode instruction set
CN115454437B (en) * 2022-08-01 2025-09-30 峰岧科技(上海)有限公司 Code compilation method, device, equipment and medium
CN116466995B (en) * 2023-06-16 2024-06-11 紫光同芯微电子有限公司 Instruction based on compound instruction and operand optimization method and device thereof

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040015912A1 (en) * 2000-11-20 2004-01-22 Bottomley Thomas Mark Walter Method of byte code quickening: quick instructions for method invocation
US7039904B2 (en) * 2001-08-24 2006-05-02 Sun Microsystems, Inc. Frameworks for generation of Java macro instructions for storing values into local variables
US6988261B2 (en) * 2001-08-24 2006-01-17 Sun Microsystems, Inc. Frameworks for generation of Java macro instructions in Java computing environments
US7058934B2 (en) * 2001-08-24 2006-06-06 Sun Microsystems, Inc. Frameworks for generation of Java macro instructions for instantiating Java objects
US8069340B2 (en) * 2008-02-08 2011-11-29 Via Technologies, Inc. Microprocessor with microarchitecture for efficiently executing read/modify/write memory operand instructions
CN101316201A (en) * 2008-07-18 2008-12-03 中国工商银行股份有限公司 Multi-terminal mode script device and data processing method and automatization test system
US20130013895A1 (en) * 2011-07-06 2013-01-10 Fs-Semi Co., Ltd. Byte-oriented microcontroller having wider program memory bus supporting macro instruction execution, accessing return address in one clock cycle, storage accessing operation via pointer combination, and increased pointer adjustment amount
CN104346132B (en) * 2013-08-08 2017-06-09 上海复旦微电子集团股份有限公司 It is applied to the control device and smart card virtual machine of smart card virtual machine operation
CN105892944B (en) * 2016-03-30 2019-11-12 深圳忆联信息系统有限公司 A kind of information processing method and electronic equipment
CN107358125B (en) * 2017-06-14 2020-12-08 北京多思科技工业园股份有限公司 Processor
CN112631724B (en) * 2020-12-24 2025-01-07 北京握奇数据股份有限公司 A bytecode instruction set simplification method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"手持式气体检测仪的设计";张中锋;《硕士电子期刊》;20130715(第2013年第07期期);第7页 *

Also Published As

Publication number Publication date
WO2022134536A1 (en) 2022-06-30
CN112631724A (en) 2021-04-09

Similar Documents

Publication Publication Date Title
CN112631724B (en) A bytecode instruction set simplification method and system
CN109885614B (en) Data synchronization method and device
CN110046086B (en) Expected data generation method and device for test and electronic equipment
CN114428639B (en) A method and system for simplifying bytecode instruction set
CN112631722A (en) Byte code instruction set simplifying method and system
CN109656986A (en) A kind of householder method that business datum summarizes, device and electronic equipment
EP3108400B1 (en) Virus signature matching method and apparatus
US7725692B2 (en) Compact representation of instruction execution path history
CN111611056B (en) Data processing method, device, computer equipment and storage medium
CN116680140A (en) Verification method, system, device and storage medium for processor
CN111861920B (en) A median filtering method and system
CN117331741A (en) Data verification method, processor and electronic equipment
CN115840618B (en) Access method and device for virtual machine simulation equipment register in hypervisor
CN115016843B (en) High-precision binary code similarity comparison method
US8225284B2 (en) Methods and systems for testing software development
CN114840847B (en) Method, device, medium and equipment for safely creating threads in a target process
CN116450134A (en) Configurable front-end control verification controller generation method and system
CN115291839A (en) Localization method of virtual method type API of JAVA card, electronic equipment and medium
CN113986980A (en) Data sorting method and device
CN114443672A (en) Multi-version concurrency control method, device, equipment and storage medium
TWI661355B (en) Context-aware data structure reverse engineering system and method thereof
CN113449232A (en) Data processing method, device, equipment and storage medium
EP0297890B1 (en) Apparatus and method for data induced condition signaling
US11720619B2 (en) Filtering based on a range specifier
CN113590194B (en) Method for transplanting and cutting execution components crossing instruction sets

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant