Instruction construction method, apparatus and device, and readable storage medium

By obtaining and parsing the bit fields in the feature identifier of the bytecode instruction, the feature information is directly obtained to construct the machine code instruction, which solves the problem of high complexity of feature information identification in the existing technology and improves the efficiency of instruction construction.

CN118535223APending Publication Date: 2024-08-23龙芯中科(合肥)技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410509975.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-25
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In the existing technology, the feature information identification process for bytecode instructions is highly complex, resulting in low instruction construction efficiency.

Method used

By obtaining the characteristic identifier of the bytecode instruction, searching and parsing the bit field in the characteristic identifier in the preset array, the target characteristic information is obtained, which is used to construct the machine code instruction.

Benefits of technology

The feature information acquisition process is simplified, the efficiency of instruction construction is improved, and the recognition complexity is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535223A
    Figure CN118535223A
Patent Text Reader

Abstract

The embodiment of the invention provides an instruction construction method and device, equipment and a readable storage medium. Relates to the technical field of computers. The method comprises the following steps: acquiring a byte code instruction, and searching a feature identifier corresponding to the byte code instruction in a preset array; the feature identifier is used for identifying the processor architecture and comprises a plurality of bit fields; the bit field records feature information corresponding to the byte code instruction; analyzing each corresponding target bit field in the feature identifier, and respectively obtaining target feature information correspondingly recorded in the target bit fields; and determining an instruction construction operation corresponding to the target feature information to obtain a machine code instruction corresponding to the byte code instruction. According to the method and the device, the feature information is recorded in the bit field in the feature identifier, so that the feature information can be quickly identified to carry out instruction construction, and the instruction construction efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure belongs to the field of computer technology, and specifically relates to an instruction construction method, device, electronic device and readable storage medium. Background Art

[0002] The process of constructing instructions based on bytecode instructions to obtain machine code instructions can be executed by a compiler. The compiler needs to construct corresponding instructions based on various feature information of the bytecode instructions, such as the instruction format type.

[0003] At present, each type of feature information needs to be identified one by one. The identification and acquisition of each type of feature information requires judgment and processing based on a large number of sentences before it can be completed.

[0004] Therefore, the current solution requires that a variety of feature information be identified one by one, and each identification process is highly complex, making the process of acquiring feature information cumbersome, resulting in low efficiency in instruction construction. Summary of the invention

[0005] The present disclosure aims to provide an instruction construction method, device, electronic device and readable storage medium, which at least solves the problem in the prior art that the instruction construction efficiency is low due to the need to identify feature information one by one and the high complexity of the identification process of each feature information.

[0006] In order to solve the above technical problems, the present disclosure is implemented as follows:

[0007] In a first aspect, an embodiment of the present disclosure provides an instruction construction method, the method comprising:

[0008] Obtain a bytecode instruction, and search a preset array for a feature identifier corresponding to the bytecode instruction; the feature identifier is used to identify a processor architecture, including a plurality of bit fields; the bit fields record feature information corresponding to the bytecode instruction;

[0009] Parse each target bit field corresponding to the feature identifier to obtain target feature information recorded in the target bit field;

[0010] An instruction construction operation corresponding to the target characteristic information is determined to obtain a machine code instruction corresponding to the bytecode instruction.

[0011] In a second aspect, an embodiment of the present disclosure further provides an instruction construction device, the device comprising:

[0012] A feature identification module, used to obtain a bytecode instruction, and search a preset array for a feature identification corresponding to the bytecode instruction; the feature identification is used to identify a processor architecture, including a plurality of bit fields; the bit fields record feature information corresponding to the bytecode instruction;

[0013] A bit field reading module, used for parsing each target bit field corresponding to the feature identifier, and obtaining the target feature information recorded in the target bit field;

[0014] The instruction construction module is used to determine the instruction construction operation corresponding to the target feature information to obtain the machine code instruction corresponding to the bytecode instruction.

[0015] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0016] In a fourth aspect, an embodiment of the present disclosure further provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0017] In the disclosed embodiment, by obtaining the bytecode instruction, the feature identifier corresponding to the bytecode instruction is searched in the preset array; the feature identifier is used to identify the processor architecture, including multiple bit fields; the bit field records the feature information corresponding to the bytecode instruction; each target bit field corresponding to the feature identifier is parsed to obtain the target feature information recorded in the target bit field; the instruction construction operation corresponding to the target feature information is determined to obtain the machine code instruction corresponding to the bytecode instruction. The feature information of the bytecode instruction can be directly recorded in the feature identifier corresponding to the bytecode instruction. When constructing the instruction, only the feature identifier needs to be read to obtain the feature information and construct the instruction based on the feature information, thereby improving the efficiency of instruction construction. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 is a flowchart of a method for constructing an instruction provided by an embodiment of the present disclosure;

[0019] Figure 2 is a schematic diagram of a feature identifier provided by an embodiment of the present disclosure;

[0020] Figure 3 is a flowchart of another instruction construction method provided by an embodiment of the present disclosure;

[0021] Figure 4 is a schematic diagram of a machine code encoding format provided by an embodiment of the present disclosure;

[0022] Figure 5 is a block diagram of an instruction construction device provided by an embodiment of the present disclosure;

[0023] Figure 6 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] The technical solutions in the embodiments of the present disclosure will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present disclosure.

[0025] Figure 1 is a flowchart of a method for constructing an instruction provided by an embodiment of the present disclosure, such as Figure 1 As shown, the method may include:

[0026] Step 101, obtaining a bytecode instruction, and searching a preset array for a feature identifier corresponding to the bytecode instruction; the feature identifier is used to identify a processor architecture, and includes a plurality of bit fields; the bit fields record feature information corresponding to the bytecode instruction;

[0027] It should be noted that the construction of machine code instructions based on bytecode instructions can be completed by a compiler, which can be a Just In Time (JIT) compiler. Whether the backend of the compiler can efficiently identify the instruction set will affect the efficiency of the backend compiler's binary encoding of different instructions. Since the JIT compiler completes the compilation and operation of the program at the same time during the program running process, the compilation efficiency will ultimately affect the program running.

