)]}'
{
  "commit": "3201d3a17d5b3807fc35e11dd705dfa2deba62fc",
  "tree": "b202a3b7733229c51cae416392ac62da6a01997e",
  "parents": [
    "e2c11856f973b6a8060a6d1978162d8c350566d5"
  ],
  "author": {
    "name": "Heejin Ahn",
    "email": "aheejin@gmail.com",
    "time": "Fri Oct 16 02:49:58 2026"
  },
  "committer": {
    "name": "Heejin Ahn",
    "email": "aheejin@gmail.com",
    "time": "Mon Oct 19 14:09:11 2026"
  },
  "message": "[EH] Handle dependent exceptions in refcounting\n\nIn libcxxabi used in Wasm EH, `__cxa_exception` is used to represent a\nnormal primary exception, and `__cxa_dependent_exception` is to a\ndependent exception created by `std::rethrow_exception`.\n`std::rethrow_exception` allocates and throws a\n`__cxa_dependent_exception` whose `primaryException` field points to its\nprimary exception.\n\n`__cxa_exception` and `__cxa_dependent_exception`\u0027s layouts are\nidentical except where `referenceCount` is in `__cxa_exception`, there\nis `primaryException` in `__cxa_dependent_exception`:\nhttps://github.com/emscripten-core/emscripten/blob/30bbb45939d0136eae1637dd17146cc02ee1658f/system/lib/libcxxabi/src/cxa_exception.h#L100-L101\n\nBut `__cxa_in/decrementExceptionRefcount` assumes all it gets is primary\nexceptions, and tries to increment the `referenceCount` field, which\nends up incrementing `primaryException` pointer in\n`__cxa_dependent_exception`.\n\nThis is not a problem within libcxxabi because all callers to those\nmethods extract a primary exception from a dependent exception before\ncalling. But these methods are also called from JS\n`in/decrementExceptionRefcount`, which doesn\u0027t know about dependent\nexceptions:\nhttps://github.com/emscripten-core/emscripten/blob/30bbb45939d0136eae1637dd17146cc02ee1658f/src/lib/libexceptions.js#L381-L391\n\nThis checks whether an exception is a dependent exception, and if it is,\nextracts the primary exception from it, and in/decrement its refcount.\nAnd if it reaches 0, also frees the dependent exception in addition to\nthe primary one.\n\nWe also have similar code to handle dependent exceptions in\n`__get_exception_message`:\nhttps://github.com/emscripten-core/emscripten/blob/30bbb45939d0136eae1637dd17146cc02ee1658f/system/lib/libcxxabi/src/cxa_exception_js_utils.cpp#L89-L95\n\nThis is a part of fixes for #27705.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "443ac285ce0c7e49095e8c3902b6cc1f809816d0",
      "old_mode": 33188,
      "old_path": "system/lib/libcxxabi/src/cxa_exception.cpp",
      "new_id": "b06112d74e18dc815c4d6db505708a32c2a23ae8",
      "new_mode": 33188,
      "new_path": "system/lib/libcxxabi/src/cxa_exception.cpp"
    },
    {
      "type": "modify",
      "old_id": "80836f064b578506951535da94c2f066eaef2b6f",
      "old_mode": 33188,
      "old_path": "test/core/test_exceptions_refcount_2.cpp",
      "new_id": "9aeab09c9ca0d7f075bff547cc9e790fd24e2a27",
      "new_mode": 33188,
      "new_path": "test/core/test_exceptions_refcount_2.cpp"
    },
    {
      "type": "modify",
      "old_id": "328c3735f30bb309b1ca2c173fec09de4c140eb0",
      "old_mode": 33188,
      "old_path": "test/core/test_exceptions_refcount_2.out",
      "new_id": "514bfd7dce66125fb92e3ac2942023240f59c98e",
      "new_mode": 33188,
      "new_path": "test/core/test_exceptions_refcount_2.out"
    }
  ]
}
