summaryrefslogtreecommitdiff
path: root/src/emscripten-optimizer
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-11-13 16:36:29 -0800
committerGitHub <noreply@github.com>2018-11-13 16:36:29 -0800
commitb67917ee7392c4d49402cb5e7320e663208390ef (patch)
treebfc32d7f2bbd007e10dbc6a7c6fa352673552741 /src/emscripten-optimizer
parent6b99d143a32263478b7d525886b0bea46cbbdcaa (diff)
downloadbinaryen-b67917ee7392c4d49402cb5e7320e663208390ef.tar.gz
binaryen-b67917ee7392c4d49402cb5e7320e663208390ef.tar.bz2
binaryen-b67917ee7392c4d49402cb5e7320e663208390ef.zip
Fix alignment in MixedAllocator (#1740)
Necessary for simd, as we add a type with alignment >8. We were just broken on that before this PR.
Diffstat (limited to 'src/emscripten-optimizer')
-rw-r--r--src/emscripten-optimizer/simple_ast.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/emscripten-optimizer/simple_ast.h b/src/emscripten-optimizer/simple_ast.h
index 237d9c1b5..9cbe7616c 100644
--- a/src/emscripten-optimizer/simple_ast.h
+++ b/src/emscripten-optimizer/simple_ast.h
@@ -80,7 +80,7 @@ class GlobalMixedArena : public MixedArena {
public:
template<class T>
T* alloc() {
- auto* ret = static_cast<T*>(allocSpace(sizeof(T)));
+ auto* ret = static_cast<T*>(allocSpace(sizeof(T), alignof(T)));
new (ret) T();
return ret;
}
@@ -92,7 +92,7 @@ class ArrayStorage : public ArenaVectorBase<ArrayStorage, Ref> {
public:
void allocate(size_t size) {
allocatedElements = size;
- data = static_cast<Ref*>(arena.allocSpace(sizeof(Ref) * allocatedElements));
+ data = static_cast<Ref*>(arena.allocSpace(sizeof(Ref) * allocatedElements, alignof(Ref)));
}
};