[0028] In addition, in addition to constructing instructions, the compiler backend also needs to identify other additional information to organize and manage instructions, such as garbage collection (GC) information and memory access information. The compiler backend needs to identify and process this type of information of instructions.

[0029] In the disclosed embodiment, the bytecode instruction may exist in a bytecode instruction set, and the instruction set includes multiple bytecode instructions, and the bytecode instruction is obtained from the instruction set. The feature identifier corresponding to the currently obtained bytecode instruction is searched in the preset array. The preset array refers to an array that pre-stores the correspondence between the bytecode instructions and the corresponding feature identifiers, and the feature identifier corresponding to the bytecode instruction can be found according to a bytecode instruction.

[0030] Among them, the feature identifier can be used to identify the processor architecture. The feature identifier can be a field, which is composed of multiple bit fields. Different bit fields record different feature information. The feature information recorded in multiple bit fields can constitute the overall feature information of the bytecode instruction.

[0031] Figure 2 is a schematic diagram of a feature identifier provided by an embodiment of the present disclosure; Figure 2 As shown, Figure 2 The feature identifier is a field with a width of 32 bits, and the feature identifier includes bit field 201, bit field 202, and bit field 303. Bit field 201, bit field 202, and bit field 303 can record different information respectively. It can be understood that Figure 2 The feature identification field width, the number of bit fields of the feature identification, and the width of each bit field are only examples. The actual feature identification field width, the number of bit fields, and the bit field width can be set according to the actual requirements of instructions in different processor architectures.

[0032] Step 102, parsing each target bit field corresponding to the feature identifier, and obtaining the target feature information recorded in the target bit field;

[0033] In the disclosed embodiment, the feature identifier corresponding to the bytecode instruction is parsed, the bit field in the feature identifier field is read, and then the feature information recorded in the bit field is obtained. Each bit field in the feature identifier field records one characteristic information, and multiple bit fields respectively record their own feature information.

[0034] Continue to refer Figure 2 As shown, the bit width of the first bit field 201 is 5 bits, and the recorded content, i.e., the bit field code, can be "01011". The bit width of the second bit field 202 is 2 bits, and the bit field code can be "11". On this basis, the characteristic information indicated by different bit field codes can be pre-set, and then the corresponding characteristic information can be found according to the bit field code of the current bit field. A characteristic information array can be set for each bit field, and in the characteristic information array, different bit field codes are corresponded to characteristic information. For example, if the width of the bit field is 2 bits, the bit field can be one of the four bit field codes "00", "01", "10", and "11", and the characteristic information can be A, B, C, and D; then the characteristic information array can include these four codes and the corresponding four characteristic information, i.e., "00-A", "01-B", "10-C", and "11-D". Specifically, when the bit field code is 01, it is represented as characteristic information B.

[0035] Step 103: determine the instruction construction operation corresponding to the target feature information to obtain the machine code instruction corresponding to the bytecode instruction.

