amos 73a5240295 Batches 21 and 18: add 74 calibrated tasks (40 Bos redo, 34 HWE code-gen)
Batch 21 (20261027-A-bos-redo-21) rebuilt 40 of the 53 rejected Bos-qiao
environments: hidden assertions that ran inside the candidate's process
now run in a trusted parent that reads observations from a low-UID
worker; gold bytes are unchanged. 9 were excluded for scope (ROS2,
oversize, security core), 3 are blocked because the source requires an
exec bit the platform does not freeze, 1 lacks requests/bs4 in trace6.

Batch 18 (20261026-C-hwe-codegen-18) adds its last 34 of 134 tasks; the
first 100 landed in 2f32624d.

Claude reviewed 74/74 USABLE against current digests, canonical
families, no ID or source overlap with main, plain public docs. Only the
new task directories are taken; the stale pre-batch-20 copies of
concur-release-capsule and resource-temp-link on the batch 21 branch and
both branches' progress notes stay as main has them. Difficulty is
unmeasured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 10:23:12 +08:00

78 lines
2.8 KiB
C++

#include "memory.hpp"
#include <array>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
static std::string bytes(const std::vector<uint8_t> &values) {
const char *digits = "0123456789abcdef";
std::string result;
for (auto value : values) {
result += digits[value >> 4];
result += digits[value & 15];
}
return result.empty() ? "-" : result;
}
static std::string numbers(const std::vector<int64_t> &values) {
std::string result;
for (auto value : values) {
if (!result.empty()) result += ',';
result += std::to_string(value);
}
return result.empty() ? "-" : result;
}
int main() {
std::array<std::unique_ptr<Memory>, 2> objects;
objects[0] = std::make_unique<Memory>();
objects[1] = std::make_unique<Memory>();
std::string line;
while (std::getline(std::cin, line)) {
std::istringstream input(line);
std::string verb;
std::size_t instance = 0;
input >> verb >> instance;
if (verb == "NEW") {
objects[instance] = std::make_unique<Memory>();
std::cout << "N\n";
continue;
}
auto &m = *objects[instance];
int64_t a = 0, b = 0, c = 0, d = 0;
input >> a >> b >> c >> d;
Status result = Status::OK;
if (verb == "RESET") result = m.reset(a, b);
else if (verb == "ARM") result = m.arm(a, b);
else if (verb == "ALLOC") result = m.allocate(a, b);
else if (verb == "REPLACE") result = m.replace(a, b);
else if (verb == "FREE") result = m.release(a);
else if (verb == "FILL") result = m.fill(a, b, c, d);
else if (verb == "READ") {
auto r = m.read(a, b, c);
std::cout << "R " << static_cast<int>(r.status) << ' ' << r.bytes.size();
std::cout << ' ' << bytes(r.bytes) << '\n';
continue;
} else if (verb == "INFO") {
auto r = m.info(a);
const auto &i = r.value;
std::cout << "I " << static_cast<int>(r.status) << ' ' << i.id << ' ' << i.size;
std::cout << ' ' << static_cast<int>(i.backend) << ' ' << i.token;
std::cout << ' ' << i.pages.size() << ' ' << numbers(i.pages) << '\n';
continue;
} else if (verb == "STATS") {
const auto s = m.stats();
std::cout << "T " << s.c_capacity << ' ' << s.v_capacity;
std::cout << ' ' << s.c_used << ' ' << s.v_used;
std::cout << ' ' << s.c_mappings << ' ' << s.v_mappings;
std::cout << ' ' << s.c_fail << ' ' << s.v_fail;
std::cout << ' ' << s.c_attempts << ' ' << s.v_attempts;
std::cout << ' ' << s.ids.size() << ' ' << numbers(s.ids) << '\n';
continue;
}
std::cout << "S " << static_cast<int>(result) << '\n';
}
return 0;
}