gc: use raw stack access whenever possible

The only architecture that actually needs special support for scanning
the stack is WebAssembly. All others allow raw access to the stack with
a small bit of assembly. Therefore, don't manually keep track of all
these objects on the stack manually and instead just use conservative
stack scanning.

This results in a massive code size decrease in the affected targets
(only tested linux/amd64 for code size) - sometimes around 33%. It also
allows for future improvements such as using proper stackful goroutines.
This commit is contained in:
Ayke van Laethem
2020-09-25 16:09:37 +02:00
committed by Ron Evans
parent bfa29f17da
commit 67de8b490d
13 changed files with 125 additions and 11 deletions
+5 -2
View File
@@ -1,5 +1,7 @@
package runtime
import "device/arm"
const GOARCH = "arm64"
// The bitness of the CPU (e.g. 8, 32, 64).
@@ -9,5 +11,6 @@ const TargetBits = 64
func align(ptr uintptr) uintptr {
return (ptr + 7) &^ 7
}
func getCurrentStackPointer() uintptr
func getCurrentStackPointer() uintptr {
return arm.AsmFull("mov {}, sp", nil)
}