[0036] In the disclosed embodiment, after determining the characteristic information recorded in the bit field, the instruction construction operation corresponding to the characteristic information is determined, and the instruction construction operation is performed on the bytecode instruction to obtain the machine code instruction. For example, since the bytecode instructions in the instruction set can be divided according to the operation unit where the instruction is located, for example, it can be divided into: non-floating point (integer instructions), scalar floating point (floating point processing unit (FPU, Floating Point Unit), vector instructions (vector operation unit). By determining whether the instruction is one of the above, the machine code instruction can be assigned to the corresponding operation unit to improve the instruction execution efficiency.

[0037] Therefore, the characteristic information can be of floating point type, and the instruction can be assigned to the operation unit according to the characteristic information. The characteristic information can also be information about the instruction format. This instruction format information indicates that the specific parameters of the bytecode instruction need to be located at the specific position of the machine code instruction. Then the instruction construction operation is: to configure the parameters based on the parameter position relationship indicated by the instruction format information to complete the construction of the machine code instruction. The characteristic information can also be other more information, as well as more corresponding instruction construction operations, which will not be repeated here.

[0038] In summary, in the disclosed embodiment, by obtaining the bytecode instruction, the feature identifier corresponding to the bytecode instruction is searched in the preset array; the feature identifier is used to identify the processor architecture, including multiple bit fields; the bit field records the feature information corresponding to the bytecode instruction; each target bit field corresponding to the feature identifier is parsed to obtain the target feature information recorded in the target bit field; the instruction construction operation corresponding to the target feature information is determined to obtain the machine code instruction corresponding to the bytecode instruction. The feature information of the bytecode instruction can be directly recorded in the feature identifier corresponding to the bytecode instruction. When constructing the instruction, only the feature identifier needs to be read to obtain the feature information and construct the instruction based on the feature information, thereby improving the efficiency of instruction construction.

[0039] Figure 3 This is an instruction construction method provided by an embodiment of the present invention. Figure 3 include:

[0040] Step 301, obtaining a bytecode instruction, and searching a preset array for a feature identifier corresponding to the bytecode instruction; the feature identifier is used to identify a processor architecture, and includes a plurality of bit fields; the bit fields record feature information corresponding to the bytecode instruction;

[0041] Step 302, parsing each target bit field corresponding to the feature identifier, and obtaining the target feature information recorded in the target bit field;

[0042] Step 303: determine the instruction construction operation corresponding to the target feature information to obtain the machine code instruction corresponding to the bytecode instruction.

[0043] For details of the above steps 301-303, please refer to Figure 1 The contents of the embodiments will not be repeated here.

[0044] Optionally, step 301: obtaining a bytecode instruction, and searching a preset array for a feature identifier corresponding to the bytecode instruction may include sub-steps 3011-3013:

[0045] Sub-step 3011, obtaining parameters contained in the bytecode instruction;

[0046] Sub-step 3012, determining the distribution interface corresponding to the bytecode instruction according to the type of the parameter;

[0047] Sub-step 3013: searching the preset array for a feature identifier corresponding to the bytecode instruction through the distribution interface.

[0048] In the embodiment of the present disclosure, a bytecode instruction is obtained, and a parameter carried in the bytecode instruction is determined, and the parameter may be an operator. An operator is an operator, and an operator may include multiple types such as arithmetic operators, shift operators, bit operators, assignment operators, and logical operators, etc., wherein each operator may also include multiple different operators, for example, an arithmetic operator may include operators such as addition, subtraction, multiplication, and division.

[0049] The compiler can first distribute the bytecode instruction to the distribution interface corresponding to the operator type according to the operator type. Different operator types correspond to different distribution interfaces, and then the distribution interface further determines the feature identifier corresponding to the current bytecode instruction according to the operator name. The feature identifier can be searched in a preset array storing parameter names and corresponding feature identifiers according to the operator name.

[0050] For example, an addition instruction (ADD instruction) in a bytecode instruction can have two operands and generate one new addition result data. The operator is an addition operator, which belongs to an arithmetic operator. Then the R_R_R interface (the distribution interface of three registers) can be selected. The R_R_R interface can index the feature identifier corresponding to the ADD instruction from the preset array storing the feature identifiers according to the operator name "ADD".

[0051] In the implementation of the embodiment of the present disclosure, after obtaining the bytecode instruction, the bytecode instruction is first distributed to the corresponding distribution interface by determining the parameter type in the bytecode instruction, and the distribution interface further determines the feature identifier according to the parameter name. Determining the feature identifier step by step based on the parameter type and the parameter name can improve the efficiency of determining the feature identifier corresponding to the bytecode instruction.

[0052] Optionally, before the step 301: obtaining a bytecode instruction and searching a preset array for a feature identifier corresponding to the bytecode instruction, steps A1-A2 are also included:

[0053] Step A1, dividing the field corresponding to the processor architecture to obtain multiple bit fields;

[0054] Step A2, encoding the multiple bit fields respectively according to the established attribute information to obtain characteristic information; the attribute information includes at least one of the following types: floating point information, update register information, memory access information, instruction format information, and debugging information.

[0055] In the disclosed embodiment, before obtaining the corresponding feature identifier according to the bytecode instruction, the feature identifier needs to be created. First, the field corresponding to the feature identifier is divided to obtain multiple bit fields, and the specific number of bit fields and the width of the bit fields can be adjusted as needed.

[0056] According to the attribute information of the bytecode instruction, multiple bit fields are encoded respectively. The attribute information of the bytecode instruction is a predetermined attribute determined when each bytecode instruction is designed, and the attribute information of each bytecode instruction can be obtained through the processor instruction manual. It is understandable that the attribute information contained in the instructions corresponding to different processor architectures can be at least partially the same. For example, the instructions corresponding to two different processor architectures can both have several specific attribute information. The attribute information can be: floating point information, update register information, memory access information, instruction format information, and debugging information. The bytecode instruction can have at least one type of attribute information mentioned above. It is understandable that the attribute information can also be other more information, and the above attribute information can only be an example of some of the more critical attribute information. It is understandable that the above attribute information can be used not only for the construction of instructions, but also for the management of instructions by the compiler. For example, the compiler can update and manage the registers allocated to each instruction according to the update register information, and manage some specific types of variables, such as tracking and managing GC information.

[0057] The number of bit fields obtained by dividing the fields of the feature identifier may be greater than or equal to the number of attribute information types. Since a bit field may be used to record only one type of attribute information, when the number of bit fields is less than the number of attribute information types, the feature identifier may not be able to fully record key attribute information.

[0058] Optionally, there is a preset mapping relationship between the type of the attribute information and the bit field; Step A2: the step of encoding the multiple bit fields respectively according to the established attribute information to obtain the characteristic information includes steps A21-A22:

[0059] Step A21, determining target bit fields corresponding to the attribute information respectively in the multiple bit fields according to the type of the attribute information and the preset mapping relationship;

[0060] Step A22, encoding the target bit field to obtain characteristic information recorded in the target bit field.

[0061] In the disclosed embodiment, after the field of the feature identifier is divided into multiple bit fields, a mapping relationship between different bit fields and attribute information can be established, that is, a specific bit field is determined to record a specific type of attribute information. Then, based on this mapping relationship, the corresponding target bit field is determined in the multiple bit fields according to the type of the current attribute information.

[0062] After determining the target bit field corresponding to the current attribute information, the target bit field is encoded according to the content of the attribute information. Each attribute information type may also correspond to attribute information with different contents. For example, attribute information A may belong to the type of "whether floating point", and further, the specific content of attribute information A may be: non-floating point, scalar floating point or vector instruction. Then, based on the type of attribute information A, the target bit field is determined, and then based on the specific content of attribute information A, how to encode the target bit field is determined.

[0063] The target bit field encoding may be based on the correspondence between the encoding mode and the content of the attribute information, as shown in Table 1:

[0064] Table 1

[0065] Bit field encoding: 0 Bit field encoding: 1 Bit field encoding: 2 Bit field encoding: 3 Non-floating point Scalar floating point Vector Instructions

[0066] Since the type of "whether floating point" can refer to three situations, the width of the target bit field can be 2 bits. Encoding 0 is 00, encoding 1 is 01, encoding 2 is 10, and encoding 3 is 11. According to the above Table 1, how to encode the target bit field can be determined according to the content of the attribute information.

[0067] When the type of attribute information is "update register information", "update register information" indicates whether the instruction will update the target register. The attribute information under this type of "update register information" may correspond to specific contents such as not updating, updating integer registers, updating floating point registers, updating condition code registers (CCR, Condition Code Register) and updating carry feedback shift registers (FCSR, Feed Back With Carry Shift Register). Similarly, as shown in Table 2 below:

[0068] Table 2

[0069]

[0070] The attribute information of the instruction corresponding to the specific processor architecture may only have part of the content in the above Table 2. For example, the Advanced RISC Machines (ARM) architecture does not involve updating the FCSR.

[0071] When the attribute information type is "memory access information", the compiler can identify and distinguish the memory type accessed by the instruction through the memory access information. Similarly, as shown in Table 3 below:

[0072] Table 3

[0073]

[0074] The memory access information can be encoded by a bit field with a width of 3 bits. In Table 3, the first bit encodes whether ihsoaib is a memory access instruction. If it is a memory access instruction, the second bit encodes whether the memory access type of ihsoaib is Store or Load type, and the third bit encodes whether soaib is an integer instruction or a floating point type.

[0075] When the type of attribute information is "instruction format information", the instruction format information may be different in different processor architecture instruction sets. For example, when the processor architecture is a dragon architecture, the instruction format information may be as shown in Table 4 below:

[0076] Table 4

[0077]

[0078]

[0079] As shown in Table 4, when the content of the instruction format information is large, the instruction format information can be encoded by a bit field with a width of 8 bits. Each instruction format type in Table 4 corresponds to the encoding one by one.

[0080] In addition, the debug information bit field can also be included. The debug information bit field mainly adds some attribute information for debugging and is only used in debug mode. This part of the bit field is added according to actual needs.

[0081] Optionally, the bytecode instruction includes instruction format information; the step of determining the instruction construction operation corresponding to the target feature information includes:

[0082] Determine instruction format information corresponding to the bytecode instruction according to the target characteristic information; the instruction format information is used to indicate a bit field corresponding to a parameter in the bytecode instruction in the machine code instruction, the parameter including an operand;

[0083] Based on the instruction format information, the parameters in the bytecode instruction are integrated into corresponding bit fields in the machine code instruction to obtain a machine code instruction corresponding to the bytecode instruction.

[0084] In the disclosed embodiment, when the attribute information includes instruction format information, the characteristic information obtained by encoding the bit field according to the attribute information will include the encoding of the instruction format information. The instruction format information corresponding to the bytecode instruction can be determined based on the characteristic information. Among them, the instruction format information represents the bit field corresponding to the parameter in the bytecode instruction in the machine code instruction, and the parameter can be an operand. An operand refers to a numerical value or data used by an operator in a computer instruction for digital operations. An operand can indicate the source of the data required for the execution of an instruction, which can be a variable or a constant.

[0085] Since the number of operands of different instructions of the processor may be different, the compiler also needs to design the instruction emission function interface of the compiler backend according to the number of operands of different instructions. The instruction emission function interface is shown in Table 5 below. In the compiler backend, when constructing and emitting a machine code instruction, it can be implemented through a function interface similar to that in Table 5.

[0086] Table 5

[0087]

[0088]

[0089] For example, a bytecode instruction may be an addition instruction (addi.d reg1, reg2, 8), which may implement the operation of adding 8 to a long type variable. The operands of the instruction include an immediate value 8 and a variable, and a variable for storing the addition result. There are three operands, including two register type operands, namely reg1 and reg2, and one immediate operand, where reg1 is a variable for storing the addition, and reg2 is a variable to be added to the immediate value. The machine code instruction construction of the addition instruction can be performed through the following steps:

[0090] Step S1, first, the feature identifier of the addition instruction can be "...0100101...", and the feature identifier can be the feature identifier corresponding to the Dragon architecture. The feature information recorded by the bit field encoding "0100101" can be the instruction format information "IF_2RI_i12" in Table 4 above.

[0091] Step S2, when constructing the machine code of the addition instruction according to the operands and variables in the addition instruction, it is necessary to determine the corresponding function interface, that is, the function interface "emitIns_R_R_I(instruction ins, regNumberreg1, regNumber reg2, int imm)" in Table 5.

[0092] Step S3, after entering the emitIns_R_R_I function interface, the bit field code "0100101" used to record the instruction format information can be identified according to the feature identifier "...0100101...", "instructionins" is the feature identifier, and the specific instruction format information is determined according to the bit field code "0100101". Combined with Table 4, the instruction format information corresponding to "0100101" can be "IF_2RI_i12". According to "IF_2RI_i12", the encoding format of the corresponding machine code can be determined in a specific processor architecture, that is, the bit field corresponding to the parameter of the bytecode instruction in the machine code instruction can be determined.

[0093] Step S4, integrate the parameters of the bytecode instruction into the bit field of the machine code instruction, and after integration, the machine code instruction (funct, 8, reg1, reg2) can be obtained. Among them, when the length of the machine code instruction is 32 bits, the funct bit field can be 0×02c00000, reg1 can be 5, indicating that the register numbered 5 is used to store the addition result. Reg2 can be 4, indicating that the register numbered 4 stores the variable added to the immediate value 8, and finally the machine code instruction (0×02c00000, 1000, 100, 101) is obtained.

[0094] For example, Figure 4 is a schematic diagram of the machine code encoding format provided by the embodiment of the present disclosure; Figure 4 As shown in the figure, bit field 401 is used to configure parameter 1 (to store the addition result), bit field 402 is used to configure parameter 2 (the variable to be added to the immediate value), bit field 403 is used to configure parameter 3 (immediate value 8), and bit field 404 is the funct bit field. According to the instruction format information "IF_2RI_i12", the parameters reg1, parameter 2, and parameter 3 are configured to Figure 4 The construction of the instruction can be completed in the bit field of the machine code. This avoids the current recognition of the machine code encoding format, which requires a large number of statements for judgment and processing, such as performing a large number of logical operations including logical AND, XOR, logical OR, logical NOT, etc., and also requires checking whether the operand is valid, etc.

[0095] Optionally, the step of dividing the field of the feature identifier to obtain multiple bit fields includes:

[0096] According to the number of types of the attribute information, adjusting the field width of the feature identifier;

[0097] According to the attribute information of each type, determining the bit field width corresponding to each bit field in the field width;

[0098] There is a positive correlation between the number of types of the attribute information and the field width of the feature identifier, and there is a positive correlation between the number of attribute information of each type and the bit field width.

[0099] In the embodiment of the present disclosure, since one type of attribute information can be recorded in one bit field, when there are many types of attribute information, the field width of the feature identifier can be adjusted so that there is enough field width to record more types of attribute information.

[0100] Furthermore, since each type of attribute information may include multiple specific contents of attribute information, in order to distinguish attribute information of different contents in one bit field, the width of the bit field corresponding to the type may be determined according to the number of attribute information of each type, so that when the number of attribute information of a specific type is large, there is enough bit field width to record attribute information of more contents. For example, the type of "whether floating point" may refer to three situations, and a bit field with a width of 2 bits can meet the encoding needs.

[0101] There is a positive correlation between the number of attribute information types and the field width of the feature identifier, and there is a positive correlation between the number of attribute information of each type and the bit field width. That is, the more the number of attribute information types, the wider the field width of the feature identifier can be; the more the number of attribute information of each type, the wider the corresponding bit field width can be.

[0102] For example, when the number of attribute information types is 3, including floating point information, update register information, and memory access information, the field width can be 8 bits; when the number of attribute information types is 2, including floating point information and update register information, the field width can be 5 bits.

[0103] When adjusting the bit field width corresponding to the bit field, it is necessary to adjust it according to the number of attribute information of each type. Generally speaking, the number of attribute information of each type is fixed. For example, when the attribute information in the floating point information type includes non-floating point and scalar floating point, the bit field width of 2 can meet the encoding needs. When it includes non-floating point, scalar floating point and vector instructions, the bit field width needs to be adjusted to 3.

[0104] Optionally, step 302: reading the bit field in the feature identifier to obtain the feature information recorded in the bit field includes:

[0105] Receiving a characteristic identification reading command; the characteristic identification reading command carries a bit to be read;

[0106] According to the bit to be read, a target bit field to be read is determined in the feature identifier.

[0107] In the disclosed embodiment, since the feature identifier field includes multiple bit fields, different bit fields record different feature information. In some cases, such as when the compiler backend organizes and manages instruction information (such as the identification and processing of GC information), it is not necessary to read all the bit fields of the feature identifier, so the bits to be read can be carried in the feature identifier read command. According to the bits to be read, one or several specific bit fields are read in a targeted manner. The feature identifier read command is not a bytecode instruction. The feature identifier read command can be sent by the user to the compiler. The feature identifier read command is used to control the compiler's reading process of the feature identifier of the bytecode instruction, and indicates to the compiler the specific bit fields that need to be read.

[0108] For example, continue to refer to Figure 2 As shown, when the bit to be read carried by the feature identification read command is [9:5], the bit field 202 can be read based on the bit to be read.

[0109] In the embodiment of the present disclosure, by carrying a read command with a bit feature identifier to be read, the target bit field to be read is determined in the feature identifier field, so that one or several specific bit fields can be read in a targeted manner, unnecessary bit field reading operations can be reduced, and the efficiency of reading feature identifiers can be improved.

[0110] Optionally, the step of reading the bit field in the feature identifier to obtain the feature information recorded in the bit field includes:

[0111] Read each target bit field corresponding to the feature identifier; each bit field includes a plurality of bits, each corresponding to a plurality of candidate feature information;

[0112] According to the bit field codes recorded corresponding to the multiple bits, a search is performed in the multiple candidate feature information to obtain the target feature information corresponding to the bit field code; the bit field code corresponds to the candidate feature information one by one.

[0113] In the disclosed embodiment, each bit field may include multiple bits, and each bit field may record multiple candidate feature information. Different bit field codes in the bit field correspond to different feature information. For example, referring to Tables 1-4 above, different bit field codes in the table have corresponding feature information, and the target feature information can be found in the candidate feature information according to the bit field codes recorded in multiple bits.

[0114] Optionally, the method further includes:

[0115] For each bytecode instruction in the bytecode instruction set, instruction sequence encoding is performed respectively to obtain the instruction number bit field in the feature identifier; the instruction number bit field is used to distinguish the bytecode instructions in the bytecode instruction set. .

[0116] In the disclosed embodiment, among the multiple bit fields of the feature identifier of each bytecode instruction, a bit field can also be used to encode the instruction sequence of the bytecode instruction, and the instruction sequence encoding can be used to directly distinguish the bytecode instructions. The instruction number bit field is a bit field in the feature identifier, similar to the bit field used to record floating point information and update register information, but the instruction number bit field does not record attribute information, but only numbers the bytecode instructions.

[0117] It is necessary to encode the instruction sequence for each bytecode instruction in the bytecode instruction set to avoid at least two bytecode instructions having the same instruction sequence encoding, so that different bytecode instructions correspond to different instruction number bit fields. For example, if instruction A is the first instruction, the instruction number bit field can be 00, which can be regarded as number 0; if instruction B is the second instruction, the instruction number bit field can be 01, which can be regarded as number 1; if instruction C is the third instruction, the instruction number bit field can be 10, which can be regarded as number 2, and so on, and each bytecode instruction in the bytecode instruction set is numbered.

[0118] The specific bytecode instruction can be identified or queried through the instruction number bit field. It is understandable that since the number of instructions contained in the instruction set of different processor architectures may be different, the width of the instruction number bit field can be adjusted according to the number of instructions, for example, it can be 10 bits, 12 bits or 13 bits.

[0119] In the implementation of the embodiment of the present disclosure, the instruction sequence is encoded for each bytecode instruction in the bytecode instruction set, and the instruction number bit field in the feature identifier is obtained. Based on the instruction number bit field, each bytecode instruction in the bytecode instruction set can be distinguished, and the bytecode instruction can be easily identified or queried, thereby improving the simplicity of querying the bytecode instruction.

[0120] Optionally, the method further includes:

[0121] Reading the instruction number bit field, and using the target feature information recorded in the instruction number bit field as an index of the bytecode instruction;

[0122] According to the index of the bytecode instruction, query other feature information corresponding to the bytecode instruction in a preset feature array;

[0123] The preset feature array stores indexes and corresponding other feature information; the other feature information is information other than the target feature information recorded in the bit field.

[0124] In the disclosed embodiment, a specific bytecode instruction can be identified or queried through the instruction number bit field, so the target feature information recorded in the instruction number bit field can be used as an index for reading the bytecode instruction. According to the index, other feature information of the bytecode instruction is queried in the preset feature array.

[0125] Since the width of the feature identifier field is limited and the number of bit fields in the field is also limited, the bit fields of the feature identifier field can only be used to record key feature information that is more important or frequently used. Other feature information, such as the quick identification mask and the number of the disassembly format of each instruction, can be stored in the feature array corresponding to the index. When it is necessary to obtain these other feature information, the corresponding other feature information can be queried in the preset feature array through the index recorded in the instruction number bit field.

[0126] For example, when it is necessary to obtain the disassembled instruction name of a machine code instruction, such as the name of the disassembled instruction of the ADDI instruction in the machine code instruction, the bit field encoding of the instruction number bit field of the byte code instruction corresponding to the machine code instruction, such as "011" is used as the index. The preset feature array can be a machine code disassembled instruction name array, which can be expressed as: const char*const insNames[] = {...}, and the machine code disassembled instruction name array has a corresponding relationship between the index and the name access pointer.

[0127] Execute the search operation corresponding to insNames[index index], then you can search in the machine code disassembly instruction name array based on the index "011", obtain the name access pointer corresponding to the index, and access the specific disassembly instruction name in the memory based on the name access pointer.

[0128] In the implementation of the embodiment of the present disclosure, by reading the index recorded in the instruction number bit field, other characteristic information of the bytecode instruction is queried in the preset characteristic array according to the index. When other characteristic information that cannot be recorded in the characteristic identifier needs to be obtained, it can be conveniently queried and obtained through the index and array, which improves the convenience of obtaining the characteristic information of the bytecode instruction.

[0129] In summary, in the disclosed embodiment, by obtaining the bytecode instruction, the feature identifier corresponding to the bytecode instruction is searched in the preset array; the feature identifier is used to identify the processor architecture, including multiple bit fields; the bit field records the feature information corresponding to the bytecode instruction; each target bit field corresponding to the feature identifier is parsed to obtain the target feature information recorded in the target bit field; the instruction construction operation corresponding to the target feature information is determined to obtain the machine code instruction corresponding to the bytecode instruction. The feature information of the bytecode instruction can be directly recorded in the feature identifier corresponding to the bytecode instruction. When constructing the instruction, only the feature identifier needs to be read to obtain the feature information and construct the instruction based on the feature information, thereby improving the efficiency of instruction construction.

[0130] Figure 5 is a block diagram of an instruction construction device provided by an embodiment of the present disclosure, such as Figure 5 As shown, the device 500 includes:

[0131] The feature identification module 501 is used to obtain a bytecode instruction and search for a feature identification corresponding to the bytecode instruction in a preset array; the feature identification is used to identify the processor architecture and includes a plurality of bit fields; the bit fields record feature information corresponding to the bytecode instruction;

[0132] A bit field reading module 502 is used to parse each target bit field corresponding to the feature identifier, and obtain the target feature information recorded in the target bit field;

[0133] The instruction construction module 503 is used to determine the instruction construction operation corresponding to the target feature information to obtain the machine code instruction corresponding to the bytecode instruction.

[0134] Optional, feature identification module, including:

[0135] An instruction parameter acquisition submodule, used to acquire parameters contained in the bytecode instruction;

[0136] A distribution interface submodule, used to determine the distribution interface corresponding to the bytecode instruction according to the type of the parameter;

[0137] The identification search submodule is used to search the characteristic identification corresponding to the bytecode instruction in the preset array through the distribution interface.

[0138] Optionally, the device further comprises:

[0139] A bit field division module is used to divide the feature identifier corresponding to the processor architecture to obtain multiple bit fields;

[0140] The bit field encoding module is used to encode the multiple bit fields respectively according to the established attribute information to obtain feature information; the attribute information includes at least one of the following types: floating point information, update register information, memory access information, instruction format information, and debugging information.

[0141] Optionally, there is a preset mapping relationship between the type of the attribute information and the bit field; the bit field encoding module includes:

[0142] A target bit field submodule, configured to determine, according to the type of the attribute information and the preset mapping relationship, target bit fields corresponding to the attribute information in the multiple bit fields;

[0143] The target encoding submodule is used to encode the target bit field to obtain the characteristic information recorded in the target bit field.

[0144] Optionally, the bytecode instruction includes instruction format information; the instruction construction module includes:

[0145] An instruction format submodule, used to determine instruction format information corresponding to the bytecode instruction according to the target feature information; the instruction format information is used to indicate a bit field corresponding to a parameter in the bytecode instruction in the machine code instruction, the parameter including an operand;

[0146] The parameter configuration submodule is used to integrate the parameters in the bytecode instruction into the corresponding bit fields in the machine code instruction based on the instruction format information to obtain the machine code instruction corresponding to the bytecode instruction.

[0147] Optional, bit field partitioning module, including:

[0148] A field width submodule, used to adjust the field width of the feature identifier according to the number of types of the attribute information;

[0149] A bit field width submodule, used to determine the bit field width corresponding to each bit field in the field width according to the attribute information of each type;

[0150] There is a positive correlation between the number of types of the attribute information and the field width of the feature identifier, and there is a positive correlation between the number of attribute information of each type and the bit field width.

[0151] Optional, bitfield read module, including:

[0152] A bit range submodule, configured to receive a feature identification read command; the feature identification read command carries a bit to be read;

[0153] The target bit submodule is used to determine the target bit field to be read in the feature identifier according to the bit to be read.

[0154] Optional, bitfield read module, including:

[0155] The reading submodules are respectively used to read each target bit field corresponding to the feature identifier; each bit field includes a plurality of bits, and each corresponds to a plurality of candidate feature information;

[0156] The respective search submodules are used to search among the plurality of candidate feature information according to the bit field codes recorded corresponding to the plurality of bits, and obtain the target feature information corresponding to the bit field codes; the bit field codes correspond one to one to the candidate feature information.

[0157] Optionally, the device further comprises:

[0158] The instruction number module is used to perform instruction sequence encoding for each bytecode instruction in the bytecode instruction set to obtain the instruction number bit field in the feature identifier; the instruction number bit field is used to distinguish the bytecode instructions in the bytecode instruction set.

[0159] Optionally, the device further comprises:

[0160] An instruction index module, used for reading the instruction number bit field, and using the target feature information recorded in the instruction number bit field as an index of the bytecode instruction;

[0161] Other feature modules, used to query other feature information corresponding to the bytecode instruction in a preset feature array according to the index of the bytecode instruction;

[0162] The preset feature array stores indexes and corresponding other feature information; the other feature information is information other than the target feature information recorded in the bit field.

[0163] In summary, in the disclosed embodiment, by obtaining the bytecode instruction, the feature identifier corresponding to the bytecode instruction is searched in the preset array; the feature identifier is used to identify the processor architecture, including multiple bit fields; the bit field records the feature information corresponding to the bytecode instruction; each target bit field corresponding to the feature identifier is parsed to obtain the target feature information recorded in the target bit field; the instruction construction operation corresponding to the target feature information is determined to obtain the machine code instruction corresponding to the bytecode instruction. The feature information of the bytecode instruction can be directly recorded in the feature identifier corresponding to the bytecode instruction. When constructing the instruction, only the feature identifier needs to be read to obtain the feature information and construct the instruction based on the feature information, thereby improving the efficiency of instruction construction.

[0164] The instruction construction device in the embodiment of the present disclosure may be a device, or a component, integrated circuit, or chip in a terminal. The device may be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., and the non-mobile electronic device may be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present disclosure.

[0165] The instruction construction device in the embodiment of the present disclosure may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present disclosure.

[0166] The instruction construction device provided in the embodiment of the present disclosure can realize Figure 1 The various processes implemented by the instruction construction device in the method embodiment will not be described here to avoid repetition.

[0167] Optionally, an embodiment of the present disclosure also provides an electronic device, including a processor, a memory, and a program or instruction stored in the memory and executable on the processor. When the program or instruction is executed by the processor, each process of the above-mentioned instruction construction method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0168] It should be noted that the electronic devices in the embodiments of the present disclosure include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0169] Figure 6 A schematic diagram of the hardware structure of an electronic device for implementing an embodiment of the present disclosure.

