Skip to content

Commit 6095fb6

Browse files
chfastaxic
authored andcommitted
Rename ExecutionContext::{inrement_call_depth() -> create_local_context()}
1 parent 111f379 commit 6095fb6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/fizzy/execute.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ ExecutionResult execute(
573573
const auto& code = instance.module->get_code(func_idx);
574574
auto* const memory = instance.memory.get();
575575

576-
const auto local_ctx = ctx.increment_call_depth();
576+
const auto local_ctx = ctx.create_local_context();
577577

578578
OperandStack stack(args, func_type.inputs.size(), code.local_count,
579579
static_cast<size_t>(code.max_stack_height));

lib/fizzy/execution_context.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ class ExecutionContext
3636

3737
/// Increments the call depth and returns the local call context which
3838
/// decrements the call depth back to the original value when going out of scope.
39-
LocalContext increment_call_depth() noexcept { return LocalContext{*this}; }
39+
LocalContext create_local_context() noexcept { return LocalContext{*this}; }
4040
};
4141
} // namespace fizzy

test/unittests/execute_call_depth_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ TEST(execute_call_depth, call_host_function_calling_wasm_function_inclusive)
213213
constexpr auto host_f = [](std::any&, Instance& instance, const Value*,
214214
ExecutionContext& ctx) noexcept {
215215
recorded_depth = ctx.depth;
216-
const auto local_ctx = ctx.increment_call_depth();
216+
const auto local_ctx = ctx.create_local_context();
217217
return fizzy::execute(instance, 2 /* $leaf */, {}, ctx);
218218
};
219219

@@ -304,7 +304,7 @@ TEST(execute_call_depth, call_host_function_calling_another_wasm_module)
304304
ExecutionContext& ctx) noexcept {
305305
recorded_depth = ctx.depth;
306306
auto instance = *std::any_cast<Instance*>(&host_context);
307-
const auto local_ctx = ctx.increment_call_depth();
307+
const auto local_ctx = ctx.create_local_context();
308308
return fizzy::execute(*instance, 0, {}, ctx);
309309
};
310310

@@ -466,7 +466,7 @@ TEST(execute_call_depth, execute_host_function_within_wasm_recursion_limit)
466466
constexpr auto host_f = [](std::any&, Instance& instance, const Value*,
467467
ExecutionContext& ctx) noexcept {
468468
max_recorded_wasm_recursion_depth = std::max(max_recorded_wasm_recursion_depth, ctx.depth);
469-
const auto local_ctx = ctx.increment_call_depth();
469+
const auto local_ctx = ctx.create_local_context();
470470
return fizzy::execute(instance, 0, {}, ctx);
471471
};
472472

@@ -537,7 +537,7 @@ TEST(execute_call, call_host_function_calling_wasm_interleaved_infinite_recursio
537537
ExecutionContext& ctx) noexcept {
538538
EXPECT_LT(ctx.depth, DepthLimit);
539539
++counter;
540-
const auto local_ctx = ctx.increment_call_depth();
540+
const auto local_ctx = ctx.create_local_context();
541541
return fizzy::execute(instance, 1, {}, ctx);
542542
};
543543

0 commit comments

Comments
 (0)