Skip to content

Commit 39cef2f

Browse files
Remove unused types and functions
1 parent f620e6b commit 39cef2f

File tree

5 files changed

+1
-84
lines changed

5 files changed

+1
-84
lines changed

Sources/WasmKit/Execution/Instructions/Expression.swift

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
import WasmParser
22

3-
/// See spec's
4-
/// [definition](https://webassembly.github.io/spec/core/text/instructions.html?highlight=pseudo#control-instructions).
5-
/// > The `block`, `loop` and `if` instructions are structured instructions. They bracket nested sequences of
6-
/// > instructions, called blocks, terminated with, or separated by, end or else pseudo-instructions. As the
7-
/// > grammar prescribes, they must be well-nested.
8-
enum PseudoInstruction {
9-
case `else`
10-
case end
11-
}
12-
133
struct InstructionSequence: Equatable {
144
let instructions: UnsafeBufferPointer<Instruction>
155

@@ -52,8 +42,3 @@ struct ExpressionRef: Equatable {
5242
self._relativeOffset = UInt32(relativeOffset)
5343
}
5444
}
55-
56-
/// > Note:
57-
/// <https://webassembly.github.io/spec/core/syntax/instructions.html#expressions>
58-
59-
typealias Expression = [WasmParser.Instruction]

Sources/WasmKit/Execution/Runtime/ExecutionState.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,3 @@ extension ExecutionState {
8282
store.module(address: stack.currentFrame.module)
8383
}
8484
}
85-
86-
extension ExecutionState {
87-
mutating func pseudo(runtime: Runtime, pseudoInstruction: PseudoInstruction) throws {
88-
fatalError("Unimplemented instruction: pseudo")
89-
}
90-
}

Sources/WasmKit/Execution/Runtime/Stack.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
/// > Note:
22
/// <https://webassembly.github.io/spec/core/exec/runtime.html#stack>
33
struct Stack {
4-
enum Element: Equatable {
5-
case value(Value)
6-
case frame(Frame)
7-
}
84

95
private var limit: UInt16 { UInt16.max }
106
private var valueStack: ValueStack
117
private var numberOfValues: Int { valueStack.count }
128
private var frames: FixedSizeStack<Frame>
139
var currentFrame: Frame!
1410

15-
var isEmpty: Bool {
16-
self.frames.isEmpty && self.numberOfValues == 0
17-
}
18-
1911
init() {
2012
let limit = UInt16.max
2113
self.valueStack = ValueStack(capacity: Int(limit))

Sources/WasmKit/Execution/Types/Value.swift

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -445,30 +445,6 @@ extension Value {
445445
}
446446
}
447447

448-
var leadingZeroBitCount: Value {
449-
switch self {
450-
case let .i32(rawValue): return .i32(UInt32(rawValue.leadingZeroBitCount))
451-
case let .i64(rawValue): return .i64(UInt64(rawValue.leadingZeroBitCount))
452-
default: fatalError("Invalid type \(type) for `Value.\(#function)` implementation")
453-
}
454-
}
455-
456-
var trailingZeroBitCount: Value {
457-
switch self {
458-
case let .i32(rawValue): return .i32(UInt32(rawValue.trailingZeroBitCount))
459-
case let .i64(rawValue): return .i64(UInt64(rawValue.trailingZeroBitCount))
460-
default: fatalError("Invalid type \(type) for `Value.\(#function)` implementation")
461-
}
462-
}
463-
464-
var nonzeroBitCount: Value {
465-
switch self {
466-
case let .i32(rawValue): return .i32(UInt32(rawValue.nonzeroBitCount))
467-
case let .i64(rawValue): return .i64(UInt64(rawValue.nonzeroBitCount))
468-
default: fatalError("Invalid type \(type) for `Value.\(#function)` implementation")
469-
}
470-
}
471-
472448
func rotl(_ l: Self) -> Self {
473449
switch (self, l) {
474450
case let (.i32(rawValue), .i32(l)):
@@ -527,36 +503,6 @@ extension Value {
527503
}
528504
}
529505

530-
static func + (lhs: Self, rhs: Self) -> Self {
531-
switch (lhs, rhs) {
532-
case let (.i32(lhs), .i32(rhs)): return .i32(lhs &+ rhs)
533-
case let (.i64(lhs), .i64(rhs)): return .i64(lhs &+ rhs)
534-
case let (.f32(lhs), .f32(rhs)): return .f32((Float32(bitPattern: lhs) + Float32(bitPattern: rhs)).bitPattern)
535-
case let (.f64(lhs), .f64(rhs)): return .f64((Float64(bitPattern: lhs) + Float64(bitPattern: rhs)).bitPattern)
536-
default: fatalError("Invalid types \(lhs.type) and \(rhs.type) for `Value.\(#function)` implementation")
537-
}
538-
}
539-
540-
static func - (lhs: Self, rhs: Self) -> Self {
541-
switch (lhs, rhs) {
542-
case let (.i32(lhs), .i32(rhs)): return .i32(lhs &- rhs)
543-
case let (.i64(lhs), .i64(rhs)): return .i64(lhs &- rhs)
544-
case let (.f32(lhs), .f32(rhs)): return .f32((Float32(bitPattern: lhs) - Float32(bitPattern: rhs)).bitPattern)
545-
case let (.f64(lhs), .f64(rhs)): return .f64((Float64(bitPattern: lhs) - Float64(bitPattern: rhs)).bitPattern)
546-
default: fatalError("Invalid types \(lhs.type) and \(rhs.type) for `Value.\(#function)` implementation")
547-
}
548-
}
549-
550-
static func * (lhs: Self, rhs: Self) -> Self {
551-
switch (lhs, rhs) {
552-
case let (.i32(lhs), .i32(rhs)): return .i32(lhs &* rhs)
553-
case let (.i64(lhs), .i64(rhs)): return .i64(lhs &* rhs)
554-
case let (.f32(lhs), .f32(rhs)): return .f32((Float32(bitPattern: lhs) * Float32(bitPattern: rhs)).bitPattern)
555-
case let (.f64(lhs), .f64(rhs)): return .f64((Float64(bitPattern: lhs) * Float64(bitPattern: rhs)).bitPattern)
556-
default: fatalError("Invalid types \(lhs.type) and \(rhs.type) for `Value.\(#function)` implementation")
557-
}
558-
}
559-
560506
static func / (lhs: Self, rhs: Self) -> Self {
561507
switch (lhs, rhs) {
562508
case let (.f32(lhs), .f32(rhs)): return .f32((Float32(bitPattern: lhs) / Float32(bitPattern: rhs)).bitPattern)

Tests/WasmKitTests/Execution/HostModuleTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ final class HostModuleTests: XCTestCase {
4343
type: 0, locals: [],
4444
body: {
4545
[
46-
.control(.call(functionIndex: 1))
46+
.call(functionIndex: 1)
4747
]
4848
}),
4949
],

0 commit comments

Comments
 (0)