[0170] The electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010 and other components.

[0171] Those skilled in the art will appreciate that the electronic device 1000 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0172] The processor 1010 is used to obtain a bytecode instruction and search a preset array for a feature identifier corresponding to the bytecode instruction; the feature identifier is used to identify a processor architecture and includes a plurality of bit fields; the bit fields record feature information corresponding to the bytecode instruction;

[0173] Parse each target bit field corresponding to the feature identifier to obtain target feature information recorded in the target bit field;

[0174] An instruction construction operation corresponding to the target characteristic information is determined to obtain a machine code instruction corresponding to the bytecode instruction.

[0175] Optionally, the processor 1010 is used to

[0176] Obtaining parameters contained in the bytecode instruction;

[0177] Determining a distribution interface corresponding to the bytecode instruction according to the type of the parameter;

[0178] The characteristic identifier corresponding to the bytecode instruction is searched in the preset array through the distribution interface.

[0179] Optionally, the processor 1010 is further configured to:

[0180] Divide the characteristic identifier corresponding to the processor architecture to obtain multiple bit fields;

[0181] According to the established attribute information, the plurality of bit fields are respectively encoded to obtain characteristic information; the attribute information includes at least one of the following types: floating point information, update register information, memory access information, instruction format information, and debugging information.

[0182] Optionally, there is a preset mapping relationship between the type of the attribute information and the bit field; the processor 1010 is used to

