
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.
15 строки
593 Б
LLVM
15 строки
593 Б
LLVM
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
|
target triple = "armv7m-none-eabi"
|
|
|
|
declare i32 @"internal/task.getGoroutineStackSize"(i32, i8*, i8*)
|
|
|
|
declare void @"runtime.run$1$gowrapper"(i8*)
|
|
|
|
declare void @"internal/task.start"(i32, i8*, i32)
|
|
|
|
define void @Reset_Handler() {
|
|
entry:
|
|
%stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (void (i8*)* @"runtime.run$1$gowrapper" to i32), i8* undef, i8* undef)
|
|
call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"runtime.run$1$gowrapper" to i32), i8* undef, i32 %stacksize)
|
|
ret void
|
|
}
|