mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
runtime: refactor initialization code
Let each target handle its own initialization/finalization sequence instead of providing one in the runtime with hooks for memory initialization etc. This is much more flexible although it causes a little bit of code duplication.
This commit is contained in:
@@ -23,25 +23,6 @@ func initAll()
|
||||
// scheduler(coroutine)
|
||||
func mainWrapper()
|
||||
|
||||
// Entry point for Go. Initialize all packages and call main.main().
|
||||
//go:export main
|
||||
func main() int {
|
||||
// Initialize memory etc.
|
||||
preinit()
|
||||
|
||||
// Run initializers of all packages.
|
||||
initAll()
|
||||
|
||||
// Enable interrupts etc.
|
||||
postinit()
|
||||
|
||||
// Compiler-generated wrapper to main.main().
|
||||
mainWrapper()
|
||||
|
||||
// For libc compatibility.
|
||||
return 0
|
||||
}
|
||||
|
||||
func GOMAXPROCS(n int) int {
|
||||
// Note: setting GOMAXPROCS is ignored.
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user