[0183] According to the type of the attribute information and the preset mapping relationship, respectively determining target bit fields corresponding to the attribute information in the multiple bit fields;

[0184] The target bit field is encoded to obtain characteristic information recorded in the target bit field.

[0185] Optionally, the bytecode instruction includes instruction format information; processor 1010 is used to

[0186] Determine instruction format information corresponding to the bytecode instruction according to the target characteristic information; the instruction format information is used to indicate a bit field corresponding to a parameter in the bytecode instruction in the machine code instruction, the parameter including an operand;

[0187] Based on the instruction format information, the parameters in the bytecode instruction are integrated into corresponding bit fields in the machine code instruction to obtain a machine code instruction corresponding to the bytecode instruction.

[0188] Optionally, the processor 1010 is used to

[0189] According to the number of types of the attribute information, adjusting the field width of the feature identifier;

[0190] According to each type of attribute information, the bit field width corresponding to each bit field is determined in the field width.

[0191] Optionally, the processor 1010 is used to

[0192] Receiving a characteristic identification reading command; the characteristic identification reading command carries a bit to be read;

[0193] According to the bit to be read, a target bit field to be read is determined in the feature identifier.

[0194] Optionally, the processor 1010 is used to

[0195] Read each target bit field corresponding to the feature identifier; each bit field includes a plurality of bits, each corresponding to a plurality of candidate feature information;

