{"action":"created","issue":{"url":"https://api.github.com/repos/kripken/emscripten/issues/3240","labels_url":"https://api.github.com/repos/kripken/emscripten/issues/3240/labels{/name}","comments_url":"https://api.github.com/repos/kripken/emscripten/issues/3240/comments","events_url":"https://api.github.com/repos/kripken/emscripten/issues/3240/events","html_url":"https://github.com/kripken/emscripten/pull/3240","id":60509377,"number":3240,"title":"Pointer masking update","user":{"login":"dtc","id":1187766,"avatar_url":"https://avatars.githubusercontent.com/u/1187766?v=3","gravatar_id":"","url":"https://api.github.com/users/dtc","html_url":"https://github.com/dtc","followers_url":"https://api.github.com/users/dtc/followers","following_url":"https://api.github.com/users/dtc/following{/other_user}","gists_url":"https://api.github.com/users/dtc/gists{/gist_id}","starred_url":"https://api.github.com/users/dtc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtc/subscriptions","organizations_url":"https://api.github.com/users/dtc/orgs","repos_url":"https://api.github.com/users/dtc/repos","events_url":"https://api.github.com/users/dtc/events{/privacy}","received_events_url":"https://api.github.com/users/dtc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2015-03-10T14:39:11Z","updated_at":"2015-03-16T21:03:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kripken/emscripten/pulls/3240","html_url":"https://github.com/kripken/emscripten/pull/3240","diff_url":"https://github.com/kripken/emscripten/pull/3240.diff","patch_url":"https://github.com/kripken/emscripten/pull/3240.patch"},"body":"Update the POINTER_MASKING feature. The POINTER_MASKING argument is\r\nnow a boolean rather than the mask. The TOTAL_MEMORY is now expected\r\nto be a power of two, and this is checked. The actual allocated buffer\r\nlength extended by 16M to support index offsets. A heap length\r\ndeclaration function is now emitted for the benefit of Odin. The masks\r\nare emitted using a 'const' rather than a 'var' for the benefit of\r\nOdin. The array access optimization now folds constant indexes, and\r\naccepts offsets up to 16M to match the guard zone added to the heap length."},"comment":{"url":"https://api.github.com/repos/kripken/emscripten/issues/comments/81937479","html_url":"https://github.com/kripken/emscripten/pull/3240#issuecomment-81937479","issue_url":"https://api.github.com/repos/kripken/emscripten/issues/3240","id":81937479,"user":{"login":"dtc","id":1187766,"avatar_url":"https://avatars.githubusercontent.com/u/1187766?v=3","gravatar_id":"","url":"https://api.github.com/users/dtc","html_url":"https://github.com/dtc","followers_url":"https://api.github.com/users/dtc/followers","following_url":"https://api.github.com/users/dtc/following{/other_user}","gists_url":"https://api.github.com/users/dtc/gists{/gist_id}","starred_url":"https://api.github.com/users/dtc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtc/subscriptions","organizations_url":"https://api.github.com/users/dtc/orgs","repos_url":"https://api.github.com/users/dtc/repos","events_url":"https://api.github.com/users/dtc/events{/privacy}","received_events_url":"https://api.github.com/users/dtc/received_events","type":"User","site_admin":false},"created_at":"2015-03-16T21:03:22Z","updated_at":"2015-03-16T21:03:22Z","body":"@sunfishcode Ion does run bounds check hoisting even on Emscripten generated code, it gets a chance to run, it's only disable in asm.js mode which would be using Odin. It may not handle the style well, but wouldn't it make a quick test of your ideas.\r\n\r\nI don't see how pointer masking practically blocks loop analysis, and plan to make use of loop analysis type information too. It does not need to be applied to ranges that wrap to be useful, but you do see masking used as a code style in loops so it's probably something that needs attention anyway.\r\n\r\nFor example, the masking is explicitly hoisted in the following, and loop analysis can help prove that the index is within bounds: p = p & 511; for (i = 0; i < e & 15; i++) { a[p + i * 4] a[p + i * 4 + 4] }\r\n\r\nFor example, loop analysis can prove that masking can be optimized away:\r\nfor (i = 0; i < 16; i++) a[i & 511] a[i & 511 + 8] }  => for (i = 0; i < 16; i++) a[i] a[i + 8] } \r\n\r\n@kripken An app using over 512MB is not practical on 32-bit windows. 1GB seems possible on b2g, and perhaps even Android 32-bit, but the resource needs managing which is what I have been calling for. It should not be a problem for 64 bit. Over 1GB for this tech seems a stretch."}}