Skip to content

Commit 1c253e5

Browse files
committed
[Wasm] Add get_base_address() helper function
1 parent c4e9d98 commit 1c253e5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/backend/WasmOperator.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,14 @@ std::vector<Schema::Identifier> deduplicate(const std::vector<Schema::Identifier
904904
return res;
905905
}
906906

907+
/** Returns a pointer to the beginning of table \p table_name in the WebAssembly linear memory. */
908+
Ptr<void> get_base_address(const char *table_name) {
909+
std::ostringstream oss;
910+
oss.str("");
911+
oss << table_name << "_mem";
912+
return Module::Get().get_global<void*>(oss.str().c_str());
913+
}
914+
907915

908916
/*======================================================================================================================
909917
* NoOp
@@ -1108,9 +1116,7 @@ void Scan<SIMDfied>::execute(const Match<Scan> &M, setup_t setup, pipeline_t pip
11081116
}
11091117

11101118
/*----- Import the base address of the mapped memory. -----*/
1111-
oss.str("");
1112-
oss << table.name() << "_mem";
1113-
Ptr<void> base_address = Module::Get().get_global<void*>(oss.str().c_str());
1119+
Ptr<void> base_address = get_base_address(table.name());
11141120

11151121
/*----- Emit setup code *before* compiling data layout to not overwrite its temporary boolean variables. -----*/
11161122
setup();

0 commit comments

Comments
 (0)