[0196] According to the bit field codes recorded corresponding to the multiple bits, a search is performed in the multiple candidate feature information to obtain the target feature information corresponding to the bit field code; the bit field code corresponds to the candidate feature information one by one.

[0197] Optionally, the processor 1010 is further configured to:

[0198] For each bytecode instruction in the bytecode instruction set, instruction sequence encoding is performed to obtain an instruction number bit field in the feature identifier; the instruction number bit field is used to distinguish the bytecode instructions in the bytecode instruction set.

[0199] Optionally, the processor 1010 is further configured to:

[0200] Reading the instruction number bit field, and using the target feature information recorded in the instruction number bit field as an index of the bytecode instruction;

[0201] According to the index of the bytecode instruction, query other feature information corresponding to the bytecode instruction in a preset feature array;

[0202] The preset feature array stores indexes and corresponding other feature information; the other feature information is information other than the target feature information recorded in the bit field.

[0203] In summary, in the disclosed embodiment, by obtaining the bytecode instruction, the feature identifier corresponding to the bytecode instruction is searched in the preset array; the feature identifier is used to identify the processor architecture, including multiple bit fields; the bit field records the feature information corresponding to the bytecode instruction; each target bit field corresponding to the feature identifier is parsed to obtain the target feature information recorded in the target bit field; the instruction construction operation corresponding to the target feature information is determined to obtain the machine code instruction corresponding to the bytecode instruction. The feature information of the bytecode instruction can be directly recorded in the feature identifier corresponding to the bytecode instruction. When constructing the instruction, only the feature identifier needs to be read to obtain the feature information and construct the instruction based on the feature information, thereby improving the efficiency of instruction construction.

