mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 00:13:43 +00:00
arm: automatically determine stack sizes
This is a big change that will determine the stack size for many goroutines automatically. Functions that aren't recursive and don't call function pointers can in many cases have an automatically determined worst case stack size. This is useful, as the stack size is usually much lower than the previous hardcoded default of 1024 bytes: somewhere around 200-500 bytes is common. A side effect of this change is that the default stack sizes (including the stack size for other architectures such as AVR) can now be changed in the config JSON file, making it tunable per application.
This commit is contained in:
committed by
Ron Evans
parent
a761f556ff
commit
a21a039ac7
Vendored
+4
-4
@@ -4,7 +4,7 @@ target triple = "armv7m-none-eabi"
|
||||
%"internal/task.state" = type { i8* }
|
||||
%"internal/task.Task" = type { %"internal/task.Task", i8*, i32, %"internal/task.state" }
|
||||
|
||||
declare void @"internal/task.start"(i32, i8*, i8*, i8*)
|
||||
declare void @"internal/task.start"(i32, i8*, i32, i8*, i8*)
|
||||
declare void @"internal/task.Pause"(i8*, i8*)
|
||||
|
||||
declare void @runtime.scheduler(i8*, i8*)
|
||||
@@ -102,9 +102,9 @@ define void @sleepGoroutine(i8*, i8* %parentHandle) {
|
||||
define void @progMain(i8*, i8* %parentHandle) {
|
||||
entry:
|
||||
; Call a sync func in a goroutine.
|
||||
call void @"internal/task.start"(i32 ptrtoint (void (i8*, i8*)* @doNothing to i32), i8* undef, i8* undef, i8* null)
|
||||
call void @"internal/task.start"(i32 ptrtoint (void (i8*, i8*)* @doNothing to i32), i8* undef, i32 undef, i8* undef, i8* null)
|
||||
; Call an async func in a goroutine.
|
||||
call void @"internal/task.start"(i32 ptrtoint (void (i8*, i8*)* @sleepGoroutine to i32), i8* undef, i8* undef, i8* null)
|
||||
call void @"internal/task.start"(i32 ptrtoint (void (i8*, i8*)* @sleepGoroutine to i32), i8* undef, i32 undef, i8* undef, i8* null)
|
||||
; Sleep a bit.
|
||||
call void @sleep(i64 2000000, i8* undef, i8* null)
|
||||
; Done.
|
||||
@@ -114,7 +114,7 @@ entry:
|
||||
; Entrypoint of runtime.
|
||||
define void @main() {
|
||||
entry:
|
||||
call void @"internal/task.start"(i32 ptrtoint (void (i8*, i8*)* @progMain to i32), i8* undef, i8* undef, i8* null)
|
||||
call void @"internal/task.start"(i32 ptrtoint (void (i8*, i8*)* @progMain to i32), i8* undef, i32 undef, i8* undef, i8* null)
|
||||
call void @runtime.scheduler(i8* undef, i8* null)
|
||||
ret void
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user