Archive incari-client (client, 26.3, clean)

This commit is contained in:
2026-11-28 00:54:38 -06:00
parent 7a6174687f
commit 12838e838c
2383 changed files with 280266 additions and 0 deletions
@@ -0,0 +1,49 @@
/**
* Checks the throw census (`-Pteavm.throwCensus`, ADR 0033): throws a known number of times on the
* main thread and on another, across one census report, then prints "probe passed". Run with the
* census on and read the "[Incari] Throws" lines: the main thread's site counts 1000 on it, the
* other thread's 3000 off it.
*/
public final class ThrowCensusProbe {
static int caught;
private ThrowCensusProbe() {}
static void fail(int i) {
throw new IllegalStateException("throw " + i);
}
static void failElsewhere(int i) {
throw new UnsupportedOperationException("throw " + i);
}
public static void main(String[] args) throws InterruptedException {
for (int i = 0; i < 1000; i++) {
try {
fail(i);
} catch (IllegalStateException e) {
caught++;
}
}
Thread other = new Thread(() -> {
for (int i = 0; i < 3000; i++) {
try {
failElsewhere(i);
} catch (UnsupportedOperationException e) {
caught++;
}
}
});
other.start();
other.join();
// The census reports at the first throw ten seconds after its first.
Thread.sleep(10_500);
try {
fail(-1);
} catch (IllegalStateException e) {
caught++;
}
System.out.println(caught == 4001 ? "probe passed" : "probe failed: caught " + caught);
}
}