[0204] It should be understood that in the embodiment of the present disclosure, the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and at least one of other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0205] The memory 1009 can be used to store software programs and various data. The memory 1009 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 1009 may include a volatile memory or a non-volatile memory, or the memory 1009 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 1009 in the embodiment of the present disclosure includes but is not limited to these and any other suitable types of memory.

[0206] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 1010.

[0207] The embodiments of the present disclosure also provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned instruction construction method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0208] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0209] The embodiment of the present disclosure further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned instruction construction method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0210] It should be understood that the chip mentioned in the embodiments of the present disclosure may also be referred to as a system-level chip, a system chip, a chip system, or a system-on-chip chip, etc.

[0211] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present disclosure.

[0212] The embodiments of the present disclosure are described above in conjunction with the accompanying drawings, but the present disclosure is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present disclosure, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present disclosure and the claims, all of which are within the protection of the present disclosure.

Claims

1. A method for constructing an instruction, characterized in that the method include: Obtaining a bytecode instruction, and searching a preset array for a feature identifier corresponding to the bytecode instruction; The feature identifier is used to identify the processor architecture, and includes a plurality of bit fields; the bit fields record feature information corresponding to the bytecode instruction; Parse each target bit field corresponding to the feature identifier to obtain target feature information recorded in the target bit field; An instruction construction operation corresponding to the target characteristic information is determined to obtain a machine code instruction corresponding to the bytecode instruction.

