Skip to content

Use conditional trap on jitted code #157

@igorsnunes

Description

@igorsnunes

See the code snippet below:

0x1f211dd8      lis     r3,16383
0x1f211ddc      ori     r3,r3,65535
0x1f211de0      cmplw   cr1,r11,r3
0x1f211de4      lwz     r12,-26432(r2)
0x1f211de8      nop
0x1f211dec      mtctr   r12
0x1f211df0      nop
0x1f211df4      nop
0x1f211df8      blectr  cr1
0x1f211dfc      trap
0x1f211e00      lwz     r3,44(r31)

The purpose of this chunk of code is to compare register $r3 and $r11. If $r11 is not less or equal $r3 (i.e., greater than) a "trap" exception is executed ($r12 is pointing to 0x1f211e00).

These operations could be substituted by:

lis     r3,16383
ori     r3,r3,65535
tdgt    r11,r3
lwz     r3,44(r31)

Accordingly to the PowerPc64 Isa, Table 130 (trap mnemonics).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions