Skip to content

Commit

Permalink
Minimal SIMD types support
Browse files Browse the repository at this point in the history
Nothing is implemented yet but just not to prevent parsing a name
section of a module with SIMD types.
  • Loading branch information
kateinoigakukun committed Dec 21, 2024
1 parent e714e82 commit a765272
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/WAT/Encoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ extension ValueType: WasmEncodable {
case .i64: encoder.output.append(0x7E)
case .f32: encoder.output.append(0x7D)
case .f64: encoder.output.append(0x7C)
case .v128: encoder.output.append(0x7B)
case .ref(let refType): refType.encode(to: &encoder)
}
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/WasmKit/Execution/UntypedValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ struct UntypedValue: Equatable, Hashable {
case .i64: return .i64(i64)
case .f32: return .f32(rawF32)
case .f64: return .f64(rawF64)
case .v128:
fatalError("v128 value type is not supported yet.")
case .ref(let referenceType):
return .ref(asReference(referenceType))
}
Expand Down
1 change: 1 addition & 0 deletions Sources/WasmParser/WasmParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ extension Parser {
case 0x7E: return .i64
case 0x7D: return .f32
case 0x7C: return .f64
case 0x7B: return .f64
case 0x70: return .ref(.funcRef)
case 0x6F: return .ref(.externRef)
default:
Expand Down
2 changes: 2 additions & 0 deletions Sources/WasmTypes/WasmTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public enum ValueType: Equatable, Hashable {
case f32
/// 64-bit IEEE 754 floating-point number.
case f64
/// 128-bit vector of packed integer or floating-point data.
case v128
/// Reference value type.
case ref(ReferenceType)
}
Expand Down

0 comments on commit a765272

Please sign in to comment.