{"action":"created","issue":{"url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/51","labels_url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/51/comments","events_url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/51/events","html_url":"https://github.com/lars-t-hansen/ecmascript_sharedmem/issues/51","id":128986005,"number":51,"title":"No quantum garbage!","user":{"login":"lars-t-hansen","id":4823190,"avatar_url":"https://avatars.githubusercontent.com/u/4823190?v=3","gravatar_id":"","url":"https://api.github.com/users/lars-t-hansen","html_url":"https://github.com/lars-t-hansen","followers_url":"https://api.github.com/users/lars-t-hansen/followers","following_url":"https://api.github.com/users/lars-t-hansen/following{/other_user}","gists_url":"https://api.github.com/users/lars-t-hansen/gists{/gist_id}","starred_url":"https://api.github.com/users/lars-t-hansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lars-t-hansen/subscriptions","organizations_url":"https://api.github.com/users/lars-t-hansen/orgs","repos_url":"https://api.github.com/users/lars-t-hansen/repos","events_url":"https://api.github.com/users/lars-t-hansen/events{/privacy}","received_events_url":"https://api.github.com/users/lars-t-hansen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/labels/Memory%20model","name":"Memory model","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/milestones/2","html_url":"https://github.com/lars-t-hansen/ecmascript_sharedmem/milestones/Stage%203","labels_url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/milestones/2/labels","id":1545373,"number":2,"title":"Stage 3","description":"Issue that has to be resolved before the proposal can go to Stage 3. ","creator":{"login":"lars-t-hansen","id":4823190,"avatar_url":"https://avatars.githubusercontent.com/u/4823190?v=3","gravatar_id":"","url":"https://api.github.com/users/lars-t-hansen","html_url":"https://github.com/lars-t-hansen","followers_url":"https://api.github.com/users/lars-t-hansen/followers","following_url":"https://api.github.com/users/lars-t-hansen/following{/other_user}","gists_url":"https://api.github.com/users/lars-t-hansen/gists{/gist_id}","starred_url":"https://api.github.com/users/lars-t-hansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lars-t-hansen/subscriptions","organizations_url":"https://api.github.com/users/lars-t-hansen/orgs","repos_url":"https://api.github.com/users/lars-t-hansen/repos","events_url":"https://api.github.com/users/lars-t-hansen/events{/privacy}","received_events_url":"https://api.github.com/users/lars-t-hansen/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2016-01-27T00:25:31Z","updated_at":"2016-01-27T01:09:57Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-01-27T00:23:59Z","updated_at":"2016-01-27T17:24:45Z","closed_at":null,"body":"Suppose `ta` is a TypedArray mapping shared memory.  Consider this code:\r\n```js\r\nlet x = ta[n]\r\nif (x)\r\n  print(x)\r\n```\r\nIf the initial value of `ta[n]` is 1, and there is a race on that access that writes 0, and the JIT duplicates the load to re-read `ta[n]` in the print statement (a legal optimization in unshared memory), then the program would print 0.  This is considered absurd by much of the committee.\r\n\r\nThe load introduction might be advantageous if the \"then\" branch is more elaborate with more code before the print call that does not affect the value of x, for example, and register pressure requires x to be saved and reloaded across that code.\r\n\r\nFixing this involves prohibiting load introduction on shared memory unless the compiler can prove that the access is not racy (generally very hard).  The optimization is still legal in unshared memory and existing code need not be impacted, if the JIT can use type information properly to tell shared from unshared memory (data needed, and it would be useful to have it here).\r\n\r\nPart of the work here is to consider whether there are other cases that might be similar."},"comment":{"url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/comments/175755793","html_url":"https://github.com/lars-t-hansen/ecmascript_sharedmem/issues/51#issuecomment-175755793","issue_url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/51","id":175755793,"user":{"login":"lars-t-hansen","id":4823190,"avatar_url":"https://avatars.githubusercontent.com/u/4823190?v=3","gravatar_id":"","url":"https://api.github.com/users/lars-t-hansen","html_url":"https://github.com/lars-t-hansen","followers_url":"https://api.github.com/users/lars-t-hansen/followers","following_url":"https://api.github.com/users/lars-t-hansen/following{/other_user}","gists_url":"https://api.github.com/users/lars-t-hansen/gists{/gist_id}","starred_url":"https://api.github.com/users/lars-t-hansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lars-t-hansen/subscriptions","organizations_url":"https://api.github.com/users/lars-t-hansen/orgs","repos_url":"https://api.github.com/users/lars-t-hansen/repos","events_url":"https://api.github.com/users/lars-t-hansen/events{/privacy}","received_events_url":"https://api.github.com/users/lars-t-hansen/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T17:24:45Z","updated_at":"2016-01-27T17:24:45Z","body":"One wonders idly how this interacts with the bailout/recover/deopt logic in ion.  In nonshared memory it is OK for a non-effecting operation to bailout and retry, even if it reads memory.  In shared memory the read can only happen once, in one of the execution engines."}}