Skip to content

Commit c025059

Browse files
Xinquan XUXinquan XU
authored andcommitted
instrument function mock stub for ~lib functions
1 parent 5172d4d commit c025059

File tree

4 files changed

+3
-7
lines changed

4 files changed

+3
-7
lines changed

instrumentation/MockInstrumentationWalker.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ uint32_t MockInstrumentationWalker::mockWalk() noexcept {
9191
return 1U; // failed
9292
} else {
9393
wasm::ModuleUtils::iterDefinedFunctions(*module, [this](wasm::Function *const func) noexcept {
94-
if (!std::regex_match(func->name.str.begin(), func->name.str.end(), functionFilter)) {
95-
walkFunctionInModule(func, this->module);
96-
}
94+
walkFunctionInModule(func, this->module);
9795
});
9896
return 0U;
9997
}

instrumentation/MockInstrumentationWalker.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <cstddef>
55
#include <cstdint>
66
#include <iostream>
7-
#include <regex>
87
#include <string_view>
98
#include <utility>
109
#include <vector>
@@ -139,7 +138,6 @@ class MockInstrumentationWalker final : public wasm::PostWalker<MockInstrumentat
139138
private:
140139
wasm::Module *const module; ///< working module
141140
const std::string checkMock; ///< mock check string
142-
const std::regex functionFilter = std::regex("~lib/.+");
143141
wasm::Builder moduleBuilder; ///< module builder
144142
uint32_t expectIndex = 0U; ///< expectation index, auto increase
145143
wasm::ExpressionStack expressionStack;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"build": "node scripts/build_instrumentation.js && tsc --build ./transform/tsconfig.json && tsc --build ./src/tsconfig.json",
1616
"test:as": "node bin/as-test.js",
1717
"test:ts": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
18-
"test:cpp": "cmake -B build -S . && cmake --build build --target wasm-instrumentation-test wasm-opt && build/bin/wasm-instrumentation-test",
18+
"test:cpp": "cmake -B build -S . && cmake --build build --parallel 4 --target wasm-instrumentation-test wasm-opt && build/bin/wasm-instrumentation-test",
1919
"test": "npm run test:as && npm run test:ts && npm run test:cpp",
2020
"lint": "eslint src assembly tests/ts/test --max-warnings=0 && prettier -c .",
2121
"lint:fix": "eslint src assembly --fix && prettier --write .",

scripts/build_instrumentation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function initEmscripten() {
1919
initEmscripten();
2020

2121
execSync("emcmake cmake -B build_wasm -S .", { encoding: "utf8", stdio: "inherit", env });
22-
execSync("cmake --build build_wasm --target wasm-instrumentation", {
22+
execSync("cmake --build build_wasm --parallel 4 --target wasm-instrumentation", {
2323
encoding: "utf8",
2424
stdio: "inherit",
2525
env,

0 commit comments

Comments
 (0)