
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.
17 строки
656 Б
LLVM
17 строки
656 Б
LLVM
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
|
target triple = "armv7m-none-eabi"
|
|
|
|
@"internal/task.stackSizes" = global [1 x i32] [i32 1024], section ".tinygo_stacksizes"
|
|
|
|
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:
|
|
%stacksize1 = load i32, i32* getelementptr inbounds ([1 x i32], [1 x i32]* @"internal/task.stackSizes", i32 0, i32 0)
|
|
call void @"internal/task.start"(i32 ptrtoint (void (i8*)* @"runtime.run$1$gowrapper" to i32), i8* undef, i32 %stacksize1)
|
|
ret void
|
|
}
|