unpoison when releasing arena

This commit is contained in:
jacob 2024-06-12 17:00:08 -05:00
parent 6704980693
commit 179a6c3588
2 changed files with 22 additions and 27 deletions

48
build.c
View File

@ -38,7 +38,6 @@ Bool IsDirty(D_Tag tag)
* Step
* ========================== */
typedef struct Step Step;
typedef struct StepList StepList;
@ -313,8 +312,6 @@ void BuildStepMsvcCompileCommand(Step *s)
void OnBuild(StringList cli_args)
{
OS_TimeStamp start = OS_GetTimeStamp();
arena = ArenaAlloc(Gigabyte(64));
store = D_StoreAlloc();
worker_shared = ArenaPush(&arena, WorkerSharedState);
@ -352,7 +349,7 @@ void OnBuild(StringList cli_args)
ArgState arg_state = ArgState_None;
for (StringListNode *n = cli_args.first; n; n = n->next) {
String arg = n->string;
if (n != cli_args.first) {
if (n != cli_args.first) {
switch (arg_state) {
case ArgState_OutputDir:
{
@ -395,27 +392,29 @@ void OnBuild(StringList cli_args)
OS_CreateDirAtAbsPath(out_bin_dir_path);
}
SH_Print(Lit("------------------------------\n"));
SH_Print(Lit("Power Play build\n"));
{
SH_Print(Lit("------------------------------\n"));
String compiler = { 0 };
String compiler_loc = { 0 };
SH_CommandResult where_res = { 0 };
if (arg_msvc) {
compiler = Lit("Msvc");
where_res = SH_RunCommandCaptureOutput(&arena, Lit("where cl.exe"), true);
} else {
compiler = Lit("Clang");
where_res = SH_RunCommandCaptureOutput(&arena, Lit("where clang.exe"), true);
{
SH_CommandResult where_res = { 0 };
if (arg_msvc) {
compiler = Lit("Msvc");
where_res = SH_RunCommandCaptureOutput(&arena, Lit("where cl.exe"), true);
} else {
compiler = Lit("Clang");
where_res = SH_RunCommandCaptureOutput(&arena, Lit("where clang.exe"), true);
}
compiler_loc = where_res.error ? Lit("Not found") : StringReplace(&arena, where_res.output, Lit("\n"), Lit(""));
}
compiler_loc = where_res.error ? Lit("Not found") : StringReplace(&arena, where_res.output, Lit("\n"), Lit(""));
SH_PrintF(Lit("[Compiler: %F] (%F)\n"), FmtStr(compiler), FmtStr(compiler_loc));
SH_PrintF(Lit("Compiler path: %F\n"), FmtStr(compiler_loc));
SH_PrintF(Lit("Build path: \"%F\"\n"), FmtStr(out_bin_dir_path));
SH_PrintF(Lit("[%F]\n"), FmtStr(compiler));
if (arg_asan) SH_Print(Lit("[Asan Enabled]\n"));
if (arg_profiling) SH_Print(Lit("[Profiling]\n"));
if (arg_developer) SH_Print(Lit("[Developer build]\n"));
SH_Print(Lit("------------------------------\n\n"));
}
if (arg_asan) SH_Print(Lit("[Asan Enabled]\n"));
if (arg_profiling) SH_Print(Lit("[Profiling]\n"));
if (arg_developer) SH_Print(Lit("[Developer build]\n"));
SH_PrintF(Lit("Building to \"%F\"\n"), FmtStr(out_bin_dir_path));
SH_Print(Lit("------------------------------\n\n"));
/* ========================== *
* Constants
@ -613,7 +612,7 @@ void OnBuild(StringList cli_args)
}
/* ========================== *
* Generate root dependencies
* Examine build hash
* ========================== */
{
@ -636,7 +635,7 @@ void OnBuild(StringList cli_args)
}
if (build_hash != old_build_hash) {
SH_Print(Lit("Builder exe or build args have changed, rebuilding all.\n"));
SH_Print(Lit("Builder exe or build args have changed, forcing complete rebuild.\n"));
force_rebuild = true;
String data = StringFromStruct(&build_hash);
D_ClearWrite(build_hash_file, data);
@ -913,7 +912,6 @@ void OnBuild(StringList cli_args)
}
}
/* ========================== *
* Build step: Link
* ========================== */
@ -1026,10 +1024,6 @@ void OnBuild(StringList cli_args)
D_WriteStoreToHistFile(&store, hist_path);
OS_TimeStamp end = OS_GetTimeStamp();
F64 seconds = OS_SecondsFromTimeStamp(end - start);
SH_PrintF(Lit("Finished in %F seconds\n"), FmtF64P(seconds, 5));
ShutdownWorkers();
#if 0

View File

@ -46,6 +46,7 @@ void arena_release(struct arena *arena)
{
__prof;
__proffree(arena->base);
ASAN_UNPOISON(arena->base, arena->committed);
sys_memory_release(arena->base);
}