Skip to main content

Thoughts from Alan

Linking Rust and C: Practicing Symbol Hygiene

This is a post about the bits and pieces I learned while trying to fix a symbol leakage problem for YJIT-enabled Ruby. The symbols I’m talking about are the labels in object, executable, and shared library files that help linkers work. Thinking back to my first few contacts with linkers, I found them somewhat mysterious. I think this is because I get errors from compilers more frequently than from linkers.

How I think about C99 strict aliasing rules

Recently I was asked how I review C99 code for problems that arise from failing to follow the so called “strict aliasing rules”. I struggled to answer, so I thought I would write a post to hopefully make my explanation more coherent. The strict aliasing rules can be surprising because the way optimizers take advantage of them doesn’t mesh well with the popular belief that pointers are “just numbers”. Ultimately, I think there are practical benefits to understanding the rules even if you disagree with them.

Checking Ruby C extensions for object movement crashes

This guide intends to help Ruby native extension maintainers upgrade libraries to be compatible with GC.compact. Application developers can also use this guide to check applications for compaction compatibility. At the time of writing, the latest Ruby release is version 3.0.0. Using automated tests to surface crashes If your test suite runs under Ruby 2.7.0 or newer, it is possible to check for compaction crashes with a small addition to your test suite.

Hotkeys For Programmable Keyboards

I have a K-Type, which is a programmable keyboard that lets me configure custom hotkeys. The configurations live with and on the keyboard, which is neat. Among other things, this lets my configuration work across different operating systems. My current configuration has several navigation hotkeys that activate with the CAPSLOCK key. CAPSLOCK+{j,k,l,;} send arrow keys, in a way similar to Vim’s default normal mode bindings. CAPSLOCK+{i,n} gives page up and down, while CAPSLOCK+{h,quote} sends HOME and END.

My Compiler

The first commit I made for my compiler was in 2016, it read “Here’s hoping I get this done in time”. I’m not sure if I met the deadline that message was referring to, but the compiler is certainly “done” now. Of course, no one in the right mind would use the compiler for anything serious, but the compiler compiles code, and I’ve made a simple graphical app launcher using it.