-
Notifications
You must be signed in to change notification settings - Fork 787
Multi-Memories improvements to binaryen-c.cpp #4940
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with getMemoryName
simplified.
src/binaryen-c.cpp
Outdated
static Name getMemoryName(BinaryenModuleRef module, const char* memName) { | ||
const char* memoryName = memName; | ||
if (memName == nullptr && module->memories.size() == 1) { | ||
memoryName = module->memories[0]->name.c_str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can save some unnecessary conversions between char*
and Name
here.
memoryName = module->memories[0]->name.c_str(); | |
return module->memories[0]->name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm % comment
src/binaryen-c.cpp
Outdated
static Name getMemoryName(BinaryenModuleRef module, const char* memName) { | ||
const char* memoryName = memName; | ||
if (memName == nullptr && module->memories.size() == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static Name getMemoryName(BinaryenModuleRef module, const char* memName) { | |
const char* memoryName = memName; | |
if (memName == nullptr && module->memories.size() == 1) { | |
static Name getMemoryName(BinaryenModuleRef module, const char* memoryName) { | |
if (memoryName == nullptr && module->memories.size() == 1) { |
The parameter can be reused.
I tried Binaryen with this API update. Unfortunately if you set 0 (nullptr) for memoryName for BinaryenLoad / BinaryenStore then Binaryen crashes with assert error here: |
Resolving a couple of issues from the multi-memories PR landing:
memName
as parameter label instead ofname
#4916Note: CI will not pass until #4939 lands.