mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 04:53:42 +00:00
all: allow -O0 optimization level
This commit is contained in:
+17
-20
@@ -10,14 +10,18 @@ const Compiler = "tgo"
|
||||
// package.
|
||||
func initAll()
|
||||
|
||||
// These signatures are used to call the correct main function: with scheduling
|
||||
// or without scheduling.
|
||||
func main_main()
|
||||
func main_mainAsync(parent *coroutine) *coroutine
|
||||
|
||||
// The compiler will change this to true if there are 'go' statements in the
|
||||
// compiled program and turn it into a const.
|
||||
var hasScheduler bool
|
||||
// The compiler will insert the call to main.main() here, depending on whether
|
||||
// the scheduler is necessary.
|
||||
//
|
||||
// Without scheduler:
|
||||
//
|
||||
// main.main()
|
||||
//
|
||||
// With scheduler:
|
||||
//
|
||||
// coroutine := main.main(nil)
|
||||
// scheduler(coroutine)
|
||||
func mainWrapper()
|
||||
|
||||
// Entry point for Go. Initialize all packages and call main.main().
|
||||
//go:export main
|
||||
@@ -31,18 +35,11 @@ func main() int {
|
||||
// Enable interrupts etc.
|
||||
postinit()
|
||||
|
||||
// This branch must be optimized away. Only one of the targets must remain,
|
||||
// or there will be link errors.
|
||||
if hasScheduler {
|
||||
// Initialize main and run the scheduler.
|
||||
coro := main_mainAsync(nil)
|
||||
scheduler(coro)
|
||||
return 0
|
||||
} else {
|
||||
// No scheduler is necessary. Call main directly.
|
||||
main_main()
|
||||
return 0
|
||||
}
|
||||
// Compiler-generated wrapper to main.main().
|
||||
mainWrapper()
|
||||
|
||||
// For libc compatibility.
|
||||
return 0
|
||||
}
|
||||
|
||||
func GOMAXPROCS(n int) int {
|
||||
|
||||
Reference in New Issue
Block a user