1
Fork 0

Grow stack size on windows binaries. Support foreign import with when correctly.

This commit is contained in:
DanielGavin 2025-06-25 15:02:05 +02:00
parent c5f8b85e9a
commit 077dba63ee
3 changed files with 27 additions and 9 deletions

View file

@ -2,11 +2,11 @@
setlocal enabledelayedexpansion
if "%1" == "test" (
odin test tests -collection:src=src -debug -define:ODIN_TEST_THREADS=1 -define:ODIN_TEST_TRACK_MEMORY=false
odin test tests -collection:src=src -debug -define:ODIN_TEST_THREADS=1 -define:ODIN_TEST_TRACK_MEMORY=false -extra-linker-flags:"/STACK:4000000,2000000"
) else if "%1" == "single_test" (
odin test tests -collection:src=src -define:ODIN_TEST_NAMES=%2 -define:ODIN_TEST_TRACK_MEMORY=false -debug
odin test tests -collection:src=src -define:ODIN_TEST_NAMES=%2 -define:ODIN_TEST_TRACK_MEMORY=false -debug -extra-linker-flags:"/STACK:4000000,2000000"
) else if "%1" == "debug" (
odin build src\ -show-timings -microarch:native -collection:src=src -out:ols.exe -o:minimal -no-bounds-check -use-separate-modules -debug
odin build src\ -show-timings -microarch:native -collection:src=src -out:ols.exe -o:minimal -no-bounds-check -use-separate-modules -debug -extra-linker-flags:"/STACK:4000000,2000000"
) else (
odin build src\ -show-timings -microarch:native -collection:src=src -out:ols.exe -o:speed -no-bounds-check
)
odin build src\ -show-timings -microarch:native -collection:src=src -out:ols.exe -o:speed -no-bounds-check -extra-linker-flags:"/STACK:4000000,2000000"
)

4
ci.bat
View file

@ -7,10 +7,10 @@ if "%1" == "CI" (
rem odin test tests -collection:src=src -define:ODIN_TEST_THREADS=1
rem if %errorlevel% neq 0 exit /b 1
odin build src\ -collection:src=src -out:ols.exe -o:speed
odin build src\ -collection:src=src -out:ols.exe -o:speed -extra-linker-flags:"/STACK:4000000,2000000"
call "tools/odinfmt/tests.bat"
if %errorlevel% neq 0 exit /b 1
) else (
odin build src\ -collection:src=src -out:ols.exe -o:speed -no-bounds-check
odin build src\ -collection:src=src -out:ols.exe -o:speed -no-bounds-check -extra-linker-flags:"/STACK:4000000,2000000"
)

View file

@ -377,6 +377,16 @@ collect_when_stmt :: proc(
for stmt in block.stmts {
if when_stmt, ok := stmt.derived.(^ast.When_Stmt); ok {
collect_when_stmt(exprs, file, file_tags, when_stmt, skip_private)
} else if foreign_decl, ok := stmt.derived.(^ast.Foreign_Block_Decl); ok {
if foreign_decl.body == nil {
continue
}
if foreign_block, ok := foreign_decl.body.derived.(^ast.Block_Stmt); ok {
for foreign_stmt in foreign_block.stmts {
collect_value_decl(exprs, file, file_tags, foreign_stmt, skip_private)
}
}
} else {
collect_value_decl(exprs, file, file_tags, stmt, skip_private)
}
@ -392,11 +402,19 @@ collect_when_stmt :: proc(
for stmt in block.stmts {
if when_stmt, ok := stmt.derived.(^ast.When_Stmt); ok {
collect_when_stmt(exprs, file, file_tags, when_stmt, skip_private)
} else if foreign_decl, ok := stmt.derived.(^ast.Foreign_Block_Decl); ok {
if foreign_decl.body != nil {
if foreign_block, ok := foreign_decl.body.derived.(^ast.Block_Stmt); ok {
for foreign_stmt in foreign_block.stmts {
collect_value_decl(exprs, file, file_tags, foreign_stmt, skip_private)
}
}
}
} else {
collect_value_decl(exprs, file, file_tags, stmt, skip_private)
}
}
}
}
}
return
}
else_stmt = else_when.else_stmt