diff --git a/archive/threads/NOTimothyLottes/2026-07-14-so-i-can-liter-error-checks-around-stuff-with/index.md b/archive/threads/NOTimothyLottes/2026-07-14-so-i-can-liter-error-checks-around-stuff-with/index.md index 6e908c3..ed98587 100644 --- a/archive/threads/NOTimothyLottes/2026-07-14-so-i-can-liter-error-checks-around-stuff-with/index.md +++ b/archive/threads/NOTimothyLottes/2026-07-14-so-i-can-liter-error-checks-around-stuff-with/index.md @@ -1,32 +1,65 @@ --- -title: "So I can liter error checks around stuff with little actual cost," +title: "Another round of getting optimized error checking." type: archive source: twitter -source_url: "https://x.com/NOTimothyLottes/status/2076893128515112995" +source_url: "https://x.com/NOTimothyLottes/status/2076888631508107561" author: "NOTimothyLottes" handle: NOTimothyLottes -post_id: "2076893128515112995" +post_id: "2076888631508107561" date: 2026-07-14 -archived: 2026-08-23 -draft: true +archived: 2026-08-24 +draft: false tags: - archive - twitter - NOTimothyLottes -description: "So I can liter error checks around stuff with little actual cost," +description: "Another round of getting optimized error checking." in_reply_to: "" --- ## Source -- URL: https://x.com/NOTimothyLottes/status/2076893128515112995 +- URL: https://x.com/NOTimothyLottes/status/2076888631508107561 - Author: NOTimothyLottes (@NOTimothyLottes) -- Posted: 2026-07-14 04:54:43 +- Posted: 2026-07-14 04:36:51 ## Thread **1/** +Another round of getting optimized error checking. Disassembly [after syscall] shows that it works. +(1.) Volatile store __LINE__ +(2.) Volatile store "error code" +(3.) TEST if error +(4.) Conditional forward branch on error [static prediction untaken] +AS_MINIMAL_AS_ONE_CAN_GET + +![](https://pbs.twimg.com/media/HNKWJZqXwAADMnN?format=png&name=orig) + +**2/** + +A macro cheat sheet to try to explain how it works ... + +![](https://pbs.twimg.com/media/HNKX5DhXIAE1BG6?format=png&name=orig) + +**3/** + +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. + +![](https://pbs.twimg.com/media/HNKY8qFXQAAF9Db?format=png&name=orig) + +**4/** + +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. + +![](https://pbs.twimg.com/media/HNKZyFTXYAAETnU?format=png&name=orig) + +**5/** + +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(). + +**6/** + So I can liter error checks around stuff with little actual cost, (1.) Two stores (2.) A CMP or TEST diff --git a/archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/2023-04-25-abductee_org-asimov-vibes-intensify.md b/archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/2023-04-25-abductee_org-asimov-vibes-intensify.md new file mode 100644 index 0000000..3267df1 --- /dev/null +++ b/archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/2023-04-25-abductee_org-asimov-vibes-intensify.md @@ -0,0 +1,35 @@ +--- +title: "@kenpex [Asimov vibes intensify]" +type: archive +source: twitter +source_url: "https://x.com/abductee_org/status/1650685805776732160" +author: "Michael Sänger (💉 3/2)" +handle: abductee_org +post_id: "1650685805776732160" +date: 2023-04-25 +archived: 2026-08-24 +draft: false +tags: + - archive + - twitter + - kenpex +description: "@kenpex [Asimov vibes intensify]" +in_reply_to: "" +parent_post_id: "1650678968255913985" +--- + +## Source + +- URL: https://x.com/abductee_org/status/1650685805776732160 +- Author: Michael Sänger (💉 3/2) (@abductee_org) +- Posted: 2023-04-25 02:18:59 + +## Branch + +**1/** + +@kenpex [Asimov vibes intensify] + +## Related + +- Spine: [[archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos]] diff --git a/archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/index.md b/archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/index.md index 5fe8a25..e452ace 100644 --- a/archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/index.md +++ b/archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/index.md @@ -29,6 +29,8 @@ in_reply_to: "" Nerds are crazy https://git.sr.ht/~vdupras/duskos +Branches: [[archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/2023-04-25-abductee_org-asimov-vibes-intensify]], [[archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/2023-04-25-streleav-indeed-any-thoughts-on-how-agi-could-help-the]], [[archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/2023-04-26-ChristerEricson-i-was-curious-about-what-it-would-take-to]], [[archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/2023-04-26-SebAaltonen-some-people-have-too-much-time-for-hobby-projects]], [[archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/2023-04-26-ErikHaliewicz-this-is-actually-a-fantastic-project-though]], [[archive/threads/kenpex/2023-04-25-nerds-are-crazy-https-git-sr-ht-vdupras-duskos/2023-04-27-JaceCear-the-what-if-were-in-an-apocalypse-part-is-very]] + **2/** @kenpex I find the context hilarious, but Forth as asm-level-yet-very-usable-mini-OS has been done, as the boot firmware for OLPC (http://laptop.org) for many years. Looks like it's currently open sourced as https://github.com/openbios/openbios.