InnocentZero's Treasure Chest

HomeFeedAbout MeList of interesting people

26 Oct 2025

MMTk integration in ocaml - part 2

MMTk Integration in OCaml - II

So yeah, I was busy the past few days, hectic assignments that gave me an RSI, so it was pretty annoying to say the least :/

Having said that, I'm looking into things today. In particular the MMTk bindings API. Let's see what's what. First up is ActivePlan, which gives some info about the mutators. I really think I should start with something else though, this looks like it depends on a bunch of other things, such as VMThread and the Mutator API. Let's go over them.

VMThread was fairly straightforward, and Mutator led me to the VMBindings trait, which seems to be the better starting point, so I'll go over that first.

HOLY SMOKES is the ObjectLayout trait HUGE!!! Well, it was more or less a given, considering how it has to support so many different runtimes which can have arbitrary forms of objects. Also, damn, it seems to have fairly strict rules about what an object can be lol. Wonder how I'll even get it to work.

Some of the key things to note are the restrictions on ObjectReference and the presence of both local and global metadata in the object.

Aha! One of the constants is the OFFSET constant that is there from the start of the allocation result! This is lovely, because now I can specify that to be 8, and let things be relatively untouched.

Right, I think I'll dive into the code now. I'll keep referencing the docs and see what all I can get out of existing machinery before going even deeper.

First things first, I'll sort the Slot thing out. This seems relatively straightforward. But I need to see how to get OCaml's runtime to recognise this. That might be painful.

As it turns out, it led to a long list of things I'd need to do for it to even get close to working.

What the fck even?

Why is the API the way it is for Slot trait? That makes absolutely zero sense at all! This shouldn't be the status quo of how it is supposed to be done. This is so weird. Why is everything bring so incompatible???? That's so retarded.

UPDATE: oh bruh slot is the pointer to the field, not the field itself, should've read the SimpleSlot thing properly lmfao.


Other posts
Creative Commons License
This website by innocentzer0 is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.