Reduces allocations during instantiation (#1267)

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
Takeshi Yoneda
2023-03-22 02:55:58 -07:00
committed by GitHub
parent c20073d228
commit cd05a22df2
24 changed files with 529 additions and 684 deletions

View File

@@ -128,7 +128,8 @@ func TestModule_BuildFunctionDefinitions(t *testing.T) {
{
name: "with imports",
m: &Module{
ImportSection: []Import{*imp},
ImportFunctionCount: 1,
ImportSection: []Import{*imp},
ExportSection: []Export{
{Name: "imported_function", Type: ExternTypeFunc, Index: 0},
{Name: "function_index=1", Type: ExternTypeFunc, Index: 1},
@@ -197,8 +198,9 @@ func TestModule_BuildFunctionDefinitions(t *testing.T) {
{
name: "with names",
m: &Module{
TypeSection: []FunctionType{v_v},
ImportSection: []Import{{Module: "i", Name: "f", Type: ExternTypeFunc}},
ImportFunctionCount: 1,
TypeSection: []FunctionType{v_v},
ImportSection: []Import{{Module: "i", Name: "f", Type: ExternTypeFunc}},
NameSection: &NameSection{
ModuleName: "module",
FunctionNames: NameMap{