{"action":"created","comment":{"url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/comments/203394280","pull_request_review_id":138273564,"id":203394280,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzM5NDI4MA==","diff_hunk":"@@ -48,11 +49,128 @@ static uintnat major_cycles_completed = 0;\n \n static atomic_uintnat num_domains_to_sweep = {0};\n static atomic_uintnat num_domains_to_mark = {0};\n+static atomic_uintnat num_domains_to_ephe_sweep = {0};\n+gc_phase_t caml_gc_phase;\n \n uintnat caml_get_num_domains_to_mark () {\n   return atomic_load_acq(&num_domains_to_mark);\n }\n \n+extern value caml_ephe_none; /* See weak.c */\n+\n+struct ephe_cycle_info_t {\n+  uintnat num_domains_todo;\n+  /* Number of domains that need to scan their ephemerons in the current major\n+   * GC cycle. This field is decremented when ephe_list_todo at a domain\n+   * becomes empty.  */\n+  uintnat ephe_cycle;\n+  /* Ephemeron cycle count */\n+  uintnat num_domains_done;\n+  /* Number of domains that have marked their ephemerons in the current\n+   * ephemeron cycle. */\n+} ephe_cycle_info = {0, 0, 0};\n+  /* In the first major cycle, there is no ephemeron marking to be done. */\n+\n+/* ephe_cycle_info is always updated with the critical section protected by\n+ * ephe_lock or in the global barrier. However, the fields may be read without\n+ * the lock. */\n+static caml_plat_mutex ephe_lock = CAML_PLAT_MUTEX_INITIALIZER;\n+\n+static void update_ephe_info_for_marking_done ()\n+{\n+  caml_plat_lock(&ephe_lock);\n+  ephe_cycle_info.ephe_cycle++;\n+  ephe_cycle_info.num_domains_done = 0;\n+  caml_plat_unlock(&ephe_lock);\n+}\n+\n+void caml_ephe_todo_list_emptied ()\n+{\n+  caml_plat_lock(&ephe_lock);\n+  --ephe_cycle_info.num_domains_todo;\n+  caml_plat_unlock(&ephe_lock);\n+  atomic_fetch_add(&num_domains_to_ephe_sweep, -1);\n+}\n+\n+void caml_ephe_todo_list_stolen ()\n+{\n+  caml_plat_lock(&ephe_lock);\n+  ++ephe_cycle_info.num_domains_todo;\n+  caml_plat_unlock(&ephe_lock);\n+  atomic_fetch_add(&num_domains_to_ephe_sweep, 1);\n+}\n+\n+/* Record that ephemeron marking was done for the given ephemeron cycle. */\n+static void record_ephe_marking_done (uintnat ephe_cycle)\n+{\n+  CAMLassert (ephe_cycle <= ephe_cycle_info.ephe_cycle);\n+  CAMLassert (Caml_state->marking_done);\n+\n+  if (ephe_cycle < ephe_cycle_info.ephe_cycle)","path":"byterun/major_gc.c","position":78,"original_position":78,"commit_id":"6578f85cec65336c5eeec699f96ade0bb6a734c6","original_commit_id":"6578f85cec65336c5eeec699f96ade0bb6a734c6","user":{"login":"stedolan","id":79765,"node_id":"MDQ6VXNlcjc5NzY1","avatar_url":"https://avatars3.githubusercontent.com/u/79765?v=4","gravatar_id":"","url":"https://api.github.com/users/stedolan","html_url":"https://github.com/stedolan","followers_url":"https://api.github.com/users/stedolan/followers","following_url":"https://api.github.com/users/stedolan/following{/other_user}","gists_url":"https://api.github.com/users/stedolan/gists{/gist_id}","starred_url":"https://api.github.com/users/stedolan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stedolan/subscriptions","organizations_url":"https://api.github.com/users/stedolan/orgs","repos_url":"https://api.github.com/users/stedolan/repos","events_url":"https://api.github.com/users/stedolan/events{/privacy}","received_events_url":"https://api.github.com/users/stedolan/received_events","type":"User","site_admin":false},"body":"This is a data race! ephe_cycle should be an `atomic_uintnat`","created_at":"2018-07-18T14:12:07Z","updated_at":"2018-07-18T14:12:07Z","html_url":"https://github.com/ocamllabs/ocaml-multicore/pull/191#discussion_r203394280","pull_request_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/191","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/comments/203394280"},"html":{"href":"https://github.com/ocamllabs/ocaml-multicore/pull/191#discussion_r203394280"},"pull_request":{"href":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/191"}}},"pull_request":{"url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/191","id":192085918,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMDg1OTE4","html_url":"https://github.com/ocamllabs/ocaml-multicore/pull/191","diff_url":"https://github.com/ocamllabs/ocaml-multicore/pull/191.diff","patch_url":"https://github.com/ocamllabs/ocaml-multicore/pull/191.patch","issue_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/191","number":191,"state":"open","locked":false,"title":"[RDY] Ephemerons","user":{"login":"kayceesrk","id":410484,"node_id":"MDQ6VXNlcjQxMDQ4NA==","avatar_url":"https://avatars0.githubusercontent.com/u/410484?v=4","gravatar_id":"","url":"https://api.github.com/users/kayceesrk","html_url":"https://github.com/kayceesrk","followers_url":"https://api.github.com/users/kayceesrk/followers","following_url":"https://api.github.com/users/kayceesrk/following{/other_user}","gists_url":"https://api.github.com/users/kayceesrk/gists{/gist_id}","starred_url":"https://api.github.com/users/kayceesrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kayceesrk/subscriptions","organizations_url":"https://api.github.com/users/kayceesrk/orgs","repos_url":"https://api.github.com/users/kayceesrk/repos","events_url":"https://api.github.com/users/kayceesrk/events{/privacy}","received_events_url":"https://api.github.com/users/kayceesrk/received_events","type":"User","site_admin":false},"body":"Todo:\r\n\r\n- [X] Operations on local ephemerons\r\n- [x] Handing off ephemerons during domain termination.\n- [x] Operations on remote ephemerons\r\n- [x] blit operations where the source and the destination ephemerons belong to either producer or the consumer. It is unclear how to support blit operations from a domain on ephemerons that belong to two different remote domains. \r\n","created_at":"2018-06-01T16:38:41Z","updated_at":"2018-07-18T14:12:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4283e238d845cafcc5dbbe21032fef0005f9da34","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/191/commits","review_comments_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/191/comments","review_comment_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/191/comments","statuses_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/statuses/6578f85cec65336c5eeec699f96ade0bb6a734c6","head":{"label":"ocamllabs:ephemerons","ref":"ephemerons","sha":"6578f85cec65336c5eeec699f96ade0bb6a734c6","user":{"login":"ocamllabs","id":2475115,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0NzUxMTU=","avatar_url":"https://avatars0.githubusercontent.com/u/2475115?v=4","gravatar_id":"","url":"https://api.github.com/users/ocamllabs","html_url":"https://github.com/ocamllabs","followers_url":"https://api.github.com/users/ocamllabs/followers","following_url":"https://api.github.com/users/ocamllabs/following{/other_user}","gists_url":"https://api.github.com/users/ocamllabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ocamllabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocamllabs/subscriptions","organizations_url":"https://api.github.com/users/ocamllabs/orgs","repos_url":"https://api.github.com/users/ocamllabs/repos","events_url":"https://api.github.com/users/ocamllabs/events{/privacy}","received_events_url":"https://api.github.com/users/ocamllabs/received_events","type":"Organization","site_admin":false},"repo":{"id":34527479,"node_id":"MDEwOlJlcG9zaXRvcnkzNDUyNzQ3OQ==","name":"ocaml-multicore","full_name":"ocamllabs/ocaml-multicore","owner":{"login":"ocamllabs","id":2475115,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0NzUxMTU=","avatar_url":"https://avatars0.githubusercontent.com/u/2475115?v=4","gravatar_id":"","url":"https://api.github.com/users/ocamllabs","html_url":"https://github.com/ocamllabs","followers_url":"https://api.github.com/users/ocamllabs/followers","following_url":"https://api.github.com/users/ocamllabs/following{/other_user}","gists_url":"https://api.github.com/users/ocamllabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ocamllabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocamllabs/subscriptions","organizations_url":"https://api.github.com/users/ocamllabs/orgs","repos_url":"https://api.github.com/users/ocamllabs/repos","events_url":"https://api.github.com/users/ocamllabs/events{/privacy}","received_events_url":"https://api.github.com/users/ocamllabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ocamllabs/ocaml-multicore","description":"Multicore OCaml","fork":false,"url":"https://api.github.com/repos/ocamllabs/ocaml-multicore","forks_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/forks","keys_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/teams","hooks_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/hooks","issue_events_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/events{/number}","events_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/events","assignees_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/assignees{/user}","branches_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/branches{/branch}","tags_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/tags","blobs_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/statuses/{sha}","languages_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/languages","stargazers_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/stargazers","contributors_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/contributors","subscribers_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/subscribers","subscription_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/subscription","commits_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/contents/{+path}","compare_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/merges","archive_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/downloads","issues_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues{/number}","pulls_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls{/number}","milestones_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/milestones{/number}","notifications_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/labels{/name}","releases_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/releases{/id}","deployments_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/deployments","created_at":"2015-04-24T15:48:46Z","updated_at":"2018-07-18T14:10:00Z","pushed_at":"2018-07-17T14:00:42Z","git_url":"git://github.com/ocamllabs/ocaml-multicore.git","ssh_url":"git@github.com:ocamllabs/ocaml-multicore.git","clone_url":"https://github.com/ocamllabs/ocaml-multicore.git","svn_url":"https://github.com/ocamllabs/ocaml-multicore","homepage":"","size":113003,"stargazers_count":284,"watchers_count":284,"language":"OCaml","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"archived":false,"open_issues_count":53,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":23,"open_issues":53,"watchers":284,"default_branch":"master"}},"base":{"label":"ocamllabs:master","ref":"master","sha":"32acc3e3c8bcaeba65b48732cd8c84b65d9a9bae","user":{"login":"ocamllabs","id":2475115,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0NzUxMTU=","avatar_url":"https://avatars0.githubusercontent.com/u/2475115?v=4","gravatar_id":"","url":"https://api.github.com/users/ocamllabs","html_url":"https://github.com/ocamllabs","followers_url":"https://api.github.com/users/ocamllabs/followers","following_url":"https://api.github.com/users/ocamllabs/following{/other_user}","gists_url":"https://api.github.com/users/ocamllabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ocamllabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocamllabs/subscriptions","organizations_url":"https://api.github.com/users/ocamllabs/orgs","repos_url":"https://api.github.com/users/ocamllabs/repos","events_url":"https://api.github.com/users/ocamllabs/events{/privacy}","received_events_url":"https://api.github.com/users/ocamllabs/received_events","type":"Organization","site_admin":false},"repo":{"id":34527479,"node_id":"MDEwOlJlcG9zaXRvcnkzNDUyNzQ3OQ==","name":"ocaml-multicore","full_name":"ocamllabs/ocaml-multicore","owner":{"login":"ocamllabs","id":2475115,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0NzUxMTU=","avatar_url":"https://avatars0.githubusercontent.com/u/2475115?v=4","gravatar_id":"","url":"https://api.github.com/users/ocamllabs","html_url":"https://github.com/ocamllabs","followers_url":"https://api.github.com/users/ocamllabs/followers","following_url":"https://api.github.com/users/ocamllabs/following{/other_user}","gists_url":"https://api.github.com/users/ocamllabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ocamllabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocamllabs/subscriptions","organizations_url":"https://api.github.com/users/ocamllabs/orgs","repos_url":"https://api.github.com/users/ocamllabs/repos","events_url":"https://api.github.com/users/ocamllabs/events{/privacy}","received_events_url":"https://api.github.com/users/ocamllabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ocamllabs/ocaml-multicore","description":"Multicore OCaml","fork":false,"url":"https://api.github.com/repos/ocamllabs/ocaml-multicore","forks_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/forks","keys_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/teams","hooks_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/hooks","issue_events_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/events{/number}","events_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/events","assignees_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/assignees{/user}","branches_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/branches{/branch}","tags_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/tags","blobs_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/statuses/{sha}","languages_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/languages","stargazers_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/stargazers","contributors_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/contributors","subscribers_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/subscribers","subscription_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/subscription","commits_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/contents/{+path}","compare_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/merges","archive_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/downloads","issues_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues{/number}","pulls_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls{/number}","milestones_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/milestones{/number}","notifications_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/labels{/name}","releases_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/releases{/id}","deployments_url":"https://api.github.com/repos/ocamllabs/ocaml-multicore/deployments","created_at":"2015-04-24T15:48:46Z","updated_at":"2018-07-18T14:10:00Z","pushed_at":"2018-07-17T14:00:42Z","git_url":"git://github.com/ocamllabs/ocaml-multicore.git","ssh_url":"git@github.com:ocamllabs/ocaml-multicore.git","clone_url":"https://github.com/ocamllabs/ocaml-multicore.git","svn_url":"https://github.com/ocamllabs/ocaml-multicore","homepage":"","size":113003,"stargazers_count":284,"watchers_count":284,"language":"OCaml","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"archived":false,"open_issues_count":53,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":23,"open_issues":53,"watchers":284,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/191"},"html":{"href":"https://github.com/ocamllabs/ocaml-multicore/pull/191"},"issue":{"href":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/191"},"comments":{"href":"https://api.github.com/repos/ocamllabs/ocaml-multicore/issues/191/comments"},"review_comments":{"href":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/191/comments"},"review_comment":{"href":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ocamllabs/ocaml-multicore/pulls/191/commits"},"statuses":{"href":"https://api.github.com/repos/ocamllabs/ocaml-multicore/statuses/6578f85cec65336c5eeec699f96ade0bb6a734c6"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"stedolan"}}