MCPcopy Create free account
hub / github.com/WasmVM/WasmVM / reorder_map

Method reorder_map

src/lib/parse/post_process.cpp:13–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11using namespace WasmVM::Parse;
12
13std::unordered_map<index_t, index_t> ParseContext::reorder_map(IndexSpace& space) {
14 std::unordered_map<index_t, index_t> result;
15 std::queue<index_t> indices;
16 for (index_t i = 0; i < space.records.size(); ++i) {
17 if (space.records[i] == IndexSpace::Type::Import) {
18 result[i] = result.size();
19 } else {
20 indices.push(i);
21 }
22 }
23 while (!indices.empty()) {
24 result[indices.front()] = result.size();
25 indices.pop();
26 }
27 return result;
28}
29
30void ParseContext::post_process() {
31 std::unordered_map<index_t, index_t> typemap;

Callers

nothing calls this directly

Calls 3

pushMethod · 0.80
emptyMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected