MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / SavedThreadLocal

Method SavedThreadLocal

lib/executor/helper.cpp:17–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15namespace Executor {
16
17Executor::SavedThreadLocal::SavedThreadLocal(
18 Executor &Ex, Runtime::StackManager &StackMgr,
19 const Runtime::Instance::FunctionInstance &Func) noexcept {
20 // Prepare the execution context.
21 auto *ModInst =
22 const_cast<Runtime::Instance::ModuleInstance *>(Func.getModule());
23 SavedThis = This;
24 This = &Ex;
25
26 SavedExecutionContext = ExecutionContext;
27 ExecutionContext.StopToken = &Ex.StopToken;
28 ExecutionContext.Memories = ModInst->MemoryPtrs.data();
29 ExecutionContext.Globals = ModInst->GlobalPtrs.data();
30 if (Ex.Stat) {
31 ExecutionContext.InstrCount = &Ex.Stat->getInstrCountRef();
32 ExecutionContext.CostTable = Ex.Stat->getCostTable().data();
33 ExecutionContext.Gas = &Ex.Stat->getTotalCostRef();
34 ExecutionContext.GasLimit = Ex.Stat->getCostLimit();
35 }
36
37 SavedCurrentStack = CurrentStack;
38 CurrentStack = &StackMgr;
39}
40
41Executor::SavedThreadLocal::~SavedThreadLocal() noexcept {
42 CurrentStack = SavedCurrentStack;

Callers

nothing calls this directly

Calls 4

getModuleMethod · 0.45
dataMethod · 0.45
getCostTableMethod · 0.45
getCostLimitMethod · 0.45

Tested by

no test coverage detected