diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-04-22 22:01:43 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-04-26 19:50:14 -0700 |
commit | d9096704dfa84aea94bb6ac2ffa02d88fa546bfa (patch) | |
tree | 817992a1e811af71087a228b20f3c35df9485b96 /src/wasm-s-parser.h | |
parent | 7fd8aac5084223c48901ca20f9d233e9764d536a (diff) | |
download | binaryen-d9096704dfa84aea94bb6ac2ffa02d88fa546bfa.tar.gz binaryen-d9096704dfa84aea94bb6ac2ffa02d88fa546bfa.tar.bz2 binaryen-d9096704dfa84aea94bb6ac2ffa02d88fa546bfa.zip |
add an ArenaVector for internal array allocations in expression nodes
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r-- | src/wasm-s-parser.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index be3263312..e1a073b0b 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -61,6 +61,7 @@ class Element { public: Element() : isList_(true) {} + Element(MixedArena& allocator) : Element() {} bool isList() { return isList_; } bool isStr() { return !isList_; } @@ -1131,30 +1132,30 @@ private: im->module = s[i++]->str(); if (!s[i]->isStr()) onError(); im->base = s[i++]->str(); - FunctionType type; + FunctionType* type = allocator.alloc<FunctionType>(); if (s.size() > i) { Element& params = *s[i]; IString id = params[0]->str(); if (id == PARAM) { for (size_t i = 1; i < params.size(); i++) { - type.params.push_back(stringToWasmType(params[i]->str())); + type->params.push_back(stringToWasmType(params[i]->str())); } } else if (id == RESULT) { - type.result = stringToWasmType(params[1]->str()); + type->result = stringToWasmType(params[1]->str()); } else if (id == TYPE) { IString name = params[1]->str(); if (!wasm.checkFunctionType(name)) onError(); - type = *wasm.getFunctionType(name); + *type = *wasm.getFunctionType(name); } else { onError(); } if (s.size() > i+1) { Element& result = *s[i+1]; assert(result[0]->str() == RESULT); - type.result = stringToWasmType(result[1]->str()); + type->result = stringToWasmType(result[1]->str()); } } - im->type = ensureFunctionType(getSig(&type), &wasm, allocator); + im->type = ensureFunctionType(getSig(type), &wasm); wasm.addImport(im); } |