A modified qualification method and system that supports a compiler generating 16-bit instructions
By determining the types of operators and integer literals in the compiler and applying numerical boosting constraints, short type instructions are generated, solving the problems of low code readability and execution efficiency on resource-constrained security chips, and achieving efficient code writing and easy-to-maintain code generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING WATCH DATA SYSTEM CO LTD
- Filing Date
- 2021-12-24
- Publication Date
- 2026-07-31
AI Technical Summary
When generating 16-bit operation instructions on resource-constrained security chips, existing technologies result in poor readability and low execution efficiency in the application source code, mainly due to the need for frequent type casting.
The compiler generates 16-bit instructions by modifying the constraint method, which determines the result type based on the type of the operator and the integer literal, and performs numerical promotion constraint to avoid forced type conversion and generate short type instructions.
It improves code writing efficiency, makes the code easier to maintain and upgrade, and enhances code readability and execution efficiency.
Smart Images

Figure CN114489591B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of code execution, specifically relating to a method and system for modifying and limiting compilers to generate 16-bit instructions. Background Technology
[0002] Resource-constrained security chips, due to limited chip resources, struggle to support virtual machines implementing 32-bit operation instructions, thus preventing them from performing 32-bit arithmetic operations. However, they can perform 8-bit or 16-bit arithmetic operations. Current methods for generating 16-bit operation instructions involve a compiler generating general bytecode, followed by a conversion program or tool optimizing some 32-bit operation instructions into 16-bit instructions. During this conversion, the compiler promotes byte and short types to int types before performing various operations, and the result is also an int type. This necessitates explicit type conversion when assigning the result of two short type operations to another short type, requiring the addition of (short) before the calculation result. Small literals are also treated as int types by the compiler, requiring short type conversion when assigned to short or byte types. This results in numerous (short) type casts in the application source code, leading to poor code readability. Without (short), the conversion program or tool cannot convert to 16-bit operation instructions, severely impacting code execution efficiency. Therefore, the code written by users in existing technical methods has poor readability. Summary of the Invention
[0003] To address the shortcomings of existing technologies, the purpose of this invention is to provide a modified constraint method and system that supports compilers in generating 16-bit instructions. In this method and system, the compiler can generate short type instructions from short type operations based on numerical promotion constraints, avoiding the need for explicit type casting in the source code to generate short type instructions. This significantly improves code writing efficiency, and the resulting code is easier to maintain and upgrade.
[0004] To achieve the above objectives, the technical solution adopted by the present invention is: a modification constraint method for supporting compiler generation of 16-bit instructions, comprising the following steps: if initial code is received, determining the result type of each operator based on the operand type of the operators in the initial code; determining that each integer literal is of type byte, short, or int based on the value of the integer literal in the initial code; performing numerical boosting constraint on the operands corresponding to unary operators in the initial code, so that the unary operator produces a short type operation result when operating on the corresponding byte or short type operands; performing numerical boosting constraint on the operands corresponding to binary operators in the initial code, so that the binary operator produces a short type operation result when operating on the corresponding byte or short type operands.
[0005] Furthermore, determining the result type of each operator based on the operand type of the operator in the initial code includes: determining whether the operand type of each operator is byte, short, or int; if the operand type of each operator is byte, short, or int, then the result type of the corresponding operator is determined based on the operand type.
[0006] Furthermore, the integer literal is a decimal, hexadecimal, or octal value. Determining whether each integer literal is of type byte, short, or int based on the value of the integer literal in the initial code includes: if the integer literal is an 8-bit signed numeric type, determining the integer literal as a byte type; if the integer literal is a 16-bit signed numeric type, determining the integer literal as a short type; if the integer literal is a 32-bit signed numeric type, determining the integer literal as an int type.
[0007] Furthermore, the step of numerically boosting the operands corresponding to the unary operators in the initial code so that the unary operators produce short type operation results when operating on the corresponding byte or short type operands includes: determining whether the type of the operand corresponding to each unary operator is byte type; if the operand type of the unary operator is byte type, widening the operand corresponding to the unary operator to short type.
[0008] Furthermore, the step of performing value promotion on the operands corresponding to the binary operators in the initial code, so that the binary operators produce a short type operation result when operating on the corresponding byte or short type operands, includes: determining whether the value type of any one of the two operands corresponding to each binary operator matches the int type; if the value type of any one of the two operands corresponding to the binary operator matches the int type, performing binary value promotion to convert the other operand of the binary operator to the int type; if the value types of neither of the two operands corresponding to the binary operator match the int type, performing binary value promotion to convert both operands corresponding to the binary operator to the short type.
[0009] A modification constraint system supporting compiler generation of 16-bit instructions includes the following devices: a result type determination device, used to determine the result type of each operator based on the operand type of the operator in the initial code if input initial code is received; an integer literal type determination device, used to determine that each integer literal is of type byte, short, or int based on the value of the integer literal in the initial code; a unary lifting constraint device, used to lift the operands corresponding to unary operators in the initial code so that the unary operator produces a short type operation result when operating on the corresponding byte or short type operands; and a binary lifting constraint device, used to lift the operands corresponding to binary operators in the initial code so that the binary operator produces a short type operation result when operating on the corresponding byte or short type operands.
[0010] Furthermore, the result type determination device includes the following units: an operand type judgment unit, used to determine whether the operand type of each operator is byte, short, or int; and a type determination unit, used to determine the result type of the corresponding operator based on the operand type if the operand type of each operator is byte, short, or int.
[0011] Furthermore, the integer literal type determination device includes the following units: a first type determination unit, used to determine that the integer literal is of type byte if the integer literal is of type 8-bit signed numeric; a second type determination unit, used to determine that the integer literal is of type short if the integer literal is of type 16-bit signed numeric; and a third type determination unit, used to determine that the integer literal is of type int if the integer literal is of type 32-bit signed numeric.
[0012] Furthermore, the unary boosting limiting device includes the following units: a value type determination unit, used to determine whether the type of the operand corresponding to each unary operator is byte type; and a unary boosting value acquisition unit, used to widen the operand corresponding to the unary operator to short type if the operand type of the unary operator is byte type.
[0013] Furthermore, the binary lifting limiting device includes the following units: a type determination unit, used to determine whether the value type of any one of the two operands corresponding to each binary operator matches the int type; an operand conversion unit, used to perform binary lifting widening to convert the other operand of the binary operator to the int type if the value type of any one of the two operands corresponding to the binary operator matches the int type; and a binary lifting value determination unit, used to perform binary lifting widening to convert both operands corresponding to the binary operator to the short type if the value types of neither operand matches the int type.
[0014] The advantages of this invention are as follows: by using the method and system described in this invention, the compiler can generate short type instructions from short type operations based on the numerical promotion constraint, which avoids generating short type instructions through type casting in the source code, greatly improving code writing efficiency, and making the written code easier to maintain and upgrade. Attached Figure Description
[0015] Figure 1 This is a flowchart of the method described in this invention;
[0016] Figure 2 This is a schematic diagram of a sub-process of the method described in this invention;
[0017] Figure 3 This is a schematic diagram of another sub-process of the method described in this invention;
[0018] Figure 4 This is a schematic diagram of another sub-process of the method described in this invention;
[0019] Figure 5 This is a schematic diagram of another sub-process of the method described in this invention;
[0020] Figure 6 This is a structural diagram of the system described in this invention;
[0021] Figure 7 This is a structural diagram of the device in the system described in this invention;
[0022] Figure 8 This is another structural diagram of the device in the system described in this invention;
[0023] Figure 9 This is another structural diagram of the device in the system described in this invention;
[0024] Figure 10 This is another structural diagram of the device in the system described in this invention. Detailed Implementation
[0025] The present invention will now be further described with reference to the accompanying drawings and specific embodiments.
[0026] like Figure 1 As shown, a modification and constraint method supporting compiler-generated 16-bit instructions is described. This method is applied in a user terminal and executed by application software installed on the user terminal. The user terminal is a terminal device, such as a desktop computer, laptop, tablet, or mobile phone, used to execute the modification and constraint method to convert the initial code. Executing the modification and constraint method allows for modifications and constraints based on general programming language specifications to facilitate the running of a virtual machine based on 16-bit operation instructions on a resource-constrained security chip. This virtual machine can execute application source code written in accordance with the programming language specifications defined in this invention, and the executable program compiled or converted by the compiler. The programming language specifications defined in this invention allow users to write easily readable and maintainable application source code suitable for running on resource-constrained security chips, enabling the compiler to generate 16-bit operation instructions. The steps include:
[0027] S110. If the input initial code is received, determine the result type of each operator according to the operand type of the operator in the initial code.
[0028] It can accept the input initial code, which can be general initial code obtained by the compiler. The initial code contains operators, and the operand types corresponding to the operators can be judged to determine the result type of each operator.
[0029] In one embodiment, such as Figure 2 As shown, step S110 includes sub-steps S111 and S112.
[0030] S111. Determine whether the operand type of each operator is byte, short, or int.
[0031] Specifically, this embodiment of the invention restricts the data types supported by traditional high-level language specifications, explicitly limiting the support for char and long integer types, as well as floating-point types. It can then determine whether the operand type of each operator is byte, short, or int. Operands can be classified as boolean or numeric; boolean types can be treated as byte types, and numeric types are either byte, short, or int.
[0032] S112. If the operand type of each operator is byte, short, or int, the result type of the corresponding operator will be determined according to the operand type.
[0033] If the operand types of an operator meet the corresponding type requirements, that is, the operand types are byte, short, or int, then the result type of the corresponding operator is determined based on the operand types. For example, if the operand types of arithmetic operations are all byte or short, then the result type can be determined to be short.
[0034] Specifically, the initial code may contain keywords that the virtual machine does not support. In this step, it is also possible to determine whether the initial code contains unsupported keywords. For example, unsupported keywords include native, strictfp, synchronized, enum, transient, assert, volatile, etc. If the initial code contains unsupported keywords, the unsupported keywords are retrieved and corresponding prompts are generated to prompt the user. The user can receive the prompts and obtain the corresponding information.
[0035] S120. Determine whether each integer literal is of type byte, short, or int based on the value of the integer literal in the initial code.
[0036] Integer literals can be decimal, hexadecimal, or octal numbers. The value of each integer literal can be obtained, and the type of each integer literal can be determined based on the value. Integer literals include byte, short, and int types.
[0037] In one embodiment, such as Figure 3 As shown, step S120 includes sub-steps S121, S122 and S123.
[0038] S121. If the integer literal is an 8-bit signed numeric type, determine that the integer literal is of type byte; S122. If the integer literal is a 16-bit signed numeric type, determine that the integer literal is of type short; S123. If the integer literal is a 32-bit signed numeric type, determine that the integer literal is of type int.
[0039] A decimal number is a single ASCII character 0, representing the integer zero, or consists of ASCII digits 1 to 9, optionally followed by one or more ASCII digits 0 to 9, representing a positive integer. The value of a decimal number less than 128 (2^38) is... 7 The type is considered to be byte; the decimal value is not less than 128 and less than 32768 (2 byte). 15 If the type is short, it is considered to be short; otherwise, it is considered to be int. The short literal 32768 can only appear as a short type operand of the unary subtraction operator "-".
[0040] Hexadecimal numbers consist of a leading ASCII character 0x or 0x followed by one or more ASCII hexadecimal digits, and can represent positive integers, zero, or negative integers. Hexadecimal numbers with values from 10 to 15 are represented by ASCII letters a to f or A to F, respectively. Each letter used as a hexadecimal number can be uppercase or lowercase.
[0041] Octal numbers are represented by the ASCII digit 0 followed by one or more ASCII digits from 0 to 7, and can represent positive integers, zero, or negative integers. If a hexadecimal or octal integer literal is within the range that can be represented by 16 bits, it is considered to be of type short; otherwise, it is considered to be of type int.
[0042] S130. The operands corresponding to the unary operators in the initial code are numerically boosted to ensure that the unary operators produce short type operation results when operating on operands of the corresponding byte or short type.
[0043] The operators in the initial code can be divided into unary operators and binary operators. Unary operators are instructions that operate on a single operand. The code retrieves the operand corresponding to the unary operator and performs a value conversion and lifting constraint on it to obtain the corresponding unary lifted value. If the operand of the unary operator is of type byte at compile time, it is converted to short type through basic type widening conversion. Specifically, unary operators include array creation expressions, array subscript index expressions, the unary minus operator "-", the bitwise NOT operator "~", the right shift operator ">>", the left shift operator "<<", and the unsigned right shift operator ">>>", etc.
[0044] In one embodiment, such as Figure 4 As shown, step S130 includes sub-steps S131 and S132.
[0045] S131. Determine whether the type of the operand corresponding to each unary operator is byte.
[0046] Specifically, it can be determined whether the type of the operand corresponding to each unary operator is byte.
[0047] S132. If the operand type of the unary operator is byte, widen the operand corresponding to the unary operator to short type.
[0048] If the operand of a unary operator is of type byte, and the type does not match the short type, the operand type can be converted. For example, if the operand of a unary operator is of type byte (8 bits) or bool, it can be converted to short.
[0049] Furthermore, for left shift, right shift, or unsigned right shift operators, if the operand on the left side of the operator needs to be promoted to a short type, only the lowest four bits of the right-side shift value are used as the shift distance. This shift value is then processed by the bitwise AND operator "&" with the mask value 0x0f, and the actual shift distance used is always within the range of [0, 15] (all shift distances are integers). If the operand on the left side of the operator needs to be promoted to an int type, only the five lowest bits of the right-side shift value are used as the shift distance. This shift value is then processed by the bitwise AND operator "&" with the mask value 0x1f, and the actual shift distance used is always within the range of [0, 31] (all shift distances are integers).
[0050] If the operand type corresponding to the unary operator is not byte, then the numeric type corresponding to the unary operator matches the short type, and the operand corresponding to the unary operator is determined as the corresponding unary promotion value.
[0051] If the numeric type corresponding to a unary operator matches the short type, then the operand corresponding to the unary operator is directly determined as the unary promotion value. For example, if the numeric type corresponding to a unary operator is short, then there is no need to convert the operand of the unary operator; the operand can be directly used as the unary promotion value.
[0052] Before executing step S131, the method further includes the step of: determining whether the unary operator is an array operator; if the unary operator is an array operator, performing unary value promotion on the expression corresponding to the array operator to obtain the corresponding unary promotion expression.
[0053] When creating an array, the expression specifying the array size must be of type `short`; the array index expression must also be of type `short`. The unary operator can then be used to determine if it is an array operator. If it is, or if it is, an array operator such as an array creation expression or an array index expression, then unary promotion can be performed on the expression corresponding to the array operator based on its `short` type, resulting in the corresponding unary promotion expression. Specifically, the virtual machine in this embodiment only supports the creation of one-dimensional arrays. Each expression corresponding to an array operator can be unary promoted, and the promoted type must be `short`; otherwise, a compile-time error will occur. This means that the type of the array dimension expression cannot be `int`. The index expression undergoes unary promotion, and the promoted type must also be `short`. This embodiment only supports the creation of one-dimensional arrays.
[0054] If the unary operator is not an array operator, the step of determining whether the numeric type of the operand corresponding to each unary operator matches the short type is executed.
[0055] If the unary operator is not an array operator, then the subsequent steps are executed, that is, step S131 is continued.
[0056] S140. The operands corresponding to the binary operators in the initial code are numerically boosted to ensure that the binary operators produce short type operation results when operating on the corresponding byte or short type operands.
[0057] The initial code can also include binary operators, which are instructions that operate on two operands simultaneously. The code can retrieve the operands corresponding to the binary operator and perform numerical conversions on them to obtain the corresponding binary promotion values. Specifically, binary operators include the multiplication operator "*", the division operator " / ", the modulo operator "%", the addition operator "+", the subtraction operator "-", comparison operators (including "<", "<=", ">", and ">="), equality operators "==" or "!=", and bitwise operators (including bitwise AND "&", bitwise OR "|", and bitwise XOR "^").
[0058] In one embodiment, such as Figure 5 As shown, step S140 includes sub-steps S141, S142 and S143.
[0059] S141. Determine whether the numeric type of either operand of the two operands corresponding to each binary operator matches the int type.
[0060] It can determine whether the numeric type of either of the two operands corresponding to a binary operator matches the int type.
[0061] S142. If the numeric type of either of the two operands corresponding to the binary operator matches the int type, the other operand of the binary operator is converted to the int type by binary numeric widening.
[0062] If either operand of a binary operator is of type `int`, then the other operand is converted to `int`. In other words, if one operand is of type `int` and the other is not, then the other operand is converted to `int`. If both operands of a binary operator are of type `int`, then the operands are directly used as binary promotion values without any conversion.
[0063] S143. If the numerical types of the two operands corresponding to the binary operator do not match the int type, the operands corresponding to the binary operator are both converted to short type by binary promotion.
[0064] If neither operand's numeric type matches the `int` type, then both operands of the binary operator are converted to the `short` type, which is a different numeric type than `int`. For example, if one operand of a binary operator is of type `short` and the other is of type `byte`, then since neither operand matches the `int` type, both operands of the binary operator are converted to `short`.
[0065] In this embodiment of the invention, the byte type is promoted to the short type. The result of arithmetic operations on the short type is of short type, so there is no need to force a conversion to short type; the compiler can generate short type instructions. It explicitly restricts support for char and long integer types, and float and double types; it only supports the creation of one-dimensional arrays, with the array size limited to 32767; the switch statement is limited to a maximum of 65536 cases, and the compiler directly reports any non-compliant content, resulting in a better user experience in an IDE environment.
[0066] In this embodiment, the result type of each operator is determined based on the operand types in the initial code. Each integer literal is determined to be of type byte, short, or int based on its value. Numerical hoisting is applied to the operands corresponding to unary operators in the initial code, and to the operands corresponding to binary operators. Using this method, the compiler can generate short type instructions from short type operations based on the numerical hoisting, avoiding the need for type casting in the source code. This significantly improves code writing efficiency, and the resulting code is maintainable and easily upgradable.
[0067] like Figure 8 As shown, a modification constraint system that supports compiler-generated 16-bit instructions is provided. This system can be configured in a user terminal and is used to execute any embodiment of the aforementioned modification constraint method for supporting compiler-generated 16-bit instructions. The system includes the following devices: a result type determination device 110, an integer literal type determination device 120, a unary promotion constraint device 130, and a binary promotion constraint device 140.
[0068] Result type determination device 110 is used to determine the result type of each operator based on the operand type of the operator in the initial code if an input initial code is received.
[0069] In one specific embodiment, such as Figure 7 As shown, the result type determination device 110 includes units: an operand type judgment unit 111, used to determine whether the operand type of each operator is byte, short, or int; and a type determination unit 112, used to determine the result type of the corresponding operator based on the operand type if the operand type of each operator is byte, short, or int.
[0070] The integer literal type determination device 120 is used to determine whether each integer literal is of type byte, short, or int based on the value of the integer literal in the initial code.
[0071] In one specific embodiment, such as Figure 8 As shown, the integer literal type determination device 120 includes the following units: a first type determination unit 121, used to determine the integer literal as a byte type if the integer literal is an 8-bit signed numeric type; a second type determination unit 122, used to determine the integer literal as a short type if the integer literal is a 16-bit signed numeric type; and a third type determination unit 123, used to determine the integer literal as an int type if the integer literal is a 32-bit signed numeric type.
[0072] The unary boosting limiting device 130 is used to boost the value of the operands corresponding to the unary operators in the initial code, so that the unary operators produce short type operation results when operating on the corresponding byte or short type operands.
[0073] In one specific embodiment, such as Figure 9 As shown, the unary boosting limiting device 130 includes the following units: a value type determination unit 131, used to determine whether the type of the operand corresponding to each unary operator is byte type; and a unary boosting value acquisition unit 132, used to widen the operand corresponding to the unary operator to short type if the operand type of the unary operator is byte type.
[0074] The binary lifting limiting device 140 is used to lift the values of the operands corresponding to the binary operators in the initial code, so that the binary operators produce short type operation results when operating on the corresponding byte or short type operands.
[0075] In one specific embodiment, such as Figure 10 As shown, the binary lifting limiting device 140 includes the following units: a type determination unit 141, used to determine whether the value type of any one of the two operands corresponding to each binary operator matches the int type; an operand conversion unit 142, used to perform binary lifting widening to convert the other operand of the binary operator to the int type if the value type of any one of the two operands corresponding to the binary operator matches the int type; and a binary lifting value determination unit 143, used to perform binary lifting widening to convert both operands corresponding to the binary operator to the short type if the value types of neither operand matches the int type.
[0076] In this embodiment, the result type of each operator is determined based on the operand types in the initial code. Each integer literal is determined to be of type byte, short, or int based on its value. Numerical hoisting is applied to the operands corresponding to unary operators in the initial code, and to the operands corresponding to binary operators. Using this method, the compiler can generate short type instructions from short type operations based on numerical hoisting, avoiding the need for type casting in the source code. This significantly improves code writing efficiency, and the resulting code is easier to maintain and upgrade.
[0077] Those skilled in the art should understand that the methods and systems described and implemented in this invention are not limited to the embodiments described in the specific implementation details. The above detailed description is merely for illustrative purposes and is not intended to limit the invention. Other implementation methods derived by those skilled in the art based on the technical solutions of this invention also fall within the scope of this invention's technical innovation. The scope of protection of this invention is defined by the claims and their equivalents.
Claims
1. A modified constraint method supporting compiler generation of 16-bit instructions, characterized in that, Includes the following steps: If the input initial code is received, determine the result type of each operator based on the operand type of the operator in the initial code; Each integer literal is determined to be of type byte, short, or int based on the value of the integer literal in the initial code. The operands corresponding to the unary operators in the initial code are subject to numerical boosting constraints so that the unary operators produce short type operation results when the corresponding byte or short type operands are operated on. The operands corresponding to the binary operators in the initial code are numerically boosted to ensure that the binary operators produce short type results when operating on operands of the corresponding byte or short type. The step of performing numerical boosting on the operands corresponding to the unary operators in the initial code, so that the unary operators produce short type results when operating on operands of the corresponding byte or short type, includes: Determine whether the type of the operand corresponding to each unary operator is byte; If the operand type of the unary operator is byte, widen the operand corresponding to the unary operator to short type; The step of performing numerical boosting on the operands corresponding to the binary operators in the initial code, so that the binary operators produce short type results when operating on operands of corresponding byte and short types, includes: Determine whether the numeric type of either operand of the two operands corresponding to each binary operator matches the int type; If the numeric type of either of the two operands corresponding to the binary operator matches the int type, the other operand of the binary operator is converted to the int type by binary numeric widening. If the numerical types of the two operands corresponding to the binary operator do not match the int type, the operands corresponding to the binary operator are both converted to the short type through binary promotion.
2. The method of claim 1, wherein the modified definition is generated by the compiler to support 16-bit instructions. Determining the result type of each operator based on the operand types of the operators in the initial code includes: Determine whether the operand type of each operator is byte, short, or int. If the operand type of each of the operators is byte, short, or int, the result type of the corresponding operator will be determined based on the operand type.
3. The method of claim 1, wherein the modified definition is generated by the compiler to support 16-bit instructions. The integer literal is a decimal, hexadecimal, or octal value. Determining whether each integer literal is of type byte, short, or int based on the value of the integer literal in the initial code includes: If the integer literal is an 8-bit signed numeric type, then the integer literal is determined to be of type byte. If the integer literal is a 16-bit signed numeric type, then the integer literal is determined to be of type short; If the integer literal is a 32-bit signed numeric type, then the integer literal is determined to be of type int.
4. A modified limited system supporting a compiler generating 16-bit instructions, characterized by, Includes the following devices: Result type determination device, used to determine the result type of each operator based on the operand type of the operator in the initial code if an input initial code is received; An integer literal type determination device is used to determine whether each integer literal is of type byte, short, or int based on the value of the integer literals in the initial code. A unary boosting limiting device is used to boost the value of the operands corresponding to the unary operators in the initial code, so that the unary operators produce short type operation results when the corresponding byte or short type operands are operated on. A binary lifting limiter is used to lift and limit the operands corresponding to the binary operators in the initial code, so that the binary operators produce a short type operation result when the corresponding byte or short type operands are operated on. The single-element lifting and limiting device includes the following units: The numeric type determination unit is used to determine whether the type of the operand corresponding to each unary operator is byte type; A unary boosting value acquisition unit is used to widen and convert the operands corresponding to the unary operator to short type if the operand type of the unary operator is byte type. The binary lifting and limiting device includes the following units: The type determination unit is used to determine whether the numeric type of either of the two operands corresponding to each binary operator matches the int type; An operand conversion unit is used to convert the other operand of the binary operator to the int type by performing binary value widening if the value type of either operand of the two operands corresponding to the binary operator matches the int type. The binary promotion value determination unit is used to convert both operands corresponding to the binary operator to short type if the value types of the two operands corresponding to the binary operator do not match the int type.
5. A modified limited system to support a compiler generating 16-bit instructions as recited in claim 4, wherein, The result type determination device includes the following units: An operand type determination unit is used to determine whether the operand type of each operator is byte, short, or int. The type determination unit is used to determine the result type of the corresponding operator based on the operand type if the operand type of each operator is byte, short, or int.
6. The modification constraint system for supporting compiler generation of 16-bit instructions as described in claim 5, characterized in that, The integer literal type determination device includes the following units: The first type determination unit is used to determine that the integer literal is of type byte if the integer literal is an 8-bit signed numeric type. The second type determination unit is used to determine that the integer literal is of type short if the integer literal is a 16-bit signed numeric type. The third type determination unit is used to determine that the integer literal is of type int if the integer literal is a 32-bit signed numeric type.