fix: trace embedded Chez boot stages
ober
81cb59081bd1348a30206645366f554f6e0c311d
--- a/support/multicall-main.c +++ b/support/multicall-main.c @@ -98,6 +98,12 @@ static void call_scheme_1(const char *who, ptr arg) { Scall1(procedure, arg); } +static void debug_boot_stage(const char *stage) { + if (getenv("JERBOA_DEBUG_BOOT") != NULL) { + fprintf(stderr, "jerboa: boot %s\n", stage); + } +} + /* ── jerbuild lib bundle: extracted to a per-sha cache dir on demand ─────── * Layout: $XDG_CACHE_HOME/jerbuild/<sha256>/ (or ~/.cache/jerbuild/<sha256>/) * holding the Jerboa stdlib + Chez kernel files the `jerbuild binary`/`build` @@ -644,10 +650,14 @@ int main(int argc, const char *argv[]) { * to native .wpo (cross-built .wpo carry the build host's machine-type). */ if (!strcmp(name, "jerboa") && argc > 1 && !strcmp(argv[1], "runtime")) { jerboa_maybe_enable_shadow_stack("jerboa"); + debug_boot_stage("scheme_init"); Sscheme_init(NULL); + debug_boot_stage("register_boot_files"); Sregister_boot_file_bytes("petite", (void *)petite_boot_data, petite_boot_size); Sregister_boot_file_bytes("scheme", (void *)scheme_boot_data, scheme_boot_size); + debug_boot_stage("build_heap"); Sbuild_heap(NULL, register_symbols); + debug_boot_stage("configure_library_paths"); configure_embedded_library_paths(); int st = (argc > 2) ? Sscheme_script(argv[2], argc - 2, argv + 2) : Sscheme_start(argc - 1, argv + 1); @@ -682,10 +692,14 @@ int main(int argc, const char *argv[]) { setenv("JERBOA_MULTICALL_NAME", mode, 1); jerboa_maybe_enable_shadow_stack(mode); + debug_boot_stage("scheme_init"); Sscheme_init(NULL); + debug_boot_stage("register_boot_files"); Sregister_boot_file_bytes("petite", (void *)petite_boot_data, petite_boot_size); Sregister_boot_file_bytes("scheme", (void *)scheme_boot_data, scheme_boot_size); + debug_boot_stage("build_heap"); Sbuild_heap(NULL, register_symbols); + debug_boot_stage("configure_library_paths"); configure_embedded_library_paths(); const char *prog = write_program_tmpfile();