internal/task: rename tinygo_pause to tinygo_task_exit

This is more descriptive: the call is to exit a task, not to pause it.
This also makes it more obvious that there's an optimization
opportunity: to free the stack explicitly after the goroutine returns
(or to keep it as a cache for the next stack allocation).
This commit is contained in:
Ayke van Laethem
2025-04-04 08:18:42 +02:00
committed by Ron Evans
parent 120d17c124
commit 95ee572b4d
12 changed files with 17 additions and 16 deletions
+3 -2
View File
@@ -54,8 +54,9 @@ func Pause() {
currentTask.state.pause()
}
//export tinygo_pause
func pause() {
//export tinygo_task_exit
func taskExit() {
// TODO: explicitly free the stack after switching back to the scheduler.
Pause()
}
+1 -1
View File
@@ -24,7 +24,7 @@ tinygo_startTask:
addl $4, %esp
// After return, exit this goroutine. This is a tail call.
jmp tinygo_pause
jmp tinygo_task_exit
.cfi_endproc
.global tinygo_swapTask
+2 -2
View File
@@ -30,9 +30,9 @@ tinygo_startTask:
// After return, exit this goroutine. This is a tail call.
#ifdef __MACH__
jmp _tinygo_pause
jmp _tinygo_task_exit
#else
jmp tinygo_pause
jmp tinygo_task_exit
#endif
.cfi_endproc
+1 -1
View File
@@ -22,7 +22,7 @@ tinygo_startTask:
// After return, exit this goroutine.
// This has to be a call, not a jump, to keep the stack correctly aligned.
callq tinygo_pause
callq tinygo_task_exit
.global tinygo_swapTask
.section .text.tinygo_swapTask,"ax"
+1 -1
View File
@@ -28,7 +28,7 @@ tinygo_startTask:
blx r4
// After return, exit this goroutine. This is a tail call.
bl tinygo_pause
bl tinygo_task_exit
.cfi_endproc
.size tinygo_startTask, .-tinygo_startTask
+2 -2
View File
@@ -27,9 +27,9 @@ tinygo_startTask:
// After return, exit this goroutine. This is a tail call.
#ifdef __MACH__
b _tinygo_pause
b _tinygo_task_exit
#else
b tinygo_pause
b tinygo_task_exit
#endif
.cfi_endproc
#ifndef __MACH__
+2 -2
View File
@@ -32,10 +32,10 @@ tinygo_startTask:
// Note that they will probably not be able to run more than the main
// goroutine anyway, but this file is compiled for all AVRs so it needs to
// compile at least.
rcall tinygo_pause
rcall tinygo_task_exit
#else
// Other devices can (and must) use the regular call instruction.
call tinygo_pause
call tinygo_task_exit
#endif
.global tinygo_swapTask
+1 -1
View File
@@ -28,7 +28,7 @@ tinygo_startTask:
blx r4
// After return, exit this goroutine. This is a tail call.
bl tinygo_pause
bl tinygo_task_exit
.cfi_endproc
.size tinygo_startTask, .-tinygo_startTask
+1 -1
View File
@@ -27,7 +27,7 @@ tinygo_startTask:
callx4 a3
// After return, exit this goroutine. This call never returns.
call4 tinygo_pause
call4 tinygo_task_exit
.section .text.tinygo_swapTask,"ax",@progbits
.global tinygo_swapTask
+1 -1
View File
@@ -18,7 +18,7 @@ tinygo_startTask:
callx0 a12
// After return, exit this goroutine. This is a tail call.
call0 tinygo_pause
call0 tinygo_task_exit
.size tinygo_startTask, .-tinygo_startTask
.global tinygo_swapTask
+1 -1
View File
@@ -22,7 +22,7 @@ tinygo_startTask:
nop
// After return, exit this goroutine. This is a tail call.
j tinygo_pause
j tinygo_task_exit
nop
.section .text.tinygo_swapTask
+1 -1
View File
@@ -19,7 +19,7 @@ tinygo_startTask:
jalr s0
// After return, exit this goroutine. This is a tail call.
tail tinygo_pause
tail tinygo_task_exit
.section .text.tinygo_swapTask
.global tinygo_swapTask