| [ Web Proxy ] |
| Viewing: https://nullprogram.com/ | [Back] [Original] |
Readers will be familiar with Mask-Step-Index (MSI) hash tables, a technique for building fast, open-addressed hash tables in a dozen lines of code. If multiple threads or processes access an MSI table with at least one still inserting elements, care must be taken to avoid data races. This article will show how to add atomic operations to MSI tables in order to support different concurrency constraints.
This article was discussed on reddit and on Hacker News.
This past Tuesday I typed
C-x C-cin Emacs for the last time after 20 years of daily use. Though nearly half that time was gradually retiring it, switching to modal editing, then to Vim. Emacs is a platform, and Id grown accustomed to its applications, especially those I built myself. There was no particular hurry, so replacements came slowly. With my newly-acquired superpowers I could knock out the last two pieces in a few days work, namelyM-x calcwith stackcalc and Elfeed with Elfeed2. Im especially excited about the latter because it already exceeds the original. Both are multi-platform, native C++ GUI applications using native UI components.
The new w64devkit release two weeks ago is the first to be code-signed with my identity, verified by Microsofts certificate chain. Currently only the release packaging is signed the self-extracting archive and its payload but I will soon code-sign individual EXEs and DLLs within the distribution. In fact, all Windows builds of my project releases have been code-signed the past two weeks, including dcmake, and so should everything going forward. My signing identity builds reputation with each download, so users will have an easier time with SmartScreen, and security software generally. Azure Artifact Signing creates the actual signature, but the rest is done with new infrastructure I built myself, aas-sign. As is often the case, the existing options were deficient for my needs, so I had to build it myself.
CMake has a
--debuggermode since 3.27 (July 2023), allowing software to manipulate it interactively through the Debugger Adaptor Protocol (DAP), an HTTP-like protocol passing JSON messages. Debugger front-ends can start, stop, step, breakpoint, query variables, etc. a live CMake. When I came across this mode, I immediately conceived a project putting it to use. Thanks to recent leaps in software engineering productivity, I had a working prototype in 30 minutes, and by the end of that same day, a complete, multi-platform, native, GUI application. I named it dcmake (debugger for CMake). Ive tested it on macOS, Windows, and Linux. Despite only being couple days old, its one of the coolest things Ive ever built. Prior to 2026, I estimate it would have taken me a month to get the tool to this point.
In February I left my employer after nearly two decades of service. In the moment I was optimistic, yet unsure I made the right choice. Dust settled, Im now absolutely sure I chose correctly. Im happier and better for it. There were multiple factors, but its not mere chance it coincides with these early months of the automation of software engineering. I left an employer that is years behind adopting AI to one actively supporting and encouraging it. As of March, in my professional capacity I no longer write code myself. My current situation was unimaginable to me only a year ago. Like it or not, this is the future of software engineering. Turns out I like it, and having tasted the future I dont want to go back to the old ways.
I came across a recent article on making Linux system calls from a Wine process. Windows programs running under Wine are still normal Linux processes and may interact with the Linux kernel like any other process. None of this was surprising, and the demonstration works just as I expect. Still, it got the wheels spinning and I realized an almost practical application: build my pkg-config implementation such that on Windows
pkg-config.exebehaves as a native pkg-config, but when run under Wine this same binary takes the persona of a Linux program and becomes a cross toolchain pkg-config, bypassing Win32 and talking directly with the Linux kernel. Cosmopolitan Libc cleverly does this out-of-the-box, but in this article well mash together a couple existing sources with a bit of glue.
Software above some complexity level tends to sport an extension language, becoming a kind of software platform itself. Lua fills this role well, and of course theres JavaScript for web technologies. WebAssembly generalizes this, and any Wasm-targeting programming language can extend a Wasm-hosting application. It has more friction than supplying a script in a text file, but extension authors can write in their language of choice, and use more polished development tools debugging, testing, etc. than typically available for a typical extension language. Python is traditionally extended through native code behind a C interface, but its recently become practical to extend Python with Wasm. That is we can ship an architecture-independent Wasm blob inside a Python library, and use it without requiring a native toolchain on the host system. Lets discuss two different use cases and their pitfalls.
Linked lists are a data structure basic building block, with especially flexible allocation behavior. Theyre not just a useful starting point, but sometimes a sound foundation for future growth. Im going to start with the beginner stuff, then without disrupting the original linked list, enhance it with new capabilities.
In preparation for a future project, I was thinking about at the unix
findutility. It operates a file system hierarchies, with basic operations selected and filtered using a specialized expression language. Users compose operations using unary and binary operators, grouping with parentheses for precedence.findmay apply the expression to a great many files, so compiling it into a bytecode, resolving as much as possible ahead of time, and minimizing the per-element work, seems like a prudent implementation strategy. With some thought, I worked out a technique to do so, which was simpler than I expected, and Im pleased with the results. I was later surprised all the real worldfindimplementations I examined use tree-walk interpreters instead. This article describes how my compiler works, with a runnable example, and lists ideas for improvements.
Back in 2017 I wrote about a technique for creating closures in C using JIT-compiled wrapper. Its neat, though rarely necessary in real programs, so I dont think about it often. I applied it to
qsort, which sadly accepts no context pointer. More practical would be working around insufficient custom allocator interfaces, to create allocation functions at run-time bound to a particular allocation region. Ive learned a lot since I last wrote about this subject, and a recent article had me thinking about it again, and how I could do better than before. In this article I will enhance Win32 window procedure callbacks with a fifth argument, allowing us to more directly pass extra context. Im using w64devkit on x64, but the everything here should work out-of-the-box with any x64 toolchain that speaks GNU assembly.
All information on this blog, unless otherwise noted, is hereby released into the public domain, with no rights reserved.
| Web Proxy Viewer | New URL | Original Page |