{"action":"created","issue":{"url":"https://api.github.com/repos/WebAssembly/design/issues/334","labels_url":"https://api.github.com/repos/WebAssembly/design/issues/334/labels{/name}","comments_url":"https://api.github.com/repos/WebAssembly/design/issues/334/comments","events_url":"https://api.github.com/repos/WebAssembly/design/issues/334/events","html_url":"https://github.com/WebAssembly/design/issues/334","id":105021851,"number":334,"title":"Pass a start-of-usable-memory to the module.","user":{"login":"JSStats","id":11826073,"avatar_url":"https://avatars.githubusercontent.com/u/11826073?v=3","gravatar_id":"","url":"https://api.github.com/users/JSStats","html_url":"https://github.com/JSStats","followers_url":"https://api.github.com/users/JSStats/followers","following_url":"https://api.github.com/users/JSStats/following{/other_user}","gists_url":"https://api.github.com/users/JSStats/gists{/gist_id}","starred_url":"https://api.github.com/users/JSStats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JSStats/subscriptions","organizations_url":"https://api.github.com/users/JSStats/orgs","repos_url":"https://api.github.com/users/JSStats/repos","events_url":"https://api.github.com/users/JSStats/events{/privacy}","received_events_url":"https://api.github.com/users/JSStats/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-09-05T11:26:38Z","updated_at":"2015-10-03T05:27:48Z","closed_at":null,"body":"For some runtimes there is the option of placing the linear memory at absolute zero in the address space. This can help on the ARM in particular as it frees up more addressing modes for use, but it also frees up a register for the linear memory base on ARM and x64 (tested on Odin). Some systems already have the bottom pages reserved for security purposes, so the low addresses could not be used with good performance (but perhaps emulated in a signal handler). If a start-of-usable-memory could be passed to a module then it could avoid allocating in this low region.\r\n\r\nThis might also be useful with an option to protect low pages (which was noted as a developer option elsewhere). Even when the linear memory is not placed at absolute zero, when this developer option is enabled the start-of-usable-memory parameter could advise the application to avoid the low protected pages, and the page size will vary between systems so the start might want to be a parameter and would be more general than a simple flag indicating that the low page is protected.\r\n"},"comment":{"url":"https://api.github.com/repos/WebAssembly/design/issues/comments/145201480","html_url":"https://github.com/WebAssembly/design/issues/334#issuecomment-145201480","issue_url":"https://api.github.com/repos/WebAssembly/design/issues/334","id":145201480,"user":{"login":"JSStats","id":11826073,"avatar_url":"https://avatars.githubusercontent.com/u/11826073?v=3","gravatar_id":"","url":"https://api.github.com/users/JSStats","html_url":"https://github.com/JSStats","followers_url":"https://api.github.com/users/JSStats/followers","following_url":"https://api.github.com/users/JSStats/following{/other_user}","gists_url":"https://api.github.com/users/JSStats/gists{/gist_id}","starred_url":"https://api.github.com/users/JSStats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JSStats/subscriptions","organizations_url":"https://api.github.com/users/JSStats/orgs","repos_url":"https://api.github.com/users/JSStats/repos","events_url":"https://api.github.com/users/JSStats/events{/privacy}","received_events_url":"https://api.github.com/users/JSStats/received_events","type":"User","site_admin":false},"created_at":"2015-10-03T05:27:48Z","updated_at":"2015-10-03T05:27:48Z","body":"Some preliminary performance results. Using WAVM, LLVM 3.8, and the zlib benchmark. Using the pointer-masking variant of the benchmark as it is significantly faster and probably has more opportunity to exploit the buffer being at zero.\r\n\r\nx86: 97.5 %\r\nx64: 96.6 %\r\nARMv7: 84.6%\r\n\r\nSo this might offer a useful performance improvement for ARM. Devices using the ARM cpu are expected to be in need of the best performance and efficiency, and may well want to run a demanding wasm app 'all-in' and be able to allocate the buffer at zero.\r\n\r\nNote the lower pages are not used. The emscripten GLOBAL_BASE option is used to move the data segment higher and this benchmark ran fine without access to the low pages and ran on an unmodified kernel."}}