aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-05-03 19:15:06 -0700
committerChad Austin <chad@imvu.com>2013-05-17 12:57:10 -0700
commit69d3621782e4b6dc131a2e5d78fdcf92047d667c (patch)
tree1e77c92de3d3610be00b52f571c638d457faca79 /system
parenta020f7dc1d37e986a2ce26a960ec1c1be5734f97 (diff)
We can get away with passing memory_view on the stack here...
Diffstat (limited to 'system')
-rw-r--r--system/include/emscripten/wire.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/system/include/emscripten/wire.h b/system/include/emscripten/wire.h
index 32080e54..a5892216 100644
--- a/system/include/emscripten/wire.h
+++ b/system/include/emscripten/wire.h
@@ -377,11 +377,16 @@ namespace emscripten {
namespace internal {
template<>
struct BindingType<memory_view> {
- typedef memory_view* WireType;
+ // This non-word-sized WireType only works because I
+ // happen to know that clang will pass aggregates as
+ // pointers to stack elements and we never support
+ // converting JavaScript typed arrays back into
+ // memory_view. (That is, fromWireType is not implemented
+ // on the C++ side, nor is toWireType implemented in
+ // JavaScript.)
+ typedef memory_view WireType;
static WireType toWireType(const memory_view& mv) {
- WireType wt = (WireType)malloc(sizeof(memory_view));
- new(wt) memory_view(mv);
- return wt;
+ return mv;
}
};
}