)]}'
{
  "commit": "149ce5c263616e657ff8d108419d2eca54532b5a",
  "tree": "ee7a4bc1381d67fc535ead2bc861b90c8112c9aa",
  "parents": [
    "3301ddba1badc50a06f5d21c78790d508969081d"
  ],
  "author": {
    "name": "Nick Alcock",
    "email": "nick.alcock@oracle.com",
    "time": "Mon Mar 25 16:39:02 2024 +0000"
  },
  "committer": {
    "name": "Nick Alcock",
    "email": "nick.alcock@oracle.com",
    "time": "Fri Apr 19 16:14:46 2024 +0100"
  },
  "message": "libctf: replace \u0027pending refs\u0027 abstraction\n\nA few years ago we introduced a \u0027pending refs\u0027 abstraction to fix one\nproblem: serializing a dict, then changing it would tend to corrupt the dict\nbecause the strtab sort we do on strtab writeout (to improve compression\nefficiency) would modify the offset of any strings that sorted\nlexicographically earlier in the strtab: so we added a new restriction that\nall strings are added only at serialization time, and maintained a set of\n\u0027pending\u0027 refs that were added earlier, whose offsets we could update (like\nother refs) at writeout time.\n\nThis was in hindsight seriously problematic for maintenance (because\nserialization has to traverse all strings in all datatypes in the entire\ndict), and has become impossible to sustain now that we can read in existing\ndicts, modify them, and reserialize them again.  We really don\u0027t want to\nhave to dig through the entire dict we jut read in just in order to dig out\nall its strtab offsets, then *change* it, just for the sake of a sort that\nadds a frankly trivial amount of compression efficiency.\n\nSorting *is* still worthwhile -- but it sacrifices very little to only sort\nnewly-added portions of the strtab, reusing older portions as necessary.\nAs a first stage in this, discard the whole \"pending refs\" abstraction and\nreplace it with \"movable\" refs, which are exactly like all other refs\n(addresses containing the strtab offset of some string, which are updated\nwiht the final strtab offset on serialization) except that we track them in\na reverse dict so that we can move the refs around (which we do whenever we\nrealloc() a buffer containing a bunch of structure members or something when\nwe add members to the structure).\n\nlibctf/\n\n\t* ctf-create.c (ctf_add_enumerator): Call ctf_str_move_refs; add\n        a movable ref.\n\t(ctf_add_member_offset): Likewise.\n\t* ctf-util.c (ctf_realloc): Delete.\n\t* ctf-serialize.c (ctf_serialize): No longer use it.  Adjust to\n\tnew fields.\n\t* ctf-string.c (ctf_str_purge_atom_refs): Purge movable refs.\n\t(ctf_str_free_atom): Free freeable atoms\u0027 strings.\n\t(ctf_str_create_atoms): Create the movable refs dynhash if needed.\n\t(ctf_str_free_atoms): Destroy it.\n\t(CTF_STR_MOVABLE): Switch (back) from ints to flags (see previous\n\treversion).  Add new flag.\n\t(aref_create):  New, populate movable refs if need be.\n\t(ctf_str_add_ref_internal): Switch back to flags, update refs\n\tdirectly for nonprovisional strings (with already-known fixed offsets);\n\tcreate refs via aref_create.  Allocate strings only if not within an\n\tmmapped strtab.\n\t(ctf_str_add_movable_ref): New.\n\t(ctf_str_add): Adjust to CTF_STR_* reintroduction.\n\t(ctf_str_add_external): LIkewise.\n\t(ctf_str_move_refs): New, move refs via ctf_str_movable_refs\n\tbackpointer.\n\t(ctf_str_purge_refs): Drop ctf_str_num_refs.\n\t(ctf_str_update_refs): Fix indentation.\n\t* ctf-impl.h (struct ctf_str_atom_movable): New.\n\t(struct ctf_dict.ctf_str_num_refs): Drop.\n\t(struct ctf_dict.ctf_str_movable_refs): New.\n\t(ctf_str_add_movable_ref): Declare.\n\t(ctf_str_move_refs): Likewise.\n\t(ctf_realloc): Drop.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9d86b96113250074335df12a8516f72fc7bf2e7a",
      "old_mode": 33188,
      "old_path": "libctf/ctf-create.c",
      "new_id": "e0558d282333ee4da670d8dd9a76270a3871d46a",
      "new_mode": 33188,
      "new_path": "libctf/ctf-create.c"
    },
    {
      "type": "modify",
      "old_id": "c16ef185fdcb5596729d60777fefd92b21e1b0de",
      "old_mode": 33188,
      "old_path": "libctf/ctf-impl.h",
      "new_id": "f4611316f507fb6059f69d33d4631ebca7c80e25",
      "new_mode": 33188,
      "new_path": "libctf/ctf-impl.h"
    },
    {
      "type": "modify",
      "old_id": "2afc7be7c48666f5685c520d3720698735e47087",
      "old_mode": 33188,
      "old_path": "libctf/ctf-serialize.c",
      "new_id": "6355d4225ebb8f3b213482359676491803c281a8",
      "new_mode": 33188,
      "new_path": "libctf/ctf-serialize.c"
    },
    {
      "type": "modify",
      "old_id": "3ce2b25400151a5891a9b303ac3c0ba932ceaa79",
      "old_mode": 33188,
      "old_path": "libctf/ctf-string.c",
      "new_id": "dcb8bf0fee1a1a92fc422052bc8ab4cb5e9ab001",
      "new_mode": 33188,
      "new_path": "libctf/ctf-string.c"
    },
    {
      "type": "modify",
      "old_id": "d47c10c99f026e78d8f68fbed13d481f0bfcce69",
      "old_mode": 33188,
      "old_path": "libctf/ctf-util.c",
      "new_id": "3ea6de9e86fe710aca4d22ac9dc493cc0c8fa103",
      "new_mode": 33188,
      "new_path": "libctf/ctf-util.c"
    }
  ]
}
