summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2016-02-04 01:23:39 -0800
committerJF Bastien <jfb@chromium.org>2016-02-04 01:23:39 -0800
commit3b89982be258921b120dfb2e951533b3e87b70e1 (patch)
tree1fa2e9343a33e24d10f1ecd2fa721a4a9e3d5067 /src
parentb1cda3d4cabc068eb46aa1508814df886fd27f63 (diff)
downloadbinaryen-3b89982be258921b120dfb2e951533b3e87b70e1.tar.gz
binaryen-3b89982be258921b120dfb2e951533b3e87b70e1.tar.bz2
binaryen-3b89982be258921b120dfb2e951533b3e87b70e1.zip
NFC: improve minSize rationale
As discussed in https://github.com/WebAssembly/binaryen/pull/167#issuecomment-179496231
Diffstat (limited to 'src')
-rw-r--r--src/binaryen-shell.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/binaryen-shell.cpp b/src/binaryen-shell.cpp
index 9bc672dd7..d8277ad80 100644
--- a/src/binaryen-shell.cpp
+++ b/src/binaryen-shell.cpp
@@ -74,8 +74,10 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface {
public:
Memory() {}
void resize(size_t newSize) {
- // Allocate at least this size to get proper alignment: the allocator will
- // usually start allocating page-sized chunks which are properly aligned.
+ // Ensure the smallest allocation is large enough that most allocators
+ // will provide page-aligned storage. This hopefully allows the
+ // interpreter's memory to be as aligned as the memory being simulated,
+ // ensuring that the performance doesn't needlessly degrade.
//
// The code is optimistic this will work until WG21's p0035r0 happens.
const size_t minSize = 1 << 12;