Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storeBuffer optimization #1505

Merged
merged 1 commit into from
Mar 2, 2023
Merged

storeBuffer optimization #1505

merged 1 commit into from
Mar 2, 2023

Conversation

iceseer
Copy link
Contributor

@iceseer iceseer commented Mar 1, 2023

Description of the Change

Remove looped set of value into memory buffer.

@iceseer iceseer requested a review from Harrm March 1, 2023 07:39
@iceseer iceseer requested a review from turuslan March 1, 2023 07:44
@@ -296,4 +297,103 @@ namespace kagome::runtime::binaryen {
return callHostApiFunc<mf>(this_.host_api_.get(), arguments);
}

void RuntimeExternalInterface::init(wasm::Module &wasm,
wasm::ModuleInstance &instance) {
memory.resize(wasm.memory.initial * wasm::Memory::kPageSize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we fill it with zeroes?

Copy link
Contributor Author

@iceseer iceseer Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По идее нет. init вызывается для объекта 1 раз в ModuleInstanceBase::ctor(). При ресайзе, память свыше memory.size() будет проинициализирована нулями, потому что default-inserted для интегральных типов 0. Т.е. на первом вызове это будет аллокация буффера проинициализированного нулями. Судя по коду не предполагается использовать объект RuntimeExternalInterface::memory до вызова init. Так что тут скорее вопросы к resize в ctor.

@iceseer iceseer force-pushed the fix/optimizations branch 4 times, most recently from 61772ba to 9734e1e Compare March 2, 2023 11:48
@iceseer iceseer enabled auto-merge (squash) March 2, 2023 11:51
@iceseer iceseer merged commit 0c3483f into master Mar 2, 2023
@iceseer iceseer deleted the fix/optimizations branch March 2, 2023 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants