)]}'
{
  "commit": "f278b1ea3657a8cccb6ebdf73d3632257fe11e9a",
  "tree": "f314ba7fa1f43a1a3708bb6bf9374b8497c6ac20",
  "parents": [
    "372601772c6e23aa617915e481d659d1baf35576"
  ],
  "author": {
    "name": "Gabe Black",
    "email": "gabe.black@gmail.com",
    "time": "Thu Dec 16 02:40:28 2021 -0800"
  },
  "committer": {
    "name": "Bobby Bruce",
    "email": "bbruce@ucdavis.edu",
    "time": "Fri Dec 17 06:58:46 2021 +0000"
  },
  "message": "systemc: Change how python initialization callbacks are handled.\n\nBecause the python environment may already be up and running by the time\nstatic initializers are run, specifically when gem5 is built as a\nlibrary and loaded with dlopen, we can\u0027t rely on all of the objects\ndeclaring python initialization callbacks having been constructed by the\ntime the code which would execute them runs.\n\nTo address that problem, this change keeps track of whether the\ninitialization has already happened when a callback is installed, and if\nso, runs the callback immediately.\n\nThe original implementation also had users install callbacks by\noverriding a virtual function in the PythonInitFunc class, and then\nstatically allocating an instance of that subclass so its constructor\nwould be called at initialization time. Calling the function manually if\ninitialization has already happened won\u0027t work in that case, because you\ncan\u0027t call a virtual function from a constructor and get the behavior\nyou\u0027d want.\n\nInstead, this change makes the PythonInitFunc wrap the actual callback\nwhich is outside of the structure itself. Because the callback is not a\nvirtual function of PythonInitFunc, we can call it in the constructor\nwithout issue.\n\nAlso, the Callback type has to be a bare function pointer and not a\nstd::function\u003c...\u003e because the argument it takes is a pybind11::module_\nreference. Pybind11 sets the visibility of all of its code to hidden to\nimprove binary size, but unfortunately that causes problems when\naccepting one as an argument in a publically accessible lambda in g++.\nclang doesn\u0027t raise a warning, but g++ does which breaks the build. We\ncould potentially disable this warning, but accepting a function pointer\ninstead works just as well, since captureless lambdas can be trivially\nconverted into function pointers, and they don\u0027t seem to upset g++.\n\nChange-Id: I3fb321b577090df67c7be3be0e677c2c2055d446\nReviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54325\nMaintainer: Gabe Black \u003cgabe.black@gmail.com\u003e\nReviewed-by: Jason Lowe-Power \u003cpower.jg@gmail.com\u003e\nTested-by: kokoro \u003cnoreply+kokoro@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2283ae7ea252831e9309e3d14d067b19e9639f89",
      "old_mode": 33188,
      "old_path": "src/systemc/core/python.cc",
      "new_id": "472a0505205e9befc9a01167424bd7c2ad4e7cf1",
      "new_mode": 33188,
      "new_path": "src/systemc/core/python.cc"
    },
    {
      "type": "modify",
      "old_id": "5a3f6efece4ab79427847b871d8733af06dedc57",
      "old_mode": 33188,
      "old_path": "src/systemc/core/python.hh",
      "new_id": "3c563db6420c2b96642e337fd6e986fcc43f8d70",
      "new_mode": 33188,
      "new_path": "src/systemc/core/python.hh"
    },
    {
      "type": "modify",
      "old_id": "1697efe51e0a12cbcf697fb705c8d1d39c3894b7",
      "old_mode": 33188,
      "old_path": "src/systemc/core/sc_main_python.cc",
      "new_id": "8d2542e5e452ea777d5e5a49b5c79f1dc5ebeb8e",
      "new_mode": 33188,
      "new_path": "src/systemc/core/sc_main_python.cc"
    },
    {
      "type": "modify",
      "old_id": "58fa65f6f0f93c7873ee427e80149fcee1ed1d5a",
      "old_mode": 33188,
      "old_path": "src/systemc/core/sc_time_python.cc",
      "new_id": "be383bccbef013b765e205e6c966c4e1d5c1e924",
      "new_mode": 33188,
      "new_path": "src/systemc/core/sc_time_python.cc"
    },
    {
      "type": "modify",
      "old_id": "c29a232d5e228ec37633e53b61a299189ebf2fda",
      "old_mode": 33188,
      "old_path": "src/systemc/tlm_core/2/quantum/global_quantum_python.cc",
      "new_id": "a00db0c3777a5fb3d01f644f145e4b0634609aae",
      "new_mode": 33188,
      "new_path": "src/systemc/tlm_core/2/quantum/global_quantum_python.cc"
    }
  ]
}
