summaryrefslogtreecommitdiff
path: root/src/binary-reader-interpreter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/binary-reader-interpreter.cc')
-rw-r--r--src/binary-reader-interpreter.cc420
1 files changed, 209 insertions, 211 deletions
diff --git a/src/binary-reader-interpreter.cc b/src/binary-reader-interpreter.cc
index 8cf4effa..6c9f5a52 100644
--- a/src/binary-reader-interpreter.cc
+++ b/src/binary-reader-interpreter.cc
@@ -257,34 +257,34 @@ class BinaryReaderInterpreter : public BinaryReaderNop {
HostImportDelegate::ErrorCallback MakePrintErrorCallback();
- ErrorHandler* error_handler = nullptr;
- Environment* env = nullptr;
- DefinedModule* module = nullptr;
- DefinedFunc* current_func = nullptr;
- TypeChecker typechecker;
- std::vector<Label> label_stack;
- IstreamOffsetVectorVector func_fixups;
- IstreamOffsetVectorVector depth_fixups;
+ ErrorHandler* error_handler_ = nullptr;
+ Environment* env_ = nullptr;
+ DefinedModule* module_ = nullptr;
+ DefinedFunc* current_func_ = nullptr;
+ TypeChecker typechecker_;
+ std::vector<Label> label_stack_;
+ IstreamOffsetVectorVector func_fixups_;
+ IstreamOffsetVectorVector depth_fixups_;
MemoryStream istream_;
- IstreamOffset istream_offset = 0;
+ IstreamOffset istream_offset_ = 0;
/* mappings from module index space to env index space; this won't just be a
* translation, because imported values will be resolved as well */
- IndexVector sig_index_mapping;
- IndexVector func_index_mapping;
- IndexVector global_index_mapping;
+ IndexVector sig_index_mapping_;
+ IndexVector func_index_mapping_;
+ IndexVector global_index_mapping_;
- Index num_func_imports = 0;
- Index num_global_imports = 0;
+ Index num_func_imports_ = 0;
+ Index num_global_imports_ = 0;
// Changes to linear memory and tables should not apply if a validation error
// occurs; these vectors cache the changes that must be applied after we know
// that there are no validation errors.
- std::vector<ElemSegmentInfo> elem_segment_infos;
- std::vector<DataSegmentInfo> data_segment_infos;
+ std::vector<ElemSegmentInfo> elem_segment_infos_;
+ std::vector<DataSegmentInfo> data_segment_infos_;
// Values cached so they can be shared between callbacks.
- TypedValue init_expr_value;
- IstreamOffset table_offset = 0;
+ TypedValue init_expr_value_;
+ IstreamOffset table_offset_ = 0;
};
BinaryReaderInterpreter::BinaryReaderInterpreter(
@@ -292,12 +292,12 @@ BinaryReaderInterpreter::BinaryReaderInterpreter(
DefinedModule* module,
std::unique_ptr<OutputBuffer> istream,
ErrorHandler* error_handler)
- : error_handler(error_handler),
- env(env),
- module(module),
+ : error_handler_(error_handler),
+ env_(env),
+ module_(module),
istream_(std::move(istream)),
- istream_offset(istream_.output_buffer().size()) {
- typechecker.set_error_callback(
+ istream_offset_(istream_.output_buffer().size()) {
+ typechecker_.set_error_callback(
[this](const char* msg) { PrintError("%s", msg); });
}
@@ -306,8 +306,8 @@ std::unique_ptr<OutputBuffer> BinaryReaderInterpreter::ReleaseOutputBuffer() {
}
Label* BinaryReaderInterpreter::GetLabel(Index depth) {
- assert(depth < label_stack.size());
- return &label_stack[label_stack.size() - depth - 1];
+ assert(depth < label_stack_.size());
+ return &label_stack_[label_stack_.size() - depth - 1];
}
Label* BinaryReaderInterpreter::TopLabel() {
@@ -315,7 +315,7 @@ Label* BinaryReaderInterpreter::TopLabel() {
}
bool BinaryReaderInterpreter::HandleError(Offset offset, const char* message) {
- return error_handler->OnError(offset, message);
+ return error_handler_->OnError(offset, message);
}
void WABT_PRINTF_FORMAT(2, 3)
@@ -325,36 +325,36 @@ void WABT_PRINTF_FORMAT(2, 3)
}
Index BinaryReaderInterpreter::TranslateSigIndexToEnv(Index sig_index) {
- assert(sig_index < sig_index_mapping.size());
- return sig_index_mapping[sig_index];
+ assert(sig_index < sig_index_mapping_.size());
+ return sig_index_mapping_[sig_index];
}
FuncSignature* BinaryReaderInterpreter::GetSignatureByModuleIndex(
Index sig_index) {
- return env->GetFuncSignature(TranslateSigIndexToEnv(sig_index));
+ return env_->GetFuncSignature(TranslateSigIndexToEnv(sig_index));
}
Index BinaryReaderInterpreter::TranslateFuncIndexToEnv(Index func_index) {
- assert(func_index < func_index_mapping.size());
- return func_index_mapping[func_index];
+ assert(func_index < func_index_mapping_.size());
+ return func_index_mapping_[func_index];
}
Index BinaryReaderInterpreter::TranslateModuleFuncIndexToDefined(
Index func_index) {
- assert(func_index >= num_func_imports);
- return func_index - num_func_imports;
+ assert(func_index >= num_func_imports_);
+ return func_index - num_func_imports_;
}
Func* BinaryReaderInterpreter::GetFuncByModuleIndex(Index func_index) {
- return env->GetFunc(TranslateFuncIndexToEnv(func_index));
+ return env_->GetFunc(TranslateFuncIndexToEnv(func_index));
}
Index BinaryReaderInterpreter::TranslateGlobalIndexToEnv(Index global_index) {
- return global_index_mapping[global_index];
+ return global_index_mapping_[global_index];
}
Global* BinaryReaderInterpreter::GetGlobalByModuleIndex(Index global_index) {
- return env->GetGlobal(TranslateGlobalIndexToEnv(global_index));
+ return env_->GetGlobal(TranslateGlobalIndexToEnv(global_index));
}
Type BinaryReaderInterpreter::GetGlobalTypeByModuleIndex(Index global_index) {
@@ -368,7 +368,7 @@ Type BinaryReaderInterpreter::GetLocalTypeByIndex(Func* func,
}
IstreamOffset BinaryReaderInterpreter::GetIstreamOffset() {
- return istream_offset;
+ return istream_offset_;
}
wabt::Result BinaryReaderInterpreter::EmitDataAt(IstreamOffset offset,
@@ -380,8 +380,8 @@ wabt::Result BinaryReaderInterpreter::EmitDataAt(IstreamOffset offset,
wabt::Result BinaryReaderInterpreter::EmitData(const void* data,
IstreamOffset size) {
- CHECK_RESULT(EmitDataAt(istream_offset, data, size));
- istream_offset += size;
+ CHECK_RESULT(EmitDataAt(istream_offset_, data, size));
+ istream_offset_ += size;
return wabt::Result::Ok;
}
@@ -438,10 +438,10 @@ wabt::Result BinaryReaderInterpreter::AppendFixup(
wabt::Result BinaryReaderInterpreter::EmitBrOffset(Index depth,
IstreamOffset offset) {
if (offset == kInvalidIstreamOffset) {
- /* depth_fixups stores the depth counting up from zero, where zero is the
+ /* depth_fixups_ stores the depth counting up from zero, where zero is the
* top-level function scope. */
- depth = label_stack.size() - 1 - depth;
- CHECK_RESULT(AppendFixup(&depth_fixups, depth));
+ depth = label_stack_.size() - 1 - depth;
+ CHECK_RESULT(AppendFixup(&depth_fixups_, depth));
}
CHECK_RESULT(EmitI32(offset));
return wabt::Result::Ok;
@@ -452,14 +452,14 @@ wabt::Result BinaryReaderInterpreter::GetBrDropKeepCount(
Index* out_drop_count,
Index* out_keep_count) {
TypeChecker::Label* label;
- CHECK_RESULT(typechecker.GetLabel(depth, &label));
+ CHECK_RESULT(typechecker_.GetLabel(depth, &label));
*out_keep_count =
label->label_type != LabelType::Loop ? label->sig.size() : 0;
- if (typechecker.IsUnreachable()) {
+ if (typechecker_.IsUnreachable()) {
*out_drop_count = 0;
} else {
*out_drop_count =
- (typechecker.type_stack_size() - label->type_stack_limit) -
+ (typechecker_.type_stack_size() - label->type_stack_limit) -
*out_keep_count;
}
return wabt::Result::Ok;
@@ -468,9 +468,9 @@ wabt::Result BinaryReaderInterpreter::GetBrDropKeepCount(
wabt::Result BinaryReaderInterpreter::GetReturnDropKeepCount(
Index* out_drop_count,
Index* out_keep_count) {
- CHECK_RESULT(GetBrDropKeepCount(label_stack.size() - 1, out_drop_count,
+ CHECK_RESULT(GetBrDropKeepCount(label_stack_.size() - 1, out_drop_count,
out_keep_count));
- *out_drop_count += current_func->param_and_local_types.size();
+ *out_drop_count += current_func_->param_and_local_types.size();
return wabt::Result::Ok;
}
@@ -494,13 +494,13 @@ wabt::Result BinaryReaderInterpreter::EmitBrTableOffset(Index depth) {
wabt::Result BinaryReaderInterpreter::FixupTopLabel() {
IstreamOffset offset = GetIstreamOffset();
- Index top = label_stack.size() - 1;
- if (top >= depth_fixups.size()) {
+ Index top = label_stack_.size() - 1;
+ if (top >= depth_fixups_.size()) {
/* nothing to fixup */
return wabt::Result::Ok;
}
- IstreamOffsetVector& fixups = depth_fixups[top];
+ IstreamOffsetVector& fixups = depth_fixups_[top];
for (IstreamOffset fixup : fixups)
CHECK_RESULT(EmitI32At(fixup, offset));
fixups.clear();
@@ -511,7 +511,7 @@ wabt::Result BinaryReaderInterpreter::EmitFuncOffset(DefinedFunc* func,
Index func_index) {
if (func->offset == kInvalidIstreamOffset) {
Index defined_index = TranslateModuleFuncIndexToDefined(func_index);
- CHECK_RESULT(AppendFixup(&func_fixups, defined_index));
+ CHECK_RESULT(AppendFixup(&func_fixups_, defined_index));
}
CHECK_RESULT(EmitI32(func->offset));
return wabt::Result::Ok;
@@ -522,10 +522,10 @@ bool BinaryReaderInterpreter::OnError(const char* message) {
}
wabt::Result BinaryReaderInterpreter::OnTypeCount(Index count) {
- Index sig_count = env->GetFuncSignatureCount();
- sig_index_mapping.resize(count);
+ Index sig_count = env_->GetFuncSignatureCount();
+ sig_index_mapping_.resize(count);
for (Index i = 0; i < count; ++i)
- sig_index_mapping[i] = sig_count + i;
+ sig_index_mapping_[i] = sig_count + i;
return wabt::Result::Ok;
}
@@ -534,14 +534,14 @@ wabt::Result BinaryReaderInterpreter::OnType(Index index,
Type* param_types,
Index result_count,
Type* result_types) {
- assert(TranslateSigIndexToEnv(index) == env->GetFuncSignatureCount());
- env->EmplaceBackFuncSignature(param_count, param_types, result_count,
- result_types);
+ assert(TranslateSigIndexToEnv(index) == env_->GetFuncSignatureCount());
+ env_->EmplaceBackFuncSignature(param_count, param_types, result_count,
+ result_types);
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::CheckLocal(Index local_index) {
- Index max_local_index = current_func->param_and_local_types.size();
+ Index max_local_index = current_func_->param_and_local_types.size();
if (local_index >= max_local_index) {
PrintError("invalid local_index: %" PRIindex " (max %" PRIindex ")",
local_index, max_local_index);
@@ -551,7 +551,7 @@ wabt::Result BinaryReaderInterpreter::CheckLocal(Index local_index) {
}
wabt::Result BinaryReaderInterpreter::CheckGlobal(Index global_index) {
- Index max_global_index = global_index_mapping.size();
+ Index max_global_index = global_index_mapping_.size();
if (global_index >= max_global_index) {
PrintError("invalid global_index: %" PRIindex " (max %" PRIindex ")",
global_index, max_global_index);
@@ -619,7 +619,7 @@ wabt::Result BinaryReaderInterpreter::AppendExport(Module* module,
wabt::Result BinaryReaderInterpreter::FindRegisteredModule(
string_view module_name,
Module** out_module) {
- Module* module = env->FindRegisteredModule(module_name);
+ Module* module = env_->FindRegisteredModule(module_name);
if (!module) {
PrintError("unknown import module \"" PRIstringview "\"",
WABT_PRINTF_STRING_VIEW_ARG(module_name));
@@ -654,8 +654,8 @@ wabt::Result BinaryReaderInterpreter::OnImportFunc(Index import_index,
string_view field_name,
Index func_index,
Index sig_index) {
- module->func_imports.emplace_back(module_name, field_name);
- FuncImport* import = &module->func_imports.back();
+ module_->func_imports.emplace_back(module_name, field_name);
+ FuncImport* import = &module_->func_imports.back();
import->sig_index = TranslateSigIndexToEnv(sig_index);
Module* import_module;
@@ -665,14 +665,14 @@ wabt::Result BinaryReaderInterpreter::OnImportFunc(Index import_index,
if (auto* host_import_module = dyn_cast<HostModule>(import_module)) {
HostFunc* func = new HostFunc(import->module_name, import->field_name,
import->sig_index);
- env->EmplaceBackFunc(func);
+ env_->EmplaceBackFunc(func);
- FuncSignature* sig = env->GetFuncSignature(func->sig_index);
+ FuncSignature* sig = env_->GetFuncSignature(func->sig_index);
CHECK_RESULT(host_import_module->import_delegate->ImportFunc(
import, func, sig, MakePrintErrorCallback()));
assert(func->callback);
- func_env_index = env->GetFuncCount() - 1;
+ func_env_index = env_->GetFuncCount() - 1;
AppendExport(host_import_module, ExternalKind::Func, func_env_index,
import->field_name);
} else {
@@ -680,16 +680,16 @@ wabt::Result BinaryReaderInterpreter::OnImportFunc(Index import_index,
CHECK_RESULT(GetModuleExport(import_module, import->field_name, &export_));
CHECK_RESULT(CheckImportKind(import, export_->kind));
- Func* func = env->GetFunc(export_->index);
- if (!env->FuncSignaturesAreEqual(import->sig_index, func->sig_index)) {
+ Func* func = env_->GetFunc(export_->index);
+ if (!env_->FuncSignaturesAreEqual(import->sig_index, func->sig_index)) {
PrintError("import signature mismatch");
return wabt::Result::Error;
}
func_env_index = export_->index;
}
- func_index_mapping.push_back(func_env_index);
- num_func_imports++;
+ func_index_mapping_.push_back(func_env_index);
+ num_func_imports_++;
return wabt::Result::Ok;
}
@@ -699,38 +699,38 @@ wabt::Result BinaryReaderInterpreter::OnImportTable(Index import_index,
Index table_index,
Type elem_type,
const Limits* elem_limits) {
- if (module->table_index != kInvalidIndex) {
+ if (module_->table_index != kInvalidIndex) {
PrintError("only one table allowed");
return wabt::Result::Error;
}
- module->table_imports.emplace_back(module_name, field_name);
- TableImport* import = &module->table_imports.back();
+ module_->table_imports.emplace_back(module_name, field_name);
+ TableImport* import = &module_->table_imports.back();
Module* import_module;
CHECK_RESULT(FindRegisteredModule(import->module_name, &import_module));
if (auto* host_import_module = dyn_cast<HostModule>(import_module)) {
- Table* table = env->EmplaceBackTable(*elem_limits);
+ Table* table = env_->EmplaceBackTable(*elem_limits);
CHECK_RESULT(host_import_module->import_delegate->ImportTable(
import, table, MakePrintErrorCallback()));
CHECK_RESULT(CheckImportLimits(elem_limits, &table->limits));
- module->table_index = env->GetTableCount() - 1;
- AppendExport(host_import_module, ExternalKind::Table, module->table_index,
+ module_->table_index = env_->GetTableCount() - 1;
+ AppendExport(host_import_module, ExternalKind::Table, module_->table_index,
import->field_name);
} else {
Export* export_;
CHECK_RESULT(GetModuleExport(import_module, import->field_name, &export_));
CHECK_RESULT(CheckImportKind(import, export_->kind));
- Table* table = env->GetTable(export_->index);
+ Table* table = env_->GetTable(export_->index);
CHECK_RESULT(CheckImportLimits(elem_limits, &table->limits));
import->limits = *elem_limits;
- module->table_index = export_->index;
+ module_->table_index = export_->index;
}
return wabt::Result::Ok;
}
@@ -741,38 +741,38 @@ wabt::Result BinaryReaderInterpreter::OnImportMemory(
string_view field_name,
Index memory_index,
const Limits* page_limits) {
- if (module->memory_index != kInvalidIndex) {
+ if (module_->memory_index != kInvalidIndex) {
PrintError("only one memory allowed");
return wabt::Result::Error;
}
- module->memory_imports.emplace_back(module_name, field_name);
- MemoryImport* import = &module->memory_imports.back();
+ module_->memory_imports.emplace_back(module_name, field_name);
+ MemoryImport* import = &module_->memory_imports.back();
Module* import_module;
CHECK_RESULT(FindRegisteredModule(import->module_name, &import_module));
if (auto* host_import_module = dyn_cast<HostModule>(import_module)) {
- Memory* memory = env->EmplaceBackMemory();
+ Memory* memory = env_->EmplaceBackMemory();
CHECK_RESULT(host_import_module->import_delegate->ImportMemory(
import, memory, MakePrintErrorCallback()));
CHECK_RESULT(CheckImportLimits(page_limits, &memory->page_limits));
- module->memory_index = env->GetMemoryCount() - 1;
- AppendExport(host_import_module, ExternalKind::Memory, module->memory_index,
- import->field_name);
+ module_->memory_index = env_->GetMemoryCount() - 1;
+ AppendExport(host_import_module, ExternalKind::Memory,
+ module_->memory_index, import->field_name);
} else {
Export* export_;
CHECK_RESULT(GetModuleExport(import_module, import->field_name, &export_));
CHECK_RESULT(CheckImportKind(import, export_->kind));
- Memory* memory = env->GetMemory(export_->index);
+ Memory* memory = env_->GetMemory(export_->index);
CHECK_RESULT(CheckImportLimits(page_limits, &memory->page_limits));
import->limits = *page_limits;
- module->memory_index = export_->index;
+ module_->memory_index = export_->index;
}
return wabt::Result::Ok;
}
@@ -783,20 +783,20 @@ wabt::Result BinaryReaderInterpreter::OnImportGlobal(Index import_index,
Index global_index,
Type type,
bool mutable_) {
- module->global_imports.emplace_back(module_name, field_name);
- GlobalImport* import = &module->global_imports.back();
+ module_->global_imports.emplace_back(module_name, field_name);
+ GlobalImport* import = &module_->global_imports.back();
Module* import_module;
CHECK_RESULT(FindRegisteredModule(import->module_name, &import_module));
- Index global_env_index = env->GetGlobalCount() - 1;
+ Index global_env_index = env_->GetGlobalCount() - 1;
if (auto* host_import_module = dyn_cast<HostModule>(import_module)) {
- Global* global = env->EmplaceBackGlobal(TypedValue(type), mutable_);
+ Global* global = env_->EmplaceBackGlobal(TypedValue(type), mutable_);
CHECK_RESULT(host_import_module->import_delegate->ImportGlobal(
import, global, MakePrintErrorCallback()));
- global_env_index = env->GetGlobalCount() - 1;
+ global_env_index = env_->GetGlobalCount() - 1;
AppendExport(host_import_module, ExternalKind::Global, global_env_index,
import->field_name);
} else {
@@ -809,93 +809,93 @@ wabt::Result BinaryReaderInterpreter::OnImportGlobal(Index import_index,
import->mutable_ = mutable_;
global_env_index = export_->index;
}
- global_index_mapping.push_back(global_env_index);
- num_global_imports++;
+ global_index_mapping_.push_back(global_env_index);
+ num_global_imports_++;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnFunctionCount(Index count) {
for (Index i = 0; i < count; ++i)
- func_index_mapping.push_back(env->GetFuncCount() + i);
- func_fixups.resize(count);
+ func_index_mapping_.push_back(env_->GetFuncCount() + i);
+ func_fixups_.resize(count);
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnFunction(Index index, Index sig_index) {
- env->EmplaceBackFunc(new DefinedFunc(TranslateSigIndexToEnv(sig_index)));
+ env_->EmplaceBackFunc(new DefinedFunc(TranslateSigIndexToEnv(sig_index)));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnTable(Index index,
Type elem_type,
const Limits* elem_limits) {
- if (module->table_index != kInvalidIndex) {
+ if (module_->table_index != kInvalidIndex) {
PrintError("only one table allowed");
return wabt::Result::Error;
}
- env->EmplaceBackTable(*elem_limits);
- module->table_index = env->GetTableCount() - 1;
+ env_->EmplaceBackTable(*elem_limits);
+ module_->table_index = env_->GetTableCount() - 1;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnMemory(Index index,
const Limits* page_limits) {
- if (module->memory_index != kInvalidIndex) {
+ if (module_->memory_index != kInvalidIndex) {
PrintError("only one memory allowed");
return wabt::Result::Error;
}
- env->EmplaceBackMemory(*page_limits);
- module->memory_index = env->GetMemoryCount() - 1;
+ env_->EmplaceBackMemory(*page_limits);
+ module_->memory_index = env_->GetMemoryCount() - 1;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnGlobalCount(Index count) {
for (Index i = 0; i < count; ++i)
- global_index_mapping.push_back(env->GetGlobalCount() + i);
+ global_index_mapping_.push_back(env_->GetGlobalCount() + i);
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::BeginGlobal(Index index,
Type type,
bool mutable_) {
- assert(TranslateGlobalIndexToEnv(index) == env->GetGlobalCount());
- env->EmplaceBackGlobal(TypedValue(type), mutable_);
- init_expr_value.type = Type::Void;
+ assert(TranslateGlobalIndexToEnv(index) == env_->GetGlobalCount());
+ env_->EmplaceBackGlobal(TypedValue(type), mutable_);
+ init_expr_value_.type = Type::Void;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::EndGlobalInitExpr(Index index) {
Global* global = GetGlobalByModuleIndex(index);
- if (init_expr_value.type != global->typed_value.type) {
+ if (init_expr_value_.type != global->typed_value.type) {
PrintError("type mismatch in global, expected %s but got %s.",
GetTypeName(global->typed_value.type),
- GetTypeName(init_expr_value.type));
+ GetTypeName(init_expr_value_.type));
return wabt::Result::Error;
}
- global->typed_value = init_expr_value;
+ global->typed_value = init_expr_value_;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnInitExprF32ConstExpr(
Index index,
uint32_t value_bits) {
- init_expr_value.type = Type::F32;
- init_expr_value.value.f32_bits = value_bits;
+ init_expr_value_.type = Type::F32;
+ init_expr_value_.value.f32_bits = value_bits;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnInitExprF64ConstExpr(
Index index,
uint64_t value_bits) {
- init_expr_value.type = Type::F64;
- init_expr_value.value.f64_bits = value_bits;
+ init_expr_value_.type = Type::F64;
+ init_expr_value_.value.f64_bits = value_bits;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnInitExprGetGlobalExpr(
Index index,
Index global_index) {
- if (global_index >= num_global_imports) {
+ if (global_index >= num_global_imports_) {
PrintError("initializer expression can only reference an imported global");
return wabt::Result::Error;
}
@@ -904,21 +904,21 @@ wabt::Result BinaryReaderInterpreter::OnInitExprGetGlobalExpr(
PrintError("initializer expression cannot reference a mutable global");
return wabt::Result::Error;
}
- init_expr_value = ref_global->typed_value;
+ init_expr_value_ = ref_global->typed_value;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnInitExprI32ConstExpr(Index index,
uint32_t value) {
- init_expr_value.type = Type::I32;
- init_expr_value.value.i32 = value;
+ init_expr_value_.type = Type::I32;
+ init_expr_value_.value.i32 = value;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnInitExprI64ConstExpr(Index index,
uint64_t value) {
- init_expr_value.type = Type::I64;
- init_expr_value.value.i64 = value;
+ init_expr_value_.type = Type::I64;
+ init_expr_value_.value.i64 = value;
return wabt::Result::Ok;
}
@@ -932,16 +932,16 @@ wabt::Result BinaryReaderInterpreter::OnExport(Index index,
break;
case ExternalKind::Table:
- item_index = module->table_index;
+ item_index = module_->table_index;
break;
case ExternalKind::Memory:
- item_index = module->memory_index;
+ item_index = module_->memory_index;
break;
case ExternalKind::Global: {
item_index = TranslateGlobalIndexToEnv(item_index);
- Global* global = env->GetGlobal(item_index);
+ Global* global = env_->GetGlobal(item_index);
if (global->mutable_) {
PrintError("mutable globals cannot be exported");
return wabt::Result::Error;
@@ -954,13 +954,13 @@ wabt::Result BinaryReaderInterpreter::OnExport(Index index,
WABT_FATAL("BinaryReaderInterpreter::OnExport(except) not implemented");
break;
}
- return AppendExport(module, kind, item_index, name);
+ return AppendExport(module_, kind, item_index, name);
}
wabt::Result BinaryReaderInterpreter::OnStartFunction(Index func_index) {
Index start_func_index = TranslateFuncIndexToEnv(func_index);
- Func* start_func = env->GetFunc(start_func_index);
- FuncSignature* sig = env->GetFuncSignature(start_func->sig_index);
+ Func* start_func = env_->GetFunc(start_func_index);
+ FuncSignature* sig = env_->GetFuncSignature(start_func->sig_index);
if (sig->param_types.size() != 0) {
PrintError("start function must be nullary");
return wabt::Result::Error;
@@ -969,46 +969,46 @@ wabt::Result BinaryReaderInterpreter::OnStartFunction(Index func_index) {
PrintError("start function must not return anything");
return wabt::Result::Error;
}
- module->start_func_index = start_func_index;
+ module_->start_func_index = start_func_index;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::EndElemSegmentInitExpr(Index index) {
- assert(init_expr_value.type == Type::I32);
- table_offset = init_expr_value.value.i32;
+ assert(init_expr_value_.type == Type::I32);
+ table_offset_ = init_expr_value_.value.i32;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnElemSegmentFunctionIndex(
Index index,
Index func_index) {
- assert(module->table_index != kInvalidIndex);
- Table* table = env->GetTable(module->table_index);
- if (table_offset >= table->func_indexes.size()) {
+ assert(module_->table_index != kInvalidIndex);
+ Table* table = env_->GetTable(module_->table_index);
+ if (table_offset_ >= table->func_indexes.size()) {
PrintError("elem segment offset is out of bounds: %u >= max value %" PRIzd,
- table_offset, table->func_indexes.size());
+ table_offset_, table->func_indexes.size());
return wabt::Result::Error;
}
- Index max_func_index = func_index_mapping.size();
+ Index max_func_index = func_index_mapping_.size();
if (func_index >= max_func_index) {
PrintError("invalid func_index: %" PRIindex " (max %" PRIindex ")",
func_index, max_func_index);
return wabt::Result::Error;
}
- elem_segment_infos.emplace_back(&table->func_indexes[table_offset++],
- TranslateFuncIndexToEnv(func_index));
+ elem_segment_infos_.emplace_back(&table->func_indexes[table_offset_++],
+ TranslateFuncIndexToEnv(func_index));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnDataSegmentData(Index index,
const void* src_data,
Address size) {
- assert(module->memory_index != kInvalidIndex);
- Memory* memory = env->GetMemory(module->memory_index);
- assert(init_expr_value.type == Type::I32);
- Address address = init_expr_value.value.i32;
+ assert(module_->memory_index != kInvalidIndex);
+ Memory* memory = env_->GetMemory(module_->memory_index);
+ assert(init_expr_value_.type == Type::I32);
+ Address address = init_expr_value_.value.i32;
uint64_t end_address =
static_cast<uint64_t>(address) + static_cast<uint64_t>(size);
if (end_address > memory->data.size()) {
@@ -1019,41 +1019,41 @@ wabt::Result BinaryReaderInterpreter::OnDataSegmentData(Index index,
}
if (size > 0)
- data_segment_infos.emplace_back(&memory->data[address], src_data, size);
+ data_segment_infos_.emplace_back(&memory->data[address], src_data, size);
return wabt::Result::Ok;
}
void BinaryReaderInterpreter::PushLabel(IstreamOffset offset,
IstreamOffset fixup_offset) {
- label_stack.emplace_back(offset, fixup_offset);
+ label_stack_.emplace_back(offset, fixup_offset);
}
void BinaryReaderInterpreter::PopLabel() {
- label_stack.pop_back();
- /* reduce the depth_fixups stack as well, but it may be smaller than
- * label_stack so only do it conditionally. */
- if (depth_fixups.size() > label_stack.size()) {
- depth_fixups.erase(depth_fixups.begin() + label_stack.size(),
- depth_fixups.end());
+ label_stack_.pop_back();
+ /* reduce the depth_fixups_ stack as well, but it may be smaller than
+ * label_stack_ so only do it conditionally. */
+ if (depth_fixups_.size() > label_stack_.size()) {
+ depth_fixups_.erase(depth_fixups_.begin() + label_stack_.size(),
+ depth_fixups_.end());
}
}
wabt::Result BinaryReaderInterpreter::BeginFunctionBody(Index index) {
auto* func = cast<DefinedFunc>(GetFuncByModuleIndex(index));
- FuncSignature* sig = env->GetFuncSignature(func->sig_index);
+ FuncSignature* sig = env_->GetFuncSignature(func->sig_index);
func->offset = GetIstreamOffset();
func->local_decl_count = 0;
func->local_count = 0;
- current_func = func;
- depth_fixups.clear();
- label_stack.clear();
+ current_func_ = func;
+ depth_fixups_.clear();
+ label_stack_.clear();
/* fixup function references */
Index defined_index = TranslateModuleFuncIndexToDefined(index);
- IstreamOffsetVector& fixups = func_fixups[defined_index];
+ IstreamOffsetVector& fixups = func_fixups_[defined_index];
for (IstreamOffset fixup : fixups)
CHECK_RESULT(EmitI32At(fixup, func->offset));
@@ -1061,7 +1061,7 @@ wabt::Result BinaryReaderInterpreter::BeginFunctionBody(Index index) {
for (Type param_type : sig->param_types)
func->param_and_local_types.push_back(param_type);
- CHECK_RESULT(typechecker.BeginFunction(&sig->result_types));
+ CHECK_RESULT(typechecker_.BeginFunction(&sig->result_types));
/* push implicit func label (equivalent to return) */
PushLabel(kInvalidIstreamOffset, kInvalidIstreamOffset);
@@ -1072,37 +1072,37 @@ wabt::Result BinaryReaderInterpreter::EndFunctionBody(Index index) {
FixupTopLabel();
Index drop_count, keep_count;
CHECK_RESULT(GetReturnDropKeepCount(&drop_count, &keep_count));
- CHECK_RESULT(typechecker.EndFunction());
+ CHECK_RESULT(typechecker_.EndFunction());
CHECK_RESULT(EmitDropKeep(drop_count, keep_count));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::Return));
PopLabel();
- current_func = nullptr;
+ current_func_ = nullptr;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnLocalDeclCount(Index count) {
- current_func->local_decl_count = count;
+ current_func_->local_decl_count = count;
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnLocalDecl(Index decl_index,
Index count,
Type type) {
- current_func->local_count += count;
+ current_func_->local_count += count;
for (Index i = 0; i < count; ++i)
- current_func->param_and_local_types.push_back(type);
+ current_func_->param_and_local_types.push_back(type);
- if (decl_index == current_func->local_decl_count - 1) {
+ if (decl_index == current_func_->local_decl_count - 1) {
/* last local declaration, allocate space for all locals. */
CHECK_RESULT(EmitOpcode(interpreter::Opcode::Alloca));
- CHECK_RESULT(EmitI32(current_func->local_count));
+ CHECK_RESULT(EmitI32(current_func_->local_count));
}
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::CheckHasMemory(wabt::Opcode opcode) {
- if (module->memory_index == kInvalidIndex) {
+ if (module_->memory_index == kInvalidIndex) {
PrintError("%s requires an imported or defined memory.", opcode.GetName());
return wabt::Result::Error;
}
@@ -1120,13 +1120,13 @@ wabt::Result BinaryReaderInterpreter::CheckAlign(uint32_t alignment_log2,
}
wabt::Result BinaryReaderInterpreter::OnUnaryExpr(wabt::Opcode opcode) {
- CHECK_RESULT(typechecker.OnUnary(opcode));
+ CHECK_RESULT(typechecker_.OnUnary(opcode));
CHECK_RESULT(EmitOpcode(opcode));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnBinaryExpr(wabt::Opcode opcode) {
- CHECK_RESULT(typechecker.OnBinary(opcode));
+ CHECK_RESULT(typechecker_.OnBinary(opcode));
CHECK_RESULT(EmitOpcode(opcode));
return wabt::Result::Ok;
}
@@ -1134,7 +1134,7 @@ wabt::Result BinaryReaderInterpreter::OnBinaryExpr(wabt::Opcode opcode) {
wabt::Result BinaryReaderInterpreter::OnBlockExpr(Index num_types,
Type* sig_types) {
TypeVector sig(sig_types, sig_types + num_types);
- CHECK_RESULT(typechecker.OnBlock(&sig));
+ CHECK_RESULT(typechecker_.OnBlock(&sig));
PushLabel(kInvalidIstreamOffset, kInvalidIstreamOffset);
return wabt::Result::Ok;
}
@@ -1142,7 +1142,7 @@ wabt::Result BinaryReaderInterpreter::OnBlockExpr(Index num_types,
wabt::Result BinaryReaderInterpreter::OnLoopExpr(Index num_types,
Type* sig_types) {
TypeVector sig(sig_types, sig_types + num_types);
- CHECK_RESULT(typechecker.OnLoop(&sig));
+ CHECK_RESULT(typechecker_.OnLoop(&sig));
PushLabel(GetIstreamOffset(), kInvalidIstreamOffset);
return wabt::Result::Ok;
}
@@ -1150,7 +1150,7 @@ wabt::Result BinaryReaderInterpreter::OnLoopExpr(Index num_types,
wabt::Result BinaryReaderInterpreter::OnIfExpr(Index num_types,
Type* sig_types) {
TypeVector sig(sig_types, sig_types + num_types);
- CHECK_RESULT(typechecker.OnIf(&sig));
+ CHECK_RESULT(typechecker_.OnIf(&sig));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::BrUnless));
IstreamOffset fixup_offset = GetIstreamOffset();
CHECK_RESULT(EmitI32(kInvalidIstreamOffset));
@@ -1159,7 +1159,7 @@ wabt::Result BinaryReaderInterpreter::OnIfExpr(Index num_types,
}
wabt::Result BinaryReaderInterpreter::OnElseExpr() {
- CHECK_RESULT(typechecker.OnElse());
+ CHECK_RESULT(typechecker_.OnElse());
Label* label = TopLabel();
IstreamOffset fixup_cond_offset = label->fixup_offset;
CHECK_RESULT(EmitOpcode(interpreter::Opcode::Br));
@@ -1171,9 +1171,9 @@ wabt::Result BinaryReaderInterpreter::OnElseExpr() {
wabt::Result BinaryReaderInterpreter::OnEndExpr() {
TypeChecker::Label* label;
- CHECK_RESULT(typechecker.GetLabel(0, &label));
+ CHECK_RESULT(typechecker_.GetLabel(0, &label));
LabelType label_type = label->label_type;
- CHECK_RESULT(typechecker.OnEnd());
+ CHECK_RESULT(typechecker_.OnEnd());
if (label_type == LabelType::If || label_type == LabelType::Else) {
CHECK_RESULT(EmitI32At(TopLabel()->fixup_offset, GetIstreamOffset()));
}
@@ -1185,14 +1185,14 @@ wabt::Result BinaryReaderInterpreter::OnEndExpr() {
wabt::Result BinaryReaderInterpreter::OnBrExpr(Index depth) {
Index drop_count, keep_count;
CHECK_RESULT(GetBrDropKeepCount(depth, &drop_count, &keep_count));
- CHECK_RESULT(typechecker.OnBr(depth));
+ CHECK_RESULT(typechecker_.OnBr(depth));
CHECK_RESULT(EmitBr(depth, drop_count, keep_count));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnBrIfExpr(Index depth) {
Index drop_count, keep_count;
- CHECK_RESULT(typechecker.OnBrIf(depth));
+ CHECK_RESULT(typechecker_.OnBrIf(depth));
CHECK_RESULT(GetBrDropKeepCount(depth, &drop_count, &keep_count));
/* flip the br_if so if <cond> is true it can drop values from the stack */
CHECK_RESULT(EmitOpcode(interpreter::Opcode::BrUnless));
@@ -1207,7 +1207,7 @@ wabt::Result BinaryReaderInterpreter::OnBrTableExpr(
Index num_targets,
Index* target_depths,
Index default_target_depth) {
- CHECK_RESULT(typechecker.BeginBrTable());
+ CHECK_RESULT(typechecker_.BeginBrTable());
CHECK_RESULT(EmitOpcode(interpreter::Opcode::BrTable));
CHECK_RESULT(EmitI32(num_targets));
IstreamOffset fixup_table_offset = GetIstreamOffset();
@@ -1220,19 +1220,18 @@ wabt::Result BinaryReaderInterpreter::OnBrTableExpr(
for (Index i = 0; i <= num_targets; ++i) {
Index depth = i != num_targets ? target_depths[i] : default_target_depth;
- CHECK_RESULT(typechecker.OnBrTableTarget(depth));
+ CHECK_RESULT(typechecker_.OnBrTableTarget(depth));
CHECK_RESULT(EmitBrTableOffset(depth));
}
- CHECK_RESULT(typechecker.EndBrTable());
+ CHECK_RESULT(typechecker_.EndBrTable());
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnCallExpr(Index func_index) {
Func* func = GetFuncByModuleIndex(func_index);
- FuncSignature* sig = env->GetFuncSignature(func->sig_index);
- CHECK_RESULT(
- typechecker.OnCall(&sig->param_types, &sig->result_types));
+ FuncSignature* sig = env_->GetFuncSignature(func->sig_index);
+ CHECK_RESULT(typechecker_.OnCall(&sig->param_types, &sig->result_types));
if (func->is_host) {
CHECK_RESULT(EmitOpcode(interpreter::Opcode::CallHost));
@@ -1246,16 +1245,16 @@ wabt::Result BinaryReaderInterpreter::OnCallExpr(Index func_index) {
}
wabt::Result BinaryReaderInterpreter::OnCallIndirectExpr(Index sig_index) {
- if (module->table_index == kInvalidIndex) {
+ if (module_->table_index == kInvalidIndex) {
PrintError("found call_indirect operator, but no table");
return wabt::Result::Error;
}
FuncSignature* sig = GetSignatureByModuleIndex(sig_index);
- CHECK_RESULT(typechecker.OnCallIndirect(&sig->param_types,
- &sig->result_types));
+ CHECK_RESULT(
+ typechecker_.OnCallIndirect(&sig->param_types, &sig->result_types));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::CallIndirect));
- CHECK_RESULT(EmitI32(module->table_index));
+ CHECK_RESULT(EmitI32(module_->table_index));
CHECK_RESULT(EmitI32(TranslateSigIndexToEnv(sig_index)));
return wabt::Result::Ok;
}
@@ -1269,34 +1268,34 @@ wabt::Result BinaryReaderInterpreter::OnConvertExpr(wabt::Opcode opcode) {
}
wabt::Result BinaryReaderInterpreter::OnDropExpr() {
- CHECK_RESULT(typechecker.OnDrop());
+ CHECK_RESULT(typechecker_.OnDrop());
CHECK_RESULT(EmitOpcode(interpreter::Opcode::Drop));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnI32ConstExpr(uint32_t value) {
- CHECK_RESULT(typechecker.OnConst(Type::I32));
+ CHECK_RESULT(typechecker_.OnConst(Type::I32));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::I32Const));
CHECK_RESULT(EmitI32(value));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnI64ConstExpr(uint64_t value) {
- CHECK_RESULT(typechecker.OnConst(Type::I64));
+ CHECK_RESULT(typechecker_.OnConst(Type::I64));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::I64Const));
CHECK_RESULT(EmitI64(value));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnF32ConstExpr(uint32_t value_bits) {
- CHECK_RESULT(typechecker.OnConst(Type::F32));
+ CHECK_RESULT(typechecker_.OnConst(Type::F32));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::F32Const));
CHECK_RESULT(EmitI32(value_bits));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnF64ConstExpr(uint64_t value_bits) {
- CHECK_RESULT(typechecker.OnConst(Type::F64));
+ CHECK_RESULT(typechecker_.OnConst(Type::F64));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::F64Const));
CHECK_RESULT(EmitI64(value_bits));
return wabt::Result::Ok;
@@ -1305,7 +1304,7 @@ wabt::Result BinaryReaderInterpreter::OnF64ConstExpr(uint64_t value_bits) {
wabt::Result BinaryReaderInterpreter::OnGetGlobalExpr(Index global_index) {
CHECK_RESULT(CheckGlobal(global_index));
Type type = GetGlobalTypeByModuleIndex(global_index);
- CHECK_RESULT(typechecker.OnGetGlobal(type));
+ CHECK_RESULT(typechecker_.OnGetGlobal(type));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::GetGlobal));
CHECK_RESULT(EmitI32(TranslateGlobalIndexToEnv(global_index)));
return wabt::Result::Ok;
@@ -1319,26 +1318,25 @@ wabt::Result BinaryReaderInterpreter::OnSetGlobalExpr(Index global_index) {
global_index);
return wabt::Result::Error;
}
- CHECK_RESULT(
- typechecker.OnSetGlobal(global->typed_value.type));
+ CHECK_RESULT(typechecker_.OnSetGlobal(global->typed_value.type));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::SetGlobal));
CHECK_RESULT(EmitI32(TranslateGlobalIndexToEnv(global_index)));
return wabt::Result::Ok;
}
Index BinaryReaderInterpreter::TranslateLocalIndex(Index local_index) {
- return typechecker.type_stack_size() +
- current_func->param_and_local_types.size() - local_index;
+ return typechecker_.type_stack_size() +
+ current_func_->param_and_local_types.size() - local_index;
}
wabt::Result BinaryReaderInterpreter::OnGetLocalExpr(Index local_index) {
CHECK_RESULT(CheckLocal(local_index));
- Type type = GetLocalTypeByIndex(current_func, local_index);
- // Get the translated index before calling typechecker.OnGetLocal because it
+ Type type = GetLocalTypeByIndex(current_func_, local_index);
+ // Get the translated index before calling typechecker_.OnGetLocal because it
// will update the type stack size. We need the index to be relative to the
// old stack size.
Index translated_local_index = TranslateLocalIndex(local_index);
- CHECK_RESULT(typechecker.OnGetLocal(type));
+ CHECK_RESULT(typechecker_.OnGetLocal(type));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::GetLocal));
CHECK_RESULT(EmitI32(translated_local_index));
return wabt::Result::Ok;
@@ -1346,8 +1344,8 @@ wabt::Result BinaryReaderInterpreter::OnGetLocalExpr(Index local_index) {
wabt::Result BinaryReaderInterpreter::OnSetLocalExpr(Index local_index) {
CHECK_RESULT(CheckLocal(local_index));
- Type type = GetLocalTypeByIndex(current_func, local_index);
- CHECK_RESULT(typechecker.OnSetLocal(type));
+ Type type = GetLocalTypeByIndex(current_func_, local_index);
+ CHECK_RESULT(typechecker_.OnSetLocal(type));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::SetLocal));
CHECK_RESULT(EmitI32(TranslateLocalIndex(local_index)));
return wabt::Result::Ok;
@@ -1355,8 +1353,8 @@ wabt::Result BinaryReaderInterpreter::OnSetLocalExpr(Index local_index) {
wabt::Result BinaryReaderInterpreter::OnTeeLocalExpr(Index local_index) {
CHECK_RESULT(CheckLocal(local_index));
- Type type = GetLocalTypeByIndex(current_func, local_index);
- CHECK_RESULT(typechecker.OnTeeLocal(type));
+ Type type = GetLocalTypeByIndex(current_func_, local_index);
+ CHECK_RESULT(typechecker_.OnTeeLocal(type));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::TeeLocal));
CHECK_RESULT(EmitI32(TranslateLocalIndex(local_index)));
return wabt::Result::Ok;
@@ -1364,9 +1362,9 @@ wabt::Result BinaryReaderInterpreter::OnTeeLocalExpr(Index local_index) {
wabt::Result BinaryReaderInterpreter::OnGrowMemoryExpr() {
CHECK_RESULT(CheckHasMemory(wabt::Opcode::GrowMemory));
- CHECK_RESULT(typechecker.OnGrowMemory());
+ CHECK_RESULT(typechecker_.OnGrowMemory());
CHECK_RESULT(EmitOpcode(interpreter::Opcode::GrowMemory));
- CHECK_RESULT(EmitI32(module->memory_index));
+ CHECK_RESULT(EmitI32(module_->memory_index));
return wabt::Result::Ok;
}
@@ -1375,9 +1373,9 @@ wabt::Result BinaryReaderInterpreter::OnLoadExpr(wabt::Opcode opcode,
Address offset) {
CHECK_RESULT(CheckHasMemory(opcode));
CHECK_RESULT(CheckAlign(alignment_log2, opcode.GetMemorySize()));
- CHECK_RESULT(typechecker.OnLoad(opcode));
+ CHECK_RESULT(typechecker_.OnLoad(opcode));
CHECK_RESULT(EmitOpcode(opcode));
- CHECK_RESULT(EmitI32(module->memory_index));
+ CHECK_RESULT(EmitI32(module_->memory_index));
CHECK_RESULT(EmitI32(offset));
return wabt::Result::Ok;
}
@@ -1387,18 +1385,18 @@ wabt::Result BinaryReaderInterpreter::OnStoreExpr(wabt::Opcode opcode,
Address offset) {
CHECK_RESULT(CheckHasMemory(opcode));
CHECK_RESULT(CheckAlign(alignment_log2, opcode.GetMemorySize()));
- CHECK_RESULT(typechecker.OnStore(opcode));
+ CHECK_RESULT(typechecker_.OnStore(opcode));
CHECK_RESULT(EmitOpcode(opcode));
- CHECK_RESULT(EmitI32(module->memory_index));
+ CHECK_RESULT(EmitI32(module_->memory_index));
CHECK_RESULT(EmitI32(offset));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnCurrentMemoryExpr() {
CHECK_RESULT(CheckHasMemory(wabt::Opcode::CurrentMemory));
- CHECK_RESULT(typechecker.OnCurrentMemory());
+ CHECK_RESULT(typechecker_.OnCurrentMemory());
CHECK_RESULT(EmitOpcode(interpreter::Opcode::CurrentMemory));
- CHECK_RESULT(EmitI32(module->memory_index));
+ CHECK_RESULT(EmitI32(module_->memory_index));
return wabt::Result::Ok;
}
@@ -1409,29 +1407,29 @@ wabt::Result BinaryReaderInterpreter::OnNopExpr() {
wabt::Result BinaryReaderInterpreter::OnReturnExpr() {
Index drop_count, keep_count;
CHECK_RESULT(GetReturnDropKeepCount(&drop_count, &keep_count));
- CHECK_RESULT(typechecker.OnReturn());
+ CHECK_RESULT(typechecker_.OnReturn());
CHECK_RESULT(EmitDropKeep(drop_count, keep_count));
CHECK_RESULT(EmitOpcode(interpreter::Opcode::Return));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnSelectExpr() {
- CHECK_RESULT(typechecker.OnSelect());
+ CHECK_RESULT(typechecker_.OnSelect());
CHECK_RESULT(EmitOpcode(interpreter::Opcode::Select));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::OnUnreachableExpr() {
- CHECK_RESULT(typechecker.OnUnreachable());
+ CHECK_RESULT(typechecker_.OnUnreachable());
CHECK_RESULT(EmitOpcode(interpreter::Opcode::Unreachable));
return wabt::Result::Ok;
}
wabt::Result BinaryReaderInterpreter::EndModule() {
- for (ElemSegmentInfo& info : elem_segment_infos) {
+ for (ElemSegmentInfo& info : elem_segment_infos_) {
*info.dst = info.func_index;
}
- for (DataSegmentInfo& info : data_segment_infos) {
+ for (DataSegmentInfo& info : data_segment_infos_) {
memcpy(info.dst_data, info.src_data, info.size);
}
return wabt::Result::Ok;