summaryrefslogtreecommitdiff
path: root/src/binaryen-c.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/binaryen-c.cpp')
-rw-r--r--src/binaryen-c.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp
index 914e37695..50e2e9a3c 100644
--- a/src/binaryen-c.cpp
+++ b/src/binaryen-c.cpp
@@ -4242,12 +4242,14 @@ void BinaryenSetMemory(BinaryenModuleRef module,
BinaryenIndex* segmentSizes,
BinaryenIndex numSegments,
bool shared,
+ bool memory64,
const char* name) {
auto memory = std::make_unique<Memory>();
memory->name = name ? name : "0";
memory->initial = initial;
memory->max = int32_t(maximum); // Make sure -1 extends.
memory->shared = shared;
+ memory->indexType = memory64 ? Type::i64 : Type::i32;
if (exportName) {
auto memoryExport = make_unique<Export>();
memoryExport->name = exportName;
@@ -4389,6 +4391,17 @@ bool BinaryenMemoryIsShared(BinaryenModuleRef module, const char* name) {
}
return memory->shared;
}
+bool BinaryenMemoryIs64(BinaryenModuleRef module, const char* name) {
+ // Maintaining compatibility for instructions with a single memory
+ if (name == nullptr && module->memories.size() == 1) {
+ name = module->memories[0]->name.c_str();
+ }
+ auto* memory = ((Module*)module)->getMemoryOrNull(name);
+ if (memory == nullptr) {
+ Fatal() << "invalid memory '" << name << "'.";
+ }
+ return memory->is64();
+}
size_t BinaryenGetMemorySegmentByteLength(BinaryenModuleRef module,
BinaryenIndex id) {
const auto& segments = ((Module*)module)->dataSegments;