summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 45a01bd76..b5dee81b8 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -1169,10 +1169,15 @@ public:
static const size_t kPageMask = ~(kPageSize - 1);
struct Segment {
size_t offset;
- const char* data;
- size_t size;
+ std::vector<char> data; // TODO: optimize
Segment() {}
- Segment(size_t offset, const char *data, size_t size) : offset(offset), data(data), size(size) {}
+ Segment(size_t offset, const char *init, size_t size) : offset(offset) {
+ data.resize(size);
+ memcpy(&data[0], init, size);
+ }
+ Segment(size_t offset, std::vector<char>& init) : offset(offset) {
+ data.swap(init);
+ }
};
size_t initial, max; // sizes are in pages