aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-12-01 09:32:31 +0100
committerAyke <[email protected]>2024-12-01 11:23:27 +0100
commit3b8062170c51524fc450cbf53f8f4eb817347f17 (patch)
treea9d74feca372033c59a3b30a481bfb3b8307fd89
parent26c36d0a2e11ba6b31300881b8dd729b1ad8cfe6 (diff)
downloadtinygo-3b8062170c51524fc450cbf53f8f4eb817347f17.tar.gz
tinygo-3b8062170c51524fc450cbf53f8f4eb817347f17.zip
mips: fix a bug when scanning the stack
Previously the assembler was reordering this code: jal tinygo_scanstack move $a0, $sp Into this: jal tinygo_scanstack nop move $a0, $sp So it was "helpfully" inserting a branch delay slot, even though this was already being taken care of. Somehow this didn't break, but it does break in the WIP threading branch (https://github.com/tinygo-org/tinygo/pull/4559) where this bug leads to a crash.
-rw-r--r--src/internal/task/task_stack_mipsx.S4
-rw-r--r--src/runtime/asm_mipsx.S4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/internal/task/task_stack_mipsx.S b/src/internal/task/task_stack_mipsx.S
index 903a847c7..018c63d93 100644
--- a/src/internal/task/task_stack_mipsx.S
+++ b/src/internal/task/task_stack_mipsx.S
@@ -1,3 +1,7 @@
+// Do not reorder instructions to insert a branch delay slot.
+// We know what we're doing, and will manually fill the branch delay slot.
+.set noreorder
+
.section .text.tinygo_startTask
.global tinygo_startTask
.type tinygo_startTask, %function
diff --git a/src/runtime/asm_mipsx.S b/src/runtime/asm_mipsx.S
index e38064364..f2e81bd94 100644
--- a/src/runtime/asm_mipsx.S
+++ b/src/runtime/asm_mipsx.S
@@ -1,3 +1,7 @@
+// Do not reorder instructions to insert a branch delay slot.
+// We know what we're doing, and will manually fill the branch delay slot.
+.set noreorder
+
.section .text.tinygo_scanCurrentStack
.global tinygo_scanCurrentStack
.type tinygo_scanCurrentStack, %function