Programming Leftovers
-
Adam Young: How Did I break my Code
Something I did in a commit broke my code. I have a git bisect that shows me the last good commit and the first bad one.
The code in question is a device driver for MCTP over PCC. MCTP is a network protocol used to have different components on a single system talk to each other. PCC is a shared buffer mechanism with a “doorbell” or register-that-triggers-an-interrupt. Another team needs to use this driver.
In looking through the output, a co-worker stated “it looks like you are sending the wrong buffer.” I suspected he was correct.
The buffers are pulled from ACPI information in a table specific to PCC, called the PCCT.
This is from the PCCT, which is common to both the good and bad run, and shows the machine (physical) addresses of the memory.
-
Ted Unangst ☛ how quick is the go compiler
Can you use go run for scripting? I wrote a small program to find out.
-
Andy Wingo: v8's precise field-logging remembered set
A remembered set is used by a garbage collector to identify graph edges between partitioned sub-spaces of a heap. The canonical example is in generational collection, where you allocate new objects in newspace, and eventually promote survivor objects to oldspace. If most objects die young, we can focus GC effort on newspace, to avoid traversing all of oldspace all the time.
Collecting a subspace instead of the whole heap is sound if and only if we can identify all live objects in the subspace. We start with some set of roots that point into the subspace from outside, and then traverse all links in those objects, but only to other objects within the subspace.
The roots are, like, global variables, and the stack, and registers; and in the case of a partial collection in which we identify live objects only within newspace, also any link into newspace from other spaces (oldspace, in our case). This set of inbound links is a remembered set.
There are a few strategies for maintaining a remembered set. Generally speaking, you start by implementing a write barrier that intercepts all stores in a program.
-
Andy Wingo: scheme modules vs whole-program compilation: fight
In a recent dispatch, I explained the whole-program compilation strategy used in Whiffle and Hoot.
-
TecAdmin ☛ Generate Random Numbers in Node.js
Random number generation is a fundamental aspect of many programming tasks, from creating unique identifiers to powering game mechanics. In Node.js, generating random numbers is a straightforward process, thanks to its robust standard libraries and a vibrant ecosystem of third-party modules.