StarletBootstrapProbe: read --cycles where it stands, as before

--broadway-h1a had moved --cycles' reading after the options, which
changed the usage errors' text for a missing value or a second --cycles.
The bound is now known before the options are read (whether
--broadway-h1a is among them), and --cycles is read in place, with
master's messages: without --broadway-h1a, every run and every refusal
is master's, byte for byte.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Yaya48andClaude Opus 5.5 committed 2026-11-04 21:03:10 +01:00
1 parent 9cce9b35ef
commit 2df9dfc909
1 file changed
+13 -15
@@ -423,8 +423,15 @@ int main(int argc, char** argv)
SBR1Mode sbr1 = SBR1Mode::None;
ExpectedOutcome expected = ExpectedOutcome::Idle;
bool outcome_selected = false;
std::optional<std::string_view> cycles_text;
std::optional<u64> cycles;
bool broadway_h1a = false;
// --cycles' bound: MAX_CYCLES, or MAX_CLIENT_CYCLES when --broadway-h1a is among the options
// (ProbeBudget.h), known before they are read so that --cycles is read where it stands.
const auto is_client = [](const char* argument) {
return std::string_view(argument) == "--broadway-h1a";
};
const u64 max_cycles =
std::any_of(argv + 2, argv + argc, is_client) ? MAX_CLIENT_CYCLES : MAX_CYCLES;
std::optional<std::string> package_path;
std::optional<std::string> script_path;
for (int index = 2; index < argc; ++index)
@@ -462,13 +469,14 @@ int main(int argc, char** argv)
}
else if (option == "--cycles")
{
// Given once; read below, once the mode, which bounds it, is known.
if (cycles_text || index + 1 == argc)
// A whole number of slices, at most max_cycles (ProbeBudget.h); given once.
if (cycles || index + 1 == argc || !(cycles = ParseCycles(argv[index + 1], max_cycles)))
{
std::cerr << "--cycles takes one decimal multiple of " << SLICE_CYCLES << ", once\n";
std::cerr << "--cycles takes one decimal multiple of " << SLICE_CYCLES << ", at most "
<< max_cycles << ", once\n";
return 2;
}
cycles_text = argv[++index];
++index;
}
else if (option == "--jit")
jit = true;
@@ -516,16 +524,6 @@ int main(int argc, char** argv)
std::cerr << "--broadway-h1a takes --sbr1-record: the loader's monitor reads the record\n";
return 2;
}
// A whole number of slices, at most MAX_CYCLES, or MAX_CLIENT_CYCLES with the client
// (ProbeBudget.h).
const u64 max_cycles = broadway_h1a ? MAX_CLIENT_CYCLES : MAX_CYCLES;
std::optional<u64> cycles;
if (cycles_text && !(cycles = ParseCycles(*cycles_text, max_cycles)))
{
std::cerr << "--cycles takes one decimal multiple of " << SLICE_CYCLES << ", at most "
<< max_cycles << ", once\n";
return 2;
}
// The package file read and checked before anything is set up: a refused file ends the run
// before StarOS starts.