runtime, internal/task: refactor to simplify stack switching

The Cortex-M target isn't much changed, but much of the logic for the
AVR stack switcher that was previously in assembly has now been moved to
Go to make it more maintainable and in fact smaller in code size. Three
functions (tinygo_getCurrentStackPointer, tinygo_switchToTask,
tinygo_switchToScheduler) have been changed to one: tinygo_swapTask.

This reduction in assembly code should make the code more maintainable
and should make it easier to port stack switching to other
architectures.

I've also moved the assembly files to src/internal/task, which seems
like a more appropriate location to me.
This commit is contained in:
Ayke van Laethem
2020-09-24 23:56:48 +02:00
committed by Ron Evans
parent bb58783158
commit abb09e869e
9 changed files with 169 additions and 268 deletions
+2 -2
View File
@@ -13,7 +13,7 @@
"-Wl,--gc-sections"
],
"extra-files": [
"src/runtime/gc_avr.S",
"src/runtime/scheduler_avr.S"
"src/internal/task/task_stack_avr.S",
"src/runtime/gc_avr.S"
]
}
+2 -2
View File
@@ -25,8 +25,8 @@
],
"extra-files": [
"src/device/arm/cortexm.s",
"src/runtime/gc_arm.S",
"src/runtime/scheduler_cortexm.S"
"src/internal/task/task_stack_cortexm.S",
"src/runtime/gc_arm.S"
],
"gdb": "gdb-multiarch"
}