Instruction jump judgment method and device, electronic equipment and readable storage medium
Patent Information
- Application Number
- CN202111569803.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2041-12-21
AI Technical Summary
[0003]本申请实施例的目的是提供一种指令跳转判断方法、装置、电子设备及可读存储介质,以解决现有的条件分支指令跳转判断的效率较低的问题
Smart Images

Figure CN116302095B_ABST
Abstract
Claims
1. A method for determining instruction jumps, applied to electronic devices, characterized in that, include: Obtain the analysis results of the first instruction; Based on the analysis results, determine whether the first instruction is a conditional branch instruction; If the first instruction is a conditional branch instruction, obtain the jump destination address of the first instruction from the analysis results; Determine whether the jump destination address of the first instruction is the same as the address of the second instruction; wherein the second instruction is the instruction following the first instruction; If the jump destination address of the first instruction is the same as the address of the second instruction, it is determined that the first instruction has jumped; The analysis result of obtaining the first instruction includes: Before the first instruction, a first type of instruction, a second type of instruction, and a third type of instruction are inserted to form an instruction sequence; wherein, the first type of instruction is used to extract the address of the first instruction; the second type of instruction is used to extract the jump destination address of the first instruction when the first instruction is a conditional branch instruction; and the third type of instruction is used to extract information on whether the first instruction is a conditional branch instruction. Execute the instruction sequence to obtain the analysis result of the first instruction; Specifically, the first type of instruction is used to save the address of the first instruction into a first variable of a predefined structure; the second type of instruction is used to save the jump destination address of the first instruction into a second variable of the predefined structure when the first instruction is a conditional branch instruction, or to set the second variable of the predefined structure to a preset value when the first instruction is not a conditional branch instruction; the third type of instruction is used to save information about whether the first instruction is a conditional branch instruction into a third variable of the predefined structure. The step of executing the instruction sequence and obtaining the analysis result of the first instruction includes: Execute the instruction sequence to obtain the target structure corresponding to the first instruction; Access the target structure to obtain the analysis results of the first instruction.
2. The method according to claim 1, characterized in that, After determining whether the jump destination address of the first instruction is the same as the address of the second instruction, the method further includes: If the jump destination address of the first instruction is different from the address of the second instruction, it is determined that the first instruction did not jump.
3. The method according to claim 1, characterized in that, The first instruction and the second instruction are two adjacent instructions of the application.
4. An instruction jump determination device, applied to electronic equipment, characterized in that, include: The first acquisition module is used to acquire the analysis results of the first instruction; The first judgment module is used to determine whether the first instruction is a conditional branch instruction based on the analysis results. The second acquisition module is used to acquire the jump destination address of the first instruction from the analysis result when the first instruction is a conditional branch instruction; The second judgment module is used to determine whether the jump destination address of the first instruction is the same as the address of the second instruction; wherein the second instruction is the next instruction after the first instruction; The determination module is used to determine that the first instruction has jumped if the jump destination address of the first instruction is the same as the address of the second instruction. The first acquisition module includes: An insertion unit is configured to insert a first type of instruction, a second type of instruction, and a third type of instruction before the first instruction to form an instruction sequence; wherein, the first type of instruction is used to extract the address of the first instruction; the second type of instruction is used to extract the jump destination address of the first instruction if the first instruction is a conditional branch instruction; and the third type of instruction is used to extract information about whether the first instruction is a conditional branch instruction. An execution unit is configured to execute the instruction sequence and obtain the analysis result of the first instruction; Specifically, the first type of instruction is used to save the address of the first instruction into a first variable of a predefined structure; the second type of instruction is used to save the jump destination address of the first instruction into a second variable of the predefined structure when the first instruction is a conditional branch instruction, or to set the second variable of the predefined structure to a preset value when the first instruction is not a conditional branch instruction; the third type of instruction is used to save information about whether the first instruction is a conditional branch instruction into a third variable of the predefined structure. The execution unit includes: An execution subunit is used to execute the instruction sequence and obtain the target structure corresponding to the first instruction; The access subunit is used to access the target structure and obtain the analysis results of the first instruction.
5. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein when the program or instructions are executed by the processor, they implement the steps of the instruction jump determination method as described in any one of claims 1 to 3.
6. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions, which, when executed by a processor, implement the steps of the instruction jump determination method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
SPARC V8 system structure based classified type mixed branch prediction system
CN105718241A
Conditional jump instruction processing method and system and related device
CN113760366A