Skip to content

Commit

Permalink
mips: fix a bug when scanning the stack
Browse files Browse the repository at this point in the history
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
(#4559) where this bug leads to
a crash.
  • Loading branch information
aykevl committed Dec 1, 2024
1 parent 26c36d0 commit 3b80621
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/internal/task/task_stack_mipsx.S
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/runtime/asm_mipsx.S
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 3b80621

Please sign in to comment.