@@ -140,13 +140,13 @@ class V8 : public WasmVm {
140
140
141
141
static std::string printValue (const wasm::Val &value) {
142
142
switch (value.kind ()) {
143
- case wasm::I32:
143
+ case wasm::ValKind:: I32:
144
144
return std::to_string (value.get <uint32_t >());
145
- case wasm::I64:
145
+ case wasm::ValKind:: I64:
146
146
return std::to_string (value.get <uint64_t >());
147
- case wasm::F32:
147
+ case wasm::ValKind:: F32:
148
148
return std::to_string (value.get <float >());
149
- case wasm::F64:
149
+ case wasm::ValKind:: F64:
150
150
return std::to_string (value.get <double >());
151
151
default :
152
152
return " unknown" ;
@@ -170,17 +170,17 @@ static std::string printValues(const wasm::Val values[], size_t size) {
170
170
171
171
static const char *printValKind (wasm::ValKind kind) {
172
172
switch (kind) {
173
- case wasm::I32:
173
+ case wasm::ValKind:: I32:
174
174
return " i32" ;
175
- case wasm::I64:
175
+ case wasm::ValKind:: I64:
176
176
return " i64" ;
177
- case wasm::F32:
177
+ case wasm::ValKind:: F32:
178
178
return " f32" ;
179
- case wasm::F64:
179
+ case wasm::ValKind:: F64:
180
180
return " f64" ;
181
- case wasm::ANYREF:
181
+ case wasm::ValKind:: ANYREF:
182
182
return " anyref" ;
183
- case wasm::FUNCREF:
183
+ case wasm::ValKind:: FUNCREF:
184
184
return " funcref" ;
185
185
default :
186
186
return " unknown" ;
@@ -229,11 +229,11 @@ template <typename T> wasm::Val makeVal(T t) { return wasm::Val::make(t); }
229
229
template <> wasm::Val makeVal (Word t) { return wasm::Val::make (static_cast <uint32_t >(t.u64_ )); }
230
230
231
231
template <typename T> constexpr auto convertArgToValKind ();
232
- template <> constexpr auto convertArgToValKind<Word>() { return wasm::I32; };
233
- template <> constexpr auto convertArgToValKind<uint32_t >() { return wasm::I32; };
234
- template <> constexpr auto convertArgToValKind<int64_t >() { return wasm::I64; };
235
- template <> constexpr auto convertArgToValKind<uint64_t >() { return wasm::I64; };
236
- template <> constexpr auto convertArgToValKind<double >() { return wasm::F64; };
232
+ template <> constexpr auto convertArgToValKind<Word>() { return wasm::ValKind:: I32; };
233
+ template <> constexpr auto convertArgToValKind<uint32_t >() { return wasm::ValKind:: I32; };
234
+ template <> constexpr auto convertArgToValKind<int64_t >() { return wasm::ValKind:: I64; };
235
+ template <> constexpr auto convertArgToValKind<uint64_t >() { return wasm::ValKind:: I64; };
236
+ template <> constexpr auto convertArgToValKind<double >() { return wasm::ValKind:: F64; };
237
237
238
238
template <typename T, std::size_t ... I>
239
239
constexpr auto convertArgsTupleToValTypesImpl (std::index_sequence<I...> /* comptime*/ ) {
@@ -352,7 +352,7 @@ bool V8::link(std::string_view /*debug_name*/) {
352
352
353
353
switch (import_type->kind ()) {
354
354
355
- case wasm::EXTERN_FUNC: {
355
+ case wasm::ExternKind:: EXTERN_FUNC: {
356
356
auto it = host_functions_.find (std::string (module) + " ." + std::string (name));
357
357
if (it == host_functions_.end ()) {
358
358
fail (FailState::UnableToInitializeCode,
@@ -375,15 +375,15 @@ bool V8::link(std::string_view /*debug_name*/) {
375
375
imports.push_back (func);
376
376
} break ;
377
377
378
- case wasm::EXTERN_GLOBAL: {
378
+ case wasm::ExternKind:: EXTERN_GLOBAL: {
379
379
// TODO(PiotrSikora): add support when/if needed.
380
380
fail (FailState::UnableToInitializeCode,
381
381
" Failed to load Wasm module due to a missing import: " + std::string (module) + " ." +
382
382
std::string (name));
383
383
return false ;
384
384
} break ;
385
385
386
- case wasm::EXTERN_MEMORY: {
386
+ case wasm::ExternKind:: EXTERN_MEMORY: {
387
387
assert (memory_ == nullptr );
388
388
auto type = wasm::MemoryType::make (import_type->memory ()->limits ());
389
389
if (type == nullptr ) {
@@ -396,7 +396,7 @@ bool V8::link(std::string_view /*debug_name*/) {
396
396
imports.push_back (memory_.get ());
397
397
} break ;
398
398
399
- case wasm::EXTERN_TABLE: {
399
+ case wasm::ExternKind:: EXTERN_TABLE: {
400
400
assert (table_ == nullptr );
401
401
auto type =
402
402
wasm::TableType::make (wasm::ValType::make (import_type->table ()->element ()->kind ()),
@@ -435,16 +435,16 @@ bool V8::link(std::string_view /*debug_name*/) {
435
435
436
436
switch (export_type->kind ()) {
437
437
438
- case wasm::EXTERN_FUNC: {
438
+ case wasm::ExternKind:: EXTERN_FUNC: {
439
439
assert (export_item->func () != nullptr );
440
440
module_functions_.insert_or_assign (std::string (name), export_item->func ()->copy ());
441
441
} break ;
442
442
443
- case wasm::EXTERN_GLOBAL: {
443
+ case wasm::ExternKind:: EXTERN_GLOBAL: {
444
444
// TODO(PiotrSikora): add support when/if needed.
445
445
} break ;
446
446
447
- case wasm::EXTERN_MEMORY: {
447
+ case wasm::ExternKind:: EXTERN_MEMORY: {
448
448
assert (export_item->memory () != nullptr );
449
449
assert (memory_ == nullptr );
450
450
memory_ = exports[i]->memory ()->copy ();
@@ -453,7 +453,7 @@ bool V8::link(std::string_view /*debug_name*/) {
453
453
}
454
454
} break ;
455
455
456
- case wasm::EXTERN_TABLE: {
456
+ case wasm::ExternKind:: EXTERN_TABLE: {
457
457
// TODO(PiotrSikora): add support when/if needed.
458
458
} break ;
459
459
}
0 commit comments