Use same CompiledCode for import replacement (#478)
This commit allows CompiledCode to be re-used regardless of the existence of import replacement configs for instantiation. In order to achieve this, we introduce ModuleID, which is sha256 checksum calculated on source bytes, as a key for module compilation cache. Previously, we used*wasm.Module as keys for caches which differ before/after import replacement. Signed-off-by: Takeshi Yoneda takeshi@tetrate.io
This commit is contained in:
@@ -346,8 +346,11 @@ func TestNewModuleBuilder_Build(t *testing.T) {
|
||||
b := tc.input(NewRuntime()).(*moduleBuilder)
|
||||
m, err := b.Build()
|
||||
require.NoError(t, err)
|
||||
|
||||
requireHostModuleEquals(t, tc.expected, m.module)
|
||||
|
||||
require.Equal(t, b.r.store.Engine, m.compiledEngine)
|
||||
|
||||
// Built module must be instantiable by Engine.
|
||||
_, err = b.r.InstantiateModule(m)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user