diff options
| author | Alessandro Gatti <a.gatti@frob.it> | 2025-11-04 01:56:33 +0100 |
|---|---|---|
| committer | Alessandro Gatti <a.gatti@frob.it> | 2025-11-04 02:21:30 +0100 |
| commit | 2b5669d193f2a2e41d7a57cedd86ec3130d2dab3 (patch) | |
| tree | 986c220a2bda3983222bd2a48933c943d405aab4 /tests/basics/int-big-mul.py | |
| parent | e0a9b7023b28ac920b9e8e82f9bb4e8fda49ab3e (diff) | |
py/emitnative: Generate shorter RV32 code for exception handling.
This commit lets the native emitter generate shorter code when clearing
exception objects on RV32.
Since there are no direct generic ASM functions to set a specific
immediate to a local variable, the native emitter usually generates an
immediate assignment to a temporary register and then a store of that
register into the chosen local variable. This pattern is also followed
when clearing certain local variables related to exception handling,
using MP_OBJ_NULL as the immediate value to set.
Given that at the moment MP_OBJ_NULL is defined to be 0 (with some other
spots in the native emitter that leverage that fact when checking the
state of the variables mentioned earlier), and that the RV32 CPU has a
dedicated register that is hardwired to read 0, a new method to set
local variables to MP_OBJ_NULL is introduced.
When generating RV32 code, the new macro will skip the intermediate
register assignment and directly uses the X0/ZERO register to set the
chosen local variable to MP_OBJ_NULL. Other platforms will still
generate the same code sequence as before this change.
This is a followup to 40585eaa8f1b603f0094b73764e8ce5623812ecf.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Diffstat (limited to 'tests/basics/int-big-mul.py')
0 files changed, 0 insertions, 0 deletions