2. The method according to claim 1, characterized in that The step of searching for a feature identifier corresponding to the bytecode instruction comprises: Obtaining parameters contained in the bytecode instruction; Determining a distribution interface corresponding to the bytecode instruction according to the type of the parameter; The characteristic identifier corresponding to the bytecode instruction is searched in the preset array through the distribution interface.

3. The method according to claim 1, characterized in that: Before obtaining the bytecode instruction, the method further includes: Divide the characteristic identifier corresponding to the processor architecture to obtain multiple bit fields; According to the established attribute information, the plurality of bit fields are respectively encoded to obtain characteristic information; the attribute information includes at least one of the following types: floating point information, update register information, memory access information, instruction format information, and debugging information.

4. The method according to claim 3, characterized in that: There is a preset mapping relationship between the type of the attribute information and the bit field; the step of encoding the multiple bit fields respectively according to the established attribute information to obtain the characteristic information includes: According to the type of the attribute information and the preset mapping relationship, respectively determining target bit fields corresponding to the attribute information in the multiple bit fields; The target bit field is encoded to obtain characteristic information recorded in the target bit field.

5. The method according to claim 1, characterized in that The bytecode instruction includes instruction format information; the step of determining the instruction construction operation corresponding to the target feature information includes: Determining instruction format information corresponding to the bytecode instruction according to the target characteristic information; the instruction format information is used to indicate a bit field corresponding to a parameter in the bytecode instruction in a machine code instruction; Based on the instruction format information, the parameters in the bytecode instruction are integrated into corresponding bit fields in the machine code instruction to obtain a machine code instruction corresponding to the bytecode instruction.

6. The method according to claim 3, characterized in that: The step of dividing the field of the feature identifier to obtain a plurality of bit fields comprises: According to the number of types of the attribute information, adjusting the field width of the feature identifier; According to each type of attribute information, the bit field width corresponding to each bit field is determined in the field width.

7. The method according to claim 1, characterized in that The step of reading the bit field in the feature identifier to obtain the feature information recorded in the bit field includes: Receiving a characteristic identification reading command; the characteristic identification reading command carries a bit to be read; According to the bit to be read, a target bit field to be read is determined in the feature identifier.

8. The method according to claim 1, characterized in that: The step of reading the bit field in the feature identifier to obtain the feature information recorded in the bit field includes: Read each target bit field corresponding to the feature identifier; each bit field includes a plurality of bits, each corresponding to a plurality of candidate feature information; According to the bit field codes recorded corresponding to the multiple bits, a search is performed in the multiple candidate feature information to obtain the target feature information corresponding to the bit field code; the bit field code corresponds to the candidate feature information one by one.

9. The method according to claim 1, characterized in that: The method further comprises: For each bytecode instruction in the bytecode instruction set, instruction sequence encoding is performed to obtain an instruction number bit field in the feature identifier; the instruction number bit field is used to distinguish the bytecode instructions in the bytecode instruction set.

10. The method according to claim 9, characterized in that The method further comprises: Reading the instruction number bit field, and using the target feature information recorded in the instruction number bit field as an index of the bytecode instruction; According to the index of the bytecode instruction, query other feature information corresponding to the bytecode instruction in a preset feature array; The preset feature array stores indexes and corresponding other feature information; the other feature information is information other than the target feature information recorded in the bit field.

11. An instruction construction device, characterized in that: include: A feature identification module, used to obtain a bytecode instruction, and search a preset array for a feature identification corresponding to the bytecode instruction; the feature identification is used to identify a processor architecture, including a plurality of bit fields; the bit fields record feature information corresponding to the bytecode instruction; A bit field reading module, used for parsing each target bit field corresponding to the feature identifier, and obtaining the target feature information recorded in the target bit field; The instruction construction module is used to determine the instruction construction operation corresponding to the target feature information to obtain the machine code instruction corresponding to the bytecode instruction.

12. An electronic device, characterized in that: The invention comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the instruction construction method as claimed in any one of claims 1 to 10.

13. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the instruction construction method according to any one of claims 1 to 10 are implemented.