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

Method growTable

include/runtime/instance/table.h:72–90  ·  view source on GitHub ↗

Grow table with initialization value.

Source from the content-addressed store, hash-verified

70
71 /// Grow table with initialization value.
72 bool growTable(const uint64_t Count, const RefVariant &Val) noexcept {
73 if (Count == 0) {
74 return true;
75 }
76 uint64_t MaxSizeCaped = getMaxAddress(TabType.getLimit().getAddrType());
77 const uint64_t Min = TabType.getLimit().getMin();
78 assuming(MaxSizeCaped >= Min);
79 if (TabType.getLimit().hasMax()) {
80 const uint64_t Max = TabType.getLimit().getMax();
81 MaxSizeCaped = std::min(Max, MaxSizeCaped);
82 }
83 if (Count > MaxSizeCaped - Min) {
84 return false;
85 }
86 Refs.resize(Refs.size() + Count);
87 std::fill_n(Refs.end() - static_cast<std::ptrdiff_t>(Count), Count, Val);
88 TabType.getLimit().setMin(Min + Count);
89 return true;
90 }
91 bool growTable(const uint64_t Count) noexcept {
92 return growTable(Count, InitValue);
93 }

Callers 3

runTableGrowOpMethod · 0.80
proxyTableGrowMethod · 0.80

Calls 9

getMaxAddressFunction · 0.85
getAddrTypeMethod · 0.80
getMinMethod · 0.80
hasMaxMethod · 0.80
getMaxMethod · 0.80
resizeMethod · 0.80
setMinMethod · 0.80
sizeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected