Files
ed 0f80938a55 docs(twitter): add 2076893128515112995 corpus (NOTimothyLottes error-check disasm)
6-post single-author walkthrough of the fast-path error-check pattern:
volatile store __LINE__ + error code, TEST, conditional forward branch
to a distant Err() call. Companion to the 2063733456144597200 thread
which established the macro system via the conversation with
@winning_tactic.
2026-07-26 21:15:16 -04:00

110 lines
4.0 KiB
JSON

{
"root_post_id": "2076893128515112995",
"posts": [
{
"post_id": "2076888631508107561",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "Another round of getting optimized error checking. Disassembly [after syscall] shows that it works. \n(1.) Volatile store __LINE__\n(2.) Volatile store \"error code\"\n(3.) TEST if error\n(4.) Conditional forward branch on error [static prediction untaken]\nAS_MINIMAL_AS_ONE_CAN_GET",
"timestamp": "2026-07-14 04:36:51",
"media_urls": [
"https://pbs.twimg.com/media/HNKWJZqXwAADMnN?format=png&name=orig"
],
"reply_to_id": null,
"quote_of_id": null,
"metrics": {
"reply_count": 2,
"repost_count": 0,
"like_count": 8,
"view_count": 1903
}
},
{
"post_id": "2076890340057878586",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "A macro cheat sheet to try to explain how it works ...",
"timestamp": "2026-07-14 04:43:38",
"media_urls": [
"https://pbs.twimg.com/media/HNKX5DhXIAE1BG6?format=png&name=orig"
],
"reply_to_id": "2076888631508107561",
"quote_of_id": null,
"metrics": {
"reply_count": 2,
"repost_count": 0,
"like_count": 7,
"view_count": 567
}
},
{
"post_id": "2076891161898143906",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "I have a collection of force inline wrappers that test returns from syscalls/functions for error and return the return. These all leverage builtin_expect so the compiler knows to make them fall through in the common case.",
"timestamp": "2026-07-14 04:46:54",
"media_urls": [
"https://pbs.twimg.com/media/HNKY8qFXQAAF9Db?format=png&name=orig"
],
"reply_to_id": "2076890340057878586",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 5,
"view_count": 350
}
},
{
"post_id": "2076892038314741815",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "Those force inlines call Err() on terminal error. The Err() function ensures the {__LINE__, error} stores are visible, then triggers the console drawing code to kill the app with printed error. Then it sleeps until the termination.",
"timestamp": "2026-07-14 04:50:23",
"media_urls": [
"https://pbs.twimg.com/media/HNKZyFTXYAAETnU?format=png&name=orig"
],
"reply_to_id": "2076891161898143906",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 2,
"view_count": 143
}
},
{
"post_id": "2076892591216341089",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "Compiler eventually screws up, but at least it gets the fast path correct, and the slow error path gets an extra call. Effectively it conditionally forward branches to a distant call to Err() instead of just branching to the Err().",
"timestamp": "2026-07-14 04:52:35",
"media_urls": [],
"reply_to_id": "2076892038314741815",
"quote_of_id": null,
"metrics": {
"reply_count": 1,
"repost_count": 0,
"like_count": 2,
"view_count": 449
}
},
{
"post_id": "2076893128515112995",
"author": "NOTimothyLottes",
"handle": "NOTimothyLottes",
"text": "So I can liter error checks around stuff with little actual cost,\n(1.) Two stores\n(2.) A CMP or TEST\n(3.) An ignored on no-error branch on the first execution! [this code almost never runs 2 times].",
"timestamp": "2026-07-14 04:54:43",
"media_urls": [],
"reply_to_id": "2076892591216341089",
"quote_of_id": null,
"metrics": {
"reply_count": 0,
"repost_count": 0,
"like_count": 3,
"view_count": 419
}
}
],
"source_url": "https://x.com/NOTimothyLottes/status/2076893128515112995"
}