summaryrefslogtreecommitdiffstatshomepage
path: root/py/modmath.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-07-31 12:33:33 +1000
committerDamien George <damien@micropython.org>2024-08-07 12:25:21 +1000
commitafba3e054041bbad961fad61df7c4797ab35d9e3 (patch)
treec05db5277813d8fd13eb04901c7f8f9c5a76c301 /py/modmath.c
parentd2e33fe3096eec60d7017b0f17c4ddb6910a4d0b (diff)
downloadmicropython-afba3e054041bbad961fad61df7c4797ab35d9e3.tar.gz
micropython-afba3e054041bbad961fad61df7c4797ab35d9e3.zip
py/emitnative: Fix case of clobbered REG_TEMP0 when loading const obj.
The `emit_load_reg_with_object()` helper function will clobber `REG_TEMP0`. This is currently OK on architectures where `REG_RET` and `REG_TEMP0` are the same (all architectures except RV32), because all callers of `emit_load_reg_with_object()` use either `REG_RET` or `REG_TEMP0` as the destination register. But on RV32 these registers are different and so when `REG_RET` is the destination, `REG_TEMP0` is clobbered, leading to incorrectly generated machine code. This commit fixes the issue simply by using `REG_TEMP0` as the destination register for all uses of `emit_load_reg_with_object()`, and adds a comment to make sure the caller of this function is careful. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/modmath.c')
0 files changed, 0 insertions, 0 deletions