summaryrefslogtreecommitdiff
path: root/src/wasm-binary.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-03-15 18:28:15 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-03-15 18:28:15 -0700
commit2f128693cd5b029aaa59d7cc51fe67f2fcbb529c (patch)
tree3dd3fff934341c1c7eeb2eb39beefa2144971177 /src/wasm-binary.h
parentfa0dbae5b907cc25715b070d64a30275a191f3f0 (diff)
downloadbinaryen-2f128693cd5b029aaa59d7cc51fe67f2fcbb529c.tar.gz
binaryen-2f128693cd5b029aaa59d7cc51fe67f2fcbb529c.tar.bz2
binaryen-2f128693cd5b029aaa59d7cc51fe67f2fcbb529c.zip
emit start after functions, and as a function index
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r--src/wasm-binary.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 64ffdeabb..d9c2efc3b 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -413,12 +413,12 @@ public:
void write() {
writeHeader();
- writeStart();
writeMemory();
writeSignatures();
writeImports();
writeFunctionSignatures();
writeFunctions();
+ writeStart();
writeExports();
writeDataSegments();
writeFunctionTable();
@@ -450,7 +450,7 @@ public:
if (!wasm->start.is()) return;
if (debug) std::cerr << "== writeStart" << std::endl;
auto start = startSection(BinaryConsts::Section::Start);
- emitString(wasm->start.str);
+ o << LEB128(getFunctionIndex(wasm->start.str));
finishSection(start);
}
@@ -1214,7 +1214,7 @@ public:
void readStart() {
if (debug) std::cerr << "== readStart" << std::endl;
- wasm.start = getString();
+ wasm.start = wasm.functions[getLEB128()]->name;
}
void